The creation of dynamic model instances in the DE domain simplifies modeling of complex systems where flexibility is needed. Using dynamic model instances, DE module or primitive instances can be created and deleted at run time.
To create a dynamic model instance, right-click on an instance in the Model Editor Window (DE domain) and select Dynamic Instance. The model instance now has auxiliary ports in addition to the ports of the conventional model instance. The additional ports functions are described here:
A deleted instance cannot be re-created with the same index.
Primitive models of the DE GotoGroup library, using the global address table, are not working in connection with dynamic instances.
An example of a dynamic primitive instance can be found under MLD Examples→Tutorials→DynamicInstance→XGraphWithDI. The ”Xgraph” is instantiated as a dynamic instance. During simulation a new instance of the ”Xgraph” is created with each iteration. The index and value of the current simulation time is displayed on each plot. The IntervalConst#1 model instance sends a particle to the Delete port of the Dynamic graph at StartupTime followed by a particle every Period. The graphs that are generated at the same time as the IntervalConst#1 fires are deleted.
The parameters of the Ramp#1 and the IntervalConst#1 have their scope set to External and are visible when MLDesigner is in simulation mode. These values can be changed while MLDesigner is in simulation mode without recompiling the system.