Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Simulink simulation engine work?

I would like to understand how Simulink simulation engine works. Does it use a discrete event simulation mecanism (then how continous time is handled ?) ? Does it rely on a static cycle-based code generation ? Or ?

like image 359
JCLL Avatar asked Oct 07 '10 19:10

JCLL


1 Answers

Before the first cycle, it figures out the order of execution of the blocks (starting with the ones that don't require inputs from any other blocks)

Each cycle, it calculates the output of each block based on the inputs and the block's code. Each block's code is static, it mostly existed before you put the model together. (I don't know if block options actually change the code, or if they are evaluated only at runtime, at each iteration.)

If the simulation step is variable, than each cycle it calculates the size of the next step, based mainly on how fast the model's variables are changing. The faster they change, the smaller the step size should be, so a briefly high derivative isn't assumed to last much longer than it should. (I don't know the details of this calculation, perhaps someone else can shed a light?) So, "continuous" simulation, or variable-step, only means Simulink will make an educated guess each cycle about what step size is small enough to keep time quantization error at an acceptable level. Truly continuous simulation is literally impossible over a completely digital hardware, such as your computer's processor.

like image 180
Emilio M Bumachar Avatar answered Oct 21 '22 04:10

Emilio M Bumachar