Holarch
कोर्स के अध्याय

प्रशिक्षण · ट्रैक 9. SysML v2 की मूल बातें · 8 में से अध्याय 9.2

9.2 पोर्ट और इंटरफ़ेस 3:44

पोर्ट और इंटरफ़ेस परिभाषित करें, टेक्स्ट में parts जोड़ें, और व्यू में एक इंटरफ़ेस बनाएं।

Holarch 2.22 दिखाता है।

आप क्या सीखेंगे

  • दिशा वाले एट्रिब्यूट के साथ एक पोर्ट परिभाषित करें और उसे `~` से conjugate करें
  • एक interface परिभाषित करें जिसके छोर पोर्ट से टाइप किए गए हों
  • interface usage से parts जोड़ें और किसी सीमा पोर्ट को किसी भीतरी part के पोर्ट से बाइंड करें
  • एक Interconnection View बनाएं और दो पोर्ट के बीच एक इंटरफ़ेस बनाएं

एक छोटे Hybrid Car प्रोजेक्ट पर SysML v2 ट्यूटोरियल Ports and Interfaces का पालन करते हुए Holarch में SysML v2 पोर्ट और इंटरफ़ेस परिभाषित करें: दिशाओं वाली port परिभाषा, एक conjugated पोर्ट, दो छोरों वाली interface परिभाषा, एक पावरट्रेन जिसके parts इंटरफ़ेस और एक binding से जुड़े हैं, उसका एक Interconnection View, और व्यू में बनाया गया एक इंटरफ़ेस जिसे Holarch टेक्स्ट में लिखता है। SysML, Object Management Group, Inc. का पंजीकृत ट्रेडमार्क है।

प्रोजेक्ट फ़ाइलें

वीडियो holarch.app से चलता है; गोपनीयता नीति देखें।

अभ्यास

यह स्वयं Holarch में, Hybrid Car डेमो प्रोजेक्ट (SysML v2) पर करें।

  1. अपना Hybrid Car डेमो प्रोजेक्ट खोलें (ज़रूरत हो तो उसे बनाएं: प्रोजेक्ट प्रबंधित करें → प्रोजेक्ट फ़ाइलें ▾ → नया डेमो प्रोजेक्ट → Hybrid Car (SysML v2)), मॉडल → संपादक और पैकेज Vehicles खोलें।
  2. interface def HighVoltageBus के नीचे interface def ControlLink { end commander : ~ControlPort; end unit : ControlPort; } जोड़ें।
  3. part def Powertrain में connect controller.engineCtl to engine.ecu; को interface engineControl : ControlLink connect controller.engineCtl to engine.ecu; से बदलें, और part battery : Battery; के बाद part auxBattery : Battery; जोड़ें।
  4. आर्किटेक्चर → Interconnection Views और व्यू powertrainConnections खोलें। auxBattery के पोर्ट powerOut के हैंडल से मोटर के पोर्ट powerIn तक खींचें और Interface : HighVoltageBus चुनें।
  5. नई लाइन चुनें और इंस्पेक्टर में उसके नाम के रूप में auxBus दर्ज करें। फिर मॉडल → संपादक खोलें और वह पंक्ति खोजें जो Holarch ने Powertrain में लिखी।

आपका काम तब पूरा है जब Powertrain में interface engineControl : ControlLink … और व्यू से बना auxBus इंटरफ़ेस है, और संपादक के नीचे की स्थिति कोई समस्या नहीं बताती।

स्वयं जांचें

  1. इंजन में port fuelIn : ~FuelPort; है। टिल्ड क्या बदलता है?
  2. bind output = transmission.output; और interface fuel : FuelLine connect tank.fuelOut to engine.fuelIn; में क्या अंतर है?
  3. जब आप बैटरी के powerOut से मोटर के powerIn तक खींचते हैं, तो व्यू Interface : HighVoltageBus क्यों देता है?
उत्तर दिखाएं
  1. इंजन में port fuelIn : ~FuelPort; है। टिल्ड क्या बदलता है?

    यह पोर्ट को conjugate करता है: इंजन के पोर्ट में FuelPort जैसे ही feature होते हैं पर दिशाएं उलटी होती हैं, इसलिए FuelPort का out attribute flowRate इंजन पर इनपुट के रूप में पहुंचता है।

  2. bind output = transmission.output; और interface fuel : FuelLine connect tank.fuelOut to engine.fuelIn; में क्या अंतर है?

    binding कहता है कि दोनों feature एक ही हैं: पावरट्रेन का सीमा पोर्ट ट्रांसमिशन का आउटपुट है। interface usage दो अलग पोर्ट जोड़ता है, और उसकी interface परिभाषा बताती है कि उसके छोर कौन-से पोर्ट स्वीकार करते हैं।

  3. जब आप बैटरी के powerOut से मोटर के powerIn तक खींचते हैं, तो व्यू Interface : HighVoltageBus क्यों देता है?

    Holarch वे interface परिभाषाएं देता है जिनके छोर दोनों पोर्ट पर फ़िट होते हैं। 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.