The Integrator-Wrapper Block
Parameters:
quantum |
output quantisation degree |
startX |
initial start value (initial condition) |
Description:
Actually, the library contains three different Integrator blocks -- one for each type of QSS. The reason for not having merged them into a single block is that they heavily differ from each other, so putting them together would have led to a block the code of which would have become very complex and thus uncomfortable to read.
However, in order to still be able to exploit the functionality of the WorldModel block (switching between different types of QSS), there is an "integrator-wrapper" component that features the same ports and parameters as an Integrator does, but has an additional parameter to choose between the QSS1, QSS2 or QSS3 Integrator. The internal structure of the model looks as follows: all three types of Integrator blocks are present, and each of them has its port connected to the corresponding port of the wrapper component. Their instantiation however depends on the value of the method parameter (i.e. world.qss). See the code snippet below for an illustration:
1 block Integrator
2 extends ModelicaDEVS.Interfaces.DDBlockIntegratorMulti;
3 parameter Real quantum= 0.1 "Quantum";
4 parameter Real startX=0 "Start Value of x";
5
6 IntegratorQSS1 IntegratorQSS1_1(quantum=quantum,startX=startX) if method == 1;
7 IntegratorQSS2 IntegratorQSS2_1(quantum=quantum,startX=startX) if method == 2;
8 IntegratorQSS3 IntegratorQSS3_1(quantum=quantum,startX=startX) if method == 3;
If method takes a value of 1, only the QSS1 Integrator is instantiated (line 6), if method equals 2, only the QSS2 Integrator is instantiated (line 7), and the same holds for a method value of 3 (line 8). It is implied that connections leading to a block are only instantiated if the block itself has been instantiated.
As stated before, the integrator wrapper block has the same parameters (quantum and startX) as a real Integrator (lines 3 and 4). This circumstance allows the wrapper to initialise the instantiated Integrator block with the appropriate parameter values. It is not very illustrative an example, given that the parameters of a specific Integrator and the integrator wrapper block have the same names, and thus the parameter initialisation unfortunately results in an instruction like quantum=quantum and startX=startX. Nevertheless, it should be understandable how parameter propagation within a model works.
Generated at 2024-11-23T19:25:52Z
by OpenModelicaOpenModelica 1.24.2 using GenerateDoc.mos