Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

real time PID control problem

Hi
 
I am quite novice to Real time PID control implementation using PXI. I wrote a single channel rt -PID AI/AO program for my PXI system. I followed the example program to write the deterministic program using shared variable to communicate with the host program. But the program doesn't work. Sometimes the analog output doesn't update and soemtimes the analog input doesn't work. I am uploading the deterministic program for checking. I will appreciate any help in thi regard.
thanks
Rahul
0 Kudos
Message 1 of 7
(5,544 Views)
Hi Rahul,
 
You mentioned that the analog input and output do not always work. 
 
1)  How are you determining this? 
 
2)  Are you monitoring the shared variables with your host VI?
 
3)  Could you please upload your shared variable library?
 
I'm happy to help but I will need a little more information.
 
Regards,
Elizabeth S.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 7
(5,504 Views)

Hello,

Rahul - please just make a zip-file of your entire project and upload it so we can look at the code.

Regards,
Jimmie Adolph
Systems Engineering Manager, National Instruments Northern European Region

0 Kudos
Message 3 of 7
(5,473 Views)
Hi
 
Thanks for your reply. I am uploading the complete project file for your consideration.
 
Looking forward for your suggestions.
 
Rahul
0 Kudos
Message 4 of 7
(5,439 Views)

Hi Rahul,

 

I have been working with your application and the analog input task is working fine with my data acquisition card.  However, I did have to change the local terminal name to ai/SampleClock.  I am interested to know how you are determining whether or not the analog I/O is working.  If you are using the graphical indicators on the host VI, then the problem may be related to shared variables or networking issues. 

 

Please add an indicator to the data node of the DAQmx Read.vi  When you run the target VI you should see the data indicator updating.  If it does not update, please go into Measurement and Automation Explorer (MAX) to determining whether or not the data is being acquired.  It is possible that you are running into a hardware problem.  If the data indicator does update, but the Sensor Output plot does not seem to update, then we need to look at the shared variables. 

 

Please open the Variable Manager by going to Tools >> Shared Variables >> Variable Manager.  Right-click on your shared variables and add them to the watch list.  Please check if the values are updating as you run your application.  Also, please note if there are any error codes associated with a particular variable. 

 

Regards,

Elizabeth S.

Applications Engineer

National Instruments

0 Kudos
Message 5 of 7
(5,400 Views)

Hi Elizabeth

Thanks a lot for your reply. I checked with the MAX and the device is working fine. But the target vi program was not updating the analog input indicator. I used rt communication wizerd to develop the program again and this time both AI/AO worked fine. But I changed the while loop to timed loop for control loop time and it also worked fine. But after two or three times running, the target vi no longer runs continuously and so I had to press continuous run button of the vi. This time the host vi can communcate well to the target vi and AI/AO works fine, but the stop command doesn't work for the target vi as it runs continuously. I am uplaoding the updated project with both the target vi versions. Please let me know what went wrong.

Thanks again

Rahul

 

0 Kudos
Message 6 of 7
(5,377 Views)

Hi Rahul,

 

Your target VI stops based on your third stop condition; that it finishes late and 999 is less than or equal to i.  One problem may be your use of shared variables within a time critical loop.  Please take a look at the following link. 

 

http://forums.ni.com/ni/board/message?board.id=280&message.id=2140&view=by_date_ascending&page=1

 

This could also be caused by the PID.vi which has performance limitations for LabVIEW Real-time.  This is determined by your hardware.  Which controller and PXI card are you using for this application? 

 

Based on your fast timing settings and code within your timed loop, the application is not staying on time.  If you monitor the loop time, you should see an increase in the iteration time.  

 

Regards,

Elizabeth S.

Applications Engineer

National Instruments

0 Kudos
Message 7 of 7
(5,311 Views)