07-25-2011 09:57 AM
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
07-25-2011 10:43 AM
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
07-25-2011 11:00 AM
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
07-25-2011 11:27 AM
please, try also to remove opening file completely.
Let us know about your investigation!
Best regards,
Cezary
07-25-2011 12:55 PM
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
07-26-2011 04:21 AM
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
07-26-2011 04:45 AM
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
07-26-2011 05:08 AM
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
07-26-2011 05:29 AM
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
07-26-2011 07:09 AM
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