Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

21장 dependency와 allocation

모델이 커지면 요소 하나하나보다 요소 사이의 관계를 관리하는 일이 더 어려워집니다. 배터리 용량 요구사항은 어느 상위 요구사항에서 나왔는지, 설계 초기에 그린 기능 블록은 지금 어느 부품이 맡고 있는지, 요구사항 package를 고치면 어느 package를 다시 검토해야 하는지를 답할 수 있어야 합니다. 이런 물음에 답하게 해 주는 것이 추적 관계입니다. 앞 장들에서 본 satisfy, verify, perform도 추적 관계이고, 이 장은 여기에 dependency, allocation, requirement의 derivation을 더한 다음 전체를 한 표로 정리합니다.

dependency

dependency는 가장 느슨한 관계입니다. 한쪽이 다른 쪽에 의존한다는 것, 곧 supplier가 바뀌면 client도 바뀌어야 할 수 있다는 것만 말합니다. from 뒤에 의존하는 쪽인 client를, to 뒤에 의존받는 쪽인 supplier를 적습니다.

package Requirements;
package Design;
package Verification;

dependency from Design to Requirements;
dependency verificationBasis from Verification to Requirements, Design;

client와 supplier는 각각 여럿일 수 있고, 어떤 종류의 element든 올 수 있습니다. dependency에 이름을 주지 않을 때에는 from을 생략해 dependency Design to Requirements;로 적을 수 있습니다.

dependency에는 의미론이 없습니다. 도구는 이 관계를 저장하고 보여 주고 영향 범위를 찾는 데 쓰지만, dependency가 있다고 해서 모델의 대상에 어떤 조건이 걸리지는 않습니다. 그래서 dependency는 관계가 있다는 것은 알지만 그 성격을 아직 정하지 못했을 때, 또는 package 사이처럼 조건을 걸 대상이 없는 관계에 씁니다.

dependency의 성격을 구별해 적으려면 23장의 metadata를 붙입니다. Metadata Domain Library에는 한쪽이 다른 쪽을 더 구체화한 것임을 나타내는 Refinement가 있습니다.

private import ModelingMetadata::*;

#refinement dependency from deliveryDrone to logicalDrone;

allocation

allocation은 한쪽의 의도를 다른 쪽이 맡아 실현한다는 관계입니다. 기능을 부품에, 논리적 구성 요소를 물리적 구성 요소에, 소프트웨어를 하드웨어에 배정하는 것이 모두 allocation입니다.

구현 방식을 정하지 않은 논리 구조가 먼저 있다고 합시다.

part def LogicalDrone {
    part energyStorage;
    part flightControl;
    part communication;
}

part logicalDrone : LogicalDrone;

논리 구조의 각 요소를 설계안의 어느 부품이 맡는지는 allocate로 적습니다. allocate 뒤에 배정하는 것을, to 뒤에 배정받는 것을 적습니다.

allocate logicalDrone.energyStorage to deliveryDrone.battery;
allocate logicalDrone.flightControl to deliveryDrone.flightController;
allocate logicalDrone.communication to deliveryDrone.radio;

allocate deliverParcel.cruise to deliveryDrone.flightController;

마지막 줄은 구조가 아닌 action을 part에 배정했습니다. allocation의 양쪽에는 어떤 종류의 usage든 올 수 있습니다.

allocation은 9장의 connection의 한 가지이며 언제나 binary입니다. 그래서 allocation definition으로 종류를 정의하고, 그 안에 더 잘게 나눈 allocation을 중첩할 수 있습니다.

allocation def LogicalToPhysical {
    end part logical : LogicalDrone;
    end part physical : Drone;

    allocate logical.energyStorage to physical.battery;
    allocate logical.flightControl to physical.flightController;
    allocate logical.communication to physical.radio;
}

allocation droneAllocation : LogicalToPhysical
    allocate logical ::> logicalDrone to physical ::> deliveryDrone;

LogicalToPhysical은 논리 구조 전체를 물리 구조 전체에 배정하면서 그 안의 요소끼리 어떻게 대응하는지도 정합니다. droneAllocation은 이 대응을 logicalDrone과 deliveryDrone에 적용합니다.

16장의 perform도 action을 part에 잇습니다. 둘은 다음과 같이 다릅니다.

allocate a to p;perform a; (part p 안에서)
뜻p가 a의 실현을 맡습니다.p가 자신의 lifetime 안에서 a를 수행합니다.
양쪽에 올 수 있는 것어떤 usage든action과 그것을 수행하는 occurrence
맞는 시기배정을 잠정적으로 정해 두는 설계 초기행위와 구조의 관계가 확정된 뒤

allocation은 정확한 의미를 정하기 전에 대응 관계부터 적어 둘 수 있게 하는 장치입니다. 설계가 구체화되면 allocation으로 적어 둔 관계를 perform, exhibit, satisfy 같은 더 엄밀한 관계로 뒷받침합니다.

requirement의 derivation

상위 요구사항에서 하위 요구사항을 이끌어 낸 관계를 derivation이라고 합니다. 체공 시간 요구사항에서 배터리 용량 요구사항이 나옵니다. 1200 W로 20분을 비행하려면 400 Wh가 필요합니다.

private import RequirementDerivation::*;

requirement <'REQ-04'> batteryCapacity {
    doc /* 배터리 용량은 400 Wh 이상이어야 한다. */

    subject battery : Battery;

    require constraint { battery.capacity >= 400 [W*h] }
}

#derivation connection {
    end #original ::> droneRequirements.endurance;
    end #derive ::> batteryCapacity;
}

derivation은 키워드가 아닌 library로 제공됩니다. Requirement Derivation Domain Library가 connection definition Derivation과, 이를 짧게 쓰기 위한 세 가지 표지 #derivation, #original, #derive를 정의합니다. #으로 시작하는 표지는 23장에서 설명하는 사용자 정의 키워드입니다.

표지붙이는 곳뜻
#derivationconnection usage이 connection이 derivation입니다.
#originalend원래의 요구사항입니다. 하나만 둡니다.
#deriveend이끌어 낸 요구사항입니다. 하나 이상 둡니다.

derivation에는 의미론이 있습니다. 원래의 requirement가 충족되면 이끌어 낸 requirement도 모두 충족되어야 합니다. 이 조건이 깨지면 요구사항을 나누는 과정에 잘못이 있었다는 뜻입니다.

같은 방식으로 정의된 관계가 하나 더 있습니다. Cause and Effect Domain Library는 원인과 결과를 잇는 #causation connection과 그 end에 붙이는 #cause, #effect를 제공하며, 고장 영향 분석처럼 사건 사이의 인과 관계를 적는 데 씁니다.

추적 관계 정리

지금까지 나온 관계를 무엇과 무엇을 잇는지에 따라 나누면 다음과 같습니다.

관계표기잇는 것다룬 곳
dependencydependency from a to b;어떤 element든이 장
allocationallocate a to b;실현을 맡기는 쪽과 맡는 쪽이 장
derivation#derivation connection { … }원래의 requirement와 이끌어 낸 requirement이 장
satisfactionsatisfy r by x;requirement와 그것을 충족하는 설계 요소14장
verificationverify r;requirement와 그것을 확인하는 verification case20장
수행perform a;, exhibit s;action이나 state와 그것을 수행하는 part16장, 18장
specialization:>, :>>, :일반적인 것과 구체적인 것5장
bindingbind a = b;같은 것을 가리키는 두 feature9장

dependency는 모델의 대상에 조건을 걸지 않고, 나머지는 저마다 조건을 겁니다. binding은 두 feature의 value가 언제나 같아야 한다고 요구하고, satisfaction은 requirement가 참이어야 한다고 요구합니다. 관계를 고를 때에는 말하려는 내용에 맞는 관계가 있으면 그것을 쓰고, 맞는 것이 없을 때에만 dependency를 씁니다. 조건이 있는 관계라야 도구가 그 조건을 검사할 수 있습니다.

KerML에서 보면

dependency는 KerML의 Root 계층에 있는 relationship이며, SysML은 이를 그대로 씁니다. KerML 표기법도 같습니다. Root 계층은 의미론을 정의하지 않으므로 dependency에는 의미가 없습니다.

SysMLKerML기준 library element
dependency (Dependency)Dependency없습니다.
allocation definition (AllocationDefinition)AssociationStructureAllocations::Allocation
allocation usage (AllocationUsage)ConnectorAllocations::allocations
derivationConnectorDerivationConnections::derivations

Dependency는 3장에서 본 Relationship을 바로 특수화하고, client를 source로, supplier를 target으로 갖습니다. 5장의 specialization이나 3장의 membership과 달리 type이나 namespace에 매이지 않아서, 어떤 element 사이에도 둘 수 있습니다.

AllocationDefinition은 ConnectionDefinition을 특수화합니다. allocation은 connection이므로 instance가 있는 link이고, 그 점에서 dependency와 다릅니다. dependency는 모델 요소 사이의 관계일 뿐이지만, allocate logicalDrone.flightControl to deliveryDrone.flightController;는 논리적 비행 제어 기능 하나하나와 그것을 맡은 비행 제어기 하나하나 사이에 link가 있다고 말합니다.

derivation은 언어의 metaclass가 아닌 library의 connection definition입니다. #derivation은 그 connection usage가 DerivationConnections::derivations를 특수화하게 만드는 metadata이며, 이런 metadata를 semantic metadata라고 합니다. 언어를 고치지 않고 library만으로 새 관계를 더하는 이 방법은 23장에서 자세히 다룹니다.

package Requirements;
package Design;

dependency from Design to Requirements;

구문 요약

구문뜻
dependency from a to b, c;a가 b와 c에 의존합니다.
dependency d from a to b;이름이 d인 dependency입니다.
allocate a to b;a를 b에 배정합니다.
allocation def A { end part x : X; end part y : Y; }allocation definition입니다.
allocation a : A allocate x ::> p to y ::> q;type이 A인 allocation usage입니다.
#derivation connection { end #original ::> r; end #derive ::> r1; }r에서 r1을 이끌어 냈다는 derivation입니다.
#refinement dependency from a to b;a가 b를 구체화했다는 dependency입니다.

명세에서 찾아보기

주제조항
dependencySysML 7.3, 8.3.3; KerML 7.2.3
allocationSysML 7.15, 8.3.15, 8.4.11
Allocations librarySysML 9.2.8
Requirement Derivation Domain LibrarySysML 9.6
Cause and Effect Domain LibrarySysML 9.5
ModelingMetadata의 RefinementSysML 9.3