Is there any real time clock in the Simulink? I would like to stop my
simulation after a certain amount of time, e.g. 10 seconds. How to do it?
best regards,
daniel
"Daniel Czarkowski" <reut...@poczta.onet.pl> wrote in message
news:c1fr16$q3h$1...@news.onet.pl...
"Stuart McGarrity" <stu...@mathworks.com> wrote in message
news:c1fu6q$6st$1...@fred.mathworks.com...
>
http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=3175&objectType=file
Thank you Stuart. The point is that I am looking for something different. In
this Simulink library, the time of simulation equals to real time. I would
like to measure how long the simulation takes in real time. I now that I can
do it in MATLAB
tic
sim('my_model',[0 10],opt)
toc
I am using GA for optimisation and sometimes the simulations in real time
takes to long, so I would like to stop it after e.g. 60 seconds. I found
STOP simulation block, but did not find the real time simulation clock. I
presume that I would have to write an s-function and include (toc). What I
need is just sth like tic and toc function in the Simulink. Anyone came
across with the problem?
Any ideas?
best regards,
daniel
Stuart
"Daniel Czarkowski" <reute...@SPAMpoczta.onet.pl> wrote in message
news:c1hqmj$l9d$1...@news.onet.pl...
Might there be something in the Humusoft Extended Real-Time Toolbox for MATLAB and
Simulink that could help you? <http://www.humusoft.cz/rt>
Kelvin B. Hales
Kelvin Hales Associates Limited
Consulting Control Engineers
E-mail: kha...@khace.com
Web: www.khace.com
It means that this command is not a part of MATLAB/Simulink. I hope in R14
Mathworks will implement that as well.
If someone done it, please send it to
http://www.mathworks.co.uk/matlabcentral/fileexchange/
best regards
daniel
thank you
daniel
One way to limit a simulation's elapsed (wall) time is to:
1) Set up a "Simulation Start Function" callback: t0=clock;
2) Add a MATLAB Fcn block with the function: etime(clock,t0). Ground
the input. The output from this block is now the elapsed time that
the simulation has been running for.
3) Add a relational operator block to compare elapsed time with some
constant (your time limit).
4) Feed the output of the relational operator into a Stop block.
When elapsed time is greater than your limit, the model stops.
If this isn't clear, I can email you my example (for R13).
HTH
- Steve
To stop your simulation after x-seconds of real time: synchronise the
simulation time with real time and take the output from a Clock block to a
Stop block.
daniel
I think your use of the expression "real time" got most posters into
the wrong mindset (RTW, HiL etc). What you really meant (pardon me
for correcting your English) was "wall time" or "elapsed time".