Lesson 3: Creating standard value types
Most of the attributes have already been added to the SystemUnderControl block. In this lesson, you add the mass of the water to the block. Since the mass of water is expressed in kg, you begin by specifying an applicable valueType, kg. The other attributes already have valueTypes.
About this task
Systems engineers can use predefined elements included in the SysML profile to speed up development. For example, the profile includes dimensions, units, and some standard value types, as shown in this example from the tutorial model.
In this example, the SysML profile (circled in the illustration) lists common dimensions including length and mass. The units supplied in the profile include ampere, meter, kilogram, and mole. The dimensions and units that were added for this project are listed in the TypesPkg, shown before the Profiles folder.
You need to add any engineering units that are
required for your project but are not included in the SysML profile packages. For example, the
kilogram unit is available in the package BaseSIUnits package, but it does not have a corresponding
value type, kg. Value types are used to specify the type for attributes of blocks, flow ports,
action pins and activity parameters, as well as constraint parameters in the same way as standard
types such as double
, short
, int
and
boolean
are used to specify types for software.
To add "kg" as the ValueType for kilogram:
Procedure
- In the browser, select ValueTypes in the TypesPkg.
- Right-click and select Add New ValueType.
- Type kg in the browser field.
- Double-click kg to open the Features window.
- Change the Kind field to Typedef.
- On the Details tab, select
double
for the Basic Type. - On the Tags tab, click the unit value field, and click the ellipsis button to open the Select Value window.
- In the browser, expand Kilogram unit. Click OK. and select the
- Save your changes in the project using either or the Save button on the toolbar.
Results
kg
, you
use it as the type specification for the mass attribute. - In the browser, select the SystemUnderControl block in the DesignSynthesisPkg.
- Right-click Attributes and select Add New Attribute.
- Change the attribute name to mass.
- Double-click the new attribute to open the Features window for the attribute and click the General tab.
- In the TypesPkg, change the type to kg by selecting <<Select>> from the list.
- In the TypesPkg, navigate to ValueTypes and choose kg. Click OK.
- Enter 720 in the Initial Value field. (The mass of the SystemUnderControl is 720 kg.) Click OK.
Lesson checkpoint
- About the Dimensions, Units, and ValueTypes provided with the SysML profile
- The importance of ValueTypes in a model
- Adding ValueTypes to your model
- Adding Attributes