Host Engineering Forum

General Category => Do-more CPUs and Do-more Designer Software => Topic started by: Ingeniero on May 12, 2016, 02:59:00 AM

Title: XY Curve
Post by: Ingeniero 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.
Title: Re: XY Curve
Post by: franji1 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.
Title: Re: XY Curve
Post by: Controls Guy 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.
Title: Re: XY Curve
Post by: Ingeniero 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.
Title: Re: XY Curve
Post by: Ingeniero 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.
Title: Re: XY Curve
Post by: Controls Guy on May 12, 2016, 03:57:29 PM
Glad you got it working!   :)
Title: Re: XY Curve
Post by: Ingeniero 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.
Title: Re: XY Curve
Post by: Controls Guy 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.
Title: Re: XY Curve
Post by: plcnut 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))
Title: Re: XY Curve
Post by: Mike Nash 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 !.  ;)
Title: Re: XY Curve
Post by: BobO on May 13, 2016, 08:21:38 AM
Glad y'all like MATH, but LERP would work very well for this.
Title: Re: XY Curve
Post by: Mike Nash 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.
Title: Re: XY Curve
Post by: franji1 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  |
-] [-+
Title: Re: XY Curve
Post by: BobO 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.
Title: Re: XY Curve
Post by: Controls Guy 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).
Title: Re: XY Curve
Post by: BobO on May 13, 2016, 10:52:26 AM
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).

Math nerds. ::)
Title: Re: XY Curve
Post by: Controls Guy on May 13, 2016, 10:52:39 AM
For example...

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

is the same as

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


Like I was saying before, in certain scenarios MATH actually IS the best way to do boolean logic, like the 1 box for 32 rungs trade.  Weird, but true.
Title: Re: XY Curve
Post by: Controls Guy on May 13, 2016, 10:54:09 AM
Math nerds. ::)

Why, thank ya! [tips hat]   ;)
Title: Re: XY Curve
Post by: plcnut on May 13, 2016, 10:54:33 AM
You either have a typo, or you have found an undocumented usage of !.  ;)
Nice catch Mike! ;D
I have a bad habit of holding down SHIFT for 2 keystrokes... It manifests itself in all kinds of strange code. Im really glad for Microsofts auto-complete in Visual Studio, or else my C# code would never work.
Title: Re: XY Curve
Post by: BobO on May 13, 2016, 10:56:57 AM
Why, thank ya! [tips hat]   ;)

Franj is actually a Carnegie-Mellon math major who happens to write software. He does Calculus for funsies. I can spell Calculus correctly 2 times out of 3. If I have spell check.
Title: Re: XY Curve
Post by: Controls Guy on May 13, 2016, 10:59:25 AM
What's Cal-cool-us?  [Stand and Deliver reference]

What does it say that there are actually math nerd movies and I love them?
Title: Re: XY Curve
Post by: Controls Guy on May 13, 2016, 11:05:01 AM
Franj is actually a Carnegie-Mellon math major who happens to write software. He does Calculus for funsies.

Yeah, I'm a [not very well] recovering addict myself.
Title: Re: XY Curve
Post by: BobO on May 13, 2016, 11:08:20 AM
Yeah, I'm a [not very well] recovering addict myself.

Member of the local "Friends of Isaac N" chapter?
Title: Re: XY Curve
Post by: Controls Guy on May 13, 2016, 11:15:30 AM
I haven't solved an indefinite integral in three days.
Title: Re: XY Curve
Post by: franji1 on May 13, 2016, 11:28:19 AM
It wasn't that bad to have Calculus with Physics I, II, III, but I knew I was in the "nerd" group when the MATH major Prob/Stat class ALSO had Calculus.

Engineers at CMU only had to take the "Prob/Stat for Engineers", which did NOT have Calculus.  There were 3 levels of Prob/Stat at CMU:
Prob Stat for Humanities
Prob Stat for Engineers
Prob Stat for Math

Funny, but I don't EVER remember there being
Shakespeare for Math/Engineers
Shakespeare for Humanities
or
World History for Math/Engineers
World History for Humanities

 ;D
Title: Re: XY Curve
Post by: Controls Guy on May 13, 2016, 12:11:06 PM
Exactly.  We have to have their stuff or we're not "well rounded", whereas they only have to do the dumbed down version of our stuff.  I guess it's not considered critical whether the artsy-fartsy types are "well rounded" or not!   :D
Title: Re: XY Curve
Post by: franji1 on May 13, 2016, 02:05:51 PM
Mathematics is the language with which God has written the Universe - Galileo

That's all I have to say about that - Forrest Gump (concurred by franji1)
Title: Re: XY Curve
Post by: Controls Guy on May 13, 2016, 02:11:48 PM
We need a "Like" button.
Title: Re: XY Curve
Post by: plcnut on May 13, 2016, 02:28:11 PM
We need a "Like" button.
That would be nice, but PLEASE don't use the forum software that AD uses. I still cannot check for new posts without going through 4 clicks minimum, and you still can't tell for sure if you have checked them all...
Title: Re: XY Curve
Post by: b_carlton on May 13, 2016, 05:21:59 PM
My company is lucky they didn't have major math intensive projects. My highest math was high school Algebra and Geometry (though I loved Physics and Chemistry). My degree was a BA in History (not even 'Calculus for Humanities' - though in a Logic class I proved part of our textbook was wrong). I was saved by Electronics training in the Air Force.
Title: Re: XY Curve
Post by: Controls Guy on May 13, 2016, 05:37:05 PM
Bernie, it's not so much that what I do is inherently math intensive as it is that I tend to view ANYTHING as a math problem, work it out, and stick the solution in a MATH box.  Another programmer would probably find another approach more rational.  (pun intended)

It's also quite possible that your unconventional (for a controls guy) education gives you an edge on certain projects.  It's not exactly the same, but take as an analogy what I've seen as I've wandered from one industry to another.  Sometimes I'll look at something and think "Oh, in the X business we'd just do Y", and sometimes it turns out to be a more practical or better quality solution than the one that's standard in the new industry.
Title: Re: XY Curve
Post by: plcnut on May 13, 2016, 07:44:16 PM
Much of what I have been able to do in the PLC world has only been possible because I did not know how it was "supposed" to be done.Nobody was there to tell me "you can't do that" until it was already being done. Do-more has been a big part of that  ;D
Title: Re: XY Curve
Post by: Mike Nash on May 13, 2016, 09:07:00 PM
Maybe we could convince someone to rename the MATH box to BACON. They both work so well with everything!
Title: Re: XY Curve
Post by: BobO on May 13, 2016, 09:19:11 PM
Much of what I have been able to do in the PLC world has only been possible because I did not know how it was "supposed" to be done.Nobody was there to tell me "you can't do that" until it was already being done. Do-more has been a big part of that  ;D

I have pretty good information that you personally use more of Do-more than any user we have, and I attribute a big part of that to coming to it with no preconceptions. Without endorsing any particular political ideology, I'll borrow a famous Reagan quote: "It isn't so much that PLC users are ignorant. It's just that they know so many things that aren't so."
Title: Re: XY Curve
Post by: Controls Guy on May 14, 2016, 11:06:53 AM
Maybe we could convince someone to rename the MATH box to BACON. They both work so well with everything!

...plus that opens up the opportunity to develop an expression for the LN(403.428) degrees of separation.
Title: Re: XY Curve
Post by: Mike Nash on May 14, 2016, 05:59:29 PM
Maybe we could convince someone to rename the MATH box to BACON. They both work so well with everything!

...plus that opens up the opportunity to develop an expression for the LN(403.428) degrees of separation.

I think I heard a whooshing noise as that went overhead. Very clever - it took me awhile online to "get it".
Title: Re: XY Curve
Post by: BobO on May 14, 2016, 06:21:06 PM
I think I heard a whooshing noise as that went overhead. Very clever - it took me awhile online to "get it".

I think this is what you are looking for: https://oracleofbacon.org/ (https://oracleofbacon.org/)
Title: Re: XY Curve
Post by: Garyhlucas on May 15, 2016, 09:08:11 PM
Bernie, it's not so much that what I do is inherently math intensive as it is that I tend to view ANYTHING as a math problem, work it out, and stick the solution in a MATH box.  Another programmer would probably find another approach more rational.  (pun intended)

It's also quite possible that your unconventional (for a controls guy) education gives you an edge on certain projects.  It's not exactly the same, but take as an analogy what I've seen as I've wandered from one industry to another.  Sometimes I'll look at something and think "Oh, in the X business we'd just do Y", and sometimes it turns out to be a more practical or better quality solution than the one that's standard in the new industry.

Yep I've signed non disclosure agreements before seeing a secret process only to see something commonly done in other industries they were not familiar with!
Title: Re: XY Curve
Post by: Ingeniero on May 16, 2016, 03:00:41 AM
Maybe we could convince someone to rename the MATH box to BACON. They both work so well with everything!

bacon is great
Title: Re: XY Curve
Post by: Controls Guy on May 16, 2016, 12:04:09 PM
We have a family fried who's a chef, who calls bacon "the duct tape of food"!   :D
Title: Re: XY Curve
Post by: ADC Product Engineer on May 17, 2016, 10:36:41 AM
Yep I've signed non disclosure agreements before seeing a secret process only to see something commonly done in other industries they were not familiar with!

I walked into a pilot plant once that was doing biomass burning to create steam to run a turbine.  I walked up to the unit and was standing there looking at it when the chief engineer came up beside me.

CE: "What do you think?"

Me: "Looks like a gasification kiln to me."

CE: -jaw hits the floor with a loud thud-  "Shhh...  We have investors in the building."

Me: "Sorry."  Whispers, "It looks like a gasification kiln to me.  Those things were being used back in the early 20th Century.  I've worked on a ton of them."
Title: Re: XY Curve
Post by: Controls Guy on May 17, 2016, 06:52:57 PM
It looks like a gasification kiln to me.  Those things were being used back in the early 20th Century.  I've worked on a ton of them.

Everything old is new again!   :D

When I worked for an equipment OEM, I was looking over the ME's shoulder one day and he's drawing an assembly with several machined and anodized aluminum plates screwed together, plus a solenoid and a limit switch.    I'm thinking it's some kind of door locking mechanism and he needs it to have positive feedback to the control system or something, so I ask him what it is.  He explains that in a mechanism he's designing, there is a signal in a circuit of one voltage that needs to be sent to another, different voltage circuit, without electrically connecting the two.  [facepalm]  He actually just built a relay from first principles.  I didn't know whether to be impressed or horrified.

I say “Congratulations Joe, you've invented the relay!!  And only 150 years too late!  Are you aware those can be purchased for $3 apiece, and we inventory them in the stockroom by the 20-ct carton?”

At least I can say I know the guy that invented the relay.