实时模拟的用户界面万博1manbetx
You can design apps with App Designer to tune parameters and monitor signals from real-time applications that are running on a Speedgoat target computer. See how Instrument Objects can simplify gathering data. You can automatically retrieve data from the target computer and display that data in an app. Learn about the commands and how to use them. An example model and demonstration are shown.
2020b是Simulink实时的主要版本。万博1manbetx有关更多一般信息,请参见2020b中Simulink实时的发布视频。万博1manbetx该视频更具体地是关于用于实时Simulink的用户界面。万博1manbetx我们将使用所谓的仪器对象来查看应用程序设计器的集成。
因此,应用程序设计师推荐的环境在MATLAB中构建应用程序。因此,应用程序设计师也是MATLAB中构建应用程序或用户界面的推荐环境。在左侧,我们显示一个典型或至少一个示例应用程序。在此中间,我们显示了一个代表开发计算机的图片,该计算机正在运行该应用程序,在右边是Spigot Target计算机,该计算机正在实时连接到硬件。而开发计算机和目标计算机是通过以太网连接的,这是两者之间传输数据的方式。
如果你有一个应用一些数值disp说lays and some line plots, you have to periodically get that data from the spigot and update the app. That's what instrumentation objects are for. They take care of all that for you. Once you create the object, it periodically gets the data from the spigot and updates the line plot. No need for timer functions or anything else, makes it really simple and easy.
Some of the key commands that are used are slrealtime.Instrument to create an instrument object, connectCallback to have your own function, which is called every time there's new data, connectLine to take a signal from the spigot and display it on a line plot, or connectScalar to take the current value of a signal, and put it in something like a numerical display or a gauge for example.
Let's look at an example of this. So here we have a model of a closed-loop control system running a PID controller on a DC motor. You can see the physical DC motor here in this video, along connected to the spigot target computer, which-- will be running this model in real time. You can see this model has a constant function, which creates the commanded position, the signal called command, and the-- feedback signal of the motor is named feedback.
因此,让我们继续运行此模型,在此我们将命令信号和反馈信号连接到此轴。当我们使用滑块更改位置时,我们可以在视频中看到电动机移动,并在图中看到数据更新。那么我们如何创建这个应用程序?好吧,我们使用了应用程序设计师,并且我们的工作方式是一个简单的应用程序,因此它只是我们抓取的几个组件。您可以看到这里有很多组件的选择。我们只是抓住轴,一个按钮,一个轴和一个按钮以及滑块。因此,如果我们转到代码视图并查看此信息,则在这里为我们生成了灰色的所有代码。因此,没有太多的代码才能使它起作用。因此,在此处的设置仪器函数中,我们使用了slrealtime.smentrument来创建我们的仪器对象,我们使用连接行来连接该命令信号,以及反馈信号与应用程序中的用户界面轴。
Other than that, we have a startup function, which creates a Simulink real-time object, stops the spigot target computer if it's running, and loads or model. And we have a function here for the slider, and every time the value changes, we simply use the setparam command to change the value of the commanded position by changing that constant block to the value. Now you might notice here that the instrumentation object is not needed for the slider, and that's because we only need to change a single value or a parameter on the spigot target computer when the slider is changed. So there's an event that causes that to happen, whereas on the plots we want that update continuously as it's running.
唯一的其他代码是我们的开始/停止按钮,因为我们两者都使用一个按钮。当我们停止模型时,我们会更改按钮以说开始,当我们启动模型时,我们更改按钮说停止,仅此而已。因此,让我们看看这一次在动作中运行。我重新启动此功能,并将视频和模型重新回到视图中,然后更改这些位置。就是这样了。很好,简单。使从目标计算机自动检索数据变得容易。
Some really cool time instrument, here are some of the key commands you might want to look up in the documentation. That's a real-time instrument for creating instrument, connect callback for retrieving or creating your own callback whenever a new data is retrieved, connect line for continuously updating something like a line plot, and then connect scalar for any type of display like a gauge, numeric display that has only a current value display, getting the current value and automatically updating that display.
For more information or to find an example, you can search for "Add App Designer App to Inverted Pendulum Model" inside the documentation, and then it'll bring you to an example, or you can look at the code and how it was done in that example. You can also get there sort of searching by going to Simulink Real-Time section under Control and Instrumentation. Go to the Real-Time Application Instruments with Instrument Objects, and you'll see the example there as well as the reference for all the commands. This example is also linked below. Thank you very much.
相关产品s manbetx 845
您还可以从以下列表中选择一个网站:
如何获得最佳网站性能
选择中国网站(中文或英语)以获得最佳场地性能。其他Mathworks乡村网站未针对您所在的访问进行优化。
美洲
- América Latina(Español)
- 加拿大(英语)
- 美国(英语)