Simulating a Microgrid with Energy Storage | Developing Electrical Systems with Simscape Electrical - MATLAB & Simulink
Video Player is loading.
Current Time 0:00
Duration 34:24
Loaded: 0.48%
Stream Type LIVE
Remaining Time 34:24
 
1x
  • Chapters
  • descriptions off, selected
  • en (Main), selected
    Video length is 34:24

    Simulating a Microgrid with Energy Storage | Developing Electrical Systems with Simscape Electrical

    From the series: Developing Electrical Systems with Simscape Electrical

    In this example, learn how to create a mixed AC to DC microgrid containing traditional rotating machinery, a battery, two fuel cells, and a PV array. First, develop and test each of these components independently. Then, connect model components to construct and test the full microgrid system to see how the power management unit operates.

    Published: 24 May 2022

    Hello, everyone, and welcome to the third session from this video series, which is about developing electrical systems with Simscape. My name is Mohsen Aleenejad, and I'm a Senior Application Engineer with a focus on power and energy fields at MathWorks, and based in Dallas, Texas. In this session, we're going to be looking in more details at the microgrid systems.

    This will be the continuation of my colleague's work in the first session of this video series. So if you haven't watched Kristin's session yet, please pause this video, go back to the first session, and start from there. So let me briefly talk about this session's agenda, and what are today's end goals.

    Mainly, I'm going to talk about the Simscape electrical essentials, and how to develop a microgrid with a bunch of AC and DC power systems, including PV panels, AC generators, fuel cells, and battery. And also, I'll talk about the higher-level power management unit and maximum power point tracking algorithm. So I'm going to show you the final system that I'm working you toward today. This is the system that we build up at the end of today, and it includes a couple of AC generators connected in parallel, AC-DC power converters, the DC system on the other side of the model that includes the battery and a couple of fuel cells, and also PV array.

    The first thing we are going to do is look at some of the key components and how they operate. So we want to incrementally build component details and evaluate operation, and satisfy ourselves that we are seeing exactly the behavior we expect for a given component. And we are going to look at a couple of components in here.

    We are going to begin with impedance matching and maximum power point tracking-- MPPT. That's going to influence our PV cell, PV arrays, solar panel. So let's open up this model in here. I have the first model impedance matching. And I have two subsystems in here.

    I'm going to expand them by using the Space bar. So on the top, we have this changing load and a fixed source. We ramp up the voltage of the load. We don't have any fancy system in this system-- one system. Two, we have a buck boost converter with maximum power point tracking if you open this maximum power point tracking.

    We have a detailed control. I'm going to run this system now. We're going to take a look at the details later. So if I open up the data simulation-- Data Inspector or SDI-- we can take a look at the load voltages for the top system. The source of voltage-- you can see the load voltage increasing and the source voltage decreasing in here.

    And we can watch the power, the power which increases up to the maximum power point and then decreases. Here, maximum power-- it's around 100 watts, which occurs at 100 volts for both voltages of the load and source. So we have an impedance match in here.

    So I'm going to uncheck these three and take a look at the second subsystem with the buck boost converter and maximum power point tracking. So if you take a look at-- the load voltage increases, the source voltage-- it has a transient. It goes to 100 volts. And it stays there.

    It sits around 100 volts. 100 volts is where we had the maximum power point. And if we look at the power-- the power tracks up to 100 volts, and it stays at that point. What's happening is that we are dynamically changing the impedance that the source is seeing, to keep it matched regardless of what's happening on the load side.

    So it's doing that changing the duty cycle. So let's take a look at the duty cycle in the maximum power point tracking algorithm in here. This is a so-called "perturb and observe" MPPT-- maximum power point tracking. If we take a look at the rate of the change of the power, that's really dependent of the rate of change of this duty cycle.

    We have the increment value in here. Now it's 1.5 minus 3. If I double-click on that, open it, and change the value to a larger amount-- like 1 e minus 2, for example-- then if I run the system with this value-- 1 e minus 2-- I'm going to run this again to see the difference. So now I'm going to go back to the Data Inspector and you see now it's a little bit noisier because of that bigger step.

    And certainly, we see it in the source voltage. But still, we are tracking the maximum power point with higher fluctuations, with bigger jiggles. So that's the first part of testing our system with the maximum power point of a voltage source. Now it's time to go and check a real-life example in here.

    The next example, which-- I said it's a real-life example of impedance matching-- is maximum power point tracking of a solar panel, instead of having a fixed voltage source. So in a real-world application, we have a detailed PV solar cell, which you can see in here. And if I double-click on that, you can see it's a pretty parameterized power cell with a manufacturer part.

    You can definitely change that manufacturer power part to another thing that you use in your system. We have these cell characteristics parameterized in here, so we can easily change the values for them. And we have this profile of the irradiance, which we are simply ramping up to 1 kilowatt over meter squared, and ramping it down to 0.

    We are using physical signal converter to get Simulink signals to these Simscape data. And we have this maximum power point tracking. It's unchanged from the previous example.

    We have ideal DC to AC system in here. So it's a single-phase inverter, and what we are doing in here is very basic. We are measuring the energy from the DC side. And we transfer it from the DC side to the AC side, using this Simulink approach in between, in the gap.

    So because we have interconnected two networks-- the DC side and AC side-- we have to solve our profilers. And that lets us to set two different step times-- sample times, TS_DC, and on the other side, the AC side, TS_AC. So typically, the AC step size is larger. It depends on your system. But you have the flexibility to change it, based on your demands and requirements.

    And in here you can see the TS_AC is 2 e minus 4, and TS_DC is 1 e minus 3-- so two separate step times, sample times for each net. And this brings efficiency to our Simulink model, to optimize based on the different characteristic that our networks have. So the other thing is we have written this MATLAB script. So it's a way of showing the power profile, to visually confirm the different power waveforms-- the curves-- for each irradiance.

    And if I run this, you should see a figure upright in our live script. I'm going to minimize this Simulink model so you can see this figure. The power curves of solar cells regarding the irradiance is shown in blue. The red curve is the maximum power point track that our system is not aware of. It doesn't have any knowledge on the blue wave forms.

    But because it's tracking the maximum power point by perturb and observation, it's tracking the maximum power. It's simply looking to define those peaks by not regarding those changes that it sees in our system. So it's a nice way of visualizing by using MATLAB graphics. It gives us these nice features to verify and see the operational behavior of our power system.

    So I'm going to close this down, and scroll down in here to go to the third example that we have in here. I'm going to close the previous model and open up the power sharing. We want to test the power sharing on AC generators.

    We want to look at the traditional mechanism of the power sharing, which is called a frequency droop, which is for active power. So this is, as I mentioned, for active power sharing. For reactive power sharing, we have the voltage group, or AC solve. But we are not going to cover that part for the sake of time. But you still have the feature to control the reactive power.

    We're going to focus on the active power in this presentation. So on the control perspective, we have this speed controller in here for the generator. We want to regulate the frequency and speed. But the droop-- which is an auxiliary signal, measuring the active power, multiplying it by a droop value.

    And what that does is it creates this droop curve, which-- it goes from zero loading to full load, one per unit. The per unit is the normalized value, based on the rating of the machine. And we can see it drops 5% based on that droop value we had in the auxiliary branch.

    And if we load the system 0.5 per unit or 50% of the system, we would end up-- to see that dashed line, where it sees that blue constant value. But what it means is that the power sharing is working. And we can take a look at that by opening this example in here.

    So it's going to open up model C, the third example. In this example, we're going to be testing the power sharing between two generators which are connected in parallel. The generator one, if we go underneath-- we see 5 mega volt-ampere for the diesel generator. We have the AVR and exciter and the governor control.

    We see the droop control in here. If we go back to the main page, we see active power load and reactive power load. We can change it with this variable, active resistance. We have the active power reference in here, which is 4 megawatts. It's 80% of the nominal value rating, and that's for one of the generators.

    So we're just going to test the active power. For the reactive power, we implemented that. We used the variable inductors. We can set a reactive power value. But in here, we use the various small values.

    So you can change that when you're playing with these models. But for this one, we are going to keep it as-is. And as I mentioned, these are two parallel generator connectors. And we are going to make sure the frequency droop for power sharing is working correctly.

    So here we have droop P1 and P2 equal to 5%-- 0.05. And then we run the system. And we take a look at the frequency droop on the left side. We have this blue curve for both of them.

    But for the voltage droop on the right side, we don't do anything with that. So it's not working at the moment. So you can see G1 and G2-- the powers from generator one and generator two-- they're equal, and stay at the same frequency. It's off the line a little bit. And that's because the blue line is a steady-state line.

    And it's a dynamic system. So the steady-state condition and the transient behavior-- it's a little bit different. But they generate exactly equal power, and they share the same frequency-- means they share power with the equal shares, equal power sharing, when the droops are the same. So now, let's make a change to the droop P2.

    And for this second generation, we set it half of the previous value-- 2.5%-- of the droop P1. And let's stop the system, rerun it again, to make sure that the frequency droop for power sharing is working fine. So if we go back to the live script, now we see we have two different droop curves-- for the red one, 45%, and for the blue one, 2.5%.

    They are at the same frequency, but the power shares are different. And in fact, generator two, which has twice the power of the generator one-- it has the value for droop-- half of the other generator. Twice the power, half the value of the droop-- that's the fundamental of the frequency, droop, power sharing. And we verified that by using Simscape. And we are seeing that on the live screen.

    So now I'm going to close down this model, stop the model. So we have confirmed this solar array and maximum power point tracking. We confirmed the power sharing for frequency droop. And the final test is going to be the power converter.

    I'm going to open up the model D, which-- we have a simplified test harness-- ideal, three-phase AC system, source and sink voltage. On the DC side, we have source and sink on the DC side-- ideal DC source. And it's going to be a bidirectional system.

    We have the power converter in between. In here, if you look under that system, we have two separate networks by using Simulink-- interconnected networks, like the previous example. But a little bit more complicated than the previous one in this example. We work on active and reactive power by using the DQ reference to transfer the power across the boundaries of the AC and DC system.

    Because we have Simulink in the middle, in the gap, we are able to split these two systems and have different time steps. We are going to have 1 megawatt for active power and 800 kilowatt for reactive power. I'm going to run the system here, take a look at the system response, and make sure that the system is working-- to confirm the connected operation of both systems.

    So going to the Simulink Data Inspector in here, checking the active power of the AC and active power of the DC-- they should be overlaid, and they are overlaid. And as you can see, we are tracking 1 megawatt. And in between five and six seconds, we have a drop to the power. That's because of ramping up the reactive power. Reactive power is ramping up, so that's the expected behavior.

    So we confirmed the operation of this system as well. And we cannot go through every single component that we have in this system. But we looked inside the main components. Now it's time to move over and go to the other parts of the system, like verifying the battery management systems-- the battery management and the fuel cells.

    Now I want to start talking about the fuel cell system. So we'll go to the directory tree-- a_AC_DC system. We are going to open up this system-- this model-- in here. So while it's opening, maybe we can talk about-- so let me minimize this system in here.

    I want to talk about the fuel cell on this live script. So what you see in here-- the fuel cells-- We have got two of those fuel cells in our system. And we model them with this lookup table. So we have a polarization curve on the right side in here.

    And what we do is we have this polarization curve-- current versus voltage. So if we measure the current, we input it to the lookup table, we calculate the voltage, we feed it through the controlled voltage source-- that we can make a model at system level. Let's say that's an average model for the fuel cell.

    It's not a detailed fuel cell model. We can do that, of course, in Simscape. But it's going to take longer times for simulations, so we keep it as a average model. So if we could run this code in here-- it plots the fuel cell polarization curve.

    And you can see the relationship for this particular fuel cell between the voltage and current. And depending on what your fuel cell is, you can generate these lookup tables-- either getting from the fuel cell suppliers, or you can generate lookup tables by detailed simulations. So by saying that, now we can bring back the Simulink models and talk about the components in here.

    So we have already seen the AC generators and the power sharing between them-- AC to DC power converters, PV arrays, the fuel cell. We just have seen that in the live script. Now it's time to talk about the battery.

    For the battery, we use a pre-built battery model from the Simscape Electrical. It's suitably parameterized for us, so you can see all the characteristics that are important. So you can save it in the workspace. You can double-click on that and check the values, if you want.

    And so we want to start looking at the operation of this particular system, and make sure that this power management system-- the power transfer management-- make sure that it's working appropriately, and all the components are doing as they're supposed to. So we put together this high-level power management system, and we focus on the key elements in here. So the main element in here is this AC load limit-- 8 megawatts. Then it's greater than 8 megawatts.

    The DC power starts supplying and helping the AC system. So AC limit is 8 megawatts. We shouldn't generate more than that nominal value of the combined two generators. So we have the power transfer limit across the AC to DC limit. It's 1.5 megawatts.

    And the combined power for the fuel cell and PV-- it's a limit of 500 kilowatts. So if that hits 500 kilowatts, we start using the battery. That's what basically, these numbers mean. So these go-to tags-- if we just click on that, we'll see there are some hyperlinks in here.

    So if we click on that, it brings us to the corresponding control unit-- for example, this one is the battery converter, which is controlling the battery power, based on the values you set in the power transfer management unit. And similarly, here, AC reference-- if you double-click on that, it takes us to the AC reference for the ideal AC to DC power conversion. So now let's memorize some of those numbers-- 8-megawatt limit for AC load limit before the DC power kicks in-- we transfer all the PV power.

    And if we go above 500 kilowatts, we'll start using the battery, above the limit of 1.5 megawatts of the power limit. Let's simulate this system and see how it looks in practice. We have a two-minute window for the simulation. And when it starts running, you see it's faster than real time. It's so much faster than real time.

    For two minutes, it's going to simulate the old system in less than-- I don't know-- 30 seconds, something like that. Now let's go to the Data Inspector. And the first thing I'm going to look at is the load profile. The AC_System P_load. So I'm going to maximize the window, and you see the loading here on the AC side.

    So it has two peaks-- a little bit above 12 megawatts here, and 9 megawatts on the first one. Next thing I want to look at is the power generated from two of those AC generators-- AC_System P_Gen1 and AC_System P_Gen2-- the power from the system number two-- generator number two.

    The generator two, providing twice the power of the generator one, has-- let me close this down-- the droops in here. You see P2 is half of the droop P1. So that means generator two generates double the amount of power of generator one.

    So now I'm going to see the total power of the AC system in here--

    P_Gen_Tot. Two generators combined-- it stays at that limit, 8 megawatts, as we want. So the management there is some limiting in here. But at some point, it breaks out. The generator is not staying at 8 megawatts. That's problematic because it's passing the rating.

    Are we seeing what we expect? Is this a simulation problem or a control problem? Now I'm going to uncheck this to investigate this scenario-- what's going on in here. The AC to DC power transfer-- I'm going to check that one. AC/DC P-- AC power transfer. I'm going to check that one as well.

    So let's look at what's happening. We transferred the power to where the peak emits. So this is a successful operation. When it hits the limit, we start transferring. But then the second peak-- we have a limit of 1.5 megawatts, so we cannot provide more than that.

    So that's why the generator have to pick up the extra and generate over that rating value. So that means the simulation is working correctly. Our system-- our power management unit-- is not meeting the demands for here.

    So I'm going to check all these boxes for the fuel cell powers, PV power. The PV power is really low in here, comparing to the other powers. So the battery is kicking in when the fuel cell and PV ever hits 500 kilowatts. The battery is kicking in.

    And there's a limit of the power of the battery. So the power transfer limit is 1.5. So we are limiting the battery power. So we are seeing the correct behavior.

    But for meeting the demands, we need to make some changes. Because the PV power is very small in here, I want to go inside the PV array, double-click on the solar cell with pre-parameterized configuration, and change the number of parallel connected strings from one to 10. And now I'm going to run the system again, and re-simulate it, and see how the system responds this time.

    By simulating this again, we'll see how that impacts the overall power sharing in the entire system. I'm going to close this down in here. And now if I maximize the window in here, you'll see the value for the PV array power-- it is indeed multiplied by 10-- around 300 kilowatts. But we reduced the fuel cell power. The combined power was 500 kilowatts, so that means we are using the battery.

    But the power management system-- we need to go there and change some values-- increase the value of the combination power first. But before doing that, let me go back to the live script in here-- let me close this Data Inspector. So I'm going to scroll down to the values that-- we want to change them.

    So in here, the combined power from fuel cell and PV-- we need to change it to 1 megawatt. And the 1.5-- I'm going to make it 5. So I'm going to double-click on that-- 5 e to the power of 6. And that 500 kilowatts-- I'm going to double-click on that and change it to 5 megawatts.

    So let's rerun the system again and take a look at the Data Inspector as soon as it comes back. Let's maximize this window. Now we are seeing the components of the DC system. The fuel cell total has been improved.

    We minimized the usage of the battery in this side. But we are not limiting that, so we are meeting that peak because of the changes that we made previously. So the value for the power of the battery is a little bit high, so that might not be what you're going to do or maybe it's what you want.

    So this is simulation. You can investigate it. You can see if that's what you want. Or no, you want to change some other things to make it a better simulation-- that's the beauty of the simulation, right? So now let's go to the AC system, look at the load power, the AC-- the total power of the generator.

    And we limited that to 8 megawatt, and for the entire time, it is equal or less than 8 megawatts. So this is the entire simulation. The question is, is that what you want? Or this simulation is not working as your engineering designs are required.

    So this concludes the third session of this video series. We talked about Simscape Electrical essentials. We used Simscape to build confidence in the development and test of interconnected AC and DC system simulations, modeled by incremental creation, tests, and integration of components covering a range of fidelity levels.

    Simscape provides a platform upon which more detailed system simulation can be created. I hope you find this session useful. And thank you for your attention.

    Up Next:

    View full series (4 Videos)