Set QSS mode for all blocks in a model.
The WorldModel
Component
Parameters:
Description:
The WorldModel component is a very simple, equation-less model that
consists of only one parameter:
model worldModel
extends Modelica.Blocks.Interfaces.BlockIcon;
parameter Integer qss=1;
equation
...[annotation]...
end worldModel;
It has to be inserted in every model, and its parameter qss is used
to set the parameter $method$ in the model's others
components.
But how is it possible to set a parameter by means of a parameter
of another component? The solution in this context is the Modelica
"inner/outer" language construct (cf. [Modelica]): "If a
variable or a component is declared as outer, the actual instance
is defined outside of the defining class and is determined by
searching the object hierarchy upwards until a corresponding
declaration with the inner prefix is found."
Every block contains therefore an outer variable world of the type
worldModel and uses the variable world.qss in order to set the
parameter method:
model anyBlock
parameter Integer method=world.qss "Use QSS1, QSS2 or QSS3";
outer ModelicaDEVS.Templates.worldModel world;
By definition, the model itself has to contain a component called
$world$ of the type worldModel that is declared as "inner". In
order to automatically guarantee these settings for all instances
of the WorldModel component, the WorldModel features the following
annotation properties:
annotation (defaultComponentName="world",
defaultComponentPrefixes="inner",
Diagram,
Icon([Icon definitions])
);
The true value of method in any block that is present in a model
that also contains the WorldModel is then determined by the
WorldModel.qss parameter. Assume a simple toy model, only
consisting of a Ramp block and the compulsory WorldModel component.
The figure below shows how the method parameter of the Ramp block
is defined by setting the qss parameter of the component
world:
The method parameter determines whether to use QSS1, QSS2 or QSS3
specifications. The presence of the WorldModel component allows the
user to switch the method parameter of all blocks in a model at
once instead of being forced to switch it for each block
separately. Then again, it is still possible to assign a fixed
value to the method parameter of certain blocks if this is desired:
simply open the parameter window of the block in question and
modify the parameter $method$ manually. Thereby, method becomes
independent of world.qss, and hence, a modification of qss in the
WorldModel will not effect it anymore.
Note that blocks that lack a parameter method produce output events
that are valid for any type of QSS, and are never influenced by the
WorldModel.
Generated at 2026-04-15T18:18:36Z by OpenModelicaOpenModelica 1.26.3 using
GenerateDoc.mos