# PID control loop with two transfer functions

• posted

This is really pathetic. I know I should know this but for the life of me I cannot remember how to do this.

Here's my (simplified) problem:

I have an stirred tank filled with water. In the tank I have a heating coil. When I switch on the coil the water in the tank heats up. The heating of the water can be characterised by a transfer function (I'm ignoring lag-times for simplicity's sake). When I switch off the coil the water will start to cool down. However, due to the insulation of the tank, the cooling process is remarkably slower. So, the cooling can be characterised by another transfer function.

Let's say that the heating process is characterised by 1/(15s+1) and the cooling is characterised by 1/(230s+1).

Now, I want to make a model of this tank and ultimately put it in a control loop using a PID controller. To model this I use MatLab/Simulink). How can I model this system? I can't figure out how to connect the two transfer functions. When I put the blocks in serial order then the slower block will also slowdown the heating up and not just the cooling down.

How should I place these blocks in order to get a good representation of the physical system?

TIA

• posted

Go back to the physics! You have a quantity of matter that is (a) gaining enthalpy at a determinable rate when the heat source is on and (b) losing enthalpy at a rate that is a function of the delta T between it and the surroundings all the time. The temperature is related to the enthalpy. The model is likely to be based on a single integrator, the thermal mass of the system.

Transfer functions should be defined from the mathematical behaviour of the system, not the the way round.

• posted

Are you sure you have two transfer functions? Are you sure you can use transfer functions at all?

If your system can be modelled with transfer functions at all then it can be modelled with just one. I suspect that you are trying to model the process with too low of an end temperature, and have convinced yourself that you have two transfer functions. If I am right this means that you have one transfer function, call it T(s), the heating process would be characterized by T(s) with some nominal input of X, and that the temperature after a long heating cycle is _hot_. The cooling process would be characterized by the same T(s) with the nominal input of 0, but because the you're way below the ultimate temperature you see a slower rate of decay.

If your temperature changes to such an extent that you cannot use a linear model then you cannot use a transfer function and you need to implement a non-linear system model using integrators and all the fun nonlinear blocks that Simulink gives you. Even if you model the system with a linear model I would still suggest modelling it with discrete blocks rather than transfer functions -- it gives you a better idea of what's going on, it removes a layer of possible mistakes, and it gives you something to show your collegues that will make more sense to them. The only time _not_ to do this is if your plant is so mysterious that you've just identified it with some system identification scheme, and your plant sounds too simple for that.

• posted

"Someone" wrote in news:butk1s\$avk\$ snipped-for-privacy@news3.tilbu.nb.home.nl:

It would seem as if you will have a cooling process even when the heating process is going on. You shouldn't have to bounce back and forth between two transfer functions

Scott

• posted

Thanks for you comments, they are highly appreciated.

After some reconsidering I must agree with you (Bruce, Tim and Scott) that I may have overlooked something and that in fact I'm looking at just one transfer function at two different moments in time (start vs. end).

But, now, on to a related problem. Suppose that the cooling is forced by sending cooling water through the coil. The cooling capacity of the water will be less than the heating capacity of, say, steam. Isn't it true that in such a case I *will* have two transfer functions to consider? Now, what if I want to model that and in the end introduce a 50/50 splitrange control using a single PID-controller? How do you suggest I'd go about that?

"Someone" schreef in bericht news:butk1s\$avk\$ snipped-for-privacy@news3.tilbu.nb.home.nl... | This is really pathetic. I know I should know this but for the life of me I | cannot remember how to do this. | | Here's my (simplified) problem: | | I have an stirred tank filled with water. In the tank I have a heating coil. | When I switch on the coil the water in the tank heats up. The heating of the | water can be characterised by a transfer function (I'm ignoring lag-times for | simplicity's sake). When I switch off the coil the water will start to cool | down. However, due to the insulation of the tank, the cooling process is | remarkably slower. So, the cooling can be characterised by another transfer | function. | | Let's say that the heating process is characterised by 1/(15s+1) and the | cooling is characterised by 1/(230s+1). | | Now, I want to make a model of this tank and ultimately put it in a | control loop using a PID controller. To model this I use MatLab/Simulink). How | can I model this system? I can't figure out how to connect the two | transfer functions. When I put the blocks in serial order then the slower block | will also slowdown the heating up and not just the cooling down. | | How should I place these blocks in order to get a good representation of the | physical system? | | TIA | | -- | Someone | |

• posted

The first rule of controlling a nonlinear system is to try as hard as you can to pretend that it is linear. You should only break out the non-linear techniques when attempts to wedge it into linearity have failed.

If you're _always_ running cooling water or steam through the coil, and if you happen to be innefficent about it (so the steam or cooling water's outlet temperature is still markedly different from the fluid in the tank) then can you just model the system with a constant heat-rate drop (or gain) in the coil?

If the volume of the coil is less than 10% of the volume of the fluid in the tank then it may make a difference, but it will be much less than various other process unknowns and you can absorb it into whatever design decisions you're taking to make the loop robust.

If you must model the system as having a time constant that changes with control input, then it is by definition nonlinear and _you cannot use transfer functions_! The Laplace transform as a means of system analysis _only_ works for linear systems, and it is peculiar and unruly for time-varying systems, to the point where it is wiser to pretend that it can't be done.

If you model your system with blocks then you will find that a non-linear simulation is as easy to build as a linear one. This is the whole point of Simulink: If all systems could be adequately modelled by transfer functions then Simulink wouldn't be worth the \$\$\$ it costs.

I am not enough of a thermodynamicist to give you pointers on how to model this system. If I were doing this and I had to model the system up front I would budget some of my contract money for just such a person and pay to have it done -- but only after I'd ascertained from the client that we couldn't just wait until things were built and tune it by cut and try.

As an intermediate step I'd try to get the tank built and characterize it with and without water in the heat transfer coil and find out (a) if the difference in characteristics is enough to bother, and (b) the apparant tran sfer functions for each mode. With these two apparant transfer functions in hand I would build a non-linear Simulink model that fit.

• posted

So what you are saying is that I should try to make the cooling and heating parts balanced so that I can model the process with a linear system. Is that it?

| > After some reconsidering I must agree with you (Bruce, Tim and Scott) that | I | > may have overlooked something and that in fact I'm looking at just one | transfer | > function at two different moments in time (start vs. end). | >

| > But, now, on to a related problem. Suppose that the cooling is forced by | > sending cooling water through the coil. The cooling capacity of the water | will | > be less than the heating capacity of, say, steam. Isn't it true that in | such a | > case I *will* have two transfer functions to consider? | > Now, what if I want to model that and in the end introduce a 50/50 | splitrange | > control using a single PID-controller? How do you suggest I'd go about | that? | >

| >

| |

• posted

Yes -- and then verify that your linear model is close enough to reality that it makes sense to use it.

• posted

----- Original Message ----- From: "Someone" Newsgroups: sci.engr.control Sent: Monday, January 26, 2004 7:51 AM Subject: Re: PID control loop with two transfer functions

Yes, there will be two transfer function because you have two forcing functions or two input coupling matrices ( B ), but the system matrix ( A ) and state vector will be the same.

You may need two PIDs. One for heating and one for cooling. The one for cooling shouldn't be required unless you need to cool the system quickly or are cooling below ambient temperature. Also, only one needs to be active at a time.

Peter Nachtwey

• posted

• posted

Oops I meant to say "You do not need TWO PID controllers"

• posted

Agreed, only one PID is necessary and gains can be changed on-the-fly. We use only one PID in hdyraulic motion control and use different gains for extending and retracting a single rodded cylinder, but we have only one output to the valves. I don't know of any PLC PIDs that have this multiple gain feature or mulitple control outputs. In addition the cooling feature may not be required unless the temperature set point is below ambient. I would think it would be easier to just use two PIDs, one for heating and one for cooling, and just enable one or the other. What will work best will depend on the tools at hand.

Yes, PID is often over kill for temperature control. Simple bang-bang control works if the system can be modeled as a first order lag. When the system has more than one pole one should consider sliding mode control ( enhanced bang-bang control ).

Peter Nachtwey

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.