פרקי הקורס
הדרכה · מסלול 9. יסודות SysML v2 · פרק 9.5 מתוך 8
9.5 דרישות 4:15
כותבים דרישות שאפשר לבדוק, מקננים אותן במפרט ורואים דרישה שאינה מתקיימת.
מציג את Holarch 2.22.
מה תלמדו
- לתת שמות למגבלות של דרישות כמאפיינים עם יחידות
- לכתוב הגדרת דרישה עם מספר, משפט, נושא ו-require constraint
- לקנן שימושי דרישה במפרט ולתת להם מגבלות משלהם עם `:>>`
- לציין מה מקיים דרישה, ולקרוא את הסימון של העורך כשהתכן לא עונה עליה
- לבדוק משפטי דרישות בדף האיכות
כותבים דרישות SysML v2 ב-Holarch, לפי המדריך Requirements של SysML v2 על פרויקט Hybrid Car קטן: מגבלות בעלות שם, הגדרות דרישה עם מספר, משפט, נושא ו-require constraint, הוספה, מפרט עם דרישות מקוננות, satisfy, דרישה שהסדאן כבר לא עונה עליה, טבלת הדרישות, תצוגת דרישות ובדיקת האיכות. SysML הוא סימן מסחרי רשום של Object Management Group, Inc.
קובצי פרויקט
- פרויקט גמור (.holarch.json; ניהול פרויקטים ← קובצי פרויקט ▾ ← ייבוא פרויקט (.json)…)
הסרטון מוצג מ-holarch.app; ראו את מדיניות הפרטיות.
תרגול
עושים את זה בעצמכם ב-Holarch, על פרויקט ההדגמה Hybrid Car (SysML v2).
- פותחים את פרויקט ההדגמה Hybrid Car (יוצרים אותו אם צריך: ניהול פרויקטים ← קובצי פרויקט ▾ ← פרויקט הדגמה חדש ← Hybrid Car (SysML v2)), פותחים את מודל ← עורך ואת החבילה
VehicleRequirements. - אחרי
attribute minElectricRangeמוסיפיםattribute minTopSpeed : SpeedValue = 180 [km/h];. - מתחת ל-
requirement def <'VR-5'> ChargeTimeבוחרים הוספה ▾ ← הגדרת דרישה וכותבים<'VR-8'> TopSpeedעם המשפטThe sports car shall reach at least the minimum top speed., הנושאcar : SportCarו-require constraint { car.topSpeed >= minTopSpeed }. - אחרי שורות ה-
satisfyהאחרות מוסיפיםsatisfy requirement roadsterSpeed : TopSpeed by fleet.roadster;. - משנים את
minTopSpeedל-220 [km/h]. מצביעים על הסימון שהעורך מציב על ה-satisfy כדי לקרוא את הערכים שהוא השווה, ואז לוחצים ⌘Z / Ctrl+Z. - פותחים את צרכים ודרישות ← דרישות ומוצאים את VR-8, ואז פותחים את צרכים ודרישות ← איכות ולוחצים על בדיקת איכות.
סיימתם כש-VR-8 נמצאת בטבלת הדרישות, ל-satisfy אין סימון ב-180 km/h, ו“בדיקת איכות” נתנה ציון למשפט שלה.
בדיקה עצמית
- למה לשמור מגבלות כמו
maxCurbMassכמאפיינים בעלי שם במקום לכתוב את המספר בכל אילוץ? - ב-
requirement <'VR-1.1'> sedanMass : CurbMass { attribute :>> limit = maxCurbMass; }, מה עושה:>>? - מה
satisfy carSpec by fleet.sedan;מאפשר ל-Holarch לבדוק? - מגדירים את הסטטוס והעדיפות של דרישה בדף הדרישות. האם טקסט ה-SysML משתנה?
הצגת התשובות
למה לשמור מגבלות כמו
maxCurbMassכמאפיינים בעלי שם במקום לכתוב את המספר בכל אילוץ?כל דרישה שמשתמשת בשם מתעדכנת בעריכה אחת, והמגבלה נושאת את היחידה שלה, כך שהבודק משווה ערכים עם יחידות.
ב-
requirement <'VR-1.1'> sedanMass : CurbMass { attribute :>> limit = maxCurbMass; }, מה עושה:>>?הוא מגדיר מחדש את המאפיין
limitש-sedanMass יורשת מ-CurbMass, ונותן לשימוש הזה ערך משלו.מה
satisfy carSpec by fleet.sedan;מאפשר ל-Holarch לבדוק?האם הערכים של הסדאן עומדים באילוצים של carSpec. אם מסת הסדאן הריקה חורגת מהמגבלה, העורך מסמן את ה-satisfy ומציג את הערכים שהושוו.
מגדירים את הסטטוס והעדיפות של דרישה בדף הדרישות. האם טקסט ה-SysML משתנה?
לא. סטטוס, עדיפות ושיטת אימות הם נתוני Holarch שנשמרים לצד המודל; הם אף פעם לא משנים את הטקסט.
קריאה נוספת
תמליל
הצגת התמליל (הקריינות ומה שמוצג על המסך)
Introduction
Chapter five: requirements. In SysML v2 a requirement can carry a constraint, so the model can check whether a design meets it.
In this chapter you write limits and requirement definitions, nest requirements in a specification, say what satisfies them, and see a requirement that is not met.
Start the tutorial
Start the tutorial Requirements from Project Files, Start a Tutorial. Its starter project holds a small copy of the design: a battery, a car, and a fleet with a sedan of fifteen hundred eighty kilograms.
On screen: Project Files ▾ → Start a Tutorial… → SysML v2: Requirements → Start; Model → Editor.
Requirement definitions
Keep limits as named values, so one edit updates every requirement that uses them. After the requirements comment, add the maximum curb mass and the minimum battery capacity.
On screen: After // ---- Requirements ----: maxCurbMass and minBatteryCapacity.
Below the limits, write the first requirement definition. V R one is its number, doc is its statement, subject is what it is about, and require constraint makes it checkable: Holarch evaluates it with units.
On screen: Below the limits: requirement def <'VR-1'> CurbMass.
Insert
Insert writes the frame of a construct for you. Below the curb mass requirement, open Insert and choose Requirement Definition. Type its number and name, then press Tab to move to the subject, its type and the statement.
On screen: Insert ▾ (open on camera) → Requirement Definition; <'VR-3'> BatteryCapacity, Tab, battery, Tab, Battery, Tab, statement.
Then give it its constraint: the battery's capacity is at least the minimum.
On screen: After the doc line: require constraint { battery.capacity >= minBatteryCapacity }
Specification and satisfy
A specification holds the sedan's requirements. Each one is a usage of a definition, and the symbol after attribute redefines the limit with the sedan's own value.
On screen: After BatteryCapacity: requirement carSpec with sedanMass : CurbMass.
Now say what satisfies them. The sedan of the fleet satisfies the car specification, and a named satisfy says that the sedan's battery satisfies the battery capacity requirement.
On screen: After carSpec: satisfy carSpec by fleet.sedan; satisfy requirement batterySpec …
Break a requirement on purpose. In the fleet, change the sedan's curb mass from fifteen hundred eighty to seventeen hundred kilograms.
On screen: In fleet: curbMass = 1580 → 1700.
The Editor marks the satisfy: the sedan no longer meets V R one point one. Point at the mark to read the values it compared.
On screen: The mark on the satisfy; its information card.
Change it back, or press Command Z, and the mark clears.
On screen: curbMass = 1700 → 1580; No problems.
Pages on the model
The requirements pages work on the model. Open Needs and Requirements, then Requirements. The model's requirements are the rows, numbered by their short names. Status, priority and verification method are Holarch data next to the model; they never change the text.
On screen: Needs & Requirements → Requirements.
Open the Diagrams page, click New Diagram, and choose Requirement View. Choose the car specification under Shows, and click Create: the specification as a tree, with what satisfies it.
On screen: Diagrams → + New Diagram → Requirement View; Shows: VehicleRequirements::carSpec; Create.
Last, open Needs and Requirements, then Quality, and click Check Quality. Each requirement's statement is scored on the quality criteria, as in an LML project.
On screen: Needs & Requirements → Quality → Check Quality.
Recap
Every step is ticked off. Click Mark as Done.
On screen: Step panel → Mark as Done.
Let's recap. You named the limits, wrote requirement definitions with a number, a statement, a subject and a constraint, used Insert, nested requirements in a specification, said what satisfies them, and saw the Editor mark a requirement that was not met.
Next, verification cases check these requirements, and the matrix traces them.