matlab - How does Simulink simulation engine work? -
i understand how simulink simulation engine works. use discrete event simulation mecanism (then how continous time handled ?) ? rely on static cycle-based code generation ? or ?
before first cycle, figures out order of execution of blocks (starting ones don't require inputs other blocks)
each cycle, calculates output of each block based on inputs , block's code. each block's code static, existed before put model together. (i don't know if block options change code, or if evaluated @ runtime, @ each iteration.)
if simulation step variable, each cycle calculates size of next step, based on how fast model's variables changing. faster change, smaller step size should be, briefly high derivative isn't assumed last longer should. (i don't know details of calculation, perhaps else can shed light?) so, "continuous" simulation, or variable-step, means simulink make educated guess each cycle step size small enough keep time quantization error @ acceptable level. continuous simulation literally impossible on digital hardware, such computer's processor.
Comments
Post a Comment