Simulink仿真引擎如何工作? [英] How does Simulink simulation engine work?

查看:91
本文介绍了Simulink仿真引擎如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想了解Simulink仿真引擎的工作原理.是否使用离散事件模拟机制(然后如何处理连续时间?)?它是否依赖于基于静态周期的代码生成?还是?

解决方案

在第一个循环之前,它会弄清楚块的执行顺序(从不需要其他任何块输入的块开始)

每个周期,它根据输入和块的代码计算每个块的输出.每个模块的代码都是静态的,在将模型放在一起之前,大多数代码已经存在. (我不知道块选项是否实际上会更改代码,或者是否仅在运行时每次迭代时对它们进行评估.)

如果模拟步骤是可变的,则每个循环将主要根据模型变量的变化速度来计算下一步的大小.它们变化得越快,步长应该越小,因此,假定短暂的高导数持续的时间不应该长得多. (我不知道此计算的详细信息,也许其他人可以了解一下?)因此,连续"仿真或可变步长仅意味着Simulink将在每个循环中进行合理的猜测,以了解步长足够小将时间量化误差保持在可接受的水平.在完全数字化的硬件(例如计算机的处理器)上,真正进行连续的仿真实际上是不可能的.

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 ?

解决方案

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.

这篇关于Simulink仿真引擎如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆