// Independent worked listings. Load this chapter with vocabulary.sysml, not with other chapters. package Lch14_01 { private import CoffeeVocabulary::*; private import ScalarValues::String; // ANCHOR: listing-1 library package CoffeeIndustryTypes { private import ScalarValues::*; public import ISQ::CelsiusTemperatureValue; enum def RoastLevel { light; medium; dark; } item def CoffeeBeans { attribute roast : RoastLevel; attribute origin : String; attribute recommendedBrewTemp : CelsiusTemperatureValue; } } // ANCHOR_END: listing-1 } package Lch14_02 { private import CoffeeVocabulary::*; // ANCHOR: listing-2 package CoffeeMachineModel { private import CoffeeIndustryTypes::*; private import ScalarValues::*; part def Grinder { item currentBeans : CoffeeBeans; attribute targetTemp : CelsiusTemperatureValue; } } // ANCHOR_END: listing-2 } package Lch14_03 { private import CoffeeVocabulary::*; // ANCHOR: listing-3 package CoffeeMachineWithUnits { private import ISQ::CelsiusTemperatureValue; private import ISQ::PressureValue; private import ISQ::VolumeValue; private import ISQ::DurationValue; private import SI::*; part def Brewer { attribute waterTemp : CelsiusTemperatureValue; attribute brewPressure : PressureValue = 900000.0 [SI::Pa]; attribute brewTime : DurationValue = 25.0 [SI::s]; } part def WaterTank { attribute currentLevel : VolumeValue; attribute maxCapacity : VolumeValue = 1.5 [SI::L]; } } // ANCHOR_END: listing-3 } package Lch14_04 { private import CoffeeVocabulary::*; // ANCHOR: listing-4 package TempOptions { private import ISQ::ThermodynamicTemperatureValue; private import ISQ::CelsiusTemperatureValue; private import ISQ::TemperatureDifferenceValue; private import SI::*; part def Brewer { attribute targetTemp : ThermodynamicTemperatureValue = 366.15 [SI::K]; attribute elementRise : TemperatureDifferenceValue = 6.0 [SI::'°C']; attribute brewTemp : CelsiusTemperatureValue = 93.0 [SI::'°C_abs']; } } // ANCHOR_END: listing-4 } package Lch14_05 { private import CoffeeVocabulary::*; private import NumericalFunctions::max; private import ScalarValues::Real; // ANCHOR: listing-5 package TankMath { private import ScalarValues::*; part def WaterTank { attribute maxCapacity : Real default = 1500.0; attribute currentLevel : Real := 0.0; attribute headroom : Real = max(0.0, maxCapacity - currentLevel); attribute fillFraction : Real = currentLevel / maxCapacity; } } // ANCHOR_END: listing-5 } package Lch14_06 { private import CoffeeVocabulary::*; private import ScalarValues::String; // ANCHOR: listing-6 library package CoffeeIndustryTypes { private import ScalarValues::*; public import ISQ::CelsiusTemperatureValue; enum def RoastLevel { light; medium; dark; } item def CoffeeBeans { attribute roast : RoastLevel; attribute origin : String; attribute recommendedBrewTemp : CelsiusTemperatureValue; } } // ANCHOR_END: listing-6 }