“Politehnica” University of Bucharest

This is an open group. Sign in and click the "Join Group" button to become a group member and start posting.

Simulation time

I have my block diagram with transfer function, PID and two saturation. When I simulate the program, it work very good. The problem occur when I put some noise to the system and that noise is a second order transfer function with an input of random numbers, I simulate the systems and  the simulation time goes crazy. In the beginning starts well but then stop, begin again, goes slower and 45 seconds later the simulation goes very very very slow. I don't know why is the reason.

0 Kudos
Message 1 of 2

Re: Simulation time

There are several problems with your simulation:

a) you are trying to simulate a system that has no notion of "time". The simulation has control over time, which means it will simulate as fast as it can. You can solve this problem by going into the configuration of the Control and Simulation Loop and enabling "Timing Parameters". Also, you could try to use a subVI with wait inside it. Look at this example to see how this can be implemented: C:\Program Files (x86)\National Instruments\LabVIEW 2016\examples\Control and Simulation\Case Studies\Aerospace\3DofHelicopter\CDEx Simulation 3DoF Helicopter.vi. This is the only possible way to keep variable step size solver together with some time control (although this is not RT friendly). For proper Real-Time control, you must use fixed step size and timed-loops.

b) You are using a "random number generator" directly on the Control and Simulation Loop. This means that for every "minor" stepsize, it will generate a new number. In general, this is not what you'd like to do since when you are solving the equations. So, here, like you did for the "wait" function, you should encapsulate the random number into a VI and by "right-click" to the subVI and using "sub-VI node setup", you can change the execution of the VI to be "Continuous" only (remove the minor timestep checkbox). This will keep the random number constant while the solver do minor stepsizes, which makes the simulation faster by itself.

c) The magnitude of your noise is huge! I had to reduce the noise by a factor of 100 to obtain a good simulation. Maybe you should look into that first to be sure the magniture is correct for the disturbance.


Hopefully this can help you make your simulation to work.

Barp - Control, Simulation, RTT and HIL - National Instruments
0 Kudos
Message 2 of 2
This is an open group. Sign in and click the "Join Group" button to become a group member and start posting.