Capítulos del curso
Formación · Curso 9. Fundamentos de SysML v2 · Capítulo 9.3 de 8
9.3 Acciones y flujos 4:31
Escribir funciones y un ciclo de conducción como acciones, y verlas como Vista de flujo de action y como FFBD.
Muestra Holarch 2.22.
Lo que aprenderá
- Definir una acción con parámetros de entrada y salida y un número de función como nombre corto
- Escribir una acción con un fork, un join, sucesiones y flujos de elementos
- Obtener calles en una Vista de flujo de action a partir de `perform`
- Elegir la función de nivel superior en Análisis funcional
- Construir los pasos de una acción en el FFBD y encontrarlos en el texto
Escriba acciones de SysML v2 en Holarch, siguiendo el tutorial de SysML v2 Actions and Flows en un pequeño proyecto Hybrid Car: definiciones de acción con parámetros y nombres cortos, un ciclo de conducción con un fork, flujos y un join, una Vista de flujo de action con calles a partir de perform, el Análisis funcional sobre el modelo y pasos construidos en el FFBD que Holarch escribe en el texto. SysML es una marca registrada de Object Management Group, Inc.
Archivos de proyecto
- Proyecto terminado (.holarch.json; Gestionar proyectos → Archivos de proyecto ▾ → Importar proyecto (.json)…)
El vídeo se reproduce desde holarch.app; consulte la Política de privacidad.
Práctica
Hágalo usted mismo en Holarch, en el proyecto de demostración Hybrid Car (SysML v2).
- Abra su proyecto de demostración Hybrid Car (créelo si hace falta: Gestionar proyectos → Archivos de proyecto ▾ → Nuevo proyecto de demostración → Hybrid Car (SysML v2)), abra Modelo → Editor y el paquete
VehicleBehavior. - Debajo de
action def <'F.3'> DriveWheels, añadaaction def <'F.4'> Refuel { in attribute fuelDemand : Real; out item fuel : Fuel; }. - Abra Comportamiento → FFBD, haga clic en + Nuevo diagrama, elija
Refuely haga clic en Crear. En el panel Añadir, escribaOpen Filler Doory pulse Intro, y despuésPump FuelyClose Filler Door. - Abra Modelo → Editor y busque
Refuel: el FFBD escribió sus tres pasos y las sucesiones entre ellos. - Abra Comportamiento → Flujos de action y la vista
driveCycleFlow. Busque la calle que contienebrakey después la líneaperformdeDrivenCarque lo coloca allí. - Abra Comportamiento → Análisis funcional, haga clic en Elegir… y elija
DriveCycle. Compruebe que sus funciones están numeradas por sus nombres cortos.
Habrá terminado cuando Refuel muestre en el Editor sus parámetros, tres pasos y sus sucesiones, y pueda nombrar la parte cuya calle contiene brake.
Compruebe lo aprendido
- En
first start then split; fork split; then supply; then produce;, ¿qué pasos se ejecutan en paralelo y qué los vuelve a reunir? - ¿Qué diferencia hay entre
first supply then ready;yflow of Fuel from supply.fuel to produce.fuel;? - ¿De dónde proceden las calles de una Vista de flujo de action?
Mostrar las respuestas
En
first start then split; fork split; then supply; then produce;, ¿qué pasos se ejecutan en paralelo y qué los vuelve a reunir?Después del fork
split,supplyyproduceempiezan como ramas paralelas; cadathendespués de un fork inicia una rama. El joinreadyespera a ambas antes del paso siguiente.¿Qué diferencia hay entre
first supply then ready;yflow of Fuel from supply.fuel to produce.fuel;?La primera es una sucesión: ordena los pasos en el tiempo. La segunda es un flujo: lleva un elemento Fuel del parámetro de salida de un paso a la entrada de otro paso, y por sí sola no ordena los pasos.
¿De dónde proceden las calles de una Vista de flujo de action?
De
perform: cada parte que realiza un paso, comopart redefines tank { perform trip.supply; }, recibe una calle con los pasos que realiza.
Más información
Transcripción
Mostrar la transcripción (narración y lo que aparece en pantalla)
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.