Simulink and Simscape Electrical for Research and Teaching - MATLAB & Simulink
Video Player is loading.
Current Time 0:00
Duration 36:01
Loaded: 0.46%
Stream Type LIVE
Remaining Time 36:01
 
1x
  • Chapters
  • descriptions off, selected
  • captions off, selected
  • en (Main), selected
    Video length is 36:01

    Simulink and Simscape Electrical for Research and Teaching

    Overview

    MATLAB and Simulink are flexible technical computing tools that encourage and support computational thinking. For Electrical Engineering applications, you can leverage these tools, along with Simscape Electrical, to tackle electrical engineering challenges.  Moreover, you can use the tools to extend student understanding and enhance the electrical engineering learning experience. Join this session to hear about how you can:

    • Explore pen and paper examples to real-world problems through modelling and simulation
    • Encourage computational thinking using virtual labs
    • Clarify and deepen student understanding

    We’ll also be demonstrating some examples that show modelling scenarios typically used for commercial and research applications, for example: electric vehicle. 

    About the Presenter

    Ruth-Anne Marchant is a Senior Application Engineer specializing in Simulink, and Model-Based Design. Since joining MathWorks in 2015, her focus is on supporting customers adopt Model-Based Design with Simulink. Prior to joining MathWorks, Ruth-Anne worked in the Canadian aerospace industry as a control systems engineer. Ruth-Anne holds a BASc in computer engineering and an MASc in electrical and computer engineering, both from the University of Waterloo, Canada, specializing in control systems.

    Recorded: 30 Mar 2021

    Hello, and welcome to this on Simulink and Simscape Electrical for research and teaching. I'm Ruth-Anne Marchant, one of the engineers at MathWorks Australia.

    I've been working at MathWorks for over five years now. And prior to joining MathWorks, I worked in the Canadian aerospace industry as a control systems engineer, where I use extensively for my control systems design work. And like many of the people who I speak with now in my role at MathWorks, I first learned to use MATLAB and Simulink in University, through my computer engineering degree.

    Moreover, during my time as a graduate student, I not only use MATLAB and Simulink for my research, but also use them to support my teaching activities. And today, you'll hear about strategies and tools you can use for research and teaching electrical engineering topics.

    A few months ago. When I was approached about presenting to a group of electrical engineering researchers and educators, I started to ask myself what are some challenges that this audience encounters. Now after asking this question to a number of my colleagues, some themes and questions came up. This included how can I transition from simple unfamiliar to big and complex, how can I balance access and cost considerations against experimenting on real physical systems, how can I encourage active learning and engagement, and how can I learn MATLAB and Simulink to use my teaching and/or research.

    I'm hoping that one or more of these questions that is on the slide today is also on your mind. Over the course of this presentation, you'll hear about strategies and approaches you can take to address these challenges. Let's answer these questions one by one, starting with how to transition from simple and familiar to big and complex. Researchers and educators commonly ask us, how can I go from pen and paper problems to real world examples. So in the context of electrical engineering, this could mean pen and paper RC circuit analysis problems to say, for example, designing and analyzing power transmission systems, renewable energy systems, or electric vehicle battery management systems.

    This scaling up or transition can be supported through modeling and simulation in Simulink. Over the next couple of slides, you'll hear about how. Then you'll see some examples. The key point here is that you can leverage simulation with Simulink and Simscape Electrical to go from pen and paper to real world examples. How? Well, let's take a look.

    As a starting point, you can start with Simulink low fidelity models. For example, ideal sources, DC systems, average value models for switching components, steady state models. And with these, you can do things like simulate the system quickly, explore and gain insight into system level behavior, and perform system level design and analysis tasks, such as component sizing and trade offs studies. Next, you could add model fidelity depending on your use case. For component validation activities, such as exploring the effects of switching and dynamics and ensuring your component behavior stays within the design envelope, you can add more fidelity. You can say, model the power system to include AC and DC elements with AD, DC, and DC to AC converters. Then you can also increase model fidelity again for component design, such as exploring losses during switching events and analyzing and predicting fault behavior. So for the AC/DC power converter, you can model the power electronics switches is in the device.

    This approach also includes adding the effects of other domains, such as mechanical and thermal effects. Let's look at a concrete example of this, a motor. From a torque speed behavior, this could range from, say steady state characteristics to thermal dependency to non-linear models. A low fidelity motor model could be based on the motor's torque speed curves and steady state. This would be different for different kinds of motors. And at this level, the model can support system model behavior design and analysis activities. You can then add fidelity to this motor model by including some thermal dependency.

    So for example, you can model the heat effects of copper resistance losses that convert electrical power to heat. At this level, you can analyze how temperature effects play a role in your system. You can then add nonlinear flux and saturation to capture detailed transitions and predict losses. This includes important data from a finite element analysis tool to model nonlinear flux linkage. You can verify the impact of nonlinearities on system behavior. So adjust the model, adjusting the model fidelity helps you go from pen and paper type of problems, likely on the lower fidelity scale, through to high fidelity models that include more real life effects.

    Diving more into the middle piece of this slide, adding thermal effects. This is one way to scale up to real world examples. So specifically, this is an example of connecting to other domains. And for this example, the other domain is thermal. There are other common domains to connect with electrical models. You can scale up to real world examples by going from component models and connecting them with other domains. So for example, mechanical thermal domains. Some real world examples include connecting electrical motors and batteries to thermal and mechanical systems for electrical vehicle applications, connecting electrical motors to mechanical effects in robotic applications, and connecting electrical grid models to electromechanical wind turbine models.

    Now let's look at answering the questions. How can you do this. What does this look like in practice. This part, I'll switch over to MATLAB for some demonstration examples. Here we are in MATLAB. And in this part of the session, we'll explore some of the strategies presented the slides through examples. The goals to go from simple and familiar to big and complex or rather, pen and paper to real world examples.

    In Simulink, you can model and simulate dynamic systems. Let's start with that pen and paper problem. The simple RC circuit. Here you see a simulation model of two ways to represent an RC circuit. One way to represent an RC circuit is through transfer functions or differential equations. And what you see in the red box is one way to represent a transfer function, using foundation blocks in Simulink. The output from this part of the model measures the voltage across the capacitor. So you can use blocks in the Simulink foundation library to derive differential equations from first principles.

    Another way to model physical systems in the stimulus environment is to use a tool that has blocks that represent physical components. So for example, blocks that represent resistors and capacitors. This tool is called SImscape and it is another way of representing physical systems. So the block's the top are this second way to represent the simple RC circuit using blocks that represent a physical system. And again, the output from that model right here. It's a voltage across the capacitor.

    To see how the system behaves over time, you run the simulation. You can run a simulation by pressing the green run button, the top of a tool strip right here. After running a simulation, you can view the simulation results by opening up the scope. And I have a scope here. So what you see here are two different colors on the scope. The pink line represents the Simulink model or rather, the differential equation based model, whereas the yellow signal that you see is the output from the model that is component based or some scale based. And the two are aligned, which you would expect to see because they're representing the same system.

    So as you can see, even with this fairly simple pen and paper type of problem, there's multiple ways of modeling the system within the Simulink environment. As the model complexity increases, it may be more and more challenging to derive the differential equations from first principles. And that's where Simscape based approach may be quite compelling to use. So let's take a step up from the previous example. We're going to now model an AC circuit example. Let's just grab our circuit.

    So here is an example of a single phase AC circuit. It's actually a simplified representation, maybe 230 kilovolt, three phase power system. Only one phase of the transmission system is represented in this model. So this part of the mollel represents the equivalent source. This part of the model represents a 150 kilometer transmission line. There is a load represented by a parallel load block. And there's a circuit breaker here to switch the load at the receiving end of the transmission line. So in this simulation, just open up the circuit breaker block and we can look at the parameters in here. It's closed for two cycles. So it's initially closed for two cycles. And then it switches open, switches open for five cycles. And then it closes again.

    Let's run a simulation to see what happens. Quick run. And we'll open up the scope. Open up our scope block. Make it bigger, so you can see it. So you can see here at the top, we have some nice steady sinusoidal waveforms. So the system is steady state. After two cycles, the currant goes flat, right? And then that's when the switch goes open. And then you can see the effect that this has on the voltage, down at the bottom and then, after five cycles, the switch closes again. And you can see the effect that this has on the voltage and the curraant profiles. So if we just go back to the model, you can see that the voltage is measured using this block. It's voltage across its capacitor. And then the currant is actually the load currant.

    So what makes this kind of a step up is that it's also model using blocks that you can perform some analysis, electrical engineering power systems analysis with. And that can be done using this power to locked down at the bottom. Just open this up. You can see here in the Tools tab, there are a number of tools that exist that you can use for various analysis functions. And what we're going to do today is look at obtaining steady state values and setting initial conditions. So I'm going to open up this initial state function here.

    So what we see in this dialog box when it opens up is the initial electrical state values at the beginning of the simulation. So you can see here the current values across the resistors and the inductors. And then you can see the voltage drops across the capacitor at the beginning of the simulation. If I want, I can actually force the initial electoral states to particular value, either steady stator to 0. Let's look at what happens if we click it and we select 0. So if I select 0, hit apply, you can see all of these values have gone down to 0. Run another simulation and observe the results, using the scope. So again, we set the initial conditions on the system to have 0 voltage and 0 currant through each of the components at the beginning of the simulation. If you take a look at the beginning of the simulation, we do not have that nice sinusoidal waveform at the very beginning. And that's because the chart the capacitor's charging up, for example.

    So this example still falls more into the category of pen and paper examples. But going from the first example to this example is using the strategy of adding fidelity to the model. And it does this by changing the source to an AC source and by using blocks that leverage electrical stimulation analysis tools. We're also scaling up by adding more components to the model.

    Moving to the other end of our continuum from pen and paper problems to real life examples, I want to show a final demonstration that is much more in that real life example category. And the model I'll show is an electric vehicle. For the sake of time, I won't be going into all of the details of this model. I'm showing this to give you a sense of what is possible or a flavor of what is possible in the Simulink environment with some Simscape. Here is a model from our simple vehicle templates, which is a multi-domain car model with configuration options that include motors and batteries. This model contains subsystems to represent the driver, the controller, the road, the vehicle, for example.

    You can look under the vehicle model and see the vehicle model consists of a trailer that may or may not be attached to can turn that on and off and a model of the vehicle itself. The vehicle model contains a chassis, brake pedals, a powertrain. And if we dig more into the Powertrain block, you can see that the Powertrain consists of driveline and power components. So you can see already that this model contains a lot of detail relative to some of the other examples that we've shown today, You can press the screen run button at the top to simulate the model.

    Once the simulation ends, I can view of the results in a few ways. One interesting way is using the mechanics explorer here. So I can just replay that test, you can see that we have this 3D visualization component because we've got these 3D mechanical components in the model that display how the system behaves over time. I can also visualize the signals and other ways for example using scopes, like my previous examples.

    So here, you're looking at a scope that's displaying some of the suspension system behavior. As I mentioned earlier, this model can be configured in a number of different ways. And to do that, there is an app that was developed in MATLAB. Over here on the right is what the app looks like. There are a number of ways to configure it, but you can use presets or you can customize configuration parameters in the Configure tab. So for example, just bring this here. Let's say for example you want to use two electric motors in this car and turn on active cooling. That's certainly possible with this model. And then you click Apply and then the configural model button. It's also possible to test different car maneuvers. And that can be done in the Events tab. So if I use this dropdown box here where I select the mover, you can see that I have a wide range of numbers to select from.

    So without going into too much detail, in this model, hopefully, you can see that you can use Simulink both for those pen and paper examples we showed earlier, all the way up to real world complex engineering problems. So this is covered the first question. How can I transition from simple and familiar to big and complex? So to summarize, you can leverage simulation to go from pen and paper problems to real world examples and help address a common challenge number one.

    Let's move to common challenge number two, balancing access and cost considerations against experimenting our real physical systems. So here's the challenge in more detail. On the one hand, using physical lab equipment is great for hands on learning, the chance to put theory into practice. It also provides an opportunity to test an experiment, try new things, validate your ideas and research. On the other hand, physical lab equipment can be expensive. And you don't want to break it. This also means that some courses that could have labs do not have lab components. So not all courses have access to labs. Moreover, limited lab space means a lot of time sharing of the equipment, also reducing access. And with COVID-19, there's been a shift to virtual that has made it hard to physically be in a lab. So there's been an increasing need to supplement a hands on lab schedule with virtual labs.

    And finally, a physical system naturally has physical limitations. And it's important to operate the equipment within these physical limitations or risk breaking the equipment or posing safety concerns. As a result, experiments must be performed to keep the equipment within the operating range. So one strategy that could help address the items in this con list is setting up a virtual lab. And a virtual lab in this context would leverage simulation models of the physical lab equipment. You can use and interact with the models in a similar way to real life labs. You can explore test ideas in a virtual lab environment, as well.

    So how can you do this? Let's take a look. The physical lab will have physical equipment in it. So here I've included batteries as an example. But really, consider your physical lab equipment in place of a battery. You start by modeling the physical lab equipment in Simscape and Simscape electrical. You run some experiments in the real physical equipment, collect the sensor data. You run the same experiment to the model using simulation. And then you compare the simulation results against the real life experiment results. If the results are not the same, then you update the model and its parameters, such that the model accurately represents your lab equipment.

    Once you have a model, you create a way to interact with it. One way to do this is to add dashboard elements to the Simulink model directly. So here is a Simulink model of a renewable energy system, solar PV, and battery backup. And here are the dashboard elements that can be used to interact with the model. In this example, there are dials to adjust the solar irradiance and loads and a toggle to restart the system. You'll also see dashboard elements displaying simulation results.

    Another way to do this is to create an interactive app connected to your Simulink model. For this, let's look at a simulation model of a high voltage battery like those used in hybrid electric vehicles. The model uses a realistic DC link current profile, which originates from a dynamic driving cycle. You can create an app that allows you and others users to interactively change parameter values, such as battery characteristics, like initial charge, ampere hour rating, nominal voltage, internal resistance. And then from the app, you can simulate the model and see results.

    You can share the simulation model and the app, so others can use it, too. Maybe you're working collaboratively on a project with other research. In this case, you could use similar projects to not only share, but also work together collaboratively. Or maybe you want others, including say, students, to be able to perform virtual tests. In that case, you can use an app. And apps can be shared in a browser.

    OK, so at this point, maybe you're wondering, is anyone else doing this virtual lab thing? The answer, it turns out, is, yes. Well, other universities are doing this-- and some have been doing it for a while. And here is one example of a University leveraging virtual labs. Mondragon University in Spain has used virtual labs as an element of their teaching approach. Some examples of the virtual lab include third year electronic engineering students using Simulink to develop and verify a control system for small mobile robot and graduate students pursuing a master's degree in power electronics and energy designing and implementing an advanced control system for vertical axis wind turbine.

    And for the second case, the student groups use MATLAB to analyze and characterize the dynamics of a real turbine operating in the lab. And then based on this analysis, they developed a full system model and Simulink that included turbine generator rectifier converter and battery components. Working in Simulink, the team's design and model a control system that uses maximum power point tracking algorithms to optimize power generation for various wind speeds.

    To summarize, you can build a virtual lab to help address a common challenge number two. Let's shift gears a bit now to focus on the teaching side of things with common challenge number three related how to encourage active learning and engagement. For those in attendance, who are also involved with teaching activities, a simulation model can enhance a student's learning experience. Now let's look at how.

    With simulation models, you give your students a tool to explore cause and effect. So you can provide your students with tools they can use to better understand how something works. If we take the example of an RC circuit. Yes, I realize this was-- this example was referred to as the pen and paper problem earlier. But I'm using it paint a point. So here again is our RC circuit. Now let's say you've gone through the differential equation formulation in lectures, introduced Kirchoff's law, Ohm's law, and are ready to analyze equations in their home assignments. To supplement this, you could also provide students with an app, powered by MATLAB and Simulink.

    And here's what such a model could look like. Then in the app, students can change circuit parameter values-- say, increase the resistance, decrease capacitance, and see what effect this has with current and voltage dynamics. Your students can use this tool to build their intuition on how the system behaves. And this approach is the same as one of the ways to build a virtual lab. And it can also work for larger scale electrical simulations, as well. Here, you're just seeing a different example.

    Another way that simulation models help you encourage active learning and engagement goes back to the concept of a model of fidelity. Specifically with simulation models, you can introduce concepts that build on each other by adding model fidelity. Let's look at an example to explain this one. Let's say you're teaching about AC/DC conversion. As a starting point, you can use an ideal AC/DC converter that does not include the effects of power electronics switching and helps focus on system level considerations. For this, you can use an ideal rectifier block in a model that looks something like this. Simulations run fast, allowing your students to quickly explore cause and effect. Here, you can see the AC currant measurements for this ideal system. Then, once students have a general idea of what the component does, perhaps by leveraging the tools to explore cause and effect, you can dive deeper into how these devices work, introducing topics such as switching behavior of the device. You can support the theory by adding fidelity to the simulation model. The students can then see the theory in action.

    So for our rectifier example, a next step would be to model a six pulse rectifier. This adds more fidelity and allows you to explore topics, such as harmonic effects. And when you run a simulation of this system, you can see the AC currant profile is different. You could then explore different pulse device options, like 12 pulses, 18 pulse devices, and use simulation to show the differences and continue to augment lessons on harmonic distortion analysis.

    And here's where some more fun comes in. The students can then compare and contrast how model fidelity changes the simulation results and in the context of system level simulations. So for example, here's a model of a two zone electric ship. The system is configurable to use ideal rectifiers or some of the higher fidelity six or 12 pulsed rectifiers. You can simulate the model at these different levels of fidelity and then explore questions like what are the trade offs between model fidelity and speed, how much model fidelity, how much fidelity does my model need? When do I use a low fidelity model versus high fidelity model? When would I need both? And these are real life problems that engineers encounter every day. And it's an opportunity for you to map what you're showing and teaching with what they can expect to encounter in their engineering careers.

    And this ties nicely with my last point for the section about engaging with students using real world examples. With Simulink, you can show students how the concepts they're learning now can be applied to real world examples. Let's go back to our battery example. Batteries and battery systems are increasing in demand, as a result of the push towards renewables. Battery management systems for houses, EVs, and other applications are real world examples you can explore with your students in Simulink.

    So you can start with a battery model and Simulink and include thermal models to explore different drive cycles. Then you can simulate them all to see some results. You can then integrate this into a power network model of the vehicle and add a battery cooling system. And with this, you could discuss how the electrical performance of the battery is impacted by the cooling system. Then you could introduce or incorporate this into a mechanical model of the vehicle to further explore the electrical system performance in the context of the system level simulation model.

    So for this example, you can explore and analyze battery range and how the cooling system works across a range of vehicle drivers. This example would likely be quite interesting, especially to students working on any EV or solar car team. And if you are interested in this example, there is it's available for you to download on the File Exchange. These Simscape vehicle templates work with MATLAB 2018 and higher. And you can find the link at the bottom of the slide here.

    To summarize, you can use modeling and simulation to encourage active learning and student engagement to help address common challenge number three. Now that you've seen a range of examples and use cases for Simulink and Simscape electrical, it's a good time to cover common challenge number four, limited experience with or knowledge of the tools. And we have support to help you get started.

    So you can leverage a range of resources from networks to help you quickly get started. We have a set of free Onramp courses. And these are two to three hour, hands-on, self-paced courses that allow you to explore a range of topics, such as MATLAB onramp, Simulink onramp, Stateflow control systems design, to name a few. There are also some training courses available to you. That's in of the bottom red box, if you see it. So there's a number of short courses related to computational mathematics. So one that may be particularly interesting and relevant is of solving ordinary differential equations with MATLAB, two hour course. We also have some longer core MATLAB functionality courses, which allow you and your students to really deep dive on some fundamental topics related to MATLAB and data analytics. We also have a selection of hands-on workshops that are available that we can run for your group. So that's an option, as well.

    So to summarize, there are a range of resources that you can use to help you ramp up with these tools. So let's recap the main points from today. One, leverage simulation to help you transition from simple and familiar to big and complex. Two, build a virtual lab environment to help balance the cost and access considerations in lab environments. Three, provide hands on real life examples to encourage active learning and engagement. And four, access a range of resources to help you get started.

    So really, it all boils down to MATLAB is flexible. And MATLAB and Simulink are flexible and help you solve complex electrical engineering problems in a user friendly environment. And for those in the audience involved with teaching, MATLAB and Simulink extend, clarify, and deepen student understanding, and enhance the electrical engineering learning experience.

    So where can you go from here? Well, if you are interested in accessing free learning and teaching resources that you can use, such as the ones that you see on the slide, please send us an email at the address specified here or indicate your interest in the webinar poll. Furthermore, if you're keen to get started and want some assistance implementing these tools in curricula and/or your research projects, also let us know in the email address provided. At this point, I'll wrap up. And thank you very much for sharing your time today.

    Related Products

    View more related videos