This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc. 

Try our online
PLC Simulator FREE.
Click here now to try it.

New Here? Please read this important info!!!

February 8th, 2018, 10:14 AM  #1 
Member
Join Date: Sep 2010
Location: Singapore
Posts: 12

second order equation implementation if controllogix
Hello,
I want to implement second order differential equation in controllogix using RSlogix 5000. The equation as attached. How to implement it? Thanks. 
February 8th, 2018, 10:22 AM  #2 
Member
Join Date: Dec 2004
Location: Detroit, SouthEast Michigan
Posts: 3,257

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.
__________________
"You can live to be a hundred if you give up all the things that make you want to live to be a hundred." Woody Allen 
February 8th, 2018, 10:42 AM  #3 
Lifetime Supporting Member

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. 
February 8th, 2018, 11:08 AM  #4 
Member
Join Date: Sep 2010
Location: Singapore
Posts: 12

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

February 8th, 2018, 02:11 PM  #5 
Lifetime Supporting Member

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.

February 8th, 2018, 02:20 PM  #6 
Member

PLCs don't "solve" equations; they use equations to calculate values.
If you substitute your bottom 2 equations into your first, you get: kČe^{kx}  3ke^{kx} + 2y = 0 or y =  (kČe^{kx}  3ke^{kx}) ) / 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] Last edited by Aardwizz; February 8th, 2018 at 02:23 PM. 
February 8th, 2018, 02:32 PM  #7 
Lifetime Supporting Member + Moderator

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?

February 8th, 2018, 07:14 PM  #8 
Member
Join Date: Sep 2010
Location: Singapore
Posts: 12

Thank you for reply.
d2y(t)/dt2 = ab 2 e bt (second order differential as attached image) How to solve y(t)? 
February 9th, 2018, 09:38 AM  #9 
Lifetime Supporting Member

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

February 9th, 2018, 10:51 AM  #10 
Member

bingo!!! It took this long to figure that out.
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.
__________________
"Living is easy with eyes closed, misunderstanding all you see...." Strawberry Fields Forever, John Lennon 
February 9th, 2018, 12:46 PM  #11 
Member
Join Date: Aug 2006
Location: Albuquerque,NM
Posts: 27

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 prewarp 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. 
February 9th, 2018, 02:17 PM  #12  
Member

Quote:
Quote:
__________________
"Living is easy with eyes closed, misunderstanding all you see...." Strawberry Fields Forever, John Lennon 

February 9th, 2018, 07:27 PM  #13 
Member
Join Date: Sep 2010
Location: Singapore
Posts: 12

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. 
February 9th, 2018, 09:55 PM  #14 
Member

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.
__________________
"Living is easy with eyes closed, misunderstanding all you see...." Strawberry Fields Forever, John Lennon 
February 9th, 2018, 10:35 PM  #15 
Member
Join Date: Sep 2010
Location: Singapore
Posts: 12

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. 
Bookmarks 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)  
Thread Tools  
Display Modes  


Similar Topics  
Thread  Thread Starter  Forum  Replies  Last Post 
RedLion to AB ControlLogix  2stepsforward  LIVE PLC Questions And Answers  1  July 18th, 2011 11:47 AM 
Controllogix / Panelview Plus 600 question  tinyku  LIVE PLC Questions And Answers  8  May 29th, 2011 07:16 PM 
ControlLogix Learning Curve?  peterjung  LIVE PLC Questions And Answers  20  May 25th, 2011 06:50 PM 
Need Help for ControlLogix System  gherz817  LIVE PLC Questions And Answers  0  September 14th, 2010 11:09 AM 
unstable redundant controlnet communication for controllogix  Mohamed Elkhateb  LIVE PLC Questions And Answers  2  July 12th, 2007 08:13 AM 