Simulink 仿真引擎如何工作?

发布于 2024-09-26 05:34:26 字数 80 浏览 3 评论 0原文

我想了解 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 ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

浅笑依然 2024-10-03 05:34:26

在第一个周期之前,它会计算出块的执行顺序(从不需要任何其他块输入的块开始)。

每个周期,它都会根据输入和块的代码计算每个块的输出。每个块的代码都是静态的,它大部分在您将模型组合在一起之前就存在。 (我不知道块选项是否实际上改变了代码,或者它们是否仅在运行时、每次迭代时进行评估。)

如果模拟步骤是可变的,那么每个周期它都会计算下一步的大小,主要基于模型变量变化的速度有多快。它们变化得越快,步长应该越小,因此短暂的高导数不会被认为持续的时间比应有的时间长。 (我不知道这个计算的细节,也许其他人可以解释一下?)因此,“连续”模拟或可变步长仅意味着 Simulink 将在每个周期对步长足够小进行有根据的猜测将时间量化误差保持在可接受的水平。在完全数字化的硬件(例如计算机的处理器)上,真正的连续模拟实际上是不可能的。

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.

-柠檬树下少年和吉他 2024-10-03 05:34:26

我当然不是专家,但答案可能是“视情况而定”。

Simulink 当然会在某些情况下使用数值积分,而对于某些积分器,您最终会得到离散的时间步长。对于其他积分器,可以在模拟运行时更改时间步长 - 这对于模拟“刚性”方程组尤其重要。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文