开发者

How does Simulink simulation engine work?

开发者 https://www.devze.com 2023-01-19 07:10 出处:网络
I would like to understand how Simulink simulation engine works. Does it use a discrete event simu开发者_JAVA技巧lation mecanism (then how continous time is handled ?) ? Does it rely on a static cycle

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


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.


I'm certainly not an expert, but the answer is likely to be 'it depends'.

Simulink certainly uses numerical integration for some things, and for some integrators you will end up with discrete time steps. For other integrators, the time-step can be altered as the simulation is running - this is particularly important for simulating 'stiff' sets of equations.

0

精彩评论

暂无评论...
验证码 换一张
取 消