LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Keeping constant speed with variable voltage using Phidgets

I have 4 motors, 3 of which are being monitored using encoders.  What I want to be done is have the user input certain variables and then have those variables control the process.  My main program is the first attachment.  My control is the second attachment.  I call the phidget that I'm using to power my motors, Motor Controller, and it has a 0-10VDC range.  I'm using signal isolators that act as the pots for DC drive boxes that then control 90VDC motors.

 

The problem I'm having is I'm not sure how to control the voltage properly.  After the user inputs the variables, I then want the signal isolators to ramp up the voltage to get the motors to drive at the user input run speed.  All the speeds won't be exactly the same, which is why I use the "Equal-Greater-Less" VI 4 different times. (ie. The desired run speed might be 15 ft/min, but the chopper speed might need to be faster or slower depending on application.)  Once the voltage is ramped up enough to keep the motors at the desired levels, I want it to slighly adjust, if needed, to make sure that the encoders are showing the same measured speed as the desired speeds.  Currently the way I have it now, I have either 0 V or 10 V outputs.  I don't want the voltages to be extremes.  If the puller encoder is showing that the the measured speed is 14.5 and I want it to be at 15, I don't want 10V to be output to that signal isolator.  Basically, my question is, how can I have a variable voltage control for the code to try to keep the measured speed at the desired speed.

 

*I have three attachments for reference, but my main question is in the Equal-Great-Less Vi.  Also, I know there are other little things that still need to be done.  I know that my program won't run at this time.  The Event structure will also be removed at the end.  I have it in there now so I can manually control each motor by itself for testing.

0 Kudos
Message 1 of 9
(2,636 Views)

Hi ggpoly,

 

on your "Equal Great Less"-VI:

Equal-Greater-Less_BD.png

- It's RubeGoldberg to convert boolean conditions to enums just to select one of two cases…

- By moving index and output outside the inner case structure you don't need local variables…

- Comparing floats for equality is very dangerous as has been explained a lot of times before…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(2,623 Views)

Thank you for those corrections.  Now that I look at it, I don't know why I didn't see that I could get rid of the enums.  When you say that "comparing floats for equality is dangerous" do you mean that I will be ok as long as I stick with the 0V and 10 V changes or are you saying my whole Equal-Greater-Less.vi needs to be changed.  If the latter is true, do you have any recommendations on how I can still achieve my goal?

0 Kudos
Message 3 of 9
(2,611 Views)

Hi ggpoly,

 

floats are often influenced by rounding errors. So when you compare one float with another, they might have nearly the same value, but not exactly the same. And the "equal" function only accepts exactly the same to output a TRUE condition…

 

This is the reason why there is an epsilon in the numerics palette!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 9
(2,608 Views)

Ahh, okay that makes sense.  I've been trying to use the epsilon, but I can't seem to figure out how to use it.  I've looked in the Labview help (as well as online) and it doesn't really tell me how to implement it.  Am I missing something? I'm not sure where to put it into my code. 

0 Kudos
Message 5 of 9
(2,600 Views)

Hi ggpoly,

 

floats are considered "the same" when their difference is below a certain limit. You can use epsilon as this limit, but you can use any other value that is suited for your task.

 

As you seem to measure voltages in the range of 0…10V you might consider being 2 values the same, when they don't differ by more than 2mV (for a 12bit resolution ADC)…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 9
(2,596 Views)

I understand that the epsilon was going to act as the tolerance, but I'm confused on how to add that tolerance.  I was under the assumption that I wire it to the Equal? terminals some how.  Am I wrong in this assumption or are we maybe talking about two differen things?  Are you talking about adding it into the inner Case structure somehow? My two rates will be coming in at ft/min.

0 Kudos
Message 7 of 9
(2,592 Views)

Hi ggpoly,

 

I wrote about the difference between two floats:

Beispiel_VI_BD.png

You can replace epsilon by your own limit as written before…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 8 of 9
(2,590 Views)

OOOO, ok I understand now.  Thank you so much for your help

0 Kudos
Message 9 of 9
(2,588 Views)