과정의 장
교육 · 트랙 9. SysML v2 기초 · 9.2장 (전체 8장)
9.2 포트와 인터페이스 3:44
포트와 인터페이스를 정의하고, 텍스트로 파트를 연결하고, 뷰에서 인터페이스를 그립니다.
Holarch 2.22 화면입니다.
학습 내용
- 방향이 있는 속성을 가진 포트를 정의하고 `~`로 켤레 만들기
- 끝이 포트로 타입 지정된 인터페이스 정의하기
- 인터페이스 사용으로 파트를 연결하고 경계 포트를 내부 파트의 포트에 바인딩하기
- 상호 연결 뷰를 만들고 두 포트 사이에 인터페이스 그리기
Hybrid Car라는 작은 프로젝트에서 SysML v2 튜토리얼 Ports and Interfaces를 따라 Holarch에서 SysML v2 포트와 인터페이스를 정의합니다. 방향이 있는 포트 정의, 켤레 포트, 두 끝이 있는 인터페이스 정의, 파트가 인터페이스와 바인딩으로 연결된 파워트레인, 그 상호 연결 뷰, 그리고 뷰에서 그린 인터페이스를 Holarch가 텍스트에 기록하는 과정을 다룹니다. SysML은 Object Management Group, Inc.의 등록 상표입니다.
실습
Hybrid Car 데모 프로젝트(SysML v2)에서 Holarch로 직접 해 보십시오.
- Hybrid Car 데모 프로젝트를 열고(필요하면 만드십시오: 프로젝트 관리 → 프로젝트 파일 ▾ → 새 데모 프로젝트 → Hybrid Car (SysML v2)), 모델 → 편집기와 패키지
Vehicles를 엽니다. interface def HighVoltageBus아래에interface def ControlLink { end commander : ~ControlPort; end unit : ControlPort; }를 추가합니다.part def Powertrain에서connect controller.engineCtl to engine.ecu;를interface engineControl : ControlLink connect controller.engineCtl to engine.ecu;로 바꾸고,part battery : Battery;뒤에part auxBattery : Battery;를 추가합니다.- 아키텍처 → 상호 연결 뷰와 뷰
powertrainConnections를 엽니다.auxBattery의 포트powerOut핸들에서 모터의 포트powerIn으로 끌고 Interface : HighVoltageBus를 선택합니다. - 새 선을 선택하고 속성 패널에서 이름에
auxBus를 입력합니다. 그런 다음 모델 → 편집기를 열고 Holarch가Powertrain에 기록한 줄을 찾습니다.
Powertrain에 interface engineControl : ControlLink …와 뷰에서 만든 auxBus 인터페이스가 있고, 편집기 아래의 상태에 문제가 없다고 표시되면 완료입니다.
스스로 확인
- 엔진에는
port fuelIn : ~FuelPort;가 있습니다. 물결표는 무엇을 바꿉니까? bind output = transmission.output;와interface fuel : FuelLine connect tank.fuelOut to engine.fuelIn;의 차이는 무엇입니까?- 배터리의
powerOut에서 모터의powerIn으로 끌 때 뷰가 Interface : HighVoltageBus를 제시하는 이유는 무엇입니까?
답 보기
엔진에는
port fuelIn : ~FuelPort;가 있습니다. 물결표는 무엇을 바꿉니까?포트를 켤레로 만듭니다. 엔진의 포트는 FuelPort와 같은 피처를 갖되 방향이 반대이므로, FuelPort의
out attribute flowRate가 엔진에는 입력으로 도착합니다.bind output = transmission.output;와interface fuel : FuelLine connect tank.fuelOut to engine.fuelIn;의 차이는 무엇입니까?바인딩은 두 피처가 같다고 말합니다. 파워트레인의 경계 포트가 곧 변속기의 출력입니다. 인터페이스 사용은 서로 다른 두 포트를 연결하며, 그 인터페이스 정의가 양 끝이 받는 포트를 정합니다.
배터리의
powerOut에서 모터의powerIn으로 끌 때 뷰가 Interface : HighVoltageBus를 제시하는 이유는 무엇입니까?Holarch는 양 끝이 두 포트에 맞는 인터페이스 정의를 제시합니다. HighVoltageBus는 끝
source : PowerPort와load : ~PowerPort를 가지며, 이것이 두 포트와 일치합니다.
더 읽어 보기
대본
대본 보기 (내레이션과 화면 내용)
Introduction
Chapter two: ports and interfaces. A port is where a part meets the world outside it. An interface says which ports may connect.
In this chapter you define a port and an interface, connect parts in a powertrain, and draw an interface in a view.
Start the tutorial
Start the tutorial Ports and Interfaces from Project Files, Start a Tutorial. Its starter project holds the car's components with their torque and power ports, two interface definitions, and nothing yet for fuel.
On screen: Project Files ▾ → Start a Tutorial… → SysML v2: Ports and Interfaces → Start.
Ports
Above the torque port, define the fuel port. A port definition lists what crosses the port. Out means the flow rate leaves the part that owns the port.
On screen: Below FuelKind; type port def FuelPort.
The tank owns a fuel port. The engine takes fuel in, so its port is conjugated with a tilde: the same features, with in and out reversed.
On screen: FuelTank: port fuelOut : FuelPort; Engine: port fuelIn : ~FuelPort;
Interfaces
An interface definition says which ports may connect. Below the high voltage bus, define the fuel line, with a supply end and a conjugated consumer end.
On screen: Below HighVoltageBus; type interface def FuelLine.
Connect the parts
Now the powertrain: a part definition made of parts. Its own output port is bound to the transmission's output, so the two are one and the same.
On screen: After Transmission; type part def Powertrain with five parts, a port and bind.
Connect the tank to the engine with a fuel line. A dotted name reaches into a part: from the tank's fuel out, to the engine's fuel in.
On screen: In Powertrain after part transmission: interface fuel : FuelLine connect tank.fuelOut to engine.fuelIn;
The engine and the motor both drive the transmission, through a shaft each.
On screen: Two shaft interfaces.
The status under the editor says the text is applied, with no problems.
On screen: Applied, No problems.
The Interconnection View
Now see the powertrain as a view. Open Architecture, then Interconnection Views, and click New Diagram. Keep Interconnection View, choose the powertrain under Shows, and click Create.
On screen: Architecture → Interconnection Views → + New Diagram; Shows: Vehicles::Powertrain; Create.
The parts sit inside the frame with their ports on their sides. Each line is an interface from the text, and the output port on the frame is bound to the transmission.
On screen: The view.
Draw an interface
The battery does not feed the motor yet. Drag from the battery's power out port to the motor's power in. Holarch offers what fits both ports: choose Interface, High Voltage Bus.
On screen: Select battery.powerOut; drag its handle to motor.powerIn → Interface : HighVoltageBus.
Select the new line, and name it H V Bus in the inspector.
On screen: Click the new line; inspector Name: hvBus.
Close the inspector and open the text again. Holarch wrote the interface into the powertrain, with its name, its type and both ends.
On screen: Inspector ×; Model → Editor: the interface hvBus line in Powertrain.
Recap
Every step is ticked off. Click Mark as Done.
On screen: Step panel → Mark as Done.
Let's recap. You defined a port with a direction, conjugated it for the engine, defined an interface with two ends, connected the powertrain's parts in text, and drew an interface that Holarch wrote back into the text.
Next, actions and flows describe what the car does.