Updating attribute value continuously in a SimEvents model

1 次查看(过去 30 天)
Hi.
I am working with a simevents model that is supposed to simulate transport to and from a given number of offshore installations. I have two models; the first one runs a weather simulation based on statistic data and shows different weather states and how they (may) change every 6 hours. This gives me, when the simulation runtime is a week, a 29x2 matrix ; i.e.
time state
0 0
6 1
12 1
18 2
24 3
30 2
36 1
....
The different states describe how harsh the conditions are, and affect the sailingspeed between the locations. I have tried to use the matrix from the first model as an input to the other simevents model where the transport chain is implemented.
I have tried a solution with a Matlab function block that takes the weather state matrix as an input, as well as a digital clock connected to Timed to Event signal --> Simtime, and use GoTo and From blocks to update the attribute value as the simulation runs. I don't know if this is the right way, or if it is even possible with this kind of behaviour in a discrete event model?
To sum up; I want to update the weatherstate attribute every 6 "hours", and send the new value to various functions. Sorry this was a messy post, but if anyone has any idea how to implement this sort of behaviour, please let me know :-)
  2 个评论
Teresa Hubscher-Younger
Hi, I was a bit confused by this one too, but a friend helped me out. Here's what he said: I assume that the output of the first weather model is a matrix in the workspace. If that is the case, then the easiest way is to use a From Workspace block (uses a MATLAB timeseries object) and specify this variable name. This block will interpolate continuously if needed, and this can be fed to a Timed to Event Signal gateway block and then to a SimEvents attribute port. SimEvents will sample/read this data whenever an event occurs. In Simulink, a model can be hybrid so you can have such a From Workspace block in the same model and run continuously, even though events may occur sporadically. If you want to read more about the From Workspace block, here is more information: http://www.mathworks.com/help/simulink/slref/fromworkspace.html
Hope this helps, Teresa
Andrea
Andrea 2016-1-5
Hi,
This method seems to work very well, thank you (and your friend) so much :-) !

请先登录,再进行评论。

回答(1 个)

Endric Schenk
Endric Schenk 2016-4-24
Hi, I try to implement the solution you explained, but struggle a little bit.
I have one block where wind speed and wave height are connected with timed to event signal as well as with set attribute.
In the other block random failures of a turbine with random repair duration are generated.
The repair shall be executed immediately but based on weather conditions. Wind and wave criteria must be fulfilled, otherwise repair can not be executed and needs to be postponed.
How do I combine those two blocks?

类别

Help CenterFile Exchange 中查找有关 Discrete-Event Simulation 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by