Guy on Simulink

金宝app基于模型的设计

卷发游戏…2022版

为了 2022年冬季奥运会 , I am excited to share a new version of the Simulink Curling Simulator ! This is now the third Winter Olympics that our curling game is participating in, making it something of a Simulink tradition. For those not familiar with this app, you can see how it evolved over the years in these posts:
对于2022年冬季奥运会,我们升级了该应用程序以使其与之兼容 Simulink Compiler 因此,它可以作为独立可执行人员部署或 Web应用程序 that can run in a web browser.
免责声明: 我真的很想在此博客文章中包括一个链接到一个公开可用的网络应用程序,供大家在您的网络浏览器中尝试游戏,就​​像我们去年为The Whe Web浏览器中的游戏 指数病毒扩散模拟器 , but I ran into a technical issue. We are still investigating that; I will update the post once the web app is available.
这是一个带有注释的动画,可帮助您开始第一场游戏:
CurlingTutorialSmall.gif

致谢

在探讨Curling App版本2022的详细信息之前,我要感谢几位研究这些更新的同事。正如我上面提到的那样,这个冰壶模拟器具有相对较长的历史,而数学工作者喜欢尝试使用新功能。
A group of consultants from 数学工作Consulting Services did the initial overhaul as part of a day-long activity experimenting with new features: Karthiga Mahalingam , Michael Boyle , Robyn Jackey , , and Sarah Dagen 。我还要感谢我的高级支持同事金宝app Corey Lagunowich for helping with further updates showcased here. Thanks for keeping the legendary curling simulator alive and fresh!
Karthiga,Michael,Robyn,Ying,Sarah和Corey

链接应用程序设计器,MATLAB和SIMULINK的状态流金宝app

One of the important things to realize with the curling app is that the app graphical elements are defined in App Designer, but most of the app logic is defined in a 状态流chart executed as a MATLAB object 。我喜欢这种做事的方式,因为状态流语言非常方便地表达应用程序所需的逻辑。
如果您查看该应用程序的启动FCN回调,则它要做的第一件事就是实例化状态图并将其传递给应用程序本身的句柄。这是应用程序和图表之间双向链接的关键。
在一个方向上,在应用程序回调中,这使我能够触发状态流图中定义的事件。在另一个方向上,状态流图可以在应用程序中访问和控制小部件:

Simulink Compiler

此版本的Curling应用程序是我尝试使用Simulink编译器作为Web应用程序部署的第二个应用程序。金宝app最后一次是在2020年, 病毒传播模拟器 。At this time, in R2020a, I could only call the sim 完成仿真后,命令并为结果动画。
Since R2020b, Simulink Compiler introduced new functions to set callbacks to get data in and out of the simulation while it is running:
这是创建simulink的代码传递给SIM命令的代码。金宝app
In a way similar to how we linked the app and the Stateflow chart, a handle to the app is passed to the callbacks. That way, the callbacks can access and control the app widgets. For example, here is the chain of events for the InputFcn callback:
  • The user clicks the Sweep button in the app
  • 扫描按钮回调会触发staflow图表中的扫描事件
  • The sweep event changes the value of the "sweepVal" property defined in the Stateflow chart
  • 当模拟触发输入FCN回调时,它读取的值app.curl.sweepval
  • The Inport block扫描outputs the value ofapp.curl.sweepvalread in the inputFcn callback.
我不会在此处描述详细信息,但是输出FCN回调也会发生类似的过程。为了提供这些回调的更简单的示例,我建议对此进行查看: 使用Liveio部署大众春季阻尼器应用程序

3D可视化

Another enhancement you probably noticed compared to the previous version is the addition of a 3D visualization.
curling3Dsmall.gif
Added by colleagues from 数学工作Consulting Services ,此3D视图已使用 matlab.graphics.chartcontainer.chartcontainer ,在R2019B中引入的一项相对较新的功能。将此基类的子类分类允许您利用有用的方法和属性。在我们的情况下 更新 method get triggered when the OutputFcn callback receives new data.

Now it's your turn

Play the Curling Game Web App in your web browser ,或从 MATLABCentral 查看细节。您认为这个新版本的冰壶模拟器最有趣的功能是什么?您如何在自己的工作中利用这一点?
|

Comments

要发表评论,请单击这里登录您的数学帐户或创建一个新帐户。