Pid fb41 matlab opc simatic

I haven't put much effort into this problem because it doesn't make sense and I have got NO answer from Kolchak that make sense.
I see the diagram has changed.
There are 2 complex poles for the plant and they are very fast, way too fast for a temperature system. s usually has units of radians per second. Also, how can the poles be imaginary? Also, where does the zero come from? What is the 90*1/(20*s+1) come from? It could be to make the ambient temperature 90 degrees but an ambient temperature of 90 degrees seems high.
This temperature system has no dead time. Strange.

Keith, the dominate poleS better not be in the right half of the s plane or the system will oscillate.

I have said this before on other forums. Students shouldn't be allowed to use Matlab until they understand the basics of control theory. Otherwise they get answers and don't really know if they are right or even apply to their system.

I have asked where this plant model came from and have yet to get and answer. I can solve this problem in a few minutes but I feel it would be a waste of time getting the right solution to the wrong problem.

Here is a link to my Scilab autotune program. This can be used to compute a valid SOPDT model and gains. There are some test files and output to show how to use it.
http://deltamotion.com/peter/Scilab/AutoTune/
However, it assumes the plant is a SOPDT system. The gain is has units of temperature/%controloutput. The time constants are in minutes. Someone on LinkedIn used it and liked it so he wrote the user interface for it.
Here is an example of simulating a SOPDT plant. Notice the plant has time constants, not complex poles. It also has a dead time.
Mathcad has no built in functions for calculating gains so I wrote my own using the pole placement technique.
http://deltamotion.com/peter/Mathcad/SOPDT/Mathcad - SOPDT_HOTROD.pdf
 
Last edited:
Kolchak has been pretty light on details of what he is trying to accomplish. IO took this to be a completely academic exercise in using Matlab and Simulink to perform in-system evaluation. So this is much less about specifically controlling the system and much more about getting the controller you connected the model to via Simulink to perform like the Matlab reference system. This may be something Kolchak is doing on his own for his own edification. But, as you said, he hasn't said so we don't know. I base a lot of this on the fact that he really just wants the S7 controller to act the way his Matlab controller does. He has never stated that he wasn't satisfied with the Matlab control given the model he has.


Originally posted by Peter Nachtwey:

There are 2 complex poles for the plant and they are very fast...

You need to take me to school on pole locations given a characteristic equation again. First, I assume you are referring to the second system, since the first system is pretty obviously has three real poles. The equation as I see it is:
383.18s2+391s+1.
I have always run under the assumption that the poles of the system are the roots of the characteristic equation. I calculate the roots of that equation to be at -0.00257 and -1.0178. Being a motion guy I wouldn't think you would see that as all that snappy. This matches up reasonably well with the graphs shown for the second system. Where am I going wrong?


Originally posted by Peter Nachtwey:

Keith, the dominate poleS better not be in the right half of the s plane or the system will oscillate.

I should have been more clear. I didn't mean the pole is in the right half-plane. I meant the pole is the the far right of the left half-plane, making the response very slow. Since your evaluation puts the poles much farther left than mine I can see how you would assume I meant right half-plane.

Keith
 
Kolchak
You need to take me to school on pole locations given a characteristic equation again. First, I assume you are referring to the second system, since the first system is pretty obviously has three real poles.
Yes

The equation as I see it is:
383.18s2+391s+1.
I don't see a decimal point. I see 38318

I have always run under the assumption that the poles of the system are the roots of the characteristic equation.
Yes

I calculate the roots of that equation to be at -0.00257 and -1.0178.
Not if the the characteristic equation is 38318*s^2+391*s+1


Being a motion guy I wouldn't think you would see that as all that snappy. This matches up reasonably well with the graphs shown for the second system. Where am I going wrong?
I don't see the decimal point even when I expand the picture. Also, how did the poles magically drop from 3 to 2?







I should have been more clear. I didn't mean the pole is in the right half-plane. I meant the pole is the the far right of the left half-plane, making the response very slow. Since your evaluation puts the poles much farther left than mine I can see how you would assume I meant right half-plane.

Keith[/QUOTE]
 
Originally posted by Peter Nachtwey:

I don't see a decimal point. I see 38318

You're right. I thought for sure I saw a decimal point yesterday. Now I don't see it. There are pictures that show a slightly increased gap between the 3 and the 1. I must have injected something I expected to see there.


Originally posted by Peter Nachtwey:

Also, how did the poles magically drop from 3 to 2?

Again, I don't think the system itself matters as long as the system would be controllable in an S7 controller (poles not too far left). Kolchak's goal is not to figure out how to control the system per se. His goal is to figure out how to run the controller in an S7 plc as part of a Matlab simulation. In order to do this he is using a couple of reference systems that he has model control of in Matlab and attempting to gain control of them using an S7. The models could be anything as long as the are inherently controllable and he already knows the Matlab response. In fact, his thought with this (although mistakenly in this case) may have been that the S7 was incapable of controlling a 3-pole plant. So the fact that he changed the model in the middle of the game doesn't affect the end goal. It just confuses the thread some.

Keith
 
Kolchak has been pretty light on details of what he is trying to accomplish.

I haven't put much effort into this problem because it doesn't make sense and I have got NO answer from Kolchak that make sense.
I see the diagram has changed.

Gentlemen, thank you answers and help!

I'm sorry that was originally introduced misunderstandings about this work.
I want to try to implement PID controller in the PLC s7-300 (Siemens) for the regulation of the process in Matlab.
As I understand it, the temperature control model in the tunnel furnace, which I showed the first, is almost impossible to realize using FB41 (PID Step7), I decided to try to implement a PID controller for temperature control of in the drying chamber, it is the last, the second model that I showed .

To explain the process for the first and second model 2 I uploaded the source pdf file. Where do you find these models and then wanted to test them PID controller to Step7. Unfortunately the original sources in Russian, but I think the scheme for models and calculations are clear.

model_1
model_2

kamenges said:
As I recall the default interrupt rate for OB35 is 100 ms. I think if you change the value of CYCLE to 100ms you will get a closer response to the Matlab response.

If you really want a more identical controller I would also set the value of TM_LAG equal to the CYCLE value
kamenges, Thank you for the advice. I changed CYRCLE=100MS, TM_LAG=100MS
I got the graphics as in the screenshot at the Setpoint =50.


 
Last edited:
I tried to use the same block FB41 for the first model, a tunnel furnace, changing only Kp, Ki, Kd coefficients. As a result, there was a lot of noise in the process beginning.

Model description of the process, I uploaded in pdf file above.
model_1

 
In the first test it looks like the dynamic response is about right but it looks like the whole output curve is a scaled down version of the Matlab curve. Are you confident the correct values are present at the S7? It looks like the S7 controller is trying to control around a setpoint of 38 or 39.

For the second test what do you have for values of Kp, Ki and Kd in Matlab as well as Gain, Ti and Td in the S7? Also, what is the update rate of the OPC link? The second test is a more responsive system and will be more sensitive to data update rate than the first test.

Keith
 
Here is a link to my Scilab autotune program. This can be used to compute a valid SOPDT model and gains. There are some test files and output to show how to use it.
http://deltamotion.com/peter/Scilab/AutoTune/
However, it assumes the plant is a SOPDT system. The gain is has units of temperature/%controloutput. The time constants are in minutes. Someone on LinkedIn used it and liked it so he wrote the user interface for it.
Here is an example of simulating a SOPDT plant. Notice the plant has time constants, not complex poles. It also has a dead time.
Mathcad has no built in functions for calculating gains so I wrote my own using the pole placement technique.
http://deltamotion.com/peter/Mathcad/SOPDT/Mathcad - SOPDT_HOTROD.pdf

Thanks for the link!
Your program specifies the PID coefficients( Ti and Td) for Step7?
How your method different from the method suggested by kamenges? :
Siemens Gain = Matlab Kp
Siemens Ti = Matlab Kp/Ki
Siemens Td = Matlab Kd/Kp

In the first test it looks like the dynamic response is about right but it looks like the whole output curve is a scaled down version of the Matlab curve. Are you confident the correct values are present at the S7? It looks like the S7 controller is trying to control around a setpoint of 38 or 39.

As seen in the screenshot above, I get through the OPC setting from Matlab, so I can be sure that it is equal to 50.
Setting the variable PV in the OPC server, I showed below:
(I understand there was a conflict of variable types, but the change in the OPC server on "Double", I can not)



For the second test what do you have for values of Kp, Ki and Kd in Matlab as well as Gain, Ti and Td in the S7? Also, what is the update rate of the OPC link? The second test is a more responsive system and will be more sensitive to data update rate than the first test.

I tuned the coefficients Kp, Ki, Kd for the PID controller in Step7, as you advised before.
Setting of PID control block in the Step7 I used in the first test did not change anything other than Kp, Ki and Kd.

I have several times update the OPC connection, as a result has received such graphs

 
Last edited:
Originally posted by kolchak:

How your method different from the method suggested by kamenges?

Peter's spreadsheet will provide calculated gains based on the characteristic equation of the plant. I haven't specifically looked at the spreadsheet but Peter often uses pole placement as a design method and places the closed loop poles so the resulting system is critically damped.
My correlations don't consider the system at all. The correlations simply convert the gain values from the independent form of the PID that you had at the beginning of the thread to the dependent form used by the S7.

Originally posted by kolchak:

As seen in the screenshot above, I get through the OPC setting from Matlab, so I can be sure that it is equal to 50.

I haven't seen anything that would definitely indicate that the setpoint value in the room temperature model test as seen by the S7 is 50. i have no doubt that the sepoint value in Matlab is 50. But what value is displayed in the S7. Remember also that the S7 PID treats the setpoint as a REAL. You need to make sure you view the data as a REAL in the S7 to know what you are seeing.

Actually I am somewhat surprised that this is working at all if the OPC data transfer is sending and receiving values as DWORDs when the S7 is expecting them to be REALS. That seems like a real issue to me (pardon the obvious pun). Are you saying that in the OPC data transfer set-up you cannot select REAL as the data type?

Finally, can you please post the form of the PID you are using in Matlab? I want to make sure it is the same in form as the parallel structure you were using manually when this all started.

Keith
 
Finally, can you please post the form of the PID you are using in Matlab? I want to make sure it is the same in form as the parallel structure you were using manually when this all started.

Keith

Welcome, gentlemen!
I am sorry that did not respond in time, was not available, out the Internet.

Keith, thanks for the answer.

PID which i using in Matlab:


I changed in Matlab Limit data points:5000 and Format:array, with the result that has received the following graphs, which show distinct from each other. You do not know what the problem is?



And every time I update the OPC connection and restart the process simulation in Matlab I get these and other deformed graphs:

 
Last edited:
Originally posted by kolchak:

And every time I update the OPC connection and restart the process simulation in Matlab I get these and other deformed graphs:

What are you updating in the OPC connection? Granted, nothing in the OPC connection should change an underdamped system to an overdamped system but I'm I'm still curious. Also, you should use an OPC data rate that is under 100 msec. Because PID execution is not tied to the OPC data rate the PID could conceivable receive two updates between one execution and no updates between another.

I will ask again: are you fully confident that the values you are writing through the OPC server are arriving in and being interpreted by the plc in the correct way, including having full precision? This could cause you all sorts of issues.

Keith
 
What are you updating in the OPC connection? Granted, nothing in the OPC connection should change an underdamped system to an overdamped system but I'm I'm still curious. Also, you should use an OPC data rate that is under 100 msec. Because PID execution is not tied to the OPC data rate the PID could conceivable receive two updates between one execution and no updates between another.

I will ask again: are you fully confident that the values you are writing through the OPC server are arriving in and being interpreted by the plc in the correct way, including having full precision? This could cause you all sorts of issues.

Keith

Keith, I use OPC KEPSeverEX , PLCSIM and utility "NetToPlcSim" for connection between plcsim and OPC server. Reboots OPC server connection switching in the tray.
Please tell me, how can I check that the data exchange occurs with 100 ms?
I have tried to transmit data using OPC between Matlab and plssim (not PID), and transmit data to the SСADA, everything worked well.

DB2 unit settings, parameters PID FB 41, I described in the screenshot above message.

I posted the results of the second screenshot below room temperature control model, which shows that the PV is always the value does not reach similar values of JV, it is always different.

As can be seen in this case that the OPC connection works well, therefore in the first case above is not promblema bad connection.

Settings DB2(in Step7) I always leave the same, changing only the values Gain, TI and TD as you recommended.
 
Originally posted by kolchak:

As can be seen in this case that the OPC connection works well, therefore in the first case above is not promblema bad connection.

I am not trying to say the connection is bad. I am trying to say that the datatype in Matlab is not the same as the datatype in the S7. The only way to know for sure is to open the S7 controller and directly view the items you are concerned with (SV, PV and LMN) in an online watch window. This will tell you if the values on the Matlab side and the values in the S7 truly match. This might also indicate why the PV doesn't reach the SP. Remember that the value of LMN is limited to +/-100%.

Originally posted by kolchak:

Please tell me, how can I check that the data exchange occurs with 100 ms?

I'm not sure about that. You show a tag properties box several posts back that shows 100msec in a "scan rate" field so I would assume this is where you can adjust it. But again, I'm not sure.

Keith
 

Similar Topics

HI.I REVIEWED A PROJECT DONE. THIS FB41 PID BLOCK WAS USED FOR THE PASTEURIZATION PROCESS. THE PROCESS I CAN'T UNDERSTAND IS THE ACTION. WHILE THE...
Replies
2
Views
1,107
We have to migrate a project from S7 300 to S7 1500 where FB41 CONT_C is used. It is called in OB (every cycle), I see that the parameter 'Cycle'...
Replies
1
Views
1,943
hello, I'm new in automatics, and i'm working on a speed control project for a hydraulic turbine. i'm using FB41 pid bloc, but the LMN give me 0...
Replies
3
Views
2,262
hi , I'm trying to implement PID in step 7 using FB41.the FB41 is implemented in OB35. I know how to set parameters of PID also I know the inputs...
Replies
16
Views
4,056
Hello, Please see attached pictures and tell me why does the output change can you please pin point my mistake i have been searching the net for...
Replies
2
Views
1,934
Back
Top Bottom