#Transformation final value
1 messages · Page 1 of 1 (latest)
what exactly are you trying to do and which sim and aircraft
X plane 12. 154 B-2 Felis. I'm making a controller at home, where I use a 27v motor that should extend when a parameter received from the sim changes from 0 to 1, and vice versa
The motor is connected via a relay. The relay should close when the parameter increases and open when it decreases
ok and what value are reading from the sim?
DataRef
tu154b2/custom/controls/control_force_pos
this DataRef is responsible for the position of the flight loader. I have an original design. which uses a 27v gear motor that extends and retracts the rod
ok i'm not too familiar with the aircraft does that value change often?
during takeoff/landing. Performed when the flaps are extended/retracted or by using the manual switch
What are the minimum and maximum values from the sim? If you are looking for a value of 0 to 1, the Min-Max scaling function will work. Here is an explanation.
What Is The Formula For Min-max Scaling? In this informative video, we will introduce you to the concept of min-max scaling and its significance in data analysis. Min-max scaling is a method used to transform data into a specific range, typically from zero to one. This technique is essential for making data easier to compare, especially when dea...
OP mentioned using a relay to control the motor so I don't think scaling would work in this context.
i cant think of an easy way to compare a value as it changes and know if it is increasing or decreasing
Yes, scaling is not suitable. You need to get a value of 1 when the parameter starts changing from 0 to 1, and 0 when the parameter changes from 1 to 0
I asked GPT, and it advised me to use "Variable". but I couldn't figure out how to do it.
what should happen when the variable doesn't change?
as you must consider all possibilities in a process that cycles at least 10 times every second.
this variable always tends to either 0 or 1.
I mean the monitored variable is a float
if it increases you want a value of 1
if it decreases, a value of -1?
Yes
if it stays in the same value, what 0?
out of curiousity, if this motor is only controlled by pulses with either 1 or -1, how does it know how far it should go?
it has an adjustment for the length of the movement, which opens the contact
I would try using a MF variable as temporary storage
GPT suggested this method, but I can't figure out how to do it
are you running flywithlua?
I have it as a plugin, but I don't know how to program it
drop this into the scripts folder. it will give you a new dataref tu154b2/custom/controls/control_force_dir which will be -1 if decreasing 1 if increasing and 0 if not moving