Prev Next

Setting Values

Having set a Block or a Part that references a component, in either Modelica or Simulink, you want to be able to set values to that external component's properties or parameters. The decision to place a value in the Block rather than in a Part derived from that Block is dependant on whether there will be any variation in that value for each Part.

Block Properties

In the example of a tank of water, in which the constant 'Gravity' is defined and is fixed for each tank instance, the value is best placed in the source Block.

This illustration also shows the Fluid Density set for water (10 kg/m3), which could be overridden either in a Part or in a simulation to define the density of another fluid, such as oil.

Part Properties

Where a Block is used repetitively with different values - e.g. to represent a resistor of 3.3 kilohms and another of 5.6 kilohms - then the initial value is best defined in the Block as blank, with individual values set in specific Parts derived from the Block.

In this example we have two tanks with same radius, but different depths, so the fluidLevel (depth of the tank), is different for the two Tank parts created in this IBD.

Note that the Type is derived from the Block FluidLevel type.

Setting the Type

You can define Properties in a Block to reference a specific Value Type. This is set in the 'Type' field on the Properties > 'Property' tab; it is best to reference a Value Type using the Browse. button.

For more details see the Modeling Quantity Using Value Types Help topic.

Setting Values in a Simulation

In simulations it is often the case that variables must be set at run time rather than in the SysML model. This is where Datasets can be used to lay out a set of values to run though in a series of variations of the simulations. For more details see the Model Analysis Using Datasets Help topic.

Learn More