कोर्स के अध्याय
प्रशिक्षण · ट्रैक 9. SysML v2 की मूल बातें · 8 में से अध्याय 9.8
9.8 Variants और configurations 3:42
variation points और नियमों वाली एक प्रोडक्ट लाइन लिखें, और ऐसे कॉन्फ़िगरेशन जिन्हें संपादक जांचता है।
Holarch 2.22 दिखाता है।
आप क्या सीखेंगे
- variants वाला एक variation लिखें और उसे किसी product line के variation point के रूप में उपयोग करें
- assert constraint से किसी product line में एक नियम जोड़ें
- ऐसे configurations बनाएं जो हर point के लिए एक variant चुनें, और उनके निर्णय पढ़ें
- अपना एक metadata कीवर्ड परिभाषित करें और उसे `#` से लागू करें
- मॉडल को एक configuration के रूप में दिखाएं
Holarch में एक SysML v2 product line लिखें, एक छोटे Hybrid Car प्रोजेक्ट पर SysML v2 ट्यूटोरियल Variants and Configurations का पालन करते हुए: Holarch का variability पैकेज, variants वाला एक variation, variation point और assertion वाली एक product line, एडिटर द्वारा जांचे जाने वाले configurations, metadata से परिभाषित आपका अपना कीवर्ड, और product line का एक General View। SysML, Object Management Group, Inc. का पंजीकृत ट्रेडमार्क है।
प्रोजेक्ट फ़ाइलें
- पूरा किया गया प्रोजेक्ट (.holarch.json; प्रोजेक्ट प्रबंधित करें → प्रोजेक्ट फ़ाइलें ▾ → प्रोजेक्ट आयात करें (.json)…)
वीडियो holarch.app से चलता है; गोपनीयता नीति देखें।
अभ्यास
यह स्वयं Holarch में, Hybrid Car डेमो प्रोजेक्ट (SysML v2) पर करें।
- अपना Hybrid Car डेमो प्रोजेक्ट खोलें (ज़रूरत हो तो उसे बनाएं: प्रोजेक्ट प्रबंधित करें → प्रोजेक्ट फ़ाइलें ▾ → नया डेमो प्रोजेक्ट → Hybrid Car (SysML v2)), मॉडल → संपादक और पैकेज
Vehiclesखोलें। यह पहले सेHolarchVariabilityआयात करता है। part def CarLineमेंchargervariation के बादvariation part rims : Wheel { variant part steelRims : Wheel; variant part alloyRims : Wheel { attribute :>> mass = 18 [kg]; } }जोड़ें। संपादक बताता है कि तीनों कॉन्फ़िगरेशन ने अभीrimsनहीं चुना है।wallboxNeedsLargePackके बाद नियमassert constraint alloyNeedsLargePack { rims == rims::alloyRims implies pack == BatteryPack::largePack }जोड़ें।- मॉडल → ब्राउज़र खोलें और
selfChargingHybridचुनें। इंस्पेक्टर के कॉन्फ़िगरेशन अनुभाग में rims के लिए steelRims चुनें;plugInHybridऔरlongRangeHybridके लिए alloyRims चुनें। फिरselfChargingHybridपर alloyRims आज़माएं, verdict पढ़ें, और ⌘Z / Ctrl+Z दबाएं। CarLineका पंक्ति मेनू (⋯) खोलें और नया कॉन्फ़िगरेशन… चुनें। उसका नामcityHybridरखें, standardPack, noCharger और steelRims चुनें, जांचें कि verdict मान्य है, और बनाएं पर क्लिक करें।- टॉप बार में इस रूप में देखें ▾ पर क्लिक करें और
cityHybridचुनें, फिर आरेख सूची से व्यूcarLineVariantsखोलें: जिन वेरिएंट को यह नहीं चुनता, वे छिपे रहते हैं।
आपका काम तब पूरा है जब CarLine के लिए इंस्पेक्टर का प्रोडक्ट लाइन अनुभाग चार कॉन्फ़िगरेशन, सभी मान्य, और नियम alloyNeedsLargePack सूचीबद्ध करता है।
स्वयं जांचें
variation part def BatteryPack { … }औरvariation part charger : Component { … }में क्या अंतर है?plugInHybrid,BatteryPack::standardPackऔरcharger::wallboxचुनता है। क्या होता है, और क्यों?- किसी कॉन्फ़िगरेशन ने अभी हर बिंदु के लिए वेरिएंट नहीं चुना है। उसका verdict क्या है?
metadata def <safetyCritical> SafetyCriticalसे आप क्या लिख पाते हैं, और अन्य SysML v2 टूल इसे कैसे देखते हैं?
उत्तर दिखाएं
variation part def BatteryPack { … }औरvariation part charger : Component { … }में क्या अंतर है?पहला एक variation परिभाषा है, विकल्पों का पुन: उपयोग योग्य सेट: उससे टाइप किया गया usage, जैसे
part pack : BatteryPack;, एक variation point है। दूसरा एक variation usage है, एक डिज़ाइन के भीतर घोषित बिंदु।plugInHybrid,BatteryPack::standardPackऔरcharger::wallboxचुनता है। क्या होता है, और क्यों?नियम
wallboxNeedsLargePackटूटता है: यह कहता है कि wallbox का अर्थ है बड़ा पैक। verdict नियम का नाम बताता है, और संपादक विफल assertion की रिपोर्ट करता है।किसी कॉन्फ़िगरेशन ने अभी हर बिंदु के लिए वेरिएंट नहीं चुना है। उसका verdict क्या है?
अपूर्ण, खुले बिंदु के नाम के साथ। जब तक किसी बिंदु का कोई विकल्प नहीं चुना गया, उस पर बना नियम न पूरा होता है न टूटता है।
metadata def <safetyCritical> SafetyCriticalसे आप क्या लिख पाते हैं, और अन्य SysML v2 टूल इसे कैसे देखते हैं?छोटा नाम एक keyword बन जाता है, जैसे
#safetyCritical part controller : Controller;में। यह एक सामान्य metadata usage है, इसलिए अन्य SysML v2 टूल इसे part पर metadata के रूप में देखते हैं।
और पढ़ें
- ट्यूटोरियल: Variants and Configurations (SysML v2 ट्यूटोरियल)
- Docs: SysML v2 Variants और configurations, अवधारणाएं
- Docs: SysML v2 Variants और configurations, एक configuration बनाएं
- Docs: SysML v2 टेक्स्ट नोटेशन, Variations, variants और configurations
- Docs: प्रोडक्ट लाइनें, SysML v2 प्रोजेक्ट
- सहायता: Variants और configurations
ट्रांसक्रिप्ट
ट्रांसक्रिप्ट दिखाएं (नरेशन और स्क्रीन पर क्या है)
Introduction
Chapter eight: variants and configurations. A product line offers choices, and a configuration picks one variant for each choice.
In this chapter you write a variation with variants, a product line with a rule, configurations the Editor checks, and a keyword of your own.
Start the tutorial
Start the tutorial Variants and Configurations from Project Files, Start a Tutorial. Its starter project holds the components, the car and the powertrain.
On screen: Project Files ▾ → Start a Tutorial… → SysML v2: Variants and Configurations → Start; Model → Editor.
Variations
Holarch's variability package lets the Editor check configurations. Import it after the other imports.
On screen: After the imports: private import HolarchVariability::*;
A variation lists the choices offered. Before the powertrain, write the battery pack variation: a standard pack and a large pack, each with its own capacity, and the large one with its own mass.
On screen: After Car: variation part def BatteryPack with two variants.
The product line
Below it, the car line. Its pack is typed by the variation, its charger is a variation point with two variants, and an assertion rules out the wallbox with the standard pack.
On screen: Below BatteryPack: part def CarLine :> Car with pack, charger and the assertion.
Configurations
A configuration is a part of the car line, marked Holarch Configuration. Until it chooses a variant for each point, the Editor notes the points still open.
On screen: Below CarLine: part plugInHybrid : CarLine { @HolarchConfiguration; }
Inside the plug-in hybrid, choose the standard pack and the wallbox. The assertion fails: the wallbox needs the large pack.
On screen: In plugInHybrid: pack = BatteryPack::standardPack; charger = charger::wallbox; the assertion error.
Choose the large pack instead, and the configuration checks.
On screen: standardPack → largePack; No problems.
Add a second configuration: a self-charging hybrid, with the standard pack and no charger.
On screen: Below plugInHybrid: part selfChargingHybrid : CarLine.
A keyword of your own
You can also define keywords of your own. At the end of the package, add a metadata definition. Its short name, safety critical, becomes a keyword.
On screen: After Powertrain: metadata def <safetyCritical> SafetyCritical.
In the powertrain, put the keyword before the controller, after a number sign. Other SysML v2 tools see it as ordinary metadata.
On screen: In Powertrain: #safetyCritical part controller : Controller;
The General View
Open Architecture, then General Views, and click New Diagram. Keep General View, choose the Vehicles package under Shows, and click Create.
On screen: Architecture → General Views → + New Diagram; Shows: Vehicles; Create.
The battery pack is marked variation in its heading.
On screen: BatteryPack: «variation part def».
Recap
Every step is ticked off. Click Mark as Done.
On screen: Step panel → Mark as Done.
Let's recap. You imported Holarch's variability package, wrote a variation with variants and a product line with a rule, built configurations that the Editor checks, and defined a keyword of your own.
That completes SysML v2 Fundamentals.