Holarch
Kurs bölümleri

Eğitim · Kurs 9. SysML v2 temelleri · Bölüm 9.7 / 8

9.7 Kısıtlar ve hesaplamalar 4:26

Kısıtlar ve hesaplamalar yazın, sedanın değerlerini birimleriyle denetleyin ve açık değerleri işaretleyin.

Holarch 2.22 sürümünü gösterir.

Neler öğreneceksiniz

  • Parametreleri olan bir kısıt tanımı ve bir hesaplama tanımı yazın
  • Bir kısıt kullanımının parametrelerini modeldeki değerlere bağlayın
  • Bir kısıtın Parametrik görünümde başarılı ve başarısız olduğunu görün ve Tümünü çöz ile her kısıtı denetleyin
  • Açık değerleri TBD ve TBR meta verileriyle işaretleyin ve onları TBD/TBR kaydında bulun
  • Bütçeler ve TPM'ler'de bir parçanın kütlesini toplayın

Küçük bir Hybrid Car projesi üzerinde SysML v2 öğreticisi Constraints and Calculations'ı izleyerek Holarch'ta SysML v2 kısıtları ve hesaplamaları yazın: bir kısıt tanımı ve bir hesaplama, sedanın değerlerine bağlanmış bir kısıt kullanımı, denetimin başarısız olup başarılı olduğu bir Parametrik görünüm, Tümünü çöz, bir analiz durumu, kayıtlarıyla TBD ve TBR değerleri ve Bütçeler'de bir kütle toplamı. SysML, Object Management Group, Inc.'in tescilli ticari markasıdır.

Proje dosyaları

  • Bitmiş proje (.holarch.json; Projeleri yönet → Proje dosyaları ▾ → Proje içe aktar (.json)…)

Video holarch.app'ten oynatılır; bkz. Gizlilik Politikası.

Alıştırma

Bunu Holarch'ta, Hybrid Car demo projesinde (SysML v2) kendiniz yapın.

  1. Hybrid Car demo projenizi açın (gerekirse oluşturun: Projeleri yönet → Proje dosyaları ▾ → Yeni demo proje → Hybrid Car (SysML v2)), Model → Düzenleyici'yi ve VehicleRequirements paketini açın.
  2. constraint def SpeedLimit'ten sonra constraint sedanBatteryCheck : MassLimit { in mass = fleet.sedan.powertrain.battery.mass; in limit = 50 [kg]; } ekleyin.
  3. Diyagramlar sayfasında + Yeni diyagram'a tıklayın, Parametrik görünüm'ü ve Gösterir altında VehicleRequirements'ı seçin ve Oluştur'a tıklayın. Yeni denetim başarılıdır: 48 kg, 50 kg sınırının içindedir.
  4. Vehicles paketinde sedan bataryasının kütlesini 52 [kg] olarak değiştirin; görünüm denetimin başarısız olduğunu gösterir. ⌘Z / Ctrl+Z'ye basın, ardından her kısıtı yeniden denetlemek için Tümünü çöz'e tıklayın.
  5. requirement def <'VR-2'> Acceleration içinde attribute zeroToHundred : TimeValue; satırını attribute zeroToHundred : TimeValue { @TBD { owner = "Test lead"; rationale = "The test track is not booked yet."; } } ile değiştirin. İhtiyaçlar ve gereksinimler → TBD/TBR'yi açın ve gereksinimi sahibiyle birlikte bulun.
  6. Mimari → Bütçeler ve TPM'ler'i açın, Kök parça seç…'e tıklayın ve sedan'ı seçin. Nicelik altında Kütle'yi seçin ve bataryanın 48 kg'ını bulun.

sedanBatteryCheck Parametrik görünümde Başarılı gösterdiğinde ve TBD/TBR kaydı Acceleration gereksinimini Test lead sahibiyle listelediğinde işiniz bitmiştir.

Kendinizi sınayın

  1. constraint def ile calc def arasındaki fark nedir?
  2. Parametrik görünümdeki bir kısıt Girdi gerekiyor gösteriyor. Eksik olan nedir?
  3. Açık bir değer neden değer olarak TBD yazmak yerine #TBD veya @TBD { … } ile işaretlenmeli?
  4. Bir analiz durumu bir hesaplamaya ne ekler?
Yanıtları göster
  1. constraint def ile calc def arasındaki fark nedir?

    Bir kısıt tanımı, parametreleri üzerinde geçerli olan ya da olmayan bir koşul belirtir; örneğin mass <= limit. Bir hesaplama tanımı ise bir değer hesaplayıp döndürür; örneğin return ratio = power / mass;.

  2. Parametrik görünümdeki bir kısıt Girdi gerekiyor gösteriyor. Eksik olan nedir?

    Bir parametrenin henüz değeri yoktur. Her parametreyi bir değere bağlayın; örneğin in mass = fleet.sedan.curbMass;.

  3. Açık bir değer neden değer olarak TBD yazmak yerine #TBD veya @TBD { … } ile işaretlenmeli?

    Bir değerin yerine TBD yazmak geçerli SysML değildir. Holarch'ın HolarchMetadata paketindeki meta veriler metni geçerli tutar; TBD ve TBR standart StatusInfo meta verisini özelleştirir, bu yüzden diğer SysML v2 araçları onları durum açıklamaları olarak okur.

  4. Bir analiz durumu bir hesaplamaya ne ekler?

    Hesaplamayı sedan gibi bir konuya uygular, sonucu döndürür ve require kısıtını Holarch'ın diğer kısıtlar gibi değerlendirdiği bir hedefe sahiptir.

Daha fazla bilgi

Döküm

Dökümü göster (anlatım ve ekranda görünenler)

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.