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

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

9.1 परिभाषाएं और एट्रिब्यूट 4:33

SysML v2 टेक्स्ट में इकाइयों वाले मानों के साथ value type और घटक लिखें।

Holarch 2.22 दिखाता है।

सभी अध्याय · 9.2 पोर्ट और इंटरफ़ेस →

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

  • संपादक में एक enumeration, एक value type और एक abstract part परिभाषा लिखें
  • `:>` से किसी परिभाषा को विशेषीकृत करें और `redefines` का उपयोग करके विरासत में मिले एट्रिब्यूट को इकाइयों वाले मान दें
  • चेकर द्वारा रेखांकित इकाई त्रुटि खोजें और ठीक करें
  • सम्मिलित करें ▾ और कम्प्लीशन से एक परिभाषा लिखें, और मानक लाइब्रेरी में कोई type देखें
  • F2 से किसी एलिमेंट का नाम एक undo चरण में हर जगह बदलें

एक छोटे Hybrid Car प्रोजेक्ट पर SysML v2 ट्यूटोरियल Definitions and Attributes का पालन करते हुए Holarch के संपादक में SysML v2 परिभाषाएं और एट्रिब्यूट लिखें: एक enumeration, ScalarValue को विशेषीकृत करने वाला value type, एक abstract घटक और इकाइयों वाले मानों के साथ उसके विशेषीकरण, चेकर द्वारा पाई गई इकाई त्रुटि, कम्प्लीशन और मानक लाइब्रेरी, सम्मिलित करें, और F2 से नाम बदलना। SysML, Object Management Group, Inc. का पंजीकृत ट्रेडमार्क है।

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

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

अभ्यास

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

  1. Hybrid Car डेमो बनाएं: प्रोजेक्ट प्रबंधित करें → प्रोजेक्ट फ़ाइलें ▾ → नया डेमो प्रोजेक्ट → Hybrid Car (SysML v2)। मॉडल → संपादक और पैकेज Vehicles खोलें।
  2. enum def FuelKind के नीचे enum def CoolingMode { enum passive; enum active; } जोड़ें।
  3. part def Body के नीचे सम्मिलित करें ▾ → पार्ट परिभाषा चुनें और part def Radiator :> Component को attribute redefines mass = 8 [kg];, attribute coolantVolume : VolumeValue; (Volu टाइप करें और कम्प्लीशन सूची से Enter दबाकर VolumeValue स्वीकार करें) और attribute mode : CoolingMode; के साथ पूरा करें।
  4. द्रव्यमान को 8 [W] में बदलें, संदेश पढ़ने के लिए रेखांकन पर पॉइंटर ले जाएं, फिर उसे वापस 8 [kg] करें।
  5. part def Powertrain में part radiator : Radiator; जोड़ें। फिर कर्सर को coolantVolume पर रखें, F2 दबाएं और उसका नाम बदलकर coolantCapacity करें।
  6. जांचे गए चरण-दर-चरण अभ्यास के लिए SysML v2 ट्यूटोरियल Definitions and Attributes चलाएं (सहायता → ट्यूटोरियल)।

आपका काम तब पूरा है जब संपादक के नीचे की स्थिति कोई समस्या नहीं बताती और ब्राउज़र Vehicles के अंतर्गत coolantCapacity और mode के साथ Radiator दिखाता है।

स्वयं जांचें

  1. part def Battery :> Component { attribute redefines mass = 45 [kg]; } में :> और redefines अलग-अलग क्या करते हैं?
  2. Component को abstract part def के रूप में क्यों घोषित किया गया है?
  3. attribute redefines power = 60 [kg]; त्रुटि क्यों देता है?
  4. doc /* … */ और // पंक्ति में क्या अंतर है?
उत्तर दिखाएं
  1. part def Battery :> Component { attribute redefines mass = 45 [kg]; } में :> और redefines अलग-अलग क्या करते हैं?

    :> Battery को Component का विशेषीकरण बनाता है, इसलिए उसे mass, partNumber और power विरासत में मिलते हैं। redefines Battery में विरासत में मिले mass को उसके अपने feature से बदलता है, जो यहाँ 45 kg से बाइंड है।

  2. Component को abstract part def के रूप में क्यों घोषित किया गया है?

    कोई भी चीज़ केवल घटक नहीं होती, केवल घटकों के प्रकार होते हैं। abstract परिभाषा वह एकत्र करती है जो हर घटक में साझा है, और केवल उसके विशेषीकरण, जैसे Battery या Engine, वास्तविक भागों का वर्णन करते हैं।

  3. attribute redefines power = 60 [kg]; त्रुटि क्यों देता है?

    power का type PowerValue है, और किलोग्राम द्रव्यमान की इकाई है। चेकर इकाइयों का मूल्यांकन करता है, इसलिए वह मान को तब तक रेखांकित करता है जब तक इकाई [W] जैसी शक्ति की इकाई न हो।

  4. doc /* … */ और // पंक्ति में क्या अंतर है?

    doc टिप्पणी वह दस्तावेज़ीकरण है जो एलिमेंट से संबंधित है और मॉडल का हिस्सा है। // नोट केवल टेक्स्ट में रहता है और मॉडल का हिस्सा नहीं है।

और पढ़ें

ट्रांसक्रिप्ट

ट्रांसक्रिप्ट दिखाएं (नरेशन और स्क्रीन पर क्या है)

Introduction

Welcome to SysML v2 Fundamentals. This track teaches the SysML v2 textual notation and views in Holarch, one task per chapter, on the starter projects of Holarch's SysML v2 tutorials, so you can follow along step by step.

In this chapter you write definitions and attributes: an enumeration, a value type, an abstract component and the components that specialize it, with values in units.

Start the tutorial

In Manage Projects, open Project Files and choose Start a Tutorial. Under the tutorials for SysML v2 projects, click Start on Definitions and Attributes. Holarch creates a small Hybrid Car project and opens the step panel, which checks each step as you go.

On screen: Project Files ▾ → Start a Tutorial… → SysML v2: Definitions and Attributes → Start; the step panel opens.

Enumerations and value types

Open Model, then Editor. The package Vehicles holds one part definition, Car, with two attributes. Every declaration is a keyword and a name, then a body in braces, or a semicolon when there is no body.

On screen: Model → Editor: Vehicles; outline part def Car.

An enumeration is a value type with a fixed set of values. Above the car, write the drive mode: economy, normal or sport.

On screen: Caret after the imports; type enum def DriveMode.

Next, a value type of your own. Tire pressure specializes Scalar Value from the standard library. The short symbol after the name means specializes.

On screen: Below DriveMode; type attribute def TirePressure :> ScalarValue;

Specialization and units

Now an abstract component. There is no component as such, only kinds of components, and every one has a mass, a part number and a power. The doc comment is part of the model. Two slashes start a note that stays in the text only.

On screen: Below TirePressure; type abstract part def Component.

The battery is a component, so it has a mass, a part number and a power of its own. Write it with a mistake on purpose: a power in kilograms.

On screen: Below Component; type part def Battery :> Component with power = 60 [kg].

The checker underlines the value, and the status under the editor counts the error. Point at the underline to read the message.

On screen: Problems count; the information card on 60 [kg].

Change kilograms to watts, and the error clears. Redefines gives each inherited attribute the battery's own value, with its unit in square brackets.

On screen: kg → W; No problems, Applied.

Completion and the Standard Library

Completion knows the model and the library. Inside the battery, type attribute capacity, a colon, and the start of Energy Value. Press Enter to take it from the list, and end the line with a semicolon.

On screen: Inside Battery: attribute capacity : Ener → completion → Enter → ;

Point at Energy Value. The card shows that it comes from the I S Q package of the standard library.

On screen: The information card on EnergyValue.

The Standard Library page lists every package and definition of that library. Open Settings, then Standard Library, and search for Energy Value.

On screen: Settings → Standard Library; Find EnergyValue.

Insert

Back in the Editor, Insert writes a construct for you. Place the cursor below the battery, open Insert, and choose Part Definition. Type Engine, and press Tab to move into its body.

On screen: Model → Editor; caret below Battery; Insert ▾ (open on camera) → Part Definition; Engine; Tab.

The engine is a component too. Give it its mass and a number of cylinders, and make it specialize Component.

On screen: Body: mass 110 kg, cylinders : Integer; then :> Component after the name.

Usages and rename

Now use the definitions. Inside the car, add a drive mode, a battery and an engine. Each usage is typed by a definition after the colon, the drive mode by the enumeration you wrote first.

On screen: In Car after curbMass: attribute mode : DriveMode; part battery : Battery; part engine : Engine;

To rename a name everywhere it is used, place the cursor on cylinders and press F2. Enter cylinder count and confirm. Every reference to it changes, in one undo step.

On screen: Caret in cylinders; F2; New name cylinderCount; OK.

Every step is ticked off. Click Mark as Done to finish the tutorial.

On screen: Step panel → Mark as Done.

Recap

Let's recap. You started a SysML v2 tutorial, wrote an enumeration and a value type, an abstract component with specializations and values in units, let the checker find a wrong unit, and used completion, the Standard Library, Insert and rename.

Next, ports and interfaces connect these components.