03-05-2018 03:39 PM
Greetings,
First thing, I'm a LabVIEW noobie.
SETUP:
OS: Windows 7
Software: LabVIEW 13.1
DAQ: NI USB-6009
CVS is displacement per second. (Each line is 1 second)
Problem: Controlling a linear actuator by using a string pot voltage output and a specified control curve (displacement per second in an excel file) to simulate a ~45 minute cycle.
What I'm trying to do is compare the displacement of the actuator (from the voltage off the string pot converted from voltage per inch to show displacement) to the numerical displacement in the csv file. If the displacement in the excel file at a given time is larger than the displacement calculated at the string pot I want to have a digital output on my NI USB-6009 to send a high signal to my extend input on the actuator. If the displacement is smaller, high signal to the retract.
How would I go about creating a curve from the CSV in a way that I can compare to the displacements?
Thanks,
Matthew
Solved! Go to Solution.
03-05-2018 03:49 PM - edited 03-05-2018 03:51 PM
03-05-2018 03:57 PM
@GerdW wrote:
Hi Matthew,
are you trying to setup a PID control loop?
On your question: sounds like an array of (setpoint) values with respect to time...
Wasn't intentionally creating a PID controller. I guess you could look at it as a really simple one. Just trying to see if I can wear out this actuator.
Would I feed the array with the values of the excel file?
03-05-2018 04:05 PM
03-05-2018 04:39 PM
You say
"CVS is displacement per second. (Each line is 1 second) "
Which I assume you mean you have a spreadsheet file, comma-separated, of the target velocity profile. You can load the CSV file using the Read spreadsheet file vi with ',' as your delimiter.
As for control, you can only tell your device to go forward or backward at a constant velocity? Indeed, you could create a PID that controls the duty cycle of a PWM that tries to follow the velocity profile. The 6009 would be terrible for this though because it's counter can't be used as a PWM and it has no FIFO for any of its outputs. So like, you're kinda stuck just turning on and off the DOs every second. That is kinda crappy. Updating DOs and AOs can't be done faster than a few hundred Hz.
You could also change your set points from velocity to position by doing a running sum of the CSV file. Then comparing the voltage from your encoder to the file knowing the displacement / volts constant of your controller.
Just some ideas.