Holarch
פרקי הקורס

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

9.3 פעולות וזרימות 4:31

כותבים פונקציות ומחזור נסיעה כפעולות, ורואים אותם כתצוגת זרימת פעולות וכ-FFBD.

מציג את Holarch 2.22.

→ 9.2 פתחות וממשקים · כל הפרקים · 9.4 מצבים ומעברים ←

מה תלמדו

  • להגדיר פעולה עם פרמטרי קלט ופלט ומספר פונקציה כשם המקוצר שלה
  • לכתוב פעולה עם fork,‏ join, רצפים (successions) וזרימות פריטים
  • לקבל נתיבי שחייה בתצוגת זרימת פעולות מ-`perform`
  • לבחור את הפונקציה העליונה ב“ניתוח פונקציונלי”
  • לבנות את השלבים של פעולה ב-FFBD ולמצוא אותם בטקסט

כותבים פעולות SysML v2 ב-Holarch, לפי המדריך Actions and Flows של SysML v2 על פרויקט Hybrid Car קטן: הגדרות פעולה עם פרמטרים ושמות מקוצרים, מחזור נסיעה עם fork, זרימות ו-join, תצוגת זרימת פעולות עם נתיבי שחייה מ-perform, ניתוח פונקציונלי על המודל, ושלבים שנבנים ב-FFBD ו-Holarch כותב לטקסט. SysML הוא סימן מסחרי רשום של Object Management Group, Inc.

קובצי פרויקט

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

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

תרגול

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

  1. פותחים את פרויקט ההדגמה Hybrid Car (יוצרים אותו אם צריך: ניהול פרויקטים ← קובצי פרויקט ▾ ← פרויקט הדגמה חדש ← Hybrid Car (SysML v2)), פותחים את מודל ← עורך ואת החבילה VehicleBehavior.
  2. מתחת ל-action def <'F.3'> DriveWheels מוסיפים action def <'F.4'> Refuel { in attribute fuelDemand : Real; out item fuel : Fuel; }.
  3. פותחים את התנהגות ← FFBD, לוחצים על + דיאגרמה חדשה, בוחרים Refuel ולוחצים על יצירה. בחלונית הוספה מקלידים Open Filler Door ולוחצים Enter, ואז Pump Fuel ו-Close Filler Door.
  4. פותחים את מודל ← עורך ומוצאים את Refuel: ה-FFBD כתב את שלושת השלבים שלו ואת הרצפים ביניהם.
  5. פותחים את התנהגות ← זרימות פעולות ואת התצוגה driveCycleFlow. מוצאים את הנתיב שמכיל את brake, ואז מוצאים את שורת ה-perform ב-DrivenCar שמציבה אותו שם.
  6. פותחים את התנהגות ← ניתוח פונקציונלי, לוחצים על בחירה… ובוחרים את DriveCycle. בודקים שהפונקציות שלו ממוספרות לפי השמות המקוצרים שלהן.

סיימתם כש-Refuel מציג בעורך את הפרמטרים שלו, שלושה שלבים והרצפים שלהם, ואתם יכולים לציין את החלק שהנתיב שלו מכיל את brake.

בדיקה עצמית

  1. ב-first start then split; fork split; then supply; then produce;, אילו שלבים רצים במקביל, ומה מאחד אותם שוב?
  2. מה ההבדל בין first supply then ready; לבין flow of Fuel from supply.fuel to produce.fuel;?
  3. מאיפה מגיעים נתיבי השחייה של תצוגת זרימת פעולות?
הצגת התשובות
  1. ב-first start then split; fork split; then supply; then produce;, אילו שלבים רצים במקביל, ומה מאחד אותם שוב?

    אחרי ה-fork ‏split, ‏supply ו-produce מתחילים כענפים מקבילים; כל then אחרי fork מתחיל ענף. ה-join ‏ready ממתין לשניהם לפני השלב הבא.

  2. מה ההבדל בין first supply then ready; לבין flow of Fuel from supply.fuel to produce.fuel;?

    הראשון הוא רצף (succession): הוא מסדר את השלבים בזמן. השני הוא זרימה (flow): הוא מעביר פריט Fuel מפרמטר הפלט של שלב אחד לקלט של שלב אחר, ואינו מסדר את השלבים בעצמו.

  3. מאיפה מגיעים נתיבי השחייה של תצוגת זרימת פעולות?

    מ-perform: כל חלק שמבצע שלב, כמו part redefines tank { perform trip.supply; }, מקבל נתיב עם השלבים שהוא מבצע.

קריאה נוספת

תמליל

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

Introduction

Chapter three: actions and flows. Actions describe what the system does, in what order, and what passes between the steps.

In this chapter you define functions with parameters, write a drive cycle with a fork, flows and a join, see it as an Action Flow View with swim lanes, and build steps in the FFBD.

Start the tutorial

Start the tutorial Actions and Flows from Project Files, Start a Tutorial. Its starter project holds the fuel and torque items, two of the car's three functions, and the parts that will perform them.

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

Functions

An action definition describes something the system does, and its parameters say what goes in and out. Below the torque item, define Supply Fuel. The short name in angle brackets, F one, is its function number.

On screen: Below item def Torque; type action def <'F.1'> SupplyFuel.

The drive cycle

Now the drive cycle, at the end of the package. Its action usages are the steps, each typed by a function. First start, then split, begins with a fork, and each then after the fork starts a parallel branch.

On screen: After DriveWheels; type action def <'F'> DriveCycle with the fork and two steps.

A flow carries an item from one step's output to another step's input. After the two steps, add a flow that carries the fuel from the supply step to the torque step.

On screen: After action produce: flow of Fuel from supply.fuel to produce.fuel;

Both branches end at a join named ready. Then the car drives the wheels, and the trip is done. A second flow carries the torque to the drive step.

On screen: After the flow: successions to the join ready, then action drive, then done; flow of torque.

The Action Flow View

Now see the drive cycle as a view. Open Behavior, then Action Flows, and click New Diagram. Keep Action Flow View, choose the drive cycle under Shows, and click Create.

On screen: Behavior → Action Flows → + New Diagram; Shows: VehicleBehavior::DriveCycle; Create.

Steps are rounded boxes, with their parameters as pins. The fork and the join are bars, and the flows are arrows between pins.

On screen: The view.

Swim lanes come from perform. Back in the Editor, at the end of the package, add a driven car. It performs the drive cycle as its trip, and its parts perform the steps.

On screen: Model → Editor; after DriveCycle: part def DrivenCar with perform.

Open the Action Flow View again. It now has a lane for each part that performs a step.

On screen: Behavior → Action Flows → the view; lanes tank, engine, transmission.

Functional Analysis and the FFBD

The same model drives Functional Analysis. Open it under Behavior, click Choose, and pick the drive cycle. Its functions are the steps, numbered by their short names.

On screen: Behavior → Functional Analysis; Choose… → DriveCycle.

Back in the Editor, at the end of the package, declare one more action: emergency shutdown. You build its steps in the FFBD.

On screen: Model → Editor; after DrivenCar: action def EmergencyShutdown;

Open Behavior, then FFBD, and click New Diagram. Type the start of emergency shutdown, pick it from the list, and click Create.

On screen: Behavior → FFBD → + New Diagram; Diagram of: EmergencyShutdown; Create.

In the Add panel, type Open Contactors and press Enter, then Cut Fuel. Each step is written into the model with its succession, one undo step each.

On screen: Add panel: Open Contactors ↵, Cut Fuel ↵.

Open the Editor and find emergency shutdown. The FFBD wrote its steps, and the successions between them.

On screen: Model → Editor: EmergencyShutdown with two steps and successions.

Recap

Every step is ticked off. Click Mark as Done.

On screen: Step panel → Mark as Done.

Let's recap. You defined functions with parameters and short names, wrote a drive cycle with a fork, flows and a join, saw it as an Action Flow View with lanes from perform, and built steps in the FFBD that Holarch wrote into the text.

Next, states and transitions describe how the car reacts to events.