Electrical System Design Tradeoffs | Developing Electrical Systems with Simscape Electrical - MATLAB & Simulink
Video Player is loading.
Current Time 0:00
Duration 35:45
Loaded: 0.46%
Stream Type LIVE
Remaining Time 35:45
 
1x
  • Chapters
  • descriptions off, selected
  • en (Main), selected
    Video length is 35:45

    Electrical System Design Tradeoffs | Developing Electrical Systems with Simscape Electrical

    From the series: Developing Electrical Systems with Simscape Electrical

    Explore electrical system design tradeoffs with the goals of optimization and efficiency improvement. There are two examples: The first example will use a single-phase AC electrical network model to show a general workflow of using Monte Carlo simulation to evaluate the impact of component tolerances. Learn how Simscape Electrical™ is leveraged with other MathWorks® tools to explore the design space, speed up simulations with parallel computing, and automate Monte Carlo simulation for massive runs. The second example focuses on the renewable energy industry for long-term simulation in wind power system design with the quasi-steady method. Learn how Simscape Electrical is used to model wind turbines with Maximum Power Point Tracking (MPPT) for functional evaluation and how to modify the model with the quasi-steady method to run long-term simulations (for one year) efficiently.

    Published: 25 May 2022

    Hello, everyone. My name is Christine Li, and I'm the application engineer at MathWorks, with the focus on the modeling and control. So today, we are going to talk about how to do some trade-off studies for the electoral system on design. We now have Simulink and Simscape Electrical.

    This is our agenda. First we will start with the quick introduction about the motivation-- why the trade-off studies is important in the electrical system of design. Next, I will use two demos to cover two important topics in the electrical system of design trade-off studies.

    One is for the power conversion system tolerance study and another one is going to be focused on the renewable energy area for the long-term simulation. Finally, I will share with you some very useful resources and MathWorks support to help you get started.

    OK, now let's get started with introduction. There are lots of areas for the electoral system of design, such as the renewable energy and microgrid, the motor and the driver for the power conversion, and much more. And when we are working on the electoral system on design, we generally started by developing a model for our system.

    And once we have the model, we can run a simulation or any type of design of innovation or verification that we are interested. But no matter which area we're focusing on, the trade-off studies are one of the most important part during the design process.

    We may want to do some early design trade-off studies with modeling and simulation to optimize the parameters and determining the best design. Or we may want to run lots of scenarios by swapping the parameter values over the whole design space to evaluate the robustness of our design or perform a sensitivity analysis to figure out the parameters that influence the system performance significantly. Specifically, in the utility area, such as the renewable energy and microgrid, we may want around very long-term simulation, like a year, to evaluate design efficiently and effectively.

    So trade-off studies can be used to improve the performance or increase the reliability. All right, so that's a quick introduction about why we want to do the trade-off studies in the electoral system of design. Next, let's use the two demos to work through how MathWorks tools can help us to do the trade-off studies.

    The first demo is about using Monte Carlo simulation for the tolerance study in the power conversion area. And the second demo is about the quasi-steady method in the wind power system design with the long-term simulation. OK, now, let's get started with the first demo.

    When design the electrical systems, the impact of component tolerance should be evaluated. The main challenge with such an evaluation is that many simulations need to be performed to get a statistical measurement of the impact. So in this demo, I will walk you through a workflow for automating the execution of Monte Carlo simulations of an exemplary R2 network, as shown here. Especially, the parallel computing is used in this example to speed up the simulation.

    And please note that even we are using a very simple model here, the workflow can be used for any other type of the electoral system of design if you want to use Monte Carlo methods in very efficient way for the trade-off study.

    All right, now let's jump to MATLAB to get started. All right, so now we are MATLAB, and this is a live script for the first demo of the tolerance impact study using Monte Carlo simulations. So first, we will take a look at this electrical system model that has been viewed with Simscape Electrical. And then, we will run some simulation and do some simulation results analysis.

    And next, we will prepare the Monte Carlo simulation and then run the simulation with parallel computing. Finally, we will do some post-simulation analysis for our trade-off studies with the results from Monte Carlo simulation. All right, so now, let's get started with our first step.

    Let's open the model and take a look at this model. We can run the script built in the model and load the data. All right, so this is a model. It is a single-phase AC electric network with Rectifier that has been developed with Simscape Electrical.

    As you can see here, we have multiple physical components that has been connected, such as the inductor and the resistor on the left side, diode in the middle, and another resistor on the right side. We are also using a voltage sensor here to measure the voltage across R2. And we want to use a scope here to monitor the voltage.

    Another important part is about the parameters. So all of the components in this network are adjustable. And now, they are parameterized with data named parameters. And this is structured data that has been loaded in the MATLAB workspace so that the Simulink model can read from it. So we can take a look.

    As you can see, this is practice-loaded in the workspace, and you can have a preview of the data inside. OK, next, we can run the simulation and explore the results.

    We can open the scope. And as you can see, this is a voltage across the R2. And if you want to explore any other data in this model, Simscape also has data logging system. And we can open this Simscape results explore to take a look.

    All right, so this is Simscape results explore. And as you can see in the left side, we have all the components in the model and you can select any of those components to take a look at the data, like the current, or the power dissipated, or the voltage. And if you are interested, you can just choose any other components.

    Let's about run the simulation and explore the results. All right, so in this demo, we want to run the Monte Carlo simulation, which means we need to run the simulation many times. So instead of stay in the Simulink environment to repeat the process manually, actually, we can automate this process by using the Simulink to API, which means we can stay in MATLAB to run the simulation and access the data directly from the MATLAB site.

    As you can see here, after it runs, the simulation results will be stored in a data set called Out. That is in MATLAB workspace. And we can run this code to take a look. So as you can see, this is Out, which is a Simulink output object. And the data we saw in the Simscape and Data Explorer has been stored in the simlog.

    As you can see, all the data for each component has been listed here. And we can access those data, create some plots easily from MATLAB side. This is a voltage across the resistors R1.

    Next, we can move forward to prepare the Monte Carlo simulation. Let's run the script the first. So as you can see here, we have few steps. And the first, so we need to define the model parameter values.

    And in this model, there are seven parameters, as you can see here. And to constrain the design space, we will consider only the nominal, minimum, and maximum values, which means there are seven parameters and each of them will have three variations.

    And next, once we defined the parameter values, we need to create a full coverage for the design space. And in this demo, we want to consider every combination of the parameter values. And we are using a function called fullfact, which is from Statistics and the Machine Learning Toolbox to create this full coverage for us. But you can also use your own function to create the coverage.

    Before we run the Monte Carlo simulation, we can have a preview of how many simulations we need. And as you can see, we will need to run 2,187 simulations. And for each of the simulation, you can also take a look at the parameter values. And then, we can also assign these parameter values to the Simulink model so that when repeated the simulation, it will read the values from this dFF.

    OK, so the last step is to speed up simulation before we run it. And Simulink and Simscape skip have many methods, but I want to highlight two of them that are very useful. So now, let's move to Simulink. OK, so first, Simscape will ask to configure the parameters we want to change as a runtime parameters, as you can see here.

    So runtime parameter means that the model does not need to be compiled every time when we change the parameter values. And so if we need to run tons of simulations, this would save lots of time for us. And just in case, if you are curious, those param can also be set up as a compile time, which means if every time you change the value, the model needs to recompiled. And then, in this model, we will keep all the parameters as runtime parameters to speed up the simulation.

    OK, so the second highlight about data simulation is to start the Fast Restart, which means when you run lots of stimulation, it will compile only once. That will save lots of time for us. OK, so that's all about the preparation for running the Monte Carlo simulation. Now, let's back to MATLAB to get started the simulation.

    All right, so here to run a Monte Carlo simulation to have the whole design space we just defined, we need to run the model for 2,187 times with different parameter values for each run. So to speed up the whole simulation, we're going to use the function called parsim, which is a function from Parallel Computing Toolbox to run the large amount of simulations in parallel on multiple cores. But please note that if you don't have the Parallel Computing Toolbox, you can still around the Monte Carlo simulation with the Simulink command called SIN-- S-I-N.

    All right, so now let's get started for the Monte Carlo simulation. All right, so when we start the Monte Carlo simulation with parsim, it will show the process here. For example, before they run the simulation, it will do some presettings, like check the parallel pull, load the model on the parallel workers. Then, it will show the parallel simulation in the command window, as well, so you can see the current process.

    I also opened the Simulation Manager on this command, which is optional. So Simulation Manager is the app to let us monitor the parallel computing process interactively. So as you can see here, this is the Simulation Manager app, and that it will show the parallel process in this view, and you will see where you are.

    And then, it will also give you an estimated parallel computing simulation time remaining. This may change during the simulation. And then, in the Figure tab, you can also log some data to monitor it during the parallel computing.

    And in this case, I didn't turn on any data logging to this Simulation Manager app, so it will just to show me the simulation numbers for the simulation process. But in your case, you can definitely use data you are interested in to create different types of plots, like scatter for the 2D or 3D surf. All right, so now let's wait a few minutes to get the whole simulation down so that we can use the simulation results to do some post-simulation data analysis for our design trade-off study.

    All right, so now all the simulation has done. And you can see from here, the total simulation time for 2,187 runs is about 30 minutes and 38 seconds for my laptop that has two workers. And if you have more workers, you may have less time than what I have here.

    All right, once we have done the Monte Carlo simulation, all the simulation results for the 2,187 runs are stored in this object named Out that is in the MATLAB workspace, as you can see here. So next, we can easily access the data from this Out data object to do some post-simulation data analysis for the design trade-off study.

    So as you can see here, we can start by comparing the nominal simulation run with the 400 simulation run. And we can easily pull out the data from the Out object and create some plots. We can also check the parameter settings for those parameters in different runs.

    We can also compare the multiple runs in one plot. So here, I'm going to compare the simulation run from 100 to 1,000 with increments of 100, as you can see here. But as you know, this is a sine wave, so it's not an efficient way to just compare the time domain voltage. An easier way is actually to calculate the mean value of each runs and to compare them.

    So next, we will do some statistical analysis by comparing the mean value of the voltage across R2 for all the simulation runs. So now let me run the script. So in this case, I'm going to calculate the mean value of each month and then create a histogram plot which is going to be shown here.

    This figure here is a histogram of mean voltage across R2. And the x-axis is the mean voltage for all the simulation runs, and the y-axis is the number of instances. Here, as example, we will focus our attention on the beam with the lowest voltage.

    As you can see here, they are 81 simulation runs that have voltage value in this range from 7.2 to 7.597 volts. And next, we can try to find the scenario that gives the lowest mean voltage value. Let's run this script.

    So as you can see, this is the lowest of any of all the simulation runs. And the ones that gave us the lowest voltage is the last two runs. And we can also pull out the parameters for this scenario. All right, so please know that you can do any post-simulation analysis with any method for your design. But we will stop here for this demo, and let me do a quick summary before we move to the next demo.

    In this demo, we have explored a workflow for performing a Monte Carlo simulation on simple electrical network model viewed with Simscape Electrical for the tolerance impact study. And it has been shown that this process can be automated by using the Simulink API. And the efficient simulation can be done on multiple cores by using the parallel computing. And the simulation data can be gathered from the simulation runs and then analyzed in the MATLAB.

    And then, please note that this workflow can be used in other electrical system of design if you want to run the Monte Carlo simulations efficiently and effectively. So that's about the first demo. Now, let's go back to the slides and move forward to the second demo.

    In the second demo, we will focus on the renewable energy industry to explore how to run a long-term simulation, like a year, with quasi-steady methods for the wind power system design. This is a preview of this demo. We want to evaluate the one-year power delivery for the wind power system that has 25 wind turbines connected to the grid.

    And the right side here is quasi-state method based model we developed with Simscape Electrical. And the left side is one-year simulation results that we can down in a few seconds. So here's-- the orange line is the total, active power delivered from all the 25 wind turbines to the grid. And the blue line here is active power delivered from the number 10 wind turbine.

    So before we jump to the demo, I want to take a few steps back to briefly introduce some background knowledge of wind turbine and why we need the quasi-state method for the long-term simulation. So as you can see here on the right side, the wind turbine power, which is the y-axis, it is a function of the wind speed here and the turbine speed. So for each blue line presents one wind speed. And for given wind speed, we can have a turbine speed that generates the maximum power.

    So therefore, for each of the speed, we can switch. And then, we can have this red curve, which is for the maximum power generation. For the wind turbine design, keep it operated on this red curve is important to generate the maximum power over all the wind speed. And this is called Maximum Power Point Tracking-- MPPD.

    So next, let's go to Simulink to see how we develop the model for the wind turbine system with a Maximum Power Point Tracking. All right, so this is a model with two wind turbines connected to the grid for the problem of Maximum Power Point Tracking. So let's run the simulation first, and I will explain the model in a bit.

    So you can see when I started the run, it will compile first. And the total simulation is about 120 seconds. And here we are using a fixed-step discrete solver with the simple time of 0.1 millisecond, as you can see here. And then the right side is the simulation result.

    So first, the characteristic data has been loaded in this model. And then, this moving pointer here-- we have two, and each of them present one wind turbine. So from this plot, we can see that with the change of the wind speed, we can successfully control the wind turbine to be on the red curve for the Maximum Power Point Tracking. So with this model, we can see that the functional design can be verified.

    OK, now, let's explore the model. So these two wind turbines have the same structure under the hood. And the model has been developed with Simscape Electrical. Let's take a look at the wind turbine. So as you can see, we have many components connected.

    So first of all, I want to point out that there are many different techniques to perform the Maximum Power Point Tracking. And in this example, we will control the turbine speed of mechanically and the command the. Maximum power transfer by controlling the DC voltage.

    OK, so first we have some defined when the speed that is loaded from MATLAB workspace. And then, it is a changing with time. And then, first the subsystem is going to give us torque and power. So as you can see, inside of this block we have the data, which is a lookup table with the data loaded. And then, it will generate the power and torque. We also have the turbine speed of control to control the turbine speed.

    And then, we have this mechanical turbine, which is going to generate the mechanical energy. And this mechanical energy has to be applied to the generator, which is a permanent magnetic synchronous generator. And then, this generator will convert the mechanical energy to the AC electrical energy. And then, right here, we have average venue rectifier, which is going to convert the AC to the DC. And the goal here is to decouple the turbine frequency.

    And next, we have this ideal inverter to transfer the DC power to the AC power at the grid side. This is going to be connected with the grid. And the reactive power at the grid side will be controlled independently by this inverter. So if we take a look inside, you will see we have some DC-to-DC converter and DC-to-AC. And then here, we have this active power control and reactive power control under the hood.

    OK, so this is a brief overview about the model. And as you can see, we are simulating all the dynamics that we are interested with a sample time of 0.1 millisecond for the total of 120 seconds. So it takes a while to get the whole simulation done, even it's 120 seconds.

    But for system-level wind turbine design, we may have many turbines in the network connected to the grid, and we generally are interested in a one-year simulation. So this model will take a long time to finish a one-year simulation because it captures the dynamics in millisecond level. So this is a functional design model. But we need to transfer this one to a consistent method model so that we can run the long-term simulation much faster.

    So now, let's back to the slides to see, how can we transfer this type of the functional design model to a quasi-steady model for a faster simulation run? In reality, the wind resources data is typically gathered at a one-hour increments and spans longer durations, such as a year. And if the sample time is one hour, then the one-year period will produce about 8,760 data points.

    You may have heard a reference to 8,760 simulation when talking with system planners and developers. And this is referring to a one-year simulation updated at one-our intervals. And the structure simulation is quasi-steady.

    So the important thing about quasi-steady is that there is no inherent dynamics in system conditions that at each time state must be solved algebraically. So this is a core strength of Simscape. And for the AC system, we need to know that we must use the frequency and time equation formulation for this type of simulation.

    So next, let's go to the demo, and let's see how we transfer the model we just explored to a quasi-steady model for faster and longer simulation. And the key point here is we do not explicitly model the wind turbine technology, but we will only use the wind profile lookup table to view the model, OK?

    All right, so this is a quasi-steady-based model we just created from the previous one. And there are 25 wind turbines be connected to the grid. For each of the wind turbines, we have fit in the wind speed profile from 25 different locations.

    And this data has been loaded from some public data set, and we will explore this later on. So we can first around the simulation and take a look at the results. And please note that the total simulation time in this model is for one year with a sample time of one hour.

    All right, now the simulation starts, and we can take a look at the data from the data inspector. This is a data inspector. We can log the total power-- total active power delivered to the grid from those 25 wind turbines. And then we can also compare with some specific wind turbines.

    And in this model, I logged the number 10 wind turbine, and this is a power from it. And let me change the color to blue to have a better comparison here. As you can see, for one-year-long simulation, the simulation speed is pretty fast in this case.

    All right, so now the simulation is done. So let's move forward to explore this model structure to compare with the previous one. So first I want to mention that in both models, the wind turbines can all operated for the Maximum Power Point Tracking. And this can be verified with the simulation results. But this quasi-steady model can run much faster for one-year-long duration.

    So let's take a look for the structure. And this is a wind turbine. The top one is the one we're using for quasi-steady simulation, and the bottom one is just the screenshot. So as you can see here, we removed all the dynamic components, like the generator, the mechanical turbine, the AC/DC rectify, and the inverters.

    So instead, we do some steady calculations to get the active power to the grid. So for example, as you can see here, once we have the maximum power from the first block, we can do some calculations to get the resistance. And then, this negative resistance block has the three Simscape customized block to calculate the AC energy that has connected to the grid. And the outside, we're using a sensor to measure the active and active power. Here, especially for this wind power curves and MPPT block, let's take a look.

    So as you can see, we removed the turbine speed control and only keep the two look-up tables. So basically, with the wind speed feed in, we can have the maximum power output power go out. All right, so that's about one turbine system structure.

    And as you may recall, we mentioned that for the AC system, we need to use a frequency and time domain formulation for this type of simulation. And this can be easily set up by configure the Simscape local server, which is in the grid block. And this is Simscape local server.

    As you can see here, we are using the frequency and the time for the equation formulation. And for the server, we're using one hour for the sample time. OK, so all of the settings makes this model as a quasi-steady model to get the fast simulation for one-year long duration.

    So the last part I want to talk about is the wind profile. So here we have 25 wind turbines, and each of them are writing data from different locations. So where we get this wind speed data for the one-year duration? OK, now, let's back to the MATLAB and take a look.

    All right so this is a wind profile data we are using. It is from the public data set for one-year duration with one-hour intervals. And this data set includes 242 locations. And for each of the location, it includes many information, like the name of the location, the temperatures, the wind speed data for one year, and much more.

    And we can access any of the location easily. And right here, we are just writing the data for like Miami International Airport. And we can create a plot to take a look at the wind speed change over the year. And in this model, what we need is actually the first 25 locations for our 25 wind turbines. This is just to make sure every wind turbine has been running in different profile.

    OK, that's all about this demo. And now, let's back to the slides to finalize our video. All right, as a summary, in this video, we talked about the electrical system and design trade-offs. And then, we used two demos to explore the Monte Carlo simulation workflow for the electrical network tolerance study. And we also explored the quasi-steady for the long-term simulation in the wind power system design.

    So finally, I want to share with you some resources to help you get started. So Simscape Electrical has a lot of examples from different industries and applications. And here are some that related to today's topic, but please check out the website for much more.

    And MathWorks has the different team to help you, like the training team to learn the tools and the consulting team to directly work with you on your projects. We also have the technical support team available 24/7. So please check out our website for more information and feel free to reach to us.

    So we have some free trainings, like those Onramps. And we also have some paid trainings pointed to different tools. So the Simscape and the Simscape Electrical also has some trainings. So please check out the link if you are interested in any of them. All right, so that's all about this video. Thanks for your attention.