Holarch
פרקי הקורס

הדרכה · מסלול 9. יסודות SysML v2 · פרק 9.7 מתוך 8

9.7 אילוצים וחישובים 4:26

כותבים אילוצים וחישובים, בודקים את הערכים של הסדאן עם יחידות ומסמנים ערכים פתוחים.

מציג את Holarch 2.22.

מה תלמדו

  • לכתוב הגדרת אילוץ והגדרת חישוב עם פרמטרים
  • לקשור את הפרמטרים של שימוש באילוץ לערכים במודל
  • לראות אילוץ עובר ונכשל בתצוגה פרמטרית, ולבדוק כל אילוץ עם “פתרון הכול”
  • לסמן ערכים פתוחים עם מטא-נתונים של TBD ו-TBR ולמצוא אותם במרשם TBD/TBR
  • לסכם את המסה של חלק ב“תקציבים ו-TPMs”

כותבים אילוצים וחישובים של SysML v2 ב-Holarch, לפי המדריך Constraints and Calculations של SysML v2 על פרויקט Hybrid Car קטן: הגדרת אילוץ וחישוב, שימוש באילוץ שקשור לערכים של הסדאן, תצוגה פרמטרית שבה הבדיקה נכשלת ועוברת, “פתרון הכול”, מקרה ניתוח, ערכי TBD ו-TBR עם המרשם שלהם, וסיכום מסה בתקציבים. SysML הוא סימן מסחרי רשום של Object Management Group, Inc.

קובצי פרויקט

  • פרויקט גמור (.holarch.json; ניהול פרויקטים ← קובצי פרויקט ▾ ← ייבוא פרויקט (.json)…)

הסרטון מוצג מ-holarch.app; ראו את מדיניות הפרטיות.

תרגול

עושים את זה בעצמכם ב-Holarch, על פרויקט ההדגמה Hybrid Car ‏(SysML v2).

  1. פותחים את פרויקט ההדגמה Hybrid Car (יוצרים אותו אם צריך: ניהול פרויקטים ← קובצי פרויקט ▾ ← פרויקט הדגמה חדש ← Hybrid Car (SysML v2)), פותחים את מודל ← עורך ואת החבילה VehicleRequirements.
  2. אחרי constraint def SpeedLimit מוסיפים constraint sedanBatteryCheck : MassLimit { in mass = fleet.sedan.powertrain.battery.mass; in limit = 50 [kg]; }.
  3. בדף דיאגרמות לוחצים על + דיאגרמה חדשה, בוחרים תצוגה פרמטרית ואת VehicleRequirements תחת מציג, ולוחצים על יצירה. הבדיקה החדשה עוברת: 48 kg הם בתוך 50 kg.
  4. בחבילה Vehicles משנים את המסה של סוללת הסדאן ל-52 [kg]; התצוגה מראה שהבדיקה נכשלת. לוחצים ⌘Z / Ctrl+Z, ואז לוחצים על פתרון הכול כדי לבדוק שוב כל אילוץ.
  5. ב-requirement def <'VR-2'> Acceleration מחליפים את attribute zeroToHundred : TimeValue; ב-attribute zeroToHundred : TimeValue { @TBD { owner = "Test lead"; rationale = "The test track is not booked yet."; } }. פותחים את צרכים ודרישות ← TBD/TBR ומוצאים את הדרישה עם הבעלים שלה.
  6. פותחים את ארכיטקטורה ← תקציבים ו-TPMs, לוחצים על בחירת חלק שורש… ובוחרים sedan. תחת כמות בוחרים Mass ומוצאים את 48 ה-kg של הסוללה.

סיימתם כש-sedanBatteryCheck מציג Pass בתצוגה הפרמטרית ומרשם TBD/TBR מציג את הדרישה Acceleration עם הבעלים Test lead.

בדיקה עצמית

  1. מה ההבדל בין constraint def לבין calc def?
  2. אילוץ בתצוגה הפרמטרית מציג “דורש קלט”. מה חסר?
  3. למה לסמן ערך פתוח עם #TBD או @TBD { … } במקום לכתוב TBD כערך?
  4. מה מקרה ניתוח מוסיף לחישוב?
הצגת התשובות
  1. מה ההבדל בין constraint def לבין calc def?

    הגדרת אילוץ מבטאת תנאי על הפרמטרים שלה שמתקיים או לא, כמו mass <= limit. הגדרת חישוב מחשבת ומחזירה ערך, כמו return ratio = power / mass;.

  2. אילוץ בתצוגה הפרמטרית מציג “דורש קלט”. מה חסר?

    לפרמטר עדיין אין ערך. קושרים כל פרמטר לערך, למשל in mass = fleet.sedan.curbMass;.

  3. למה לסמן ערך פתוח עם #TBD או @TBD { … } במקום לכתוב TBD כערך?

    TBD במקום ערך אינו SysML תקין. המטא-נתונים מהחבילה HolarchMetadata של Holarch שומרים על תקינות הטקסט; TBD ו-TBR מרחיבים את המטא-נתונים הסטנדרטיים StatusInfo, כך שכלי SysML v2 אחרים קוראים אותם כהערות סטטוס.

  4. מה מקרה ניתוח מוסיף לחישוב?

    הוא מחיל את החישוב על נושא, כמו הסדאן, מחזיר את התוצאה, ויש לו מטרה שאת ה-require constraint שלה Holarch מעריך כמו כל אילוץ אחר.

קריאה נוספת

תמליל

הצגת התמליל (הקריינות ומה שמוצג על המסך)

Introduction

Chapter seven: constraints and calculations. They turn the model's values into checks and results that Holarch evaluates with units.

In this chapter you write a constraint and a calculation, bind a check to the sedan's values, see it fail and pass in a Parametric View, run an analysis case, and mark open values.

Start the tutorial

Start the tutorial Constraints and Calculations from Project Files, Start a Tutorial. Its starter project holds the sedan with its engine and battery values, and two targets: the maximum curb mass and the minimum power to weight.

On screen: Project Files ▾ → Start a Tutorial… → SysML v2: Constraints and Calculations → Start; Model → Editor.

Constraints and calculations

A constraint definition states a condition over its parameters. After the constraints comment, write the mass limit: the mass is at most the limit.

On screen: After // ---- Constraints and calculations ----: constraint def MassLimit.

Below it, a calculation: power to weight divides the power by the mass, and returns the ratio.

On screen: Below it: calc def PowerToWeight.

A constraint usage binds each parameter to a value: here, the sedan's curb mass and the maximum curb mass.

On screen: Below it: constraint sedanMassCheck : MassLimit with bound inputs.

The Parametric View

Open the Diagrams page, click New Diagram, and choose Parametric View. Choose the vehicle analysis package under Shows, and click Create.

On screen: Diagrams → + New Diagram → Parametric View; Shows: VehicleAnalysis; Create.

The check shows its expression, with its parameters bound to the values. Fifteen hundred eighty kilograms is within sixteen hundred fifty, so it passes.

On screen: The mass check: pass.

In the Editor, change the sedan's curb mass to seventeen hundred kilograms. Back in the Parametric View, the mass check now fails.

On screen: Model → Editor: curbMass 1580 → 1700; Diagrams → the Parametric View: fail.

Change it back to fifteen hundred eighty in the Editor. In the view, Solve All checks every constraint again, with units.

On screen: Model → Editor: 1700 → 1580; the view → Solve All → Pass; Close.

An analysis case

An analysis case computes a result for a subject. At the end of the package, add the power to weight analysis, and apply it to the sedan. Its objective requires at least the minimum, and the checker evaluates it like any constraint.

On screen: Model → Editor; after sedanMassCheck: analysis def PowerToWeightAnalysis; analysis sedanPowerToWeight.

TBD and TBR

Values that are still open get a mark. First import Holarch's metadata package after the other imports.

On screen: After the imports: private import HolarchMetadata::*;

Then add a charge time requirement. TBR marks the time limit to be reviewed, and TBD marks the charger power to be determined, with an owner, a due date and a rationale. Both come from Holarch's metadata library and specialize the standard status metadata, so other SysML v2 tools see them as status annotations.

On screen: At the end: requirement def <'VR-5'> ChargeTime with #TBR and @TBD.

Open Needs and Requirements, then TBD/TBR. The charge time is listed with the owner and the due date from its metadata. The register only lists them: to change them, edit the metadata in the Editor.

On screen: Needs & Requirements → TBD/TBR; the ChargeTime row with owner and due date.

Budgets

Last, open Architecture, then Budgets, and select the sedan as the root part. The quantity Mass reads each part's mass attribute with its unit: the battery shows the sedan's own forty eight kilograms.

On screen: Architecture → Budgets & TPMs → Select Root Part… → sedan; the battery 48 kg.

Recap

Every step is ticked off. Click Mark as Done.

On screen: Step panel → Mark as Done.

Let's recap. You wrote a constraint and a calculation, bound a check to the sedan's values, saw it fail and pass in a Parametric View, ran an analysis case, marked open values for the register, and rolled up the mass.

Next, variants and configurations describe a product line.