Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Internal model control with cRIO, time loop synchronization

Solved!
Go to solution

Hello,

 

I am working with Control Design & Simulation toolkit and I want to implement an Internal Model Control to a real-time target. I would like to implement my simulation (in attachment) to the real-target (NI cRIO 9024, NI cRIO 9112). I removed the process transfer function, I broke the line and I added my input/output modules from cRIO. I set a step size 1ms, Euler ode solver and synchronize time loop. Unfortunately it does not work correctly. The loop decreased speed much and I cannot get 1ms response time and finally a good answer for my system. Does it mean that I cannot get 1ms response for the loop? Is it the problem of computer, windows or real-time hardware or software? Or simple I do something wrong? Any advice will be appreciate. 

 

Regards,

Kamil

0 Kudos
Message 1 of 21
(5,691 Views)

Hello Kamil,

 

I hope it will help:

 

http://zone.ni.com/reference/en-XX/help/371894E-01/lvsimhowto/sim_h_looptiming/

 

Best regards,

Cezary

 

 

0 Kudos
Message 2 of 21
(5,684 Views)

Hello Cezary,

 

I found something similar and I will try to check it tomorrow.

 

http://zone.ni.com/reference/en-XX/help/371894B-01/lvsimhowto/sim_h_looptiming/

 

It is written that I have to create an additional vi which controls the timing. I hope it will work. I will let you know tomorrow.

 

Best regards,

Kamil

 

 

0 Kudos
Message 3 of 21
(5,678 Views)

I did it how it was in the link above but the time is not synchronized still. There is still a big difference. Any suggestions how I can synchronize the timing 1ms or run a loop KHz loop?

 

Kamil

0 Kudos
Message 4 of 21
(5,669 Views)

Hello agian,

 

I checked your file target.vi. You have not applied time loop. Add time loop over the simulation loop and run again. There are number of examples and tutorial on NI website. Please visit http://zone.ni.com/devzone/cda/tut/p/id/6029#software

 

Best regards,

Cezary

0 Kudos
Message 5 of 21
(5,657 Views)

Hello,

 

Do you mean that I have to add a timed loop? Something like in the attachment? I did it but it does not work. I checked examples, tutorials but I have not found anything that explain simulation for fast real-time loop (1KHz). I was trying to convert my continuous transfer function to discrete transfer function in order to use timed loop without simulation toolkit but it does not work neither. After conversion I cannot get the same results. Maybe my transfer functions are too complicate?

 

Kamil

0 Kudos
Message 6 of 21
(5,647 Views)

Hello,

Yes it is necessary. But you have to synchronize control loop with time loop. Please follow the steps which you can find inside the tutorial - link I send - first link I sent you.

Generally, you should configure control loop like you will find in attachtment to this post.

Good luck

Cezary

 

 

 

 

 

 

 

configuration of loop 

0 Kudos
Message 7 of 21
(5,641 Views)

Actually I am in the lab and I am checking all possibilities (your too). Unfortunately it does not want to work with 1ms. I mean it works if I do not put anything to the simulation loop. I can get that sampling time. As long as I put transfer function the loop cannot get correct time calculation. Maybe the IMC is to heavy for real-time control?

 

Kamil

0 Kudos
Message 8 of 21
(5,639 Views)

I ma trying but northing works. I checked even through SIT (NI LabVIEW Simulation Interface Toolkit) but I received below error:

 

Error 14120 occurred at an unidentified location

Possible reason(s):

Simulation Interface Toolkit:  The base rate loop did not finish in time.  The combined time of computing the model and performing input and output is too long. Increase the model time step, switch to a simpler solver, or reduce the number of inputs and outputs used.

 

It seems that hardware cannot manage to solve the problem with desire time step 0.001 (KHz). I do not know it is problem of hardware (NI 9024, NI 9112) or my computer Notebook Intel Duo Core P8400 2.27GHz, 4 GB Ram memory, Vista system.

 

Any help?

 

Kamil

0 Kudos
Message 9 of 21
(5,609 Views)

Hello,

 

Are you using cRIO or you perform simulation on PC?

Anyway in both cases you should receive good results I mean if you set your simulation for 10sek you should simulate 10sek + jitter.

 

Have you try to put external while loop (in the same VI) where you generate parameters. Afterwors you send these parameters by global variables into control loop.

 

Please, reply. It will be benficial: what is your simulation time? How do you know that you do not have correct answares? What is your CPU and memory usege during simulation?

 

Best regards,

Cezary 

 

 

 

0 Kudos
Message 10 of 21
(5,607 Views)