Due to the compatibility between DEVSLib and SIMANLib, the functionalities included in DEVSLib for modeling hybrid systems can be used in SIMANLib. This is, the Quantizer, CrossUP, CrossDOWN and DICO models can be combined with the SIMANLib blocks.
The use of a CrossDOWN model to detect the condition to generate new entities (using the input port of the Create block) is shown in the next figure.
Additionally, the ExternalAssign block has been developed to provide an interaction mechanism between the flow of entities and the continuous-time part of the model. The discrete assignments to SIMANLib variables or attributes are translated to a continuous real variable (y). The change port has been included to detect assignments, even when the new value assigned is equal to the previous one.
The difference between the Assign and the ExternalAssign blocks is shown in the next figure (notice the two additional output ports in the ExternalAssign block).
The following code shows the detection of variable assignments (checking the value of the truckL1.change port, where truckL1 is an ExternalAssign block) and the reinitialization of continuous-time variables.
when change(truckL1.change) then reinit(truckLevel,2000); end when;