PLCS.net - Interactive Q & A

PLCS.net - Interactive Q & A (http://www.plctalk.net/qanda/index.php)
-   LIVE PLC Questions And Answers (http://www.plctalk.net/qanda/forumdisplay.php?f=2)
-   -   second order equation implementation if controllogix (http://www.plctalk.net/qanda/showthread.php?t=114157)

Osias1970 February 8th, 2018 09:14 AM

second order equation implementation if controllogix
 
1 Attachment(s)
Hello,
I want to implement second order differential equation in controllogix using RSlogix 5000. The equation as attached.
How to implement it?

Thanks.

jstolaruk February 8th, 2018 09:22 AM

The math operations exist, break it down into smaller components. Epsilon may have to be hardwired. Down side? Floating point in Controllogix is only 32bit.

Tom Jenkins February 8th, 2018 09:42 AM

Why would you want to solve a differential equation in a PLC?

I suggest the first thing you do is substitute for the differentials in the first equation, and then solve for y - which I assume is your output value from a control algorithm. Then you can enter the equation in ladder logic as a straight algebraic equation using the ControlLogix math functions.

Osias1970 February 8th, 2018 10:08 AM

I have math formula for application that required second order equation.

Tom Jenkins February 8th, 2018 01:11 PM

1 Attachment(s)
OK - but you also show the equivalents of the derivatives. So attached is the substitution. Now solve for your dependent (output) variable using ordinary algebra and, magically, the differentials are gone.

Aardwizz February 8th, 2018 01:20 PM

PLCs don't "solve" equations; they use equations to calculate values.

If you substitute your bottom 2 equations into your first, you get:

kČekx - 3kekx + 2y = 0

or

y = - (kČekx - 3kekx) ) / 2

Measure x with the PLC, you can calculate y.

If you're measuring y, well then god help you figure out how to solve the equation for x.

[EDIT: Tom beat me to the same answer]

Steve Bailey February 8th, 2018 01:32 PM

Based on the equations for the first and second derivatives, you already know that y is equal to e to the power kx, so you can calculate the value of y for any value of x if k is a known constant. Is your need to find a value of k for each value of x to satisfy the differential equation?

Osias1970 February 8th, 2018 06:14 PM

1 Attachment(s)
Thank you for reply.
d2y(t)/dt2 = ab 2 e bt (second order differential as attached image)
How to solve y(t)?

Tom Jenkins February 9th, 2018 08:38 AM

This isn't really a PLC problem, is it?

Peter Nachtwey February 9th, 2018 09:51 AM

bingo!!! It took this long to figure that out.
 
Quote:

Originally Posted by Tom Jenkins (Post 768104)
This isn't really a PLC problem, is it?

There are two poles. one at 1 and the other at 2. Both of the there will cause what ever it is to ''blow up" or go to infinity shortly.

On pole will be exp(t) and the other exp(2*t)

There is no forcing function of input to this differential equation either.
Yes, i can pretty much do simple diffEQs like this in my head.

A more realistic problem would be y``+3*y`+2*y=f(t)
notice that if f(t)=2 then y will be equal to 1 so the gain is 1/2.
Now the two poles are negative and will decay over time and there is a forcing function that makes the system do something.

Kevbo February 9th, 2018 11:46 AM

Various transfer functions can be represented by differential equations. For example higher order (than just averaging...first order) filtering of noisy data to smooth it out with less delay than a first order solution.

My last/only experience with this was for aircraft flight control and stability augmentation systems in the late 1980's. We were just starting to use embedded microprocessors to replace the earlier analog circuits. Today's PLCs would be up to the computing task, but the redundancy requirements would be a problem.

In general, you need to convert the differential equation into an approximately equivalent difference equation. You need to take the sampling time (must be greater than plc scan time) into account to pre-warp the coefficients.

Beware that higher order equations may exhibit oscillatory response (limit cycling) when converted to discreet time form when the the continuous time form was stable. For this reason it is better to design the system with discreet time/difference equations from the outset.

Peter Nachtwey February 9th, 2018 01:17 PM

Quote:

Originally Posted by Kevbo (Post 768140)
In general, you need to convert the differential equation into an approximately equivalent difference equation.

Integrating the differential equations using Runge-Kutta is better because the differential equation can be non-linear and it is easier to model disturbances.

Quote:

Beware that higher order equations may exhibit oscillatory response (limit cycling) when converted to discreet time form when the the continuous time form was stable. For this reason it is better to design the system with discreet time/difference equations from the outset.
I never had that problem because I know where to place the closed loop poles and the sample times on a motion controller are fast and deterministic.

Osias1970 February 9th, 2018 06:27 PM

1 Attachment(s)
Thank you for reply.
We want to implement the y(t) to model the anode voltage Vs alumina concentration to control anode voltage in smelting process.
We plan to implement this model in PLC.

can we use delta motion controller to implement this model?
This is non linear with second order of differential and exponential as can seen in attached curve.

Peter Nachtwey February 9th, 2018 08:55 PM

Yes, the Delta RMC can do complex math real time.
It looks like you have solve the math and have the equations already so the RMC only needs to find the position as a function of Alumina concentration and the A/cm^2.

The RMC can also use cubic interpolation between points but if the A/cm^2 value is constantly changing you have a two dimensional problem so equations would be best.

What are the equations? I can enter them into RMCTools and show how long the calculations would take. That way the math part would be done.

The RMC can execute the equation faster and easier than a Control Logix. The lines in the graph do not match the simple differential equation present in the first post.

Osias1970 February 9th, 2018 09:35 PM

Hello Peter,
I have two different model:
1. Equation as previous post (d2y(t)/dt2) = a*(b^2)*(e^bt) where a and b is parameter that will define it as constant.

2. chart that I sent in last post. From this chart need to write or define the equation.


All times are GMT -5. The time now is 08:56 PM.

.