News:

  • June 07, 2026, 07:48:40 AM

Login with username, password and session length

Author Topic: XY Curve  (Read 68872 times)

Ingeniero

  • Full Member
  • ***
  • Posts: 45
XY Curve
« on: May 12, 2016, 02:59:00 AM »
I dont see a XY curve function in Do-more. To make a curve with two breaks required 5 rungs and a little bit of thought.  :'( :P

Does do-more have a XY curve function.

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3827
    • Host Engineering
Re: XY Curve
« Reply #1 on: May 12, 2016, 06:30:47 AM »
SCALE performs a simple linear scale given 2 points as the "line"

LERP lets you emulate a curve with multiple points to describe a curve, using linear interpolation between the points.

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3607
  • Darth Ladder
Re: XY Curve
« Reply #2 on: May 12, 2016, 12:03:25 PM »
I dont see a XY curve function in Do-more. To make a curve with two breaks required 5 rungs and a little bit of thought.  :'( :P

Does do-more have a XY curve function.

Derive the equation and put it in a MATH box.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

Ingeniero

  • Full Member
  • ***
  • Posts: 45
Re: XY Curve
« Reply #3 on: May 12, 2016, 03:55:47 PM »
""Derive the equation and put it in a MATH box.""

that is what I did,

There are two flat spots where I used the less than and great than.

Ingeniero

  • Full Member
  • ***
  • Posts: 45
Re: XY Curve
« Reply #4 on: May 12, 2016, 03:57:25 PM »
Quote
SCALE performs a simple linear scale given 2 points as the "line"

LERP lets you emulate a curve with multiple points to describe a curve, using linear interpolation between the points.

I have to look into these.

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3607
  • Darth Ladder
Re: XY Curve
« Reply #5 on: May 12, 2016, 03:57:29 PM »
Glad you got it working!   :)
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

Ingeniero

  • Full Member
  • ***
  • Posts: 45
Re: XY Curve
« Reply #6 on: May 12, 2016, 03:59:35 PM »
the math function is cool, instead of using some bloatware function you have to think about what you are doing, takes a little longer but it is probably better code.

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3607
  • Darth Ladder
Re: XY Curve
« Reply #7 on: May 12, 2016, 11:32:10 PM »
I love them.  I have one 200+ rung program with about 200 MATH boxes.  I even do bulk booleans in them.   I have one box that replaced 32 rungs of traditional boolean ladder.  If Do-More had 64-bit registers (or 2D arrays addressable across either axis), I could replace 64 rungs or whatever, almost without limit.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

plcnut

  • Hero Member
  • *****
  • Posts: 814
    • premiersi.com
Re: XY Curve
« Reply #8 on: May 13, 2016, 07:12:56 AM »
There are two flat spots where I used the less than and great than.
Check the IF() instruction inside your MATH box.

Code: [Select]
IF(D1>=10&&D1<=20,D!*3,IF(D1>=50$$D1<=60,D1*4,D1*5))
Circumstances don't determine who we are, they only reveal it.

~Jason Wolthuis
Premier Systems Integration, LLC
http://premiersi.com

Mike Nash

  • Hero Member
  • *****
  • Posts: 652
Re: XY Curve
« Reply #9 on: May 13, 2016, 08:07:23 AM »
There are two flat spots where I used the less than and great than.
Check the IF() instruction inside your MATH box.

Code: [Select]
IF(D1>=10&&D1<=20,D!*3,IF(D1>=50$$D1<=60,D1*4,D1*5))

You either have a typo, or you have found an undocumented usage of !.  ;)

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6158
  • Yes Pinky, Do-more will control the world!
Re: XY Curve
« Reply #10 on: May 13, 2016, 08:21:38 AM »
Glad y'all like MATH, but LERP would work very well for this.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

Mike Nash

  • Hero Member
  • *****
  • Posts: 652
Re: XY Curve
« Reply #11 on: May 13, 2016, 09:51:58 AM »
There are two flat spots where I used the less than and great than.
Check the IF() instruction inside your MATH box.

Code: [Select]
IF(D1>=10&&D1<=20,D!*3,IF(D1>=50$$D1<=60,D1*4,D1*5))

You either have a typo, or you have found an undocumented usage of !.  ;)

Must have been niggling in the back of my brain because $$ ain't valid either.  ;D

Glad y'all like MATH, but LERP would work very well for this.

After awhile all problems look like a MATH solution just works. I kept getting hung up on not having conditional instructions that could do the math inline when I needed it and it just built from there.

Now I am realizing I do a lot of -||- ST1 -[MATH]- before I even start figuring where I am going with it.

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3827
    • Host Engineering
Re: XY Curve
« Reply #12 on: May 13, 2016, 10:49:10 AM »
Now I am realizing I do a lot of -||- ST1 -[MATH]- before I even start figuring where I am going with it.
For example...

MATH Y0 "(X0 || X1) && !C42"

is the same as

Code: [Select]
X0    C42        Y0
-] [-+-]/[--------( )
     |
 X1  |
-] [-+

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6158
  • Yes Pinky, Do-more will control the world!
Re: XY Curve
« Reply #13 on: May 13, 2016, 10:50:10 AM »
After awhile all problems look like a MATH solution just works. I kept getting hung up on not having conditional instructions that could do the math inline when I needed it and it just built from there.

Now I am realizing I do a lot of -||- ST1 -[MATH]- before I even start figuring where I am going with it.

In the end, you'll use what works best for you. There is no wrong answer if it works like you want and is maintainable.

When we decided to add boolean operators to MATH, we knew it was possible to do much more than traditionally done in PLC math and that it really had become ST-Lite. Glad to see that others agree.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3607
  • Darth Ladder
Re: XY Curve
« Reply #14 on: May 13, 2016, 10:50:29 AM »
Glad y'all like MATH, but LERP would work very well for this.

LERP's only going to give straight segments hooked together.  MATH can give you the real curve (or several real curves over segmented domains stitched together the same way the LERP approximation does with straight lines).
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.