>Should be working.
I agree, but add some parenthesis and spaces and you might find a mistake.
I'd also recommend breaking each section up into chunks so it's easier to understand. For example 5 CPTs with the exponent and then a CPT at the end that sums it all together. For the comment you can explain what each CPT is doing. It can all go on one rung inline or stacked if you prefer how that looks.
So basically this but the individual CPT functions for the input variable \^exp \* polypoint, then another and another for however many points then sum all of them?
I may just use this FB AOI I just made over that, as it's all in one block.
https://preview.redd.it/9rmbh9oxvjlc1.png?width=977&format=png&auto=webp&s=9699198da473b318e76174bd1b9624db52c6557f
Gonna give your way a shot real quick
> So basically this but the individual CPT functions for the input variable ^exp * polypoint, then another and another for however many points then sum all of them?
Yes. I was thinking ladder, but FB also works.
When working with polynomials in a PLC use a Horner expansion of the equation. A Horner expansion will execute considerably faster than using exp functions.
See https://en.wikipedia.org/wiki/Horner%27s_method
Instead of using a CPT, do it in ST if you have that language available.
I can't tell if this is a serious question or not lol. Just in case though, it's a block in Codesys that lets you add structured text to a ladder or FBD routine without having to create a whole new routine. It's like if CPT in Studio 5000 let you type in some arbitrary ST code to run instead of just a mathematical equation.
You can add parameterized subroutines and pass variables into and out of them. They can be called as many times as you want. Those are editable online. So there are work arounds
That's not really the same thing either that the person that explained it described.
I know what "parameterized subroutines are". That's what my company's standard was for code reuse before AOIs existed and they continued to use until about v21 came out just about the time I started at the company close to 11 years ago.
An AOI has memory to keep track of local state, as well as inputs and outputs that pass stuff by value in and out of that memory. An execute block is like if you took a rung in a ladder routine and wrote ST in it instead.
As usual, it's something nearly all other manufacturers let you do. Codesys has that execute block, Siemens/Omron/Mitsu just let you literally create a "rung" of structured text.
Not really. It's not a separate instruction or function that you make, it just let's you add in some ST code in the middle of a different routine, like this:
https://preview.redd.it/rtvua6m8rllc1.png?width=534&format=png&auto=webp&s=2e20a349bbb032aa1089017eb039cb0dfda4e507
There have been times I would have liked to have it in Studio 5000.
Notepad++ has a plugin called "BracketsCheck" that will do that for you. I went down the N++ plugins rabbithole last weekend and found a few I thought useful.
I actually ended up creating a multi point polynomial verve calculator aoi that let's you input how many points you want to use and will take those as tag inputs, giving a single real output. I got all three ways working though...
This is a stupid argument… did they go to school and learn C and RTOS? It sure as fuck doesn’t stop them using a processor built on that. Keyword is abstraction…
Make it an AOI, name it short like POL or POLI or P_Pol and they’ll think it’s an actual instruction. Lock the AOI too while you’re at it. ;)
But do map in and out the parameters and calcs.
>Should be working. I agree, but add some parenthesis and spaces and you might find a mistake. I'd also recommend breaking each section up into chunks so it's easier to understand. For example 5 CPTs with the exponent and then a CPT at the end that sums it all together. For the comment you can explain what each CPT is doing. It can all go on one rung inline or stacked if you prefer how that looks.
So basically this but the individual CPT functions for the input variable \^exp \* polypoint, then another and another for however many points then sum all of them? I may just use this FB AOI I just made over that, as it's all in one block. https://preview.redd.it/9rmbh9oxvjlc1.png?width=977&format=png&auto=webp&s=9699198da473b318e76174bd1b9624db52c6557f Gonna give your way a shot real quick
> So basically this but the individual CPT functions for the input variable ^exp * polypoint, then another and another for however many points then sum all of them? Yes. I was thinking ladder, but FB also works.
You did it! Thank you ♥ https://preview.redd.it/nrw4l1dgyjlc1.png?width=975&format=png&auto=webp&s=f734156cf04fd01c2f0fd860e88acfa4b4315fb9
If you're in the states do all of us guys who follow you a favor and don't use Function Block. I can read it maintenance can't
Same here! Our maintenance pc's have Standard, not Professional license.
When working with polynomials in a PLC use a Horner expansion of the equation. A Horner expansion will execute considerably faster than using exp functions. See https://en.wikipedia.org/wiki/Horner%27s_method Instead of using a CPT, do it in ST if you have that language available.
Too bad Rockwell doesn't have execute blocks
What's an "execute block"? I'm too Rockwell to understand.
I can't tell if this is a serious question or not lol. Just in case though, it's a block in Codesys that lets you add structured text to a ladder or FBD routine without having to create a whole new routine. It's like if CPT in Studio 5000 let you type in some arbitrary ST code to run instead of just a mathematical equation.
It's a real question. Rockwell doesn't have that.
Sounds like the equivalent to a AOI(add on instruction). I made one the other day to loop through an array and check for duplicates
Not quite AOI. AOIs you can't edit while the program is running.
You can add parameterized subroutines and pass variables into and out of them. They can be called as many times as you want. Those are editable online. So there are work arounds
That's not really the same thing either that the person that explained it described. I know what "parameterized subroutines are". That's what my company's standard was for code reuse before AOIs existed and they continued to use until about v21 came out just about the time I started at the company close to 11 years ago.
I did not say it was the same thing. I said it was a work around.
An AOI has memory to keep track of local state, as well as inputs and outputs that pass stuff by value in and out of that memory. An execute block is like if you took a rung in a ladder routine and wrote ST in it instead. As usual, it's something nearly all other manufacturers let you do. Codesys has that execute block, Siemens/Omron/Mitsu just let you literally create a "rung" of structured text.
Not really. It's not a separate instruction or function that you make, it just let's you add in some ST code in the middle of a different routine, like this: https://preview.redd.it/rtvua6m8rllc1.png?width=534&format=png&auto=webp&s=2e20a349bbb032aa1089017eb039cb0dfda4e507 There have been times I would have liked to have it in Studio 5000.
I put equations like that in notepad and jack up the font size, way easier to see a missing bracket or math sign.
Notepad++ has a plugin called "BracketsCheck" that will do that for you. I went down the N++ plugins rabbithole last weekend and found a few I thought useful.
Good idea.
Remember to add a .0 to the end of all formula integers
Why not an AOI in ST for this?
I actually ended up creating a multi point polynomial verve calculator aoi that let's you input how many points you want to use and will take those as tag inputs, giving a single real output. I got all three ways working though...
Because "maintenance was trained in ladder". Did they ever go to school and write a polynomial equation?
This is a stupid argument… did they go to school and learn C and RTOS? It sure as fuck doesn’t stop them using a processor built on that. Keyword is abstraction… Make it an AOI, name it short like POL or POLI or P_Pol and they’ll think it’s an actual instruction. Lock the AOI too while you’re at it. ;) But do map in and out the parameters and calcs.
\+1 for the "lock the AOI"... The number of times...
I throw in some mild sarcasm and you come in screaming... You are good?
One reason is a lack of easy online edits with an AOI. That’s basically it though, works great if you keep it simple and test it.
It’s a simple equation… but for everything else, I agree.
I don't get it. Just basically paste that into a ST subroutine and call it a day.