MATLAB最新版本R2022A刚刚发布!在这里,我将与您分享我最喜欢的MATLAB R2022A中的新Simulink功能。金宝app
型号参考本地求解器
只要Simulink has existed, it has always been a fact that there could be only one single continuous rate in a simulation. Well... not anymore!
Let's take an example where you have a simulation including the fast dynamic of an electrical circuit and a mechanical system with a significantly slower dynamic. If the system was solved using a continuous solver, it had to be solved using the same time steps. As you can imagine, this is not optimal in terms of performance since a lot more steps are taken to solve the slow mechanical system that could have theoretically been needed.
在里面
模型引用
模型配置的部分,您将看到一个新的选项,以指定在引用模型时选择的求解器,与顶部模型的求解器相反,将其引用为先前版本中的求解器。回想一下,在先前的版本中,层次结构中的最高模型确定了哪个求解器将用于在参考模型中集成连续状态。
引用模型时,在对话框中
Model block
, you will see a new "Solver" tab reporting which solver is being used:
To illustrate that, I put together a simple model referencing two other models, one simulating a stiff system solved with steps of 0.01 second using the ode1be solver, and the other a less stiff system solved using steps of 0.1 second using the ode1 solver. If I enable the logging of states in the top model and display the results in the
模拟Data Inspector
有了标记,我可以看到它们已经使用不同的步骤解决了:
固定步骤求解器的零交叉检测
Simulink求解器的另一个主要补充是可以检测使用金宝app固定步骤求解器的零交叉事件。
在里面Solver section of the model configuration, you will see this new option:
This setting can significantly improve the accuracy of models with fast switching dynamics that need to be solved using a fixed-step solver to enable deployment to hardware. The settings for maximum number of bracketing iterations and maximum number of zero-crossing per step can help ensuring that the generated code can respect real-time constraints.
Here is a simple model illustrating the impact of enabling fixed-step zero-crossing, notice how it improves the results compared to the variable-step reference:
If I run the model and compare the output of the Integrator block, we can clearly see the impact of fixed-step zero-crossing
在(1:3)= si金宝appmulink.simulationInput(MDL);
在(1)= in(1).setModelParameter(“ solverType”,'Variable-step');
在(2)= in(2).setModelParameter(“ solverType”,'Fixed-Step',。。。
在(3)= in(3).setModelParameter(“ solverType”,'Fixed-Step',。。。
out = sim(in,'ShowProgress','离开');
绘图(out(1).logsout.get("pulse").Values)
绘图(out(1).logsout.get(“集成商”)。值);抓住在;
绘图(out(2).logsout.get(“集成商”).Values)
绘图(out(3).logsout.get(“集成商”).Values,'-o')
传奇({'Variable-Step',“固定步骤否ZC”,'Fixed-Step ZC'},,'地点','northwest')
Many Redesigned Apps
我想指出的关于MATLAB R2022A的最后一件事是,重新设计了多个工具和应用程序,以实现更现代的外观和提高可用性。
这里有一些例子:
现在轮到你了
如果您特别想在此博客中看到更多的详细信息涵盖一项功能,请在评论中告诉我们。
评论
To leave a comment, please click这里to sign in to your MathWorks Account or create a new one.