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 Cezary,

 

Thank you for replay.

 

I am using cRIO. I put my project in attachments.

 

1) yes I tried external timed loop with setting of priorities. The same results.

 

2) The simulation time is infinitive. Time step 0.001s. Solver Euler.

 

3)  3.1 I looked the simulation time and I checked with the clocked. I noticed that 1 second of simulation time is 4 seconds of real-time.

     3.2 I send output data to the linear motor. On the controller of the linear motor I have a scope and I can check the data that I received. In the Labview I set the period of the reference signal on 1s and on the scope I got about 4s. It means that time is not correct. I mean the simulation is not fast enough.

 

4) I checked in NI Distributed system Manager: CPU about 90%, memory usage 10%.

 

I cannot set time step more than 0.001s because my simulation becomes unstable and I cannot get a good answer.

 

Regards,

Kamil

Download All
0 Kudos
Message 11 of 21
(2,349 Views)

Hello,

 

Have you checked simulation on PC?

 

Try to simulate 20sec both on PC and cRIO.

 

Please, try to apply discrete time= auto in loop configuration.

 

I noticed that you are reading a file. I think that maybe it is a reason. Can you remove?

 

Please, try to run your program generating sinus to your control blocks.

 

Please, deliver all files I can not open correctely your "main" file.

 

Best regards,

Cezary

0 Kudos
Message 12 of 21
(2,343 Views)

Hello again,

 

I simulated on PC and it was ok. I received a good answer. I could run simulation even faster than the real-time.

 

Discrete time I have in auto.

 

I should have opened file before the simulation loop. I will try tomorrow.

 

I checked with simulation sine wave and it did not help much but I can check again.

 

Regards,

Kamil

Download All
0 Kudos
Message 13 of 21
(2,339 Views)

please, try also to remove opening file completely.

 

Let us know about your investigation!

 

Best regards,

Cezary

0 Kudos
Message 14 of 21
(2,334 Views)

Hello again,

 

Consider a tutorial http://zone.ni.com/devzone/cda/tut/p/id/11198 for logging date to disk

 

I look forward to hearing good news from you.

 

best regards,

Cezary

0 Kudos
Message 15 of 21
(2,331 Views)

Hello,

 

I checked a simple test. I just put sinusoidal wave plus my I/O connections. I added an addition timed loop to check the time. Please look an attachment. You can see that simulation does not follow real-time. The simulation time is late about 24 seconds. I put in the simulation loop synchronize loop and auto period. Does it mean that simulation loop takes much resource of hardware?

 

Regards,

Kamil

0 Kudos
Message 16 of 21
(2,323 Views)

Hello,

 

I think that you are using CRIO with very good performance - cRIO 9024 so the efficiency should be enough to perform simulation. Is it possible for you to add over the control loop time loop - I mean control loop inside the time loop and run the test again. Please, synchronize your loop control loop according to picture I sent you before. Maybe some fail inside FPGA? Is it possible to run test without FPGA? Try to remove one by one element of your system - code - and check what "absorbs" your time. Please, let me know about results!

 

Best regards,

Cezary 

0 Kudos
Message 17 of 21
(2,317 Views)

I did it as you said. But without better results (test2). Please look at pictures. I can get the same time when I remove all simulations vi's (test3). Just I left I/O connections to FPGA (test3). Please notice one thing, just removing a simple sinus wave decreesed processor resource 40% and time seems to be ok. I checked FPGA. It looks ok and the vi for FPGA is not complicated (FPGA). I checked before test with scan mode with the same results.

 

Kamil

Download All
0 Kudos
Message 18 of 21
(2,312 Views)
Solution
Accepted by topic author Nemesis

Hello,

I think that not sinus decreases time but chart. Please, remove chart and insert standard numeric output - connect with sinus. Please, try and let know.

 

Best regards,

Cezary

Message 19 of 21
(2,309 Views)

Hello again,

 

Well your idea about chart was correct. It speeded time much but I had still some difference. I fixed it finally by changing in synchronization loop 1KHz clock to 1MHz clock and I unchecked auto period and I put 1000 manually. The result is in the picture.

 

Thanks a lot. Now I will try to connect to my equipment and check if IMC is correct. If everything will be fine I will give you answer.

 

Best regards,

Kamil

0 Kudos
Message 20 of 21
(2,304 Views)