Advanced Control - System Identification

first cut at data collection ...

Greetings to Peter and all ...



the Hotrod (click here for picture) is running along even as I write ... I’ll be using an SLC-5/05 to provide PID control - but until later I’ll leave the PID in the manual mode ... I’ll be using the Hotrod’s “tip” thermocouple which should provide a reasonable amount of deadtime/lag for the system ... I’ll leave the Hotrod’s fans running with an airflow of 20% of full flow ... later we’ll increase this to 40% (or something else) to gauge how the system responds to load changes ... note that the fans and the airflow will be controlled by a separate PLC-5 ... that way we can keep the SLC’s program stripped down to its very basics - and concentrate just on the Hotrod’s heater section ...



the Hotrod gets its temperature input signal (PV) from a J-type thermocouple and a 0 to 500 degree F transmitter ... 4 to 20 mA from the transmitter is wired to Channel 0 of a 1746-NI4 module located in the SLC’s slot number 1 ... (address I:1.0) ...



the output (CV/CO) signal is wired to Channel 0 of a 1746-NO4I module located in the SLC’s slot number 2 ... (address O:2.0) ... the 4 to 20 mA signal from the module is wired to an Omega PCM-1 “Pulse Control Module” ... this component turns the current signal into an “on/off” pulse train which then controls a solid state relay for the 120 VAC, 25 Watt heating element ...



I’ve written a small QBASIC program which will listen to the PLC’s serial port ... as the test runs, the PLC will transmit the data that Peter requested ... the data will be transmitted once per second ...



here’s what I propose for a “standard” test cycle ... in the manual mode, I’ll set a conservative value for CV/CO (I suggest 10%) ... I’ll let the system settle out to a steady state (something like 117 degsF is common) ... I’ll start the GET_DATA.BAS program running ... I’ll flip the “test” input switch on ... the PLC will run through a short pause of about 15 seconds (with no changes yet) to allow graphing/collecting a “base line” data stream ... at the end of the “base line” pause, the PLC will crank the CV/CO up to a higher value ... (I suggest 80%) ... I’ll allow the system to run long enough (about 20 minutes) to settle out at its new steady state value ... (380 degsF is common) ... during the test, the GET_DATA.BAS program will collect the data stream and write it to a .TXT file ... I’ll provide that file to you guys ... you can crunch the numbers to your hearts’ content and then let me know what “tuning” settings you want to try ... once I’ve got your “try this” settings, I’ll put the Hotrod in automatic and see how the system responds to a few different tests ...



note that I probably won’t have time for too much number crunching at my end ... the bo$$ has come up with some time-consuming work projects for me - but I can probably handle the data collection without too much delay ...



anyway, that’s what I suggest as a “let’s get started” plan of attack ... I’m wide open to suggestions if you have something different in mind ...


I’m attaching copies of both the .RSS program and the .BAS program in case you want to look at them ...... sorry that there is almost ZERO documentation in the .RSS file for now ... I should be able to add rung comments, etc. in a day or so ... I’ll post an updated copy when that’s finished ... I’m also including QBASIC in case you want to poke around with that end of the line ... double-clicking “GO.BAT” should start the little collection program - at least it does on my computers ...



the actual “DATA” file that you asked for is named “Hotrod_TF_A.txt” ... I tried to match the format to your example - but I decided to “pad” the values with leading zeros to keep things lined up ... let me know if all of that fits your needs ... if not, I can make modifications ...



I’m also enclosing the “Hotrod_TF_A.dbf” file - just in case you want to look at that ... I made it with the old-fashioned “Create Snapshot” method by right-clicking on the RSTrend window ...



good luck with your end of things ... let me know if I need to do something different ... it’s no trouble - but it might take a day or two since I’ll have to squeeze it in between work sessions ...
 
Last edited:
The moment of truth is near

Ron, the time periods are not equal. I have fixed fix it using Excel and included the fixed version in the attached .zip file. The Autotune.sci program looks at the difference between the first two times as an indicator of the time difference between all the points. I also included the result .gif file which looks like the orginal hotrod.gif. One can see the that the hotrod has changed or at least the testing conditions have changed.

Code:
 -->AutoTune("Hotrod1.txt")
 .......................................................................
 
 FOPDT SSE=3890.813344
 Kp=3.367948 Tp=3.077651 DT=1.047402
 The FOPDT gains are Kc=0.096939 Ti=3.077651 Td=0.000000
 ..............................................................
 
 SOPDT SSE=121.091126
 Kp=3.567089 Tp1=0.666427 Tp2=2.893061 DT=0.391555
 The SOPDT gains are Kc=0.045882 Ti=3.559488 Td=0.541655
 
 The plant is a SOPDT
It didn't take many iterations to find the best solution.

For starters use
Kc=0.045882 %CO/deg
Ti=3.559488 minutes
Td=0.541655 minutes

It may take 30 minutes or more to reach steady state temperature. I made the closed loop time constant conservatively long but it shouldn't overshoot.

This should be more aggressive with one overshoot.
Kc=0.080528 Ti=3.559488 Td=0.541655

According to the formulas, Ti and Td are not dependent on the closed loop time constant. You can change Kc to values between 0.046 and 0.08 without problems. If Kc is increased too much the deadtime causes the system to oscillate.

My simulations indicate it could take 100 minutes.
 
Last edited:
I'm confused

First off - if Kp (plant gain) is defined as delta PV divided by delta CO, why is it different for 1st order and 2nd order models?

Next, using Ron's data,
delta PV = 389-117 = 272
delta CO = 80-10 = 70
Kp = 272/70 = 3.89

As per the controlguru, picking dead time from the data is somewhat arbitrary. I decided to pick a whole degree increase as the end of dead time giving a value of 18 seconds.

For Tp, if you take the time when the PV has risen 0.632121 of delta PV or 172 deg to reach 117+172 = 289 deg that is 238 seconds.
Tp = T - DT = 238-18 = 220 seconds

I've created a FOPDT simulation in ControlLogix and run it with both sets of constants. I've merged the results into a spreadsheet with Ron's data (the .dbf file) and plotted them.
The results using the values obtained by following the procedure from controlguru are pretty close to actual, whereas the values calculated by your scilab program produce model behaviour that is rather far off the mark.

If I knew how to create a 2nd order simulation, I would.
 
Gerry said:
First off - if Kp (plant gain) is defined as delta PV divided by delta CO, why is it different for 1st order and 2nd order models?
Ideally it shouldn't be. The FOPDT SSE is 30 times worse than the SOPDT model. The FOPDT model is not very good. Note the AutoTune.sci says it is a FOPDT model.

We can use the the original manual version to check your values.

I've created a FOPDT simulation in ControlLogix and run it with both sets of constants. I've merged the results into a spreadsheet with Ron's data (the .dbf file) and plotted them.
You didn't use my hotrod1.txt? I had to fix the time intervals between the periods in Ron's files.

The results using the values obtained by following the procedure from controlguru are pretty close to actual, whereas the values calculated by your scilab program produce model behaviour that is rather far off the mark.
Like I said the second order model isn't very goodl

If I knew how to create a 2nd order simulation, I would.
Two just add a second LDLG block to the output of the first LDLG block. It should have a gain of 1 and no bias.

I think your bias is not right. You can see that my FOPDT is very close to the actual PV if you look at my hotrot1.gif plot.
I will check this again. I will read the LDLG documentation to make sure you are using it correctly. It is bed time here.

Have you installed scilab 4.1 and run the Autotune program?

Ron's tests will let us know how well the AutoTune.sci works.
 
Greetings Peter ...



I'm going to try running your first tests this afternoon ... I'm not 100% sure about how you want this done - so please correct me if you’ve got something different in mind ...



first of all, remember that I'll be using the PID in an SLC-5/05 ... all of those decimal places that you've given will have to be rounded off ... and I'm not sure that you and I are on the same page with the units (or lack thereof) for Kc ...



here's what I'm going to do - unless I hear something different from you soon ... I'll tune the PID for the following: Kc=0.05 Ti=3.56 Td=0.54 ... I'll let the system settle out at an initial setpoint of 100 degsF ... then I'll step-change the SP to 200 degsF and graph the response ... we'll see what happens ...



Ron, the time periods are not equal.



those are probably the best we’re going to get with the hardware we’re using ... the intervals are being set by a TON timer in the SLC ... I’m open to suggestions if anyone can come up with a better method ... PLEASE send specific code - and NOT just suggestions ... my time is VERY limited with work assignments right now ... I will be GLAD to follow any suggestions - but it might take a week or two before I can squeeze any “programming” into my schedule ... I can download a program ... I just don’t have time to design/write anything these days ...



One can see the that the hotrod has changed or at least the testing conditions have changed.



maybe this is what’s going on ... the Hotrod has FOUR basic configurations ... we can use the “BASE” thermocouple which is secured right up next to the heating element ... it gives only a few seconds of deadtime/lag before responding ... or we can use the “TIP” thermocouple ... this one is located at the far end of a screw (the “rod” as my students have named it) which replaces the original soldering iron tip ... naturally the length of the rod introduces a greater deadtime into the system’s response ... if I had to guess, I’ll bet that you’re looking at data from an older setup of the Hotrod - which probably used the “BASE” arrangement ... I think that’s what we used a couple of years ago ... the data that I just sent to you uses the “TIP” arrangement ... if you want me to go back and use the “BASE” just let me know ... it only takes a second for me to plug it in - but I’ll have to run the data collection process again ... no problem - just a delay in the proceedings ... beyond the two thermocouple settings, we can also put the Hotrod in the “FULL” mode - which uses the full 25-watts (nominal) of the soldering iron heater ... or we can go to the “HALF” mode ... this inserts a diode into the heater’s circuit ... the half-wave power gives the equivalent of a 12.5 watt heater ...



I’m not trying to make this more difficult than it needs to be ... but some of these setups might prove interesting over the long haul - to provide some variety and extra challenge for your “autotuning pleasure” ... I know that my students find it challenging whenever I keep making changes to the basic system ...



I suggest that we stay with the “TIP/FULL” arrangement for now ...



basically (at least for the next few weeks) you need to consider me as the “lab grunt” ... you guys tell me what you want done - and I’ll do my best to put the equipment through its paces ... right now though, the bo$$ has work for me to do ... my “thinking/designing/programming” time is unfortunately very limited ...



hopefully I’ll have something before I go home for tonight ... I’ve got the graph set for 120 minutes ... let’s see what happens ... be sure to let me know if I’ve misinterpreted the units/values for your tuning ...
 
Ron Beaufort said:
Greetings
first of all, remember that I'll be using the PID in an SLC-5/05 ... all of those decimal places that you've given will have to be rounded off ... and I'm not sure that you and I are on the same page with the units (or lack thereof) for Kc ...
That is OK. Make Kc=0.28 because I made an error in my Mathcad SOPDT temperature simulator that I have fixed. The error caused me to make the controller gain (Kc) too conservative. I had a feeling that it wasn't quite right. The old value would work but it would take too long to get to the set point. The new value will still take about 30 minutes.

Meanwhile know that the Tc calculated for the SOPDT PID gais is too big. It doesn't hurt anything except for to make the response very slow. You can see 00.28 is over 5 times larger than the orginal Kc. The new closed loop Tc is 5.8 so it will take about 5x5.8 minutes to reach SP.



I think the TON timer is good. You can convert %CO to time in millisecods my multiplying by 10. I am assuming this is what you have already.

We must test the hotrod in the same configuration that the data was gathered. If the configuration changes we must start over.

My time is short too. I am leaving for remote places in BC tonight. ( snow, cold, servo motors and VFDs Oh my ). Just found out an hour ago. There may not be internet access where I am going. So I may be out of touch for a couple of days. Then I will be back in my warm office with the e-mail alerts on.

Ron, the next time you collect data it would be good to have more time at steady state before changing the CO. This would make calculating the gains a little more accurate.
 
You didn't use my hotrod1.txt? I had to fix the time intervals between the periods in Ron's files.
I used the .dbf file data because the sample intervals are consistent at 1 second +/- a few milliseconds. That data is in the same format as a datalog from RSView - I don't know what Ron used to get it, but it appears more trustworthy to me.

I think your bias is not right.
The values in the screenshot relate to the FOPDT values from your last post: Kp = 3.367948; Tp = 3.077651; DT = 1.047402
Extrapolating the Kp back to 0% output from 117 deg gives 117-33.7 = 83.3 deg. which could be considered as the a_mbient - rather toasty!

The times have been converted to seconds and scaled down by a factor of 10 so that it doesn't take all day to get results.
Tp 3.077651 min = 184.66 sec ---> 18.47 sec in sim
DT 1.047402 min = 62.84 sec ---> 6.3 sec in sim

The FOPDT SSE is 30 times worse than the SOPDT model.
Note that the simulation with the scilab values settles out at 353 deg., not 389 deg. as the real one does.
This is consistent with the gain :
117 + (3.367948 * 70) = 352.76

Two just add a second LDLG block to the output of the first LDLG block. It should have a gain of 1 and no bias.
Thanks, I'll work on that and come back.

basically (at least for the next few weeks) you need to consider me as the “lab grunt” ... you guys tell me what you want done - and I’ll do my best to put the equipment through its paces
Ron,
I think the .dbf file data is more reliable, so for my benefit, please continue to provide that. I am curious to see similar data for a step change from 80% back to 10% - if you have the time.

edit: dealing with curious censorship of a_mbient without the underscoreo_O
 
Last edited:
Gerry, if you look at the hotrod.gif you can see the FOPDT model doesn't like the curve. This is because a FOPDT can't make that curve. If Ron's data had more time at 117.6 degrees that would help weight that part of the graph more so that getting the ******t temperature would be more accurate.

Note that the SOPDT gain is higher so the ******t temperature is lower but it still isn't a low as 803 degrees which I agree is toasty.

I will copy lines from the beginning of the data and add that to the beginning of the data. This should weight the data when the CO is at 10% more.

Quick Edit. I did what I suggested above. The answer the Autotune.sci are much better if there is more time at the lower temperature.

Code:
-->AutoTune("hotrod1c.txt")
.............................................................

FOPDT SSE=5447.346475
Kp=3.802599 Tp=3.142409 DT=0.915295 PVss=86.281019
The FOPDT gains are Kc=0.100318 Ti=3.142409 Td=0.000000
................................................

SOPDT SSE=239.920580
Kp=3.870863 Tp1=0.687665 Tp2=2.919845 DT=0.328980 PVss=79.747658
The SOPDT gains are Kc=0.259408 Ti=3.607510 Td=0.556582

The plant is a SOPDT
/code]
Notices that the PVss is lower and in the range that Gerry predicts.  In fact the SOPDT PVss is lower.

Ron, the next time you collect data could you collect about 1/3 of the time at the lower temperature and 1/3 at the higher tempererature.

Gerry, note that the PVss is not directly part of the formulas to compute the gains.
 
Last edited:
here's the "first cut" results using the setup I described above ...

HOTROD_TF_B.JPG


I'll try some more runs tomorrow ...

Ron, the next time you collect data could you collect about 1/3 of the time at the lower temperature and 1/3 at the higher tempererature.

so about 20 minutes at the 10% setting ... then about 20 minutes as the temperature stabilizes ... and then about 20 minutes after the temperature has reached steady state? ... that's about an hour ... as long as the .TXT file doesn't overload and blow up, it should be no problem ... did I interpret the tuning units correctly? ...
 
I created the SOPDT simulation as suggested and it appears to work.
SOPDT_Model.jpg

The attached updated spreadsheet shows some results.
Using the numbers from Peter's initial post the plot line SOPDT_A follows the real data closely initially, but then departs significantly, settling at 367 deg. instead of 389 deg.
This aligns with the Kp figure of 3.567089.

For the SOPDT_B plot line, I changed the Kp to 3.89. This line virtually overlays the data for the real HotRod except at the beginning where it overlays the SOPDT_A line. I suspect a small reduction in the DT value might bring it into line.

The values in the screenshot were used for the SOPDT_B plot.

...next I'll run some PID against the model...
 
Gerry, that is good!!

It looks like you used the latest solution is posted because the PVss or ******t temperature is lower.

Now can you add a PID to control your model? I think many would be interested in your results.

I will fix the Autotune.sci to so it provides better closed loop time constants when I get back.

I think what we have learned is that it is important to capture different parts of the data more evenly.
 
This plot shows the response using the latest values for the tuning constants:
Kc = 0.259408
Ti = 3.607510 min = 216.45 sec
Td = 0.556582 min = 33.395 sec
Times are scaled. The model and its values are unchanged from the previous screenshot.

HR_PID_1.jpg


The yellow line is set point - step change from 150 to 300
Blue line is controller output
Red line is tip temperature.
 
Last edited:
This plot is a PI configuration run against the same model
Kc = 0.44
Ti = 220 sec = 3.666667 min

Max overshoot is 3.7 deg., undershoot is 4.7deg.
Peak controller output is 95%

HR_PID_2.jpg
 
Gerry, that looks good

Did you implement the PID in FBD too? If so can you share it? I bet it looks pretty simple.

The ease with which you implemented the SOPDT simulator has raised my interest in RS5000's FBD. I have always thought the trends were a very strong point too.

Now we must wait for Ron Beaufort's tests to see if our models match reality. They should be very close.

I wonder if there is are Siemens programmers that can write a SOPDT simulator FB. One should exist somewhere.

BTW, type 0 second order system, like a temperature system, needs a gain for every pole in the system. The integrator does not count as a gain because it comes with its own pole. That is why a P and D gain are required if one wants to place all the poles. A PI controller is good for type 0 first order systems. This is why your PI controller overshoots. The combined controller and plant transfer function is under damped.
 

Similar Topics

This video shows the things I think about on page 1. I use Laplace transforms a lot. Laplace transforms allow one to express differential...
Replies
2
Views
1,818
Instead of this info getting lost in another thread I will start a new thread. For those that don't know you can search for Advanced Control on...
Replies
8
Views
2,662
sampling data. I will probably use this in a magazine article.
Replies
18
Views
8,437
This topic deserved to be a separate thread with and Advanced Control header. The first video was made from videos a couple of years back. You...
Replies
3
Views
1,543
Hello dear experts! I use WinCC Advanced Runtime V15 as a HMI for the process. I grab values from AB Micro 850 PLC via Modbus TCP. On the HMI...
Replies
2
Views
2,419
Back
Top Bottom