Holarch
Capítulos do curso

Treinamento · Trilha 9. Fundamentos do SysML v2 · Capítulo 9.7 de 8

9.7 Restrições e cálculos 4:26

Escreva restrições e cálculos, cheque os valores do sedã com unidades e marque valores em aberto.

Mostra o Holarch 2.22.

O que você vai aprender

  • Escrever uma definição de restrição e uma definição de cálculo com parâmetros
  • Vincular os parâmetros de um uso de restrição a valores do modelo
  • Ver uma restrição ser aprovada e reprovada em uma Visão paramétrica e checar todas as restrições com Resolver tudo
  • Marcar valores em aberto com metadados TBD e TBR e encontrá-los no registro TBD/TBR
  • Consolidar a massa de uma parte em Orçamentos e TPMs

Escreva restrições e cálculos SysML v2 no Holarch, seguindo o tutorial de SysML v2 Constraints and Calculations em um pequeno projeto Hybrid Car: uma definição de restrição e um cálculo, um uso de restrição vinculado aos valores do sedã, uma Visão paramétrica em que a checagem é reprovada e aprovada, Resolver tudo, um caso de análise, valores TBD e TBR com seu registro e uma consolidação de massa em Orçamentos. SysML é uma marca registrada da Object Management Group, Inc.

Arquivos de projeto

  • Projeto concluído (.holarch.json; Gerenciar projetos → Arquivos de projeto ▾ → Importar projeto (.json)…)

O vídeo é reproduzido a partir de holarch.app; veja a Política de Privacidade.

Prática

Faça isto você mesmo no Holarch, no projeto de demonstração Hybrid Car (SysML v2).

  1. Abra seu projeto de demonstração Hybrid Car (crie-o se necessário: Gerenciar projetos → Arquivos de projeto ▾ → Novo projeto de demonstração → Hybrid Car (SysML v2)), abra Modelo → Editor e o pacote VehicleRequirements.
  2. Depois de constraint def SpeedLimit, adicione constraint sedanBatteryCheck : MassLimit { in mass = fleet.sedan.powertrain.battery.mass; in limit = 50 [kg]; }.
  3. Na página Diagramas, clique em + Novo diagrama, escolha Visão paramétrica e VehicleRequirements em Mostra e clique em Criar. A nova checagem é aprovada: 48 kg está dentro de 50 kg.
  4. No pacote Vehicles, mude a massa da bateria do sedã para 52 [kg]; a visão mostra a checagem reprovada. Pressione ⌘Z / Ctrl+Z e depois clique em Resolver tudo para checar todas as restrições de novo.
  5. Em requirement def <'VR-2'> Acceleration, substitua attribute zeroToHundred : TimeValue; por attribute zeroToHundred : TimeValue { @TBD { owner = "Test lead"; rationale = "The test track is not booked yet."; } }. Abra Necessidades e requisitos → TBD/TBR e encontre o requisito com seu responsável.
  6. Abra Arquitetura → Orçamentos e TPMs, clique em Selecionar parte raiz… e escolha sedan. Em Grandeza, escolha Mass e encontre os 48 kg da bateria.

Você terminou quando sedanBatteryCheck mostrar Aprovado na Visão paramétrica e o registro TBD/TBR listar o requisito Acceleration com o responsável Test lead.

Teste-se

  1. Qual é a diferença entre um constraint def e um calc def?
  2. Uma restrição na Visão paramétrica mostra Requer entrada. O que está faltando?
  3. Por que marcar um valor em aberto com #TBD ou @TBD { … } em vez de escrever TBD como valor?
  4. O que um caso de análise acrescenta a um cálculo?
Mostrar as respostas
  1. Qual é a diferença entre um constraint def e um calc def?

    Uma definição de restrição declara uma condição sobre seus parâmetros que vale ou não, como mass <= limit. Uma definição de cálculo calcula e retorna um valor, como return ratio = power / mass;.

  2. Uma restrição na Visão paramétrica mostra Requer entrada. O que está faltando?

    Um parâmetro ainda não tem valor. Vincule cada parâmetro a um valor, por exemplo in mass = fleet.sedan.curbMass;.

  3. Por que marcar um valor em aberto com #TBD ou @TBD { … } em vez de escrever TBD como valor?

    TBD no lugar de um valor não é SysML válido. Os metadados do pacote HolarchMetadata do Holarch mantêm o texto válido; TBD e TBR especializam os metadados padrão StatusInfo, então outras ferramentas SysML v2 os leem como anotações de status.

  4. O que um caso de análise acrescenta a um cálculo?

    Ele aplica o cálculo a um sujeito, como o sedã, retorna o resultado e tem um objetivo cuja require constraint o Holarch avalia como qualquer outra restrição.

Saiba mais

Transcrição

Mostrar a transcrição (narração e o que aparece na tela)

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.