LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Inversed slide?

Hi,

 

In my project slider gives me one of the numbers that is being sent to controller.

 

What I want to do to finish it ,to inverse slide that the minimum value (visually) would give the maximum value. I'm using slider expressed as percentage slide. 0% value of slide now gives 100% of power in controller.  And the 100% value of slide gives 0% of power in controler. Command sent to controller is expressed via cosine, so I guess that's why I'm facing this problem. =ACOS(SQRT(percentage))*180 / (2*PI())*43,333*2

 

I think the easiest way to fix it, is to customize slider, but I don't know how to solve this fully,because inverse function reverses direction of the slide, but also changes numbers below the slider, and changes blue/silver indication.

 

 But if it's possible to inverse it in block diagram that would be better,because I will want to add possibility to enter value manually,so only changing the slider visually will cause problem.

 

 

EDIT: SOLVED
Just needed to subtract slider value from 100

 

Download All
0 Kudos
Message 1 of 7
(2,771 Views)

Lets sort it out:

 

sqrt(percentage) runs from 0 to 10 (because sqrt(100) = 10 and sqrt(0) = 0).

acos(0) = pi/2 (or 90°) and acos(10) = invalid, because cos is limited to [-1..1].

Guess, if the controller receives an invalid value, it defaults to minimum power (which would make sense in terms of

security).

Now, for slider being to the left (0%) we calculate (assuming the standard angle unit of radians):

(pi/2)*180°/(2*pi)*43,333*2 = 90°*43,333 = 3899,97°. Why on earth should some controller designer assign 100% power to a value of 3899,97°?

Probably the controller defaults to 100% for values larger than the maximum and thats why you get 100% power.

If we use pi instead of 180° (to have everything in radians) we get: pi/2*43,333 = 68,07 which turns out to be another unreasoned value.

 

The consequence of this issue is, that you should obtain an indepth understanding of your formulas before implementing them and maybe practice some basic trigonometry.

 

 

 

0 Kudos
Message 2 of 7
(2,715 Views)

Result of the formula is position of stepper motor. Power depends on position of stepper motor. Before sqrt function I divide the value from 100 to get it from 0 to 1.

0 Kudos
Message 3 of 7
(2,706 Views)

Could you specify a little more clearly which stepper motor position belongs to 0% and which to 100% and what you want to calculate

from the slider position? Why do you use a nonlinear relation, how is stepper motor position related to power? Can you say some words to your calibration constants?

Sorry about pushing on you, but there seems to be something wrong with the formula.

 

 

0 Kudos
Message 4 of 7
(2,689 Views)

Stepper motor position 3900 belongs to 100% of power, position 0 belongs to 0% of power. From slider position I'm calculating stepper motor position which is related to power.

There's a optical lense attached to stepper motor and depending on its position laser diode power is determined.

0 Kudos
Message 5 of 7
(2,669 Views)

Why don't you just calculate:

 

Scalervalue*3900, what do you want to archive with the acos function?

 

0 Kudos
Message 6 of 7
(2,656 Views)

Because dependence is nonlinear.

I'm very thankful for your help, I've solved my main problem.

 

Thanks for your time.

0 Kudos
Message 7 of 7
(2,652 Views)