فصول الدورة
التدريب · المسار 9. أساسيات SysML v2 · الفصل 9.3 من 8
9.3 الإجراءات والتدفقات 4:31
اكتب الوظائف ودورة قيادة كإجراءات، وشاهدها كـ «عرض تدفق الإجراءات» وكـ FFBD.
يعرض Holarch 2.22.
ما ستتعلمه
- عرّف إجراءً بمعاملات إدخال وإخراج ورقم وظيفة كاسم مختصر له
- اكتب إجراءً فيه fork وjoin وsuccessions وitem flows
- احصل على المسارات في «عرض تدفق الإجراءات» من `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).
- افتح مشروع Hybrid Car التوضيحي (أنشئه إذا لزم الأمر: إدارة المشاريع ← ملفات المشروع ▾ ← مشروع توضيحي جديد ← Hybrid Car (SysML v2))، وافتح النموذج ← المحرر والحزمة
VehicleBehavior. - تحت
action def <'F.3'> DriveWheels، أضفaction def <'F.4'> Refuel { in attribute fuelDemand : Real; out item fuel : Fuel; }. - افتح السلوك ← FFBD، وانقر + مخطط جديد، واختر
Refuelثم انقر إنشاء. في لوحة إضافة، اكتبOpen Filler Doorواضغط Enter، ثمPump FuelوClose Filler Door. - افتح النموذج ← المحرر واعثر على
Refuel: كتب FFBD خطواته الثلاث والـ successions بينها. - افتح السلوك ← تدفقات الإجراءات والعرض
driveCycleFlow. اعثر على المسار الذي يحتويbrake، ثم اعثر على سطرperformفيDrivenCarالذي يضعه هناك. - افتح السلوك ← التحليل الوظيفي، وانقر اختيار… واختر
DriveCycle. تحقق من أن وظائفه مرقّمة بأسمائها المختصرة.
تكون قد انتهيت عندما يُظهر Refuel معاملاته وخطواته الثلاث والـ successions بينها في المحرر، وتستطيع أن تسمّي الجزء الذي يحتوي مساره brake.
اختبر نفسك
- في
first start then split; fork split; then supply; then produce;، أي الخطوات تعمل بالتوازي، وما الذي يجمعها مرة أخرى؟ - ما الفرق بين
first supply then ready;وflow of Fuel from supply.fuel to produce.fuel;؟ - من أين تأتي مسارات «عرض تدفق الإجراءات»؟
إظهار الإجابات
في
first start then split; fork split; then supply; then produce;، أي الخطوات تعمل بالتوازي، وما الذي يجمعها مرة أخرى؟بعد الـ fork
split، تبدأsupplyوproduceكفرعين متوازيين؛ وكلthenبعد fork يبدأ فرعًا. وينتظر الـ joinreadyكليهما قبل الخطوة التالية.ما الفرق بين
first supply then ready;وflow of Fuel from supply.fuel to produce.fuel;؟الأول succession: يرتّب الخطوات زمنيًا. والثاني flow: ينقل عنصرًا متدفقًا Fuel من معامل إخراج خطوة إلى مدخل خطوة أخرى، ولا يرتّب الخطوات بحد ذاته.
من أين تأتي مسارات «عرض تدفق الإجراءات»؟
من
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.