10-25-2007 03:59 AM
10-25-2007 06:16 AM
Hi soeren
1) If you double click the simulation loop and choose the 'Timing Parameters' tab, you have to check the 'Synchronize loop to timing source' box.
Then if you expand the inputs on the left hand side loop you will see the 'Source Name' appearing. This is where you can wire in an external timing source.
2) Create a timing source and wire it to the inputs of the timed and the simulated loop that you want to sync. The timing source can be the 1KHz clock Windows use
or the 1MHz clock that can be found in the latest NI Real time controllers.
3) Determine the rate at which the loops will run. The simulation rate has to be expressed in seconds and the timed loop rate will be in ticks ( for a 1KHz source the tick will be 1 msec). The photos attached depict two loops that are synchronized to run every 10msec. Please note that you need to choose a Fixed step solver from the simulation loop configuration box.
With regard to the integration block, it's behavior will depend on the ODE ( Ordinary Differential Equation) solver you choose. Therefore, you can play around with the simulation loop parameters to find out which method gives you the most meaningful results.
I hope that helped,
Kostas
10-26-2007 03:57 AM
Hi
Thanks for the answers, I'm using Labview 8.2, so my configuration parameters are not exactly as you depict them, but pretty close. Instead of the "Synchronize........etc." I can check a box called Software timing and I'll check if this works. I would like to place the simulation loop inside the timed loop because I have a case stucture with different control strategies, do you think this would cause any problems?
Thanks again
soeren
10-26-2007 06:06 AM
Hi,
why don't you try placing the case structure in the simulation loop instead?
Thanks,
KostasB
Applications Engineer NI UK & IE
10-26-2007 07:46 AM
Hi
The reason why I wan't the simulation loop to be inside a case, is that, I in the other cases I'm using the PID from the "Control module", which does not need to be inside the simulation loop. I could probably implement my model based controls by using other instances from the "Control module", but there are some advantages which can be gained by directly typing in transfer function which can be done in the simulation loop.
I have tried some of the solutions which you suggested, and now the simulation loop is placed inside my control case structure, but I still have a few issues.
I'm have the simulation loop inside a case which is inside a timed loop, the simulation and the timed loop at running at the same frequency 10 Hz, on the same 1 kHz clock. I have the simulation time starting at 0s and finishing at Inf s. The problem is that whenever I switch to the simulation case, all the other stuff happening ouside the simulation stops. I think i'll try messing around with the priority of the simulation loop.
10-29-2007 05:38 AM
10-29-2007 06:13 AM
You can use the simulation environment for real time control. In your program you placed a simulation loop with infinite end time that will never end as there is no stop button. You
need to click the abort button to exit the program. Have a look at the attached VI and let me now if it helped.
Thanks,
KostasB
Applications Engineering NI UK
10-29-2007 07:10 AM
10-30-2007 04:01 AM
Hi, I've fooling around with some features of the Simulation module using the strategy shown in my previous post. I've tested a transfer function and a transport delay, and they won't work using that strategy, because they both are reset whenever the simulation is halted. Is there no work around this? If the simulation is not halted it will not update the other instances in the timed loop, where one would put DAQ etc.
I've attached a vi that should show the problem with the reset transfer fuctions.
10-30-2007 11:28 AM
Hi,
the integrators have a 'reset' option. Double click the integrator and on the reset option you can choose 'none'. If you want to run simulation loops sequentially you
could use a timed loop structure and pass data throughout the structures. When you place multiple instances of integrators each one will keep its own values.
Thanks,
KostasB