This works:Math R25 IF(
R25 != R20, IF(R20 > R25, IF((R25 + (((0.0001 * (D120 - D121)) / R21))) < R20, R25 + (((0.0001 * (D120 - D121)) / R21)), R20), IF((R25 - (((0.0001 * (D120 - D121)) / R22))) > R20, R25 - (((0.0001 * (D120 - D121)) / R22)), R20))
, R25)
This won't "take".Math R25 IF(
R25 == R20, R25, IF(R20 > R25, IF((R25 + (((0.0001 * (D120 - D121)) / R21))) < R20, R25 + (((0.0001 * (D120 - D121)) / R21)), R20), IF((R25 - (((0.0001 * (D120 - D121)) / R22))) > R20, R25 - (((0.0001 * (D120 - D121)) / R22)), R20)))
I don't understand why though. It took me a long time to realize it didn't like the order. I prefer the == because I thought it might be faster if no ramp is happening.
Simplified
If(A!=B,If(etc.),A) is OK
If(A==B,A,If(etc.)) is No Go.
Why?
Just in case you are wondering, it's supposed to be a ramp. R20 input, R25 output, R21 Accel Time, R22 Decel Time, D120 Current
TICKus, D121 Previous
TICKus. I was having real timing issues trying to use a timer - 22.xx seconds to do a 20 second ramp. Real Do-more with some serial comms and VPN for me to program/monitor. I have used this concept with D2-260 and D0-06 before with the scan time,
but it is actually cleaner in DL because the scan time is a single Vmem and I don't have to do the new-previous steps and math. This is quite ugly - I was hoping for a single instruction.I think this will be going into the Dancer Simulator for the
undesirable drive following lag. My most consistent trait is inconsistency as this will be the third excuse for a linear ramp in that little program.
RAMP
HINT HINT
HINT 
Eagerly awaiting DMD 2.0 to see what we get to play with.
Happy New Year folks!
Edited 11:18PM CST Sorry to those who have seen this already, but I have had to correct some things, namely, while TICKms was working fine, it is too crude a resolution for Do-more's fast scan times so I replaced it with TICKus and cleaned up the math to get rid of the extra multiply for clarity (I had a good reason for it!).
Secondly, it was niggling in my brain that DST4 $ElapsedTicks had been mentioned by BobO as being what I wanted, but I didn't find the post and the help file doesn't really sound like it. I did just test a SINGLE INSTRUCTION Ramp that works perfectly:
MATH R25 IF(R25 != R20, IF(R20 > R25, IF((R25 + ((0.0001 * DST4) / R21)) < R20, R25 + ((0.0001 * DST4) / R21), R20), IF((R25 - ((0.0001 * DST4) / R22)) > R20, R25 - ((0.0001 * DST4) / R22), R20)), R25)
I like it!
BTW, the reason it is so involved is to prevent the output from oscillating around the input value as can happen without the extra tests.