Simulink中的消息是什么?万博1manbetx
From the series:Run-Time Software Modeling
使用消息对具有基于消息的通信的软件组成进行建模并生成C ++代码。您可以从模型的根输入和输出端口发送和接收消息。您还可以生成C/C ++代码以连接到中间件或操作系统通信API。请参阅如何构建一个简单的模型,用于使用消息和事件库中的块生成和接收消息,并使用事件记录,消息动画和序列查看器进行调试。
Messages allow you to model and generate C++ code for software compositions with message based communication. To do this you can send and receive messages from a model's root input and output ports. You can also generate C++ code to connect to a middleware or an operating system communication API. Let's build a simple message communication model.
I will use the message blocks in the messages and events library in Simulink. I have a sine wave source block sending a sine wave in a sample based manner and an output port. I will use the message send block to convert the sine wave into a message that sends on the sample time of the source block. A message received block will convert that message back into a signal at the rate it's received.
We can use a queue block to hold messages if they're sent faster than they can be processed. The queue is set to behave like a buffer, dropping the oldest element when it's full. That can be changed. You can also set the capacity of the queue, which is how many messages it will hold, and set the type of cue that it is such as last in first out or first in first out. I can debug my model using event animation. I can choose the animation speed that shows while running the model. This shows me that my messages are being sent and when they are arriving.
我也可以记录事件。选择一条消息行来记录并使用数据检查器以查看发送消息何时发送以及其价值是什么。在运行仿真时单击行还将显示值。序列查看器还可以用于显示发送的订单消息。单击消息查看器中的一行,向您显示消息的起源位置以及该特定消息随着时间的流逝而发生的情况。
There's a message merge block to send messages to the same message line as well in the library. You can connect messages to middleware or operating system communication APIs with code generation. You use ERT and C++ to get appropriate message communication on your model boundaries. This will create a service at the component boundary, a class declaration in the header file, and allow you to add code customization data into the main file to connect.
We have another video in this series to learn more about modeling message based communication between model components.
Featured Product
万博1manbetx
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select:.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- AméricaLatina(Español)
- Canada(English)
- United States(English)
Europe
- Belgium(English)
- 丹麦(English)
- Deutschland(Deutsch)
- España(Español)
- Finland(English)
- 法国(Français)
- 爱尔兰(English)
- Italia(意大利语)
- Luxembourg(English)
- 荷兰(English)
- 挪威(English)
- Österreich(Deutsch)
- Portugal(English)
- Sweden(English)
- Switzerland
- United Kingdom(English)
Asia Pacific
- Australia(English)
- India(English)
- New Zealand(English)
- 中国
- 日本Japanese(日本語)
- 한국Korean(한국어)