Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

basics of PID control

Status
Not open for further replies.

PG1995

Active Member
Hi

Could you please help me with these queries? Thank you very much.

Regards
PG
 

Attachments

  • pid_final.jpg
    pid_final.jpg
    1.4 MB · Views: 653
Q1: They could have used PI control, but they are taking a step by step approach to introduce P, I and D and then work up to PID control. PID control is the most general control for second order systems, but one is always free to set any of the gains to zero to create P, PI, PD or I control.

Q2: It is a common feature of control systems (particularly second order systems) that then become unstable as gain is increased beyond a certain level. This is not a firm rule, but a general rule that works in most cases (first order systems with P control are the simplest exception in that they theoretically are always stable when gain is increased arbitrarily). Instability is obvious from the pole locations, also.

Q3: Different system are ... different. There is no one control method for the general case. Gradually you learn the most common cases and learn which control approach works well. Then, you will eventually encounter uncommon or unique problems and you will need to go to more advanced methods.

Q4: I think you are right.
 
Last edited:
Q1: That is a PI control. You can't set P parameter to zero, therefore all controllers have Proportional gain. Here the integral gain and proportional gain are both included in the parameter K.

EDIT: I'm used to work with the stanard form:

68dcc9ea850cb4411290fa7bb6e47219.png

If you use the Ideal (parallel) form, you can set P gain to zero.
 
Hi

Now that I have some basic understanding of the circuit, I believe I can slowly start learning the maximum power point circuit from control theory point of view. I think this model more closely resembles what I intend to design. I think to get started we would first need to translate the circuit model into a control system block diagram. How do we transform the model into something like this one which is, I believe, standard way of representing a control system? Thank you.

Regards
PG
 

Attachments

  • pro_block1.jpg
    pro_block1.jpg
    41.2 KB · Views: 1,240
  • pro_con.jpg
    pro_con.jpg
    24.3 KB · Views: 4,562
You have to take your converter circuit (buck converter in this case) and create an averaged model. Then you can linearize the average model and create a linear model suitable for control theory analysis. Since, the system is nonlinear, your linear model will depend on operating point. The process is good to learn, but if you are not in the mood to do it, it has been worked out in many books and probably on-line somewhere too. If you can't find it, let me know. I can derive it and give you a copy if needed.
 
Also, your block diagram is shown in the continuous time domain, but unless you are going to implement feedback with opamps/analog circuits, this is not correct. If you use a micro controller to sample the measurements and do the feedback, then it is best to discretize your circuit model and use discrete time feedback and discrete time block diagrams/modeling.
 
Thank you, Steve.

I will get back to the main question soon. But first let's discuss some important points.

Why should we analyze the circuit from control theory point of view? What advantages will it offer? What kind of more insight into the circuit behavior it will provide us with which simple circuit theory wasn't able to?

This is what I think. The circuit which we are discussing is a DC one so I can't even say that we are analyzing the circuit in frequency domain such as Laplace because DC circuit has zero frequency. First, simple circuit theory model only reveals the behavior of the circuit in steady state. It doesn't provide us information about what happens when the circuit is switched on. How the circuit handles transients. It doesn't tell tell what happens to the circuit behavior when it is suddenly disturbed such as during cloudy season. I don't know if what I'm saying I'm correct. It would be kind of you if you could correct me and elaborate more on why analyzing the circuit from control theory point of view might be a good idea. Please try to keep things simple as you always do. Thank you.

Regards
PG

PS: Made some edits.
 
Last edited:
Basically, what you are saying is correct. A control theory analysis will allow you to rigorously understand the stability and robustness of your control system, and it would allow you to understand the dynamic effects in great detail and gives insight into making even better control systems. One could even go to the point of using full state feedback control instead of PID control.

But, to be honest, in this case, this is overkill for designing a good system. It would be enough to use the dynamic equations to make a numerical model of the system (using Matlab or Simulink for example) and manually tune your PID controller. You may even be able to estimate good PID gain values using some formulas, and then fine tune it experimentally.

It's really a matter of how much effort you want to put in. There are very simple ways to get it to work, and there are more complicated ways to thoroughly understand every aspect of the system and optimize it.

At this stage, it's not even clear to me what control approach you will use. Most of the guidance from your reference and from NorthGuy is saying to use a very simple direct feedback with duty cycle as the control input and P&O as the algorithm. If you do that, then control analysis is not even required, as far as I can tell.

Personally, I would implement a dual feedback with P&O providing control as an outer slow loop, and a faster loop controlling the input voltage (input resistance could be done too, but is more complicated ). The outer loop would command input voltage, and the inner loop would command duty cycle. By doing this, you allow the slow outer loop to control for sun/cell variation, and the inner loop controls against load/temperature changes in the buck converter itself. This might be overkill (then again, it might not be depending on the actual application), but it's not difficult and typically would not add more cost because a slow P&O algorithm does not strain even the most basic microprocessor, and hence leaves processing power for a faster inner loop.

The other thing is you will learn a lot with a more advanced approach, but I would caution you that the time investment may be too much for you. Students often don't have time to get too fancy; and, nowadays, even real world engineers are not given the time to make the best solution if a simple approach gets the job done.
 
Last edited:
Thank you.

But, to be honest, in this case, this is overkill for designing a good system. It would be enough to use the dynamic equations to make a numerical model of the system (using Matlab or Simulink for example) and manually tune your PID controller. You may even be able to estimate good PID gain values using some formulas, and then fine tune it experimentally.

Thanks a lot for the good advice. Yes, you are right that I can't invest too much time into it. But if it were possible I would have learned a lot. I think your suggestion of using Simulink is a good one. I have never used Simulink but I'm sure you have so I shouldn't worry too much about that! :) Just kidding. I will try to learn it myself too. Thanks.

I know that it's going to sound very silly and stupid but anyway I should clarify it. I was thinking that we were using a microcontroller with P&O algorithm, so what's this talk about PID controller?! :banghead:

At this stage, it's not even clear to me what control approach you will use. Most of the guidance from your reference and from NorthGuy is saying to use a very simple direct feedback with duty cycle as the control input and P&O as the algorithm. If you do that, then control analysis is not even required, as far as I can tell.

Yes, I intend to use direct feedback with duty cycle as the control input and P&O as the algorithm. But why isn't control analysis required in this case? Could you please tell me? Thanks.

I have tried to draw a block diagram for the circuit in terms of control theory. Is it correct? Don't we need to include the buck converter too in the diagram?

Best regards
PG
 

Attachments

  • pro_feedback.jpg
    pro_feedback.jpg
    25.2 KB · Views: 871
Yes, I intend to use direct feedback with duty cycle as the control input and P&O as the algorithm. But why isn't control analysis required in this case? Could you please tell me? Thanks.
Well, in my view, control analysis is always preferred when it can be done. This is definitely a case where doing it is very feasible, and I would do it if it were me. However, I have experience doing it, I enjoy doing it, I personally design better that way and I can do it in a reasonable amount of time. So for me, it makes sense. However, not everyone will take this path and certainly this project can be done in a common sense fashion.

Basically, the analysis isn't required because you have the basic system identified, you know others have implemented similar approaches with success and you have few enough degrees of freedom that you can hunt and peck to find control topologies and control gains that work.

I have tried to draw a block diagram for the circuit in terms of control theory. Is it correct? Don't we need to include the buck converter too in the diagram?

I would prefer to see a better diagram with more accurate labeling. For example, the solar input is unclear. What is that? The output of the controller, is it duty cycle? If so, label it. The system is not just a capacitor, but is an entire buck converter. What exact measurements are you taking? Show them clearly.

I understand that the diagram will likely evolve as you learn more and make decisions, but I think you can include more than what is shown, even at this point.

EDIT: Also, as I mentioned before, if this is a digital control loop, then you should show the sampling points and discrete time signals.
 
Last edited:
Thank you.

Although I believe one query you just skipped because it really frustrated you, I would still gather the courage to ask you again. Please don't mind.

I know that it's going to sound very silly and stupid but anyway I should clarify it. I was thinking that we were using a microcontroller with P&O algorithm, so what's this talk about PID controller?! :banghead:

I would prefer to see a better diagram with more accurate labeling. For example, the solar input is unclear. What is that? The output of the controller, is it duty cycle? If so, label it. The system is not just a capacitor, but is an entire buck converter. What exact measurements are you taking? Show them clearly.

I understand that the diagram will likely evolve as you learn more and make decisions, but I think you can include more than what is shown, even at this point.

I have tried it again but I already know it's wrong. Thanks.

Regards
PG
 

Attachments

  • pro_feedback1.jpg
    pro_feedback1.jpg
    87.4 KB · Views: 828
I didn't realize the PID question was a question. I thought it was your own realization that with P&O implemented the way you said, you don't need PID. PID is only needed if you decide to implement PID control. If you don't decide to implement PID control you don't need it.

PID control would be appropriate if you decided to implement an outer loop with P&O maximization control, and an inner loop controlling the input voltage could be done with PID.

Alternatively, even if you had only one loop for maximization of power, you could use consecutive readings of power to estimate the slope of power or the derivative dP/dD. Then a PID regulator could be used to drive the slope signal to zero.

Fuzzy logic control is also good for maximizing power. It has better dynamic response, but it is also more involved to implement and understand.

There are just so many different ways to implement control.

As far as the block diagram, it is better but still not great. But, you can leave it till you get closer to finalizing your approach. I think it would make sense to make one block diagram of the physical system and interconnections. And, then another diagram could show the digital control to be implemented in code. You started to do this above, but you can refine both diagrams gradually.

I find it interesting that you identified the Cin as a system by itself. There is nothing wrong with this, but maybe it is an uncommon approach. I like to include Cin as part of the source system, and many other people like to include Cin as part of the converter system. But, there is no right and wrong here. It's personal preference because all 3 ways obey proper rules about what a system and its subsystems needs to be, and all 3 could be represented effectively with a state space system models of the subsystems.
 
Last edited:
Thank you.

This is my understanding of PID controller. It is an algorithm, just like P&O, which is used to provide a stable relationship between an output and input by minimizing the error. That algorithm could come in a form of hardware chip as an embedded algorithm or can be implemented in software form. Kindly correct me.

I showed Cin as a separate system because it looked more logical and descriptive to me. We are sensing the current and voltage of Cin to drive the switching of buck converter. If you don't mind, could you show me how you would draw those diagrams because I might need to show them in next couple of days? This way I will get some time to understand them properly. Thanks a lot.

Regards
PG
 
This is my understanding of PID controller. It is an algorithm, just like P&O, which is used to provide a stable relationship between an output and input by minimizing the error. That algorithm could come in a form of hardware chip as an embedded algorithm or can be implemented in software form. Kindly correct me.
Seems reasonable to me. I guess hardware chips do exist, if you look for them. However, they are very simple to implement using a simple opamp circuit. Nowadays, we see more an more implementation digitally using a microprocessor.

I showed Cin as a separate system because it looked more logical and descriptive to me. We are sensing the current and voltage of Cin to drive the switching of buck converter. If you don't mind, could you show me how you would draw those diagrams because I might need to show them in next couple of days? This way I will get some time to understand them properly. Thanks a lot.
Maybe I can sketch something up soon.

By the way, you are correct that we sense the voltage of Cin, but I believe you are not planning to sense the current of of Cin directly. You will be measuring the cell current I thought. Is that correct?
 
Thanks a lot.

By the way, you are correct that we sense the voltage of Cin, but I believe you are not planning to sense the current of of Cin directly. You will be measuring the cell current I thought. Is that correct?

That's good thing that you asked me about this because I didn't think about it. I think we need to sense the voltage at capacitor, Cin, terminals and current flowing into the capacitor, Cin, when the switch, such as mosfet, of buck converter is open. When the switch is open, the current flowing into the capacitor is same as coming out the solar panel (i.e. cell). I might be missing something important. Please let me know.

When the switch is closed, there are two sources of current which is flowing toward the output terminal, Vout, and those sources are Cin and solar panel.

Regards
PG
 
OK, this last point is providing some insight into why I don't like converters with discontinuous input current for this application. Things look and behave a little simpler when you have a coil on the input, such as you do with a boost converter.

So, I think you are measuring photocell current. Let me ask, why do you even care about the current into the capacitor when you are doing control? The capacitor is there to help smooth out the current from the solar cell. The converter is turning the current on and off, which would not be good for MPPT because the cell would see zero current for part of the duty cycle, and too much current for the other part, and the cell would never be at it's maximum power point. However, the Cin will filter the PWM switching and let the cell see a more or less constant voltage and current. You want to measure the average values of these two quantities so that you can calculate average power from the cell. The current in Cin is not relevant, nor is the current going into the converter input. However the sum of these two currents is the photocell current, which you do care about.

Please correct me if I've missed anything about your approach.
 
Thank you, Steve.

You have pointed out something very important. I need to think about it properly so that I can phrase it clearly. But I think we should also get NorthGuy here. Right now I should sleep and will think about it once I'm fresh. Thanks.

By the way, I should mention something from this post (Section 2) which lets you know what I think of Cin.

I think the capacitor C_in in Figure 2 plays the role of input voltage source for the buck converter and at the same time also functions as dummy load or resistance to the panel.

Regards
PG
 
If you don't mind, could you show me how you would draw those diagrams because I might need to show them in next couple of days?

I've attached a block diagram showing my point of view on this. There is no one perfect way to do these things, so just take this as guidance. Also, I'm doing this very quickly without a lot of thought. So, keep an eye out for mistakes and oversights. I've left some of the detail out. For example, the P&O algorithm you have already shown, so I show it as a higher level block. Also, the disable detect is important, but you have not defined how you want this to work. Eventually, you will want overvoltage protection and short circuit protection of some type. You may even want to include more inputs than I've shown to the disable. So, you will need to work out the details of this block.
 

Attachments

  • BlockDiag.JPG
    BlockDiag.JPG
    1.6 MB · Views: 530
Thanks a lot, Steve.

Please use this attachment for the queries.. It looks like you are also including battery charging algorithm into MPPT. But I wanted to design maximum power point tracker not maximum power point charge controller. I had thought of using a separate battery charging IC, like this one, to regulate the charging.

1: If I exclude the battery charging part from the block diagram as I'm only trying to design a tracker, then do you find my edited version correct?

2: Don't you think excluding the battery charging part also renders that digital system block diagram at the bottom somewhat irrelevant?

3: What does that line running from buck converter into the Cin represent?

Thank you for the help.

Regards
PG
 

Attachments

  • pro_BlockDiag11.jpg
    pro_BlockDiag11.jpg
    126.8 KB · Views: 908
Last edited:
It looks like you are also including battery charging algorithm into MPPT.
With what I showed, you could include it or not include it. I don't really see the advantage of excluding it, but certainly you can exclude it and do the charging with a separate block. If you notice, I showed a load. The battery charger circuit and battery, and the load on that system, would become the total load on this system. The diagram is quite general to handle many cases.

But I wanted to design maximum power point tracker not maximum power point charge controller. I had thought of using a separate battery charging IC, like this one, to regulate the charging.
You can do that. It seems redundant and inefficient to me. Can you explain your rationale for doing this?

If I exclude the battery charging part from the block diagram as I'm only trying to design a tracker, then do you find my edited version correct?
No, I think the original that I provided still holds up. The load is the battery charger as I mentioned above. The capacitor in your buck converter will still be at risk of getting overcharged, and protection against this is even more critical. In fact, now you are in a situation where you might need a faster feedback loop just to prevent the cap from blowing up. A battery charges gradually and gives you time to do a charge shutdown, but a cap charges quickly. Basically, as soon as your battery charging system fully charges the battery, it will stop charging and become an insignificant load to your buck converter. You either need to shutdown the buck converter or turn on a bleeder resistor to prevent the cap from exploding.

Don't you think excluding the battery charging part also renders that digital system block diagram at the bottom somewhat irrelevant?
Huh? Why would you think that? The digital system is your P&O algorithm plus any other features, such as protection and shutdown. Did you suddenly decide to not implement P&O or do any control at all?
What does that line running from buck converter into the Cin represent?
That line is labeled i_in(t) which is the input current to the buck converter. The capacitor C_in will be charged by the difference in the i_sc(t) and i_in(t) currents.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top