Holarch
Capítulos del curso

Formación · Curso 9. Fundamentos de SysML v2 · Capítulo 9.8 de 8

9.8 Variantes y configuraciones 3:42

Escribir una línea de productos con puntos de variación y reglas, y configuraciones que el Editor comprueba.

Muestra Holarch 2.22.

← 9.7 Restricciones y cálculos · Todos los capítulos

Lo que aprenderá

  • Escribir una variación con variantes y usarla como punto de variación de una línea de productos
  • Añadir una regla a una línea de productos con una assert constraint
  • Crear configuraciones que elijan una variante por punto y leer sus veredictos
  • Definir una palabra clave de metadatos propia y aplicarla con `#`
  • Mostrar el modelo como una configuración

Escriba una línea de productos de SysML v2 en Holarch, siguiendo el tutorial de SysML v2 Variants and Configurations en un pequeño proyecto Hybrid Car: el paquete de variabilidad de Holarch, una variación con variantes, una línea de productos con un punto de variación y una aserción, configuraciones que el Editor comprueba, una palabra clave propia definida mediante metadatos y una Vista general de la línea de productos. 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).

  1. 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 Vehicles. Ya importa HolarchVariability.
  2. En part def CarLine, después de la variación charger, añada variation part rims : Wheel { variant part steelRims : Wheel; variant part alloyRims : Wheel { attribute :>> mass = 18 [kg]; } }. El Editor indica que las tres configuraciones aún no han elegido rims.
  3. Después de wallboxNeedsLargePack, añada la regla assert constraint alloyNeedsLargePack { rims == rims::alloyRims implies pack == BatteryPack::largePack }.
  4. Abra Modelo → Navegador y seleccione selfChargingHybrid. En la sección Configuración del inspector, elija steelRims para rims; elija alloyRims para plugInHybrid y longRangeHybrid. Después pruebe alloyRims en selfChargingHybrid, lea el veredicto y pulse ⌘Z / Ctrl+Z.
  5. Abra el menú de la fila (⋯) de CarLine y elija Nueva configuración…. Llámela cityHybrid, elija standardPack, noCharger y steelRims, compruebe que el veredicto es Válida y haga clic en Crear.
  6. Haga clic en Ver como ▾ en la barra superior y elija cityHybrid; después abra la vista carLineVariants desde la lista Diagramas: las variantes que no elige quedan ocultas.

Habrá terminado cuando la sección Línea de productos del inspector para CarLine liste cuatro configuraciones, todas Válidas, y la regla alloyNeedsLargePack.

Compruebe lo aprendido

  1. ¿Qué diferencia hay entre variation part def BatteryPack { … } y variation part charger : Component { … }?
  2. plugInHybrid elige BatteryPack::standardPack y charger::wallbox. ¿Qué ocurre y por qué?
  3. Una configuración aún no ha elegido una variante para cada punto. ¿Cuál es su veredicto?
  4. ¿Qué permite escribir metadata def <safetyCritical> SafetyCritical y cómo lo ven otras herramientas de SysML v2?
Mostrar las respuestas
  1. ¿Qué diferencia hay entre variation part def BatteryPack { … } y variation part charger : Component { … }?

    La primera es una definición de variación, un conjunto reutilizable de opciones: un uso tipado por ella, como part pack : BatteryPack;, es un punto de variación. La segunda es un uso de variación, un punto declarado dentro de un diseño concreto.

  2. plugInHybrid elige BatteryPack::standardPack y charger::wallbox. ¿Qué ocurre y por qué?

    Se incumple la regla wallboxNeedsLargePack: dice que el wallbox implica el paquete grande. El veredicto nombra la regla y el Editor indica la aserción fallida.

  3. Una configuración aún no ha elegido una variante para cada punto. ¿Cuál es su veredicto?

    Incompleta, con el nombre del punto abierto. Mientras un punto no tiene elección, una regla sobre él no se cumple ni se incumple.

  4. ¿Qué permite escribir metadata def <safetyCritical> SafetyCritical y cómo lo ven otras herramientas de SysML v2?

    El nombre corto se convierte en una palabra clave, como en #safetyCritical part controller : Controller;. Es un uso de metadatos corriente, de modo que otras herramientas de SysML v2 lo ven como metadatos de la parte.

Más información

Transcripción

Mostrar la transcripción (narración y lo que aparece en pantalla)

Introduction

Chapter eight: variants and configurations. A product line offers choices, and a configuration picks one variant for each choice.

In this chapter you write a variation with variants, a product line with a rule, configurations the Editor checks, and a keyword of your own.

Start the tutorial

Start the tutorial Variants and Configurations from Project Files, Start a Tutorial. Its starter project holds the components, the car and the powertrain.

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

Variations

Holarch's variability package lets the Editor check configurations. Import it after the other imports.

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

A variation lists the choices offered. Before the powertrain, write the battery pack variation: a standard pack and a large pack, each with its own capacity, and the large one with its own mass.

On screen: After Car: variation part def BatteryPack with two variants.

The product line

Below it, the car line. Its pack is typed by the variation, its charger is a variation point with two variants, and an assertion rules out the wallbox with the standard pack.

On screen: Below BatteryPack: part def CarLine :> Car with pack, charger and the assertion.

Configurations

A configuration is a part of the car line, marked Holarch Configuration. Until it chooses a variant for each point, the Editor notes the points still open.

On screen: Below CarLine: part plugInHybrid : CarLine { @HolarchConfiguration; }

Inside the plug-in hybrid, choose the standard pack and the wallbox. The assertion fails: the wallbox needs the large pack.

On screen: In plugInHybrid: pack = BatteryPack::standardPack; charger = charger::wallbox; the assertion error.

Choose the large pack instead, and the configuration checks.

On screen: standardPack → largePack; No problems.

Add a second configuration: a self-charging hybrid, with the standard pack and no charger.

On screen: Below plugInHybrid: part selfChargingHybrid : CarLine.

A keyword of your own

You can also define keywords of your own. At the end of the package, add a metadata definition. Its short name, safety critical, becomes a keyword.

On screen: After Powertrain: metadata def <safetyCritical> SafetyCritical.

In the powertrain, put the keyword before the controller, after a number sign. Other SysML v2 tools see it as ordinary metadata.

On screen: In Powertrain: #safetyCritical part controller : Controller;

The General View

Open Architecture, then General Views, and click New Diagram. Keep General View, choose the Vehicles package under Shows, and click Create.

On screen: Architecture → General Views → + New Diagram; Shows: Vehicles; Create.

The battery pack is marked variation in its heading.

On screen: BatteryPack: «variation part def».

Recap

Every step is ticked off. Click Mark as Done.

On screen: Step panel → Mark as Done.

Let's recap. You imported Holarch's variability package, wrote a variation with variants and a product line with a rule, built configurations that the Editor checks, and defined a keyword of your own.

That completes SysML v2 Fundamentals.