Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

Real time workshop - simulation duration

Asked by Bertz Tourgoutian on 26 Aug 2013

I would like to ask you a specific question and I would appreciate any help. I m trying to run a real time simulation using a target pc and the simulink encoder (RTW). Although I set inf at the end time, the simulation stops after ~23 sec (fs=500Hz and duration 10000 steps). Increasing the sampling frequency the simulation ends after one period (ie 5000Hz).

Does anybody know why does this happen? I would expect 20sec and 2 sec respectively, as the duration indicates. And if I increased to 100000 steps I would expect even longer simulation time; however nothing changes.

Thank you

1 Comment

Azzi Abdelmalek on 26 Aug 2013

Are you using Real Time Windows Target?

Bertz Tourgoutian

1 Answer

Answer by Azzi Abdelmalek on 26 Aug 2013

When you work with Real Time Windows Target, your operating system will allow to your Matlab application the highest priority, but depending on your pc performances, and your sample frequency, sometimes your calculations take more then your sample time, and after n repetition of this problem (corresponding to maximum ticks missed) your code stops

3 Comments

Bertz Tourgoutian on 26 Aug 2013

Thanks for the reply. However don t you think that 500Hz is too low sampling frequency to stop the operation. I d understand if this happened at 8-10kHz or even more. Moreover, do you mean that this depends on host pc perfomance or the target pc? Is there any way that you know of, to overcome this problem. It is quite weird because the target pc is part of an inverter system with rated frequency 8kHz.

Azzi Abdelmalek on 26 Aug 2013

Are you using two PC with real time windows target? How?

Are you running your model in normal mode, if yes, normally 500 Hz is allowed? to improve the performance you can run it in external mode, but you need a Simulink coder.

Bertz Tourgoutian on 27 Aug 2013

I am using a host pc with normal MATLAB/Simulink installation and using external mode I am trying to acquire some measurement from the hardware which is actually connected to the host pc through the target PC (xenomai target). I do run it in external mode with simulink coder, and this is the result.

Azzi Abdelmalek

Contact us