Updating attribute value continuously in a SimEvents model
2 views (last 30 days)
Show older comments
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 Comments
Teresa Hubscher-Younger
on 31 Dec 2015
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
Answers (1)
Endric Schenk
on 24 Apr 2016
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?
0 Comments
See Also
Categories
Find more on Discrete-Event Simulation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!