Share data between two simulink models

12 次查看(过去 30 天)
Lets say I have following model
And I want the block in red will come from other model.I want the two models to run independently and having them talk to each other
I have read this https://www.mathworks.com/help/simulink/ug/share-data-with-other-matlab-system-blocks.html but I didn't help me I also tried to use this https://www.mathworks.com/help/instrument/examples/basic-udp-communication.html but I have received following error
The block 'UDP Send1' cannot be assigned a continuous sample time.

回答(1 个)

Walter Roberson
Walter Roberson 2019-4-2
As you are using continuous time, you will need to use a single model with lines that connect the appropriate parts. This is needed so that Simulink can construct the differential equations needed to solve the system over indefinite time.
As soon as you refer to models "talking" to each other, you are talking about discrete events, that one model sometimes sends updates to the other, or one model sometimes queries the state of the other. Discrete events are incompatible with continuous time systems -- unless, that is, you set up portions to be triggered at particular times: if you did that then Simulink would treat those times as boundary conditions and do continuous modeling them.

类别

Help CenterFile Exchange 中查找有关 Simulink Functions 的更多信息

标签

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by