The DBS file parameter imode is used to control the simulation mode. This option is set to 4 (simultaneous simulation) or 7 (sequential simulation) for dynamic simulation.
apm.imode = 4 (simultaneous dynamic simulation) apm.imode = 7 (sequential dynamic simulation) % MATLAB example apm_option(server,app,'apm.imode',7); # Python example apm_option(server,app,'apm.imode',4)
Like steady-state simulation, dynamic simulation requires a square problem with no degrees of freedom (neqn=nvar). Dynamic simulation has many useful purposes including
Dynamic simulation is the easiest dynamic mode to configure and run. The requirement for a square problem facilitates model convergence as the solver has only to achieve feasibility with the equality constraints.
Example Code (Python GEKKO) with IMODE 4 and 7
Three simulations show simultaneous simulation (IMODE=4), sequential simulation (IMODE=7), and simultaneous simulation in a Python loop (IMODE=4).