You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
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!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

Reply
 
Thread Tools Display Modes
Old August 8th, 2022, 03:37 PM   #46
Peter Nachtwey
Member
United States

Peter Nachtwey is online now
 
Peter Nachtwey's Avatar
 
Join Date: Apr 2002
Location: The land of the woke and the home of the broke
Posts: 8,030
Quote:
Originally Posted by MaxK View Post
I please to excuse me, I have one stupid question:
Why do all your models include dead time? Do all your systems have transport delay (conveyors, pipelines, etc.)? What is the reason?
In reality EVERYTHING HAS A DEAD TIME!!!!
In most cases the dead time is so small it can be ignored.

Quote:
Peter Nachtwey's "Hotrod.zip" example is approximated pretty well by the following function

W(s) = 3,77142857142857/ ((170,2864769*s+1)* (36,0195267*s+1)* (14,57362541*s+1)* (11,51468826*s+1))
That doesn't' look right because there is no dead time. What is the SSE ( sum of squared errors ) between the actual data and your estimated data? I always print that because it tells me how good my model is.

Quote:
destination unknown example (post 36):

W(s) = 2,22 / ((91,225*s+1)* (21,3625*s+1))
(If I get data (not image) maybe I can improve the model.)
This doesn't look right either. Again, would like to see the SSE.

SSE is the sum of squared errors is more appropriate than other evaluation methods when testing for goodness of fit between a model and actual data.

My SOPDT program returns this for hotrod.txt
sse = 250.31414761879358
RMS error = 0.436
The open loop gain = 3.757 PV/%CO
Time constant 0 = 0.685 minutes
Time constant 1 = 2.849 minutes
Ambient PV = 77.840 in PV units
Dead time = 0.354
Time units are the same as provided in input file
The closed loop time constant = 0.285
The controller gain = 1.472 %CO/unit of error
The integrator time constant = 3.534 minutes
The derivative time constant = 0.552 minutes
__________________
"Living is easy with eyes closed, misunderstanding all you see...." Strawberry Fields Forever, John Lennon
  Reply With Quote
Old August 9th, 2022, 01:35 AM   #47
Peter Nachtwey
Member
United States

Peter Nachtwey is online now
 
Peter Nachtwey's Avatar
 
Join Date: Apr 2002
Location: The land of the woke and the home of the broke
Posts: 8,030
Quote:
Originally Posted by MaxK View Post
W(s) = 2,22 / ((91,225*s+1)* (21,3625*s+1))
(If I get data (not image) maybe I can improve the model.)
I have previously posted the data hotrod.txt. It is included in this zip file
https://deltamotion.com/peter/py/SysID%20SOPDT.zip

BTW, it doesn't take much longer to find the parameter for a SOPDT system than a FOPDT system but the difference in the quality of the model can be significant.

This is my old Mathcad Hotrod SOPDT work sheet as a pdf
http://www.plctalk.net/qanda/attachm...1&d=1660019198
Notice that I use differential equations to express the SOPDT model. Differential equations are THE way to go because they are so flexible. State space and Laplace transforms don't work for non-linear systems.

None of you guys account for the ambient temperature nor do you express the dead time correctly.
Attached Files
File Type: pdf Mathcad - Sysid SOPDT ODE.pdf (105.2 KB, 14 views)
__________________
"Living is easy with eyes closed, misunderstanding all you see...." Strawberry Fields Forever, John Lennon

Last edited by Peter Nachtwey; August 9th, 2022 at 01:37 AM.
  Reply With Quote
Old August 11th, 2022, 11:14 AM   #48
destination unknown
Member
Ireland

destination unknown is offline
 
Join Date: Jun 2010
Location: Ireland
Posts: 94
Quote:
Originally Posted by Peter Nachtwey View Post
I have previously posted the data hotrod.txt. It is included in this zip file
https://deltamotion.com/peter/py/SysID%20SOPDT.zip

BTW, it doesn't take much longer to find the parameter for a SOPDT system than a FOPDT system but the difference in the quality of the model can be significant.

This is my old Mathcad Hotrod SOPDT work sheet as a pdf
http://www.plctalk.net/qanda/attachm...1&d=1660019198
Notice that I use differential equations to express the SOPDT model. Differential equations are THE way to go because they are so flexible. State space and Laplace transforms don't work for non-linear systems.

None of you guys account for the ambient temperature nor do you express the dead time correctly.
Here's the model for the Hotrod data, using a different representation:

HR.png

Model:
Model Gain= 3.78
Damping Factor= 1.27
2nd Order Time Constant= 83.23 seconds
DeadTime= 20.73 seconds

The PID Tune:
Kp=1.496
Ki=0.0071
Kd=49.39

HrTuned.PNG




Quote:
Originally Posted by MaxK View Post
I please to excuse me, I have one stupid question:
Why do all your models include dead time? Do all your systems have transport delay (conveyors, pipelines, etc.)? What is the reason?

Peter Nachtwey's "Hotrod.zip" example is approximated pretty well by the following function

W(s) = 3,77142857142857/ ((170,2864769*s+1)* (36,0195267*s+1)* (14,57362541*s+1)* (11,51468826*s+1))

example (post 36):

W(s) = 2,22 / ((91,225*s+1)* (21,3625*s+1))
(If I get data (not image) maybe I can improve the model.)
These functions look like they are from some curve fitting tool disregarding the dead time.
__________________
same same, but different...

Github: https://github.com/Destination2Unknown
YouTube: https://www.youtube.com/channel/UCjw...hVY32I2q2JZnBQ
  Reply With Quote
Old August 13th, 2022, 11:51 PM   #49
Peter Nachtwey
Member
United States

Peter Nachtwey is online now
 
Peter Nachtwey's Avatar
 
Join Date: Apr 2002
Location: The land of the woke and the home of the broke
Posts: 8,030
The response looks good but still not sum of squared errors. Also, when the damping factors is greater or equal to one then you have two real poles and the transfer function should be expressed that way. Normally a damping factor is used when the open loop system is under damped.
The math still works but now we can't compare your two time constants to my two time constants.
__________________
"Living is easy with eyes closed, misunderstanding all you see...." Strawberry Fields Forever, John Lennon
  Reply With Quote
Old August 17th, 2022, 08:57 AM   #50
Matjuhnl
Member
Netherlands

Matjuhnl is offline
 
Join Date: Jun 2020
Location: Somewhere
Posts: 23
A PIDNN (PID Neural Network) is a dream of mine. This method of control shows a lot of potential. Unfortunately, I am not able to create this code myself.
  Reply With Quote
Old August 17th, 2022, 10:04 PM   #51
Peter Nachtwey
Member
United States

Peter Nachtwey is online now
 
Peter Nachtwey's Avatar
 
Join Date: Apr 2002
Location: The land of the woke and the home of the broke
Posts: 8,030
What do you think the NN adds?
__________________
"Living is easy with eyes closed, misunderstanding all you see...." Strawberry Fields Forever, John Lennon
  Reply With Quote
Old August 18th, 2022, 06:44 AM   #52
Matjuhnl
Member
Netherlands

Matjuhnl is offline
 
Join Date: Jun 2020
Location: Somewhere
Posts: 23
I hope the PIDNN automatically adapts to the situation. As the model in our machines sometimes changes depending on the type of product and weather conditions.

By adapt, I mean adjusting the Kp, Ti & Td. I see in literature that a PID controller is still active in the background.

I have seen people running a PIDNN functionally on a PLC. However, I would like to look into the code.
  Reply With Quote
Old August 19th, 2022, 05:10 PM   #53
Peter Nachtwey
Member
United States

Peter Nachtwey is online now
 
Peter Nachtwey's Avatar
 
Join Date: Apr 2002
Location: The land of the woke and the home of the broke
Posts: 8,030
NNs need be trained with hundreds or even thousands of examples. When you provide the different inputs, how do you grade the output if you don't really know what you want or what is optimal? Who would do that? How would you do that? You can't just say I am using a NN or FL and that will solve the problem. If you don't know the best answer to a set of inputs, then training the NN is not going to yield the results you want.

I am a big believer in staying with the basics and understanding them thoroughly. Understanding how to write the differential equations is a must. I know most of you would not call differential equations, basic.
__________________
"Living is easy with eyes closed, misunderstanding all you see...." Strawberry Fields Forever, John Lennon
  Reply With Quote
Old August 24th, 2022, 04:17 AM   #54
moistcat
Member
Australia

moistcat is offline
 
Join Date: Jun 2020
Location: Melbourne
Posts: 27
I gave it a crack with some pumps the other day.
Unfortunately the downstream pipework is not complete so I couldn't ramp to 50Hz. (set to 30Hz)

Bit of a noob here, but can you tell me what is happening around the 50s mark where the model starts tracking the PV ? What is happening prior to that point ?

Ill have some more time on site soon, so ill be keen to run some more tests.

Thanks for creating this tool.
Attached Images
File Type: png MicrosoftTeams-image (5).png (242.0 KB, 75 views)
  Reply With Quote
Old August 24th, 2022, 08:36 AM   #55
destination unknown
Member
Ireland

destination unknown is offline
 
Join Date: Jun 2010
Location: Ireland
Posts: 94
Quote:
Bit of a noob here, but can you tell me what is happening around the 50s mark where the model starts tracking the PV ? What is happening prior to that point ?


The tuner in pytunelogix is a very specific/limited tuner which is based on a single step Process Reaction Curve.


It looks for the step in the CV (point where CV is at its max) and uses that as its starting point.
I didn't really document this very well but as you can see it doesn't quite work when there are multiple steps. You have to pay extra for the one that does $$$$$


Try clean up the CV data in the csv file, instead of the CV going from 0->20->30 change it to 0->30 and see what that looks like.
__________________
same same, but different...

Github: https://github.com/Destination2Unknown
YouTube: https://www.youtube.com/channel/UCjw...hVY32I2q2JZnBQ

Last edited by destination unknown; August 24th, 2022 at 08:38 AM.
  Reply With Quote
Old August 24th, 2022, 08:55 AM   #56
destination unknown
Member
Ireland

destination unknown is offline
 
Join Date: Jun 2010
Location: Ireland
Posts: 94
Quote:
Originally Posted by moistcat View Post
I gave it a crack with some pumps the other day.
Unfortunately the downstream pipework is not complete so I couldn't ramp to 50Hz. (set to 30Hz)
For a Process Reaction Curve you generally do a small step in CV e.g 0-10% or 0-20% and see what happens.
In your case 0-20hz or 0-30Hz is fine, not the best idea to go 0-50Hz just for a step test.
__________________
same same, but different...

Github: https://github.com/Destination2Unknown
YouTube: https://www.youtube.com/channel/UCjw...hVY32I2q2JZnBQ
  Reply With Quote
Old August 24th, 2022, 09:20 AM   #57
destination unknown
Member
Ireland

destination unknown is offline
 
Join Date: Jun 2010
Location: Ireland
Posts: 94
Quote:
Originally Posted by Matjuhnl View Post
I hope the PIDNN automatically adapts to the situation. As the model in our machines sometimes changes depending on the type of product and weather conditions.

By adapt, I mean adjusting the Kp, Ti & Td. I see in literature that a PID controller is still active in the background.

I have seen people running a PIDNN functionally on a PLC. However, I would like to look into the code.
You don't need NN for that, and PLC's are not the best place to handle NN anyway.

Feedforward and/or pre-calculated adaptive gains should work in that scenario.
__________________
same same, but different...

Github: https://github.com/Destination2Unknown
YouTube: https://www.youtube.com/channel/UCjw...hVY32I2q2JZnBQ
  Reply With Quote
Old August 24th, 2022, 10:17 PM   #58
moistcat
Member
Australia

moistcat is offline
 
Join Date: Jun 2020
Location: Melbourne
Posts: 27
Very interesting. Thanks for letting me know.
I have cleaned up the data but still seem to get a similar outcome:

It will be interesting to see the difference in model, say from a step from 0->20Hz, vs 20->30Hz (latter is more within the pumps operational curve).

Would probably be best to ramp up manually to minimum flow speed, and then let the PID take over once we are within the vicinity of the pump curve.
Attached Images
File Type: png khVsCb3PKL.png (76.5 KB, 58 views)
  Reply With Quote
Old August 25th, 2022, 12:39 AM   #59
Peter Nachtwey
Member
United States

Peter Nachtwey is online now
 
Peter Nachtwey's Avatar
 
Join Date: Apr 2002
Location: The land of the woke and the home of the broke
Posts: 8,030
Quote:
Originally Posted by moistcat View Post
I gave it a crack with some pumps the other day.
Unfortunately the downstream pipework is not complete so I couldn't ramp to 50Hz. (set to 30Hz)
50 HZ is mentioned. What does 50 Hz have to do with anything. I don't see 50 Hz in any of the graphs or pictures nor do I see 30 Hz.
__________________
"Living is easy with eyes closed, misunderstanding all you see...." Strawberry Fields Forever, John Lennon
  Reply With Quote
Old August 25th, 2022, 01:26 AM   #60
moistcat
Member
Australia

moistcat is offline
 
Join Date: Jun 2020
Location: Melbourne
Posts: 27
Quote:
Originally Posted by Peter Nachtwey View Post
50 HZ is mentioned. What does 50 Hz have to do with anything. I don't see 50 Hz in any of the graphs or pictures nor do I see 30 Hz.
Thanks for the reply Peter - Hz is a common measurement for motor speed in Australia. (as opposed to RPM: 50Hz=approx 3000RPM for 2 pole motor.)
50Hz is mentioned in the context of me not being able to run the VSD @ 50Hz.
The pipework downstream from the pump is incomplete, and can only handle about 50L/s flow (achieved at about 40Hz).

If you look at the top left graph, you will see the CV (VSD Hz) ramps to 30Hz.

Being new to this, I assumed that the best model would be obtained by ramping over the whole range of the output CV ramps 0Hz >> 50Hz.
But further reading indicates it may be better to measure step response over "expected" process values, eg: 20-50Hz.

Last edited by moistcat; August 25th, 2022 at 01:28 AM.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Slow Acting Long Time Interval PID Tuning GrizzlyC LIVE PLC Questions And Answers 141 March 30th, 2021 07:04 AM
PID tuning methods OysterMan LIVE PLC Questions And Answers 4 March 21st, 2021 11:59 AM
Micrologix 1400 Timed Proportioned Output PID Tuning Paul Begley LIVE PLC Questions And Answers 3 January 13th, 2014 05:26 PM
PID Tuning and Process Modeling kdcui LIVE PLC Questions And Answers 14 October 15th, 2009 02:27 PM
PLC PID Auto Tuning Problem monet LIVE PLC Questions And Answers 6 May 26th, 2009 10:50 AM


All times are GMT -4. The time now is 02:26 AM.


.