# Introduction to Electrical Simscape in MATLAB Simulink | Solver configuration, PS-Simulink Converter (2023)

## Entry

MATLAB Simulink Guide for Electrical Engineers and this video includes:
Bugfix: Each physical mesh must be associated with exactly one Solver configuration block
Voltage drop across a resistor MATLAB simulations

#MATLAB
#Education
#Simscape

Let's practice and train in #MATLAB, #Simulink, #LabVIEW, #FPGA, #VHDL and #Verilog, #Arduino, #NodeMCU, #Robotics and #Python.

Thank you
Abhyas opleidingsinstituut
contact -abhyaast.institute@gmail.com

## Contents

Hello friends, welcome back to the abhayas training institute.

So this is a video simulation.

So we've seen the basics of Simulink in the last few videos.

We've seen resource synchronization, logical operations, queue, and plain blocked usage.

So these blocks are only used for math operations and so on.

So from this video we're going to talk about half the space.

Let me give you a little piece first.

What are the same spaces? Semi-Space is a module or set of tools in which we will build a physical model.

Okay, physical model.

As far as you're going to be working with an electrical model in blue, fine, or you can work with a thermal model or something.

So as a foundation, as a library, we see that we have electric gas hydraulic isothermal magnetic mechanical in mechanical.

You can see that you have a mechanical sensor source.

So these are some of the physical things we're talking about.

So it becomes a physical network.

Agree.

Therefore, the same space is the physical network for which we will build a physical model.

First, we'll talk about electrical correctness in half-space.

Okay, then we're talking about electricity.

So when we're done with electricity, we'll move on to magnetic-mechanical.

Okay, so we're also going to talk about the heat.

Let me just give you the electrical part.

We have a room with electric sim card.

So in the same electrical room, we have three things, an electrical component where we'll find a resistance capacitor, an op-amp, everything we'll find there.

Then we have a sensor like a current sensor and a voltage sensor as usual.

We don't feel anything else in electricity, okay, so we have sources.

So the sources can be DC.

Current source.

DC, voltage source, AC current, consoles, AC voltage source.

Okay so I think you know all the basics of all these like what is voltage dependent then what is AC and DC? So I won't get into a discussion on that.

But what we're going to try to do, we're going to build an electrical circuit.

We will then verify this result numerically and analytically.

Let me give you a brief overview of what we are going to do.

So let's assume we have one resistor.

We want to check the voltage drop on this register.

So what I'm going to do is drag and drop this resistance here.

And we want to change the value.

So let me change the unit first.

So I'll take that as 10 kilos, oh okay.

And so I checked that it was applied automatically.

Well, I think I'm using matlab from 0 to 2a.

So there's been a little progress, uh, and from the next release.

Shall we talk about news next week? I missed this video this time so stay tuned.

Okay, my value is 10,000.

Next, we need to check the voltage drop.

So we need a voltage drop source.

So let's take volts of DC.

Agree.

So first we will do a DC analysis.

Then we move on to analysis, etc.

So here we will be controlling both the network analysis circuit and the analog electronics.

Okay, let me just put them together.

So what do we need?

We have to ground ourselves.

All right, grounding is essential with electricity.

Yes, I think you know without foundation.

We can't assume it's something.

All right.

Now we have something to do.

We need to connect the sensor.

Okay, I'll also hook up a voltage sensor.

So, in the voltage sensor, it is the positive pole.

This is the negative pole.

And this is the turn we can take a turn.

So there are few things.

So I'll show you what we're missing.

And what is needed in a sim room or whatever physical network we are building.

So we need a solver.

What does this solver do? Let me run this program and you will see an error.

So you can see that exactly one solver setup needs to be linked, which means it's a physical mesh, but simulink doesn't know what solver we're trying to solve with.

So we need to connect the solver and where to find it.

So I don't know exactly, location ok because I always plug in once and then we use the same.

So we need to find the solver configuration here.

So here you can see dsb system toolkit.

Then we have a fixed point.

Hdl, solver, yes, then we have half the space.

Agree.

So you can see the solver configuration in half space.

So I'm going to drag and drop this solver configuration.

Agree.

Just click.

So I'm always going to ground it, you can ground it.

And we will not change it until a special request is attached.

Agree.

So leave it as it is now, what can we do, we can run it.

So you see there is no diagonal.

The text means there was no error, but when we click, we can't see the result.

So we can't see the output because it's a physical output.

Agree.

To see the physical output, we need to convert it to a simulink output.

But this converter is a simulation of a physical system.

Okay, so we don't need this.

We need this, physical, ps2, max.

So just click this search.

Agree.

So we'll see that the same block of space is there.

So, if you want to know more about it so that we can click here and double click, we can see how the description converts the physical input into a Simulink output.

OK, this is the input for a physical signal that the voltage is OK.

And we convert it to simulink output.

You can read that about the unit, uh, when they give us the unit.

So you can see if this will normally give a Bundy streak.

Okay, but if there's a 2D glitch or something, we'll see when we get to that video.

So let's leave that for now, I'll just take a look at the physical system how it works.

So let me put it together.

Agree.

Now that we can, we can go to the simulink sink and then I can connect.

So yes, just tell me what will be the voltage drop across this resistor? As you can see, the voltage is one volt? OK, and the resistance is 10 km.

So I think some volts will come out, which I'm going to do, I'm going to pick 10 ohms or something like 20 ohms here.

Agree.

Let me move it.

We still get 1 volt because it is equal.

W.

So there will be one volt.

Okay, we can build any circuit like this.

This way we can check the output or whatever or what we can do.

We can remove this voltage source with current.

Okay, so we can see.

Let's move on to the sources, and I'll take the DC source.

Then we can find the voltage drop accurately.

If I take 20 amps, we can check the voltage and go down.

So that's 20 amps v u.

So that's going to be 20 times 20.

There will be 400.

So you can see that the voltage drop is 400 volts.

This is what it will look like.

This allows us to accurately control the performance of the physical system.

I hope you understand what I am trying to say, such as how to build a basic system.

So from the next video, we're going to build a real electrical simulation space application.

Oh thank you friend and stay tuned.

Don't forget to subscribe and share with your friends.

And if you have doubts, you can write to us on your behalf.

T, dot Institute at gmail.com or comment on this video.

Thank you.

Friends.

Thank you for watching this video.

## FAQs

### How to convert Simscape to Simulink? ›

Use the PS-Simulink Converter block to connect outputs of a Simscape physical network to Simulink scopes or other Simulink blocks. You can also use it to specify the desired output signal units. For more information, see the PS-Simulink Converter block reference page.

What is PS-Simulink converter in MATLAB? ›

Description. The PS-Simulink Converter block converts a physical signal into a Simulink® output signal. Use this block to connect outputs of a Simscape™ physical network to Simulink scopes or other Simulink blocks.

How do I get Simscape electrical in MATLAB? ›

You can access the Simscape Electrical libraries from the Simulink Library Browser or from the MATLAB® command prompt. To display the Electrical library in the Simulink Library Browser, scroll to the Simscape node. Expand the Simscape node and then the Electrical node.

What is the difference between Simscape and Simulink in MATLAB? ›

Simulink is a graphical programming environment for modelling ,simulating and analysis of dynamic systems where as simscape is a Physical modelling part in simulink environment. 2:- The signal flow in simulink is unidirection and in simscape the signal flow is bi-directional between blocks.

Can you convert Simulink to MATLAB code? ›

There is no automated way to do it. You can analyze the simulink model and convert it to matlab code manually. After conversion your can verify the equivalence by executing both and comparing result.

Is Simscape included in Simulink? ›

Simscape™ enables you to rapidly create models of physical systems within the Simulink® environment. With Simscape, you build physical component models based on physical connections that directly integrate with block diagrams and other modeling paradigms.

How to use Simscape block in Simulink? ›

Using the Simscape Class Path for a Block
1. In a Simulink diagram containing the Simscape component, click on the component and press Ctrl+L to access that component-type in the Library.
2. In the Library window, note the path in the window title, and the Component name under the Component element in the body of the window.

Why use Simscape? ›

Simscape helps you develop control systems and test system-level performance. You can create custom component models using the MATLAB® based Simscape language, which enables text-based authoring of physical modeling components, domains, and libraries.

What is the purpose of MATLAB Simulink? ›

A Simulink® function is a computational unit that calculates a set of outputs when provided with a set of inputs. Since a Simulink function provides a common text interface to its function definition and a function caller, how you define the function is your choice.

What is Simscape function in MATLAB? ›

Simscape™ functions model a class of pure first-order mathematical functions with explicit input-output relationship. These functions explicitly map the inputs of numerical values into outputs of numerical values by using declarative expressions.

### How to work with Simscape? ›

Getting Started with Simscape
1. Assemble Simscape components into a mechanical schematic to model the vehicle.
2. Simulate a passing maneuver to determine the required motor torque.
3. Use parameters from a datasheet to refine the electric motor model.

How do I install Simscape electrical? ›

In MATLAB go to Home tab > Add-ons, there you can search for 'Simscape Electrical' and you will get an option to download it there.

Why Simulink is better than MATLAB? ›

The Simulink approach is based on time based and multi rate system. SO that will be useful for HDL code generation. Whereas, MATLAB is for the mathematical based algorithm development and which will not consider the time while in simulation (independent of time). Simulink is graphical and more interactive to the user.

Which is better MATLAB or Simulink? ›

Simulink blocks provide a visual representation of your system, which can help you to verify its logic and behavior. On the other hand, MATLAB code requires you to write and edit text commands, which can be more complex and error-prone.

How does Simscape solve? ›

Solving the Network: The Simscape Numerical Scheme

Calculations are computed at each node of your fluid network, such as at block ports, connector intersections, and at internal points in dynamic components. To solve a network, the fluid properties at each node propagate according to the upwind numerical scheme.

1. Step 1: Create MathWorks Account.
2. Step 2: Associate to a MathWorks License. Complete Step 1 (Create MathWorks Account) ...
3. Step 2: Associate to a MathWorks License. ...
4. Step 2: Associate to a MathWorks License. ...
6. Step 4: Install the Software. ...
7. Step 4: Install the Software. ...
8. Step 4: Install the Software.

How to simulate a Simulink model from MATLAB? ›

Simulate a model interactively by clicking the Run button in the Simulink Toolstrip, or programmatically using functions like sim and set_param in the MATLAB Command Window or a MATLAB script. For information about running parallel and batch simulations, see Run Multiple Simulations.

How are MATLAB and Simulink related? ›

Use MATLAB and Simulink together to combine the power of textual and graphical programming in one environment. Apply your MATLAB knowledge to: Optimize parameters. Create new blocks.

What is Simscape electrical? ›

Simscape Electrical provides component libraries for modeling and simulating electronic, mechatronic, and electrical power systems. This includes applications such as power converters, electric drives, electromechanical actuators, and smart grids.

Which of the following functionality is not possible in MATLAB simscape? ›

You cannot set breakpoints on Simscape blocks. Reusable subsystems cannot contain Simscape blocks. You cannot use the Simulink Fixed-Point Tool with Simscape blocks.

### Is there a free alternative to Simulink? ›

Scilab is a free open-source software for numerical computation and simulation similar to Matlab/Simulink.

How to convert a MATLAB code into Simulink block? ›

There is no tool provided to convert . m into Simulink . What you can do is use a MATLAB Function Block in simulink, and have that block call your code.

What is the basics of Simulink? ›

Simulink is a simulation and model-based design environment for dynamic and embedded systems, integrated with MATLAB. Simulink, also developed by MathWorks, is a data flow graphical programming language tool for modelling, simulating and analyzing multi-domain dynamic systems.

How to create a Simscape model in MATLAB? ›

Domain Types and Recommended Blocks

An easy way to start a new Simscape model is by using the ssc_new function. When you type ssc_new at the MATLAB® Command prompt, the software creates a new model prepopulated with certain blocks.

How do I start Simscape? ›

To open the Simscape model template, at the MATLAB® command prompt, enter ssc_new . Simscape software opens the model template along with the Foundation block library. To open the Simscape Driveline block library, enter sdl_lib .

Why do we use simOut in MATLAB? ›

simOut = sim( modelName , Name,Value ) simulates the model specified by modelName with options specified using one or more name-value arguments. For example, you can modify a model configuration parameter value for the simulation by specifying the parameter name and value as a name-value argument.

Is Simulink a programming language? ›

Yes Simulink is a graphical programming language because, the source code itself is graphical in nature, though text can be included.

What type of software is Simulink? ›

Simulink is a MATLAB-based graphical programming environment for modeling, simulating and analyzing multidomain dynamical systems. Its primary interface is a graphical block diagramming tool and a customizable set of block libraries.

Do I need Simulink with MATLAB? ›

Yes, to run an FMU generated by Simulink requires an active license and a local installation of MATLAB and Simulink.

To load the structure data, you can run the code to create the simin loading variable in the MATLAB Command Window or select then click the Create structure data to load Callback Button block. Then, simulate the model and view the loaded data on the Dashboard Scope block.

### What is the difference between MATLAB function and Simulink function? ›

The Simulink Coder product can generate code for both MATLAB S-functions and MATLAB functions for code generation. However, MATLAB S-functions require a Target Language Compiler (TLC) file for code generation. MATLAB functions for code generation do not require a TLC file.

How do I run a Simulink simulation? ›

You can also use the keyboard shortcut, Ctrl+T, to start the simulation. Note A common mistake that new Simulink users make is to start a simulation while the Simulink block library is the active window. Make sure your model window is the active window before starting a simulation.

What is Physical modelling using Simscape? ›

Physical modeling is a way of modeling and simulating systems that consist of real physical components. It employs a physical network approach, where Simscape™ blocks correspond to physical elements, such as pumps, motors, and op-amps.

How do I see Simscape results? ›

In the model window, on the Simulation tab, click Review Results > Simscape Results Explorer. Select a Simscape block in the model, and then, on the Simscape Block tab, click Review Results > Results Explorer.

1. On the Simulink start page, in the search box, type library . ...
2. Add a Gain block to the library.
3. In the MATLAB® Command Window, enter this command to set the EnableLBRepository library property to 'on' . ...
4. Save the library in a folder on the MATLAB path.

How to connect voltage sensor in MATLAB? ›

Use the + and - ports to connect the sensor in parallel with the block (or several blocks) where you want to measure the voltage. Port V outputs the measurement result as a physical signal. Use a PS-Simulink Converter block to connect this port to Simulink® blocks, such as Scope or Display.

Which engineers use MATLAB the most? ›

Mechanical engineers of Design and manufacturing field use MATLAB and Simulink heavily. You would be surprised to know that MATLAB also forms the based for different CAD software as well as designing software just like SOLIDWORKS.

Is Simulink and MATLAB the same? ›

Simulink has Graphical User Interface (GUI) whereas Matlab is just code. Simulink's GUI lends it more intuitiveness. Simulink supports hardware communication. You can write a PID controller in Simulink and download it to Arduino.

Which software is better than MATLAB? ›

AnyLogic is the best Matlab alternative, an open-source simulation software to deal with business challenges. It is a virtually pleasant drag-and-drop environment. It includes a graphical modelling language written with Java; users can customize it.

How long does it take to learn MATLAB and Simulink? ›

Become a Good MATLAB Programmer in 30 Days

This is an excellent course for learning basic programming concepts essential for MATLAB, features like variables, scripts, and functions. This is an ideal course for beginners.

### What is the salary of MATLAB Simulink? ›

Matlab Simulink Developer salary in India ranges between ₹ 2.1 Lakhs to ₹ 12.3 Lakhs with an average annual salary of ₹ 4.2 Lakhs.

Is MATLAB enough for a job? ›

Conclusion. The industry has some familiar buzz that learning MATLAB will not be a good opportunity for a better career. But this is not fully true. Yes, it is an acceptable reason that salary or company structure will never be able to touch available popular jobs on other programming technologies.

What are the benefits of using MATLAB Simulink in electric drives? ›

This motor to mechanical load match means better energy efficiency and leads to lower energy costs. In addition, during the transient period of acceleration and deceleration, the electric drive provides fast dynamics and allows soft starts and stops, for instance.

How to get Simscape in Simulink? ›

Your MATLAB® and CAD installations must have the same system architecture, such as Windows 64-bit.
1. Step 1: Get the Installation Files. ...
2. Step 2: Run the Installation Function. ...
3. Step 3: Register MATLAB as an Automation Server. ...
4. Step 4: Enable the Simscape Multibody Link Plugin in a CAD Application.

How do I get Simscape library in Simulink? ›

You can access the blocks through the Simulink Library Browser. To display the Library Browser, type slLibraryBrowser in the MATLAB® Command Window. Then expand the Simscape entry in the contents tree. When you type simscape in the MATLAB Command Window, the main Simscape library opens in a separate window.

How to convert physical signal to Simulink? ›

You can connect Physical Signal ports to Simulink ports through special converter blocks. Use the Simulink-PS Converter block to connect Simulink outports to Physical Signal inports. Use the PS-Simulink Converter block to connect Physical Signal outports to Simulink inports.

What is the solver configuration in Simscape? ›

The Solver Configuration block specifies the solver parameters that your model needs before you can begin simulation. Each topologically distinct Simscape block diagram requires exactly one Solver Configuration block to be connected to it.

What is the difference between MATLAB and Simulink? ›

The Simulink approach is based on time based and multi rate system. SO that will be useful for HDL code generation. Whereas, MATLAB is for the mathematical based algorithm development and which will not consider the time while in simulation (independent of time). Simulink is graphical and more interactive to the user.

What is PS Simulink converter used to convert? ›

The Simulink-PS Converter block converts the input Simulink® signal into a physical signal. Use this block to connect Simulink sources or other Simulink blocks to the inputs of a Simscape™ physical network.

Which device will convert electrical signal into physical parameters? ›

Transducers are often employed at the boundaries of automation, measurement, and control systems, where electrical signals are converted to and from other physical quantities (energy, force, torque, light, motion, position, etc.).

### How to use MATLAB code in Simulink model? ›

Open the Simulink Coder or Embedded Coder app. On the C Code tab, Build to compile and build the example model. If you get an error related to the Variable-step solver, open the Configuration Parameters window, then click Solver in the left pane. Under Solver selection, set Type to Fixed-step and generate code again.

How to open Simulink from MATLAB code? ›

Top Articles
Latest Posts
Article information

Author: Saturnina Altenwerth DVM

Last Updated: 06/27/2023

Views: 5793

Rating: 4.3 / 5 (44 voted)

Author information

Name: Saturnina Altenwerth DVM

Birthday: 1992-08-21

Address: Apt. 237 662 Haag Mills, East Verenaport, MO 57071-5493

Phone: +331850833384

Job: District Real-Estate Architect

Hobby: Skateboarding, Taxidermy, Air sports, Painting, Knife making, Letterboxing, Inline skating

Introduction: My name is Saturnina Altenwerth DVM, I am a witty, perfect, combative, beautiful, determined, fancy, determined person who loves writing and wants to share my knowledge and understanding with you.