Properties
The properties of a block describe its state, including values of certain aspects of the block, parts included in the block, and references to other things related to the block. These properties also define the slots on each of the block's instance specifications.
Units
A value property can have a Unit and Quantity Kind (e.g., time or distance) in addition to its value. Behavior Execution Engine supports value types for a variety of units in SysML, including many of the types that the ISO-80000 specification defines. You are not required to use ISO-80000 when providing input values to a Behavior Execution Engine simulation, but it can be useful from a modeling perspective to note what the expected or required units are for input to a given system. In the delegate implementation, Behavior Execution Engine provides support for accepting these values and converting to the units required for analysis. If Behavior Execution Engine does not support a particular unit or quantity kind by default, it provides an easy way to register a new mapping, for instance, for nonstandard or custom units such as USCustomary or other non-SI units. Also, though Behavior Execution Engine treats value types similarly to primitives, it does not support arithmetic operations for quantity kinds in expressions. If you want to perform such operations, you can create your own custom operations, making use of Behavior Execution Engine's unit conversion system.
In order to support general use of any unit for a particular value property, consider making use of the value type for a given
quantity
that does not specify a particular unit.
For instance, rather than creating a value property of type
ISO-80000::ISO80000-3 Space and Time::Quantities::distance::distance[metre]
consider making it of type
ISO-80000::ISO80000-3 Space and Time::Quantities::distance::distance
.
Then, users of that block can create instances that assign different unit values to that value property in its slot by updating the slot's value
specification to note the specific type of the value assigned.
This way, you can specify the unit for the input value in the type of the instance's slot's value specification rather than requiring a specific
unit in the block's value property.
At runtime, the simulation will then store the provided unit and support the appropriate conversions when you require comparisons between
properties.
Multiplicity
Every property has a Multiplicity which defines the lower and upper bounds on how many elements the property's
corresponding slot can hold.
This is typically [0..1]
(from 0 to 1), which means the slot can either be empty or hold a single element.
Behavior Execution Engine treats a property with a multiplicity upper bound greater than 1 as a ListProperty
in Java.
This allows state machine expressions to manipulate the property's slot as if it were a Java list.
The following operations, shown for a sample property named items
, are available for any property with upper
multiplicity greater than 1:
Sample Expression | Description |
---|---|
items.add(newItem)
|
Adds the newItem to the items slot.
|
items.addAll(newItems)
|
Adds all of the elements in newItems to the items slot.
The type of newItems must be assignable to the type of items .
|
items.remove(item)
|
Removes the item from the items slot, if it exists.
This returns a primitive boolean result of true if the item was removed
(false if the item does not exist in items ).
|
items.clear()
|
Removes all elements from the items slot.
|
items.getValueAt(integerIndex)
|
Retrieves the element contained in the items slot at the given index.
The index must be another slot, expression, or literal, and be of type
SysML::Libraries::PrimitiveValueTypes::Integer .
|
items.setValueAt(integerIndex, newItem)
|
Assigns the given newItem to replace the element contained in the items
slot at the given index.
The index must be another slot, expression, or literal, and be of type
SysML::Libraries::PrimitiveValueTypes::Integer .
|
items.removeValueAt(integerIndex)
|
Removes the element contained in the items slot at the given index.
The index must be another slot, expression, or literal, and be of type
SysML::Libraries::PrimitiveValueTypes::Integer .
|
items.size()
|
Returns an instance of SysML::Libraries::PrimitiveValueTypes::Integer equal to the number of elements in the
items slot.
|