From: Edward on
Hi,
I am using simulink to control a device via RS232. I can successfully communicate with it using the "To Instrument" block although for some reason the time scale is completely incorrect, leading to some strange responses.

For some reason the simulation time seems to increment about 120 seconds for every real world second. I suspect this may have something to do with changing the solver from "ode45" to "discrete", which seemed necessary as the simulation would not work in "ode45".

Does anyone know what might be causing this strange time scale?
And how can i fix it?

Thanks for your help
From: Steven Lord on

"Edward " <thomson.ed(a)gmail.com> wrote in message
news:i11nc8$cua$1(a)fred.mathworks.com...
> Hi,
> I am using simulink to control a device via RS232. I can successfully
> communicate with it using the "To Instrument" block although for some
> reason the time scale is completely incorrect, leading to some strange
> responses.
>
> For some reason the simulation time seems to increment about 120 seconds
> for every real world second. I suspect this may have something to do with
> changing the solver from "ode45" to "discrete", which seemed necessary as
> the simulation would not work in "ode45".
>
> Does anyone know what might be causing this strange time scale?
> And how can i fix it?

Are you looking for your Simulink model to execute in real-time?

http://www.mathworks.com/support/solutions/en/data/1-15JAW/?solution=1-15JAW

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com


From: Edward on
Thank you very much Steven.

I followed your link and found this block, which may be of interest to anybody else experiencing a similar problem:

http://www.mathworks.com/matlabcentral/fileexchange/21908-simulink%C2%AE-real-time-execution
 | 
Pages: 1
Prev: Stacked bar
Next: how to cretae a function.