Analog Output block keeps timing out (glitches)

2 views (last 30 days)
Using the Analog Output block in Real-Time Windows Target run in Normal mode, I always get flat-waveform glitches that last ~50 ms. (Analog Output block details: Sample time 0.001, Maximum Missed Counts is 75). Clearly the OS is somehow unable to execute regularly inside of that timing tolerance, but CPU/RAM are far underutilized.
Any lower Maximum Missed Counts yields a simulation error: "Error reported by S-function 'rtwinao' in 'daqTest/Analog Output': Maximum missed ticks count exceeded"
What can I do to have Simulink output a waveform with any decent fidelity?

Accepted Answer

Jan Houska
Jan Houska on 15 Aug 2014
To get reliable timing and smooth output waveform, the only real solution is to switch from Normal Mode to External Mode. This way, you will not be influenced by possible delays introduced by the operating system. External Mode timing is exact to several microseconds. So please switch to External Mode if possible, this should solve the problem.
That said, glitches of the order of 50 ms are way too long even for Normal Mode - certainly much longer than expected or observed on a typical computer. This in effect means that there is something that periodically prevents Simulink from running for as long as 50 ms. It would be worth to examine your computer and find out what that can be (some background process, e.g. a virus scanner?), because this not only makes your computer almost unusable for Normal Mode, but is also bad for performance in general.
  2 Comments
John
John on 15 Aug 2014
To anyone else who has this question, after much back and forth it turns out that mathworks considers 50 ms a "normal" delay when using I/O with real-time target toolbox. This is a very poor performance, and it's a bit unusual for Mathworks to claim hardware-in-the-loop capabilities with RT Target, when in reality that can only be achieved by buying yet another product (Simulink Coder) to use External Mode. So this is solved in the sense that i know the issue, but unsolved in that it shouldn't be happening in the first place based on the product details.
Jan Houska
Jan Houska on 18 Aug 2014
I cannot speak for MathWorks, but to my best konwledge, delays about 50 ms are not usual in Normal Mode. Occasional 1 ms or maybe 2 ms yes, but not 50 ms. You may want to speak to technical support again and insist on more detailed investigation of the issue. More details, such as your model, will be needed for that.
What you are facing is essentially the fact that it sometimes takes 50 ms to Simulink to compute output data for the next step. The question is why - is your model really that complex? Is that particular time step difficult to compute (perhaps because of numerical issues)? Is some other process preventing Simulink from running? There may be multiple reasons for this behavior and the root cause needs to be found before any suggestion for improvement can be given.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!