How to control a Release Gate with data computed in another Subsystem?
5 次查看(过去 30 天)
显示 更早的评论
Hello everyone,
I am trying to do a traffic simulation with SimEvents (Matlab R2013b). Since I have cars, that change their data continuously and entities, which are in a discrete event system I have to synchronize both parts. For a straight street my approach was to store the entities in a N-Server until the car has passed the straight and then let it out. The data of the car is stored in a matrix and each car has its own ID. Now the SimEvents system needs to check in the Matrix if the car already passed and then needs to open the release gate. If I try implementing this the function, which reads the memory matrix, is just executed once and the I also tried using "Event To Timed Signale" Blocks before and after the function, which reads the memory. But then I get an algebraic loop error. If I break this loop with an delay, my data gets too old, which falsifies my simulation. Do you have any ideas how to solve this? Is there a possibility to tell Simulink, to execute this function continuously?
Thanks for your help. I attached an example code.
Lucas
0 个评论
采纳的回答
Sandip Kumar
2014-10-27
Based on the example model you had, I have modified the model to incorporate a 'Data Store Read' block, to read the Matrix (which is getting modified every time step).
If you attach a scope to output of MATLAB function block, ControlReleaseGate/Straight/Scope you will notice the MATLAB function is actually reading the modified values.
Now you will notice, although there are 5 entities in the N-server, the release gate is not releasing them, because the setting on release gate says to only open gate when the "change in signal from port VC".
Please find the attached model here, usage of Data Store Read block fixes the issue you were noticing.
Thank Sandip
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Discrete-Event Simulation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!