Motion Control and Motor Drives

cancel
Showing results for 
Search instead for 
Did you mean: 

Question about the setpoint on the pid vi.

I have a vi that incorporates a PID loop.  For testing purposes, the "Setpoint" terminal is currently setup with a front panel slide control so I can test the loop.  However, and for permanent loop control, I have a text file with 2 columns of data; one column contains time in seconds, the second column contains the actual setpoint value to be used in actual operation. The setpoint input to the PID vi, should be based on the correlation between the time value in the first column of the file and the corresponding setpoint value in the second column.
I have set up a seperate vi which reads the file and, through an index array, have extracted the data into two 1D arrays. 
I cant programmatically determine how to provide the setpoint value to the PID vi based on the time value in the same file. 
Thanks,
Wayne Hilburn
0 Kudos
Message 1 of 4
(3,631 Views)
I suppose I should ask a question?Smiley Surprised, sorry I forgot.....
Can someone help me with my problem posted above???
Thanks again,
Wayne
0 Kudos
Message 2 of 4
(3,614 Views)
Wayne,

Is there any relationship between the time and the setpoints? That will be the first thing to identify. Once this relation is defined you can write a simple VI that will set the setpoints based on the time stamp you have. The VIs in the 'Time and Dialogue' might help you to create the relation between the time values you have and the system time. I think, if you give some more details on how the time stamps and the setpoints are related, we can give you more specific suggestions.,

Regards,
Ame G.
National Instruments
0 Kudos
Message 3 of 4
(3,592 Views)

 

 

 

Thanks for your reply Ame,

Your question was "Is there any relationship between the time and the setpoints?"   The answer here is yes.  I have attached an example.txt file to show you how the data origionates.  When the vi starts, the file dialog opens, then the user will select the file.  The resolution of the data in the file is based on 1 second increments.  In addition to the origional question, I would like to know how to interpolate the data to various points of resolution based on observation of the file I have attached;  As it stands, the data is at 1 second intervals, I would like to interpolate data to values at rate of 10 times per second, or 100msec.  I wrote and attached a vi that provides what I am looking for but I dont know if it is the proper approach to solving my problem; it is the Read text file4.vi below.  I am simply counting in a For Loop 1 time per second for the maximum index value of the time column of data, and outputing the setpoint value.  If I wanted to speed up the For Loop, I would in turn want to interpolate the time and setpoint data to correspond to the same rate as the execution rate of the For loop;  if I interpolated the data to a rate of 10 times per second, then I would set the execution rate of the FOR loop to 100msec.  I also am attaching a .jpg to show the actual PID vi i am using. 

 

Download All
0 Kudos
Message 4 of 4
(3,582 Views)