0% found this document useful (0 votes)
79 views

Lab 08 Modeling of Electrical and Electronics Systems

Uploaded by

Reem Gheith
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views

Lab 08 Modeling of Electrical and Electronics Systems

Uploaded by

Reem Gheith
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

AIN SHAMS UNIVERSITY

FACULTY OF ENGINEERING
MECHATRONICS ENGINEERING DEPARTMENT
Credit Hours Programs

Spring Semester, 2017


MCT 456: Dynamic Modeling and Simulation
Lab. 08: Modeling of Electrical, Electronic and Electromechanical Systems Using Simscape

Contents*

1- Introduction to Simscape electronics and power Systems.


2- Modelling of DC motor with motor driver and current sensor.
3- Modelling of JFET Amplifier and Frequency Response Analysis.
4- Modelling of Linear Electric Actuator with worm gear and screw.
5- Modelling of Automotive Electrical System.
6- Create physical models (Such as Mechanical, Electrical, Hydraulic, Pneumatic, Thermal Liquid Models, etc.)
7- Modelling Electromechanical Systems (e.g DC motor)
8- Creating Custom Components using Simscape components
9- Modelling of Dynamic systems
Background (Introduction to Simscape Electrical and Electronics)

simscape Electronics™ (formerly SimElectronics®) provides component libraries for modelling and simulating
electronic and mechatronic systems. It includes models of semiconductors, motors, drives, sensors, and actuators. You
can use these components to develop electromechanical actuation systems and to build behavioural models for evaluating
analog circuit architectures in Simulink®. You can integrate mechanical, hydraulic, pneumatic, and other physical
systems into your model using components from the Simscape™ family of products.

Simscape Electronics helps you develop control algorithms in electronic and mechatronic systems, including vehicle body
electronics, aircraft servomechanisms, and audio power amplifiers. The semiconductor models include nonlinear and
dynamic temperature effects, enabling you to select components in amplifiers, motor drives, analog-to-digital converters,
phase-locked loops, and other circuits. You can parameterize your models using MATLAB® variables and expressions.
To deploy models to other simulation environments, including hardware-in-the-loop (HIL) systems, Simscape Electronics
supports C-code generation.

Simscape Power Systems™ (formerly SimPowerSystems™) provides component libraries and analysis tools for
modelling and simulating electrical power systems. It includes models of electrical power components, including three-
phase machines, electric drives, and components for applications such as flexible AC transmission systems (FACTS) and
renewable energy systems. Harmonic analysis, calculation of total harmonic distortion (THD), load flow, and other key
electrical power system analyses are automated, helping you investigate the performance of your design.

Visit:

https://www.youtube.com/watch?v=jCZ2vZzDO1U

https://www.youtube.com/watch?v=WF_QhnjsvSs

https://www.mathworks.com/help/pdf_doc/physmod/elec/elec_ug.pdf

1. Exercise: Permanent Magnet DC Motor

 Description: This example shows how to build a Permanent Magnet DC Motor using Simscape Foundation
Electrical Library.

 Build Model

1. Drag the following blocks into the model.

Library Block
Simscape > Foundation > Electrical >Electrical elements Electrical Reference
Simscape > Foundation > Electrical >Electrical elements Resistor

*
Parts of this lab sheet are based on the Simscape documentation, provided by Mathworks
Library Block
Simscape > Foundation > Electrical >Electrical elements Inductor
Simscape > Foundation > Electrical >Electrical elements Rotational Electromechanical Converter
Simscape > Foundation > Electrical >Electrical Sources DC Voltage Source
Simscape> Utilities Solver Configuration
2. Connect the blocks as shown below

3. Specify the following parameters

Block Parameter Value


Dc Voltage Source Constant voltage 9 V
Resistor Resistance 1.5 Ohm
Inductor Inductance 12e-6 H

4. Drag the following blocks into the model.

Library Block Qt.


Simscape > Foundation > Mechanical >Rotational elements Inertia 1
Simscape > Foundation > Mechanical >Rotational elements Rotational Friction 1
Simscape > Foundation > Mechanical >Rotational elements Mechanical Rotational Reference 1
Simscape > Foundation > Mechanical >Mechanical Sensors Ideal Rotational Motion Sensor 1
Simscape> Utilities PS-Simulink Converter 1
Simulink > Sinks Scope 1

5. Connect the dropped blocks as shown below

Page 2 of 24
6. Specify the Inertia to be 0.01 Kg*m^2
7. For the rotational Friction Block, specify the following parameters

8. For the PS-Simulink converter set the units to rpm.


9. Run the simulation. The simulation results are shown in the following illustration.

10. Now we will apply an external load to the motor. Open the Simscape > Mechanical >Mechanical Sources
library and copy the Ideal Torque Source block into the model.
The block represents an ideal source of torque that generates torque at its terminals proportional to the
input physical signal. The source is ideal in a sense that it is assumed to be powerful enough to maintain
specified torque regardless of the angular velocity at source terminals.
11. Open the Simulink > Sources library and copy the Step block into the model.
12. Open the Simscape> Utilities library and copy the Simulink-PS Converter block into the model.
13. Connect the blocks as shown below

Page 3 of 24
14. For the Step Block, specify the following parameters

15. Ensure that the simulation stop time is equal to or greater than 100

16. Run the simulation. The simulation results are shown in the following illustration.

Page 4 of 24
17. Change the final value of the Step Block to be: -0.5, 0, 0.5 and comment on the Motor RPM.

…………………………………………………………………………………………………
…………………………………………………………………………………………………
…………………………………………………………………………………………………

2. Exercise 4: Implementing the PI controller using Operational Amplifiers.

 Background: A PI controller normally has the following transfer function


𝑶𝒖𝒕𝒑𝒖𝒕 𝟏
= (𝑷 + 𝑰 × )
𝐄𝐫𝐫𝐨𝐫 𝐒𝐢𝐠𝐧𝐚𝐥 𝑺
where P, I are gains. This transfer function can be implemented using operational amplifiers as shown in
the following diagram:

Set point
Error Signal
Gain Circuit PI Signal
− +

Summing
Circuit
𝐼 Summing
Sensor Signal Circuit

Integrating
Circuit

Page 5 of 24
 The previous schematic could be implemented using the following circuits:

𝑉𝑜 𝑅𝑓 𝑉1 𝑉2 𝑉𝑛
Inverting amplifier =− Summing Amplifier 𝑉𝑜 = −𝑅𝑓 ( + +⋯+ )
𝑉𝑖𝑛 𝑅𝑖𝑛 𝑅1 𝑅2 𝑅𝑛

𝑉0 1
Integrating amplifier = − 𝑅𝐶𝑆
𝑉𝑖𝑛

 Description: In this exercise, given the information above, you should construct and validate a practical
implementation for a PI controller using Opamp circuits. This will be done by comparing the output of an
ideal PID block from Simulink to the output of your circuit.

 Build Model

1. At the MATLAB® command line, enter scc_new to create a new Simscape model.

Place the following blocks in your model. Block Qty


Library
Simulink>Continuous PID controller 1
Simulink>Continuous Transfer function 2
Simulink>Math Sum 1
Simulink>Sources Step 1
Simscape > Foundation > Electrical >Electrical Sources Controlled Voltage Source 2
Simscape> Foundation > Electrical >Electrical Sensors Voltage Sensor 1
Simscape> Foundation > Electrical >Electrical Elements Electrical Reference 3
2. Connect the blocks that you placed as shown in the following figure:

Page 6 of 24
3. In the dialog box of the PID block input the following parameters:

Parameter Value
Proportional (P): 20
Integeral (I): 10
Derivative (D): 0

4. The previous Figure shows a closed loop system implemented using a summing and a PID block available
in Simulink. You should design an electric circuit that does the same functionality using the circuits
shown in the background section of this exercise. Your circuit should have the same proportional and
integral gains as the ideal PID controller.
If you design and model the circuit correctly, the two signals on the scope should be the same.
………………………………………………………………………………………………………………
………………………………………………………………………………………………………………
………………………………………………………………………………………………………………

3. Explore electronics library and blocks.

To open Simscape electronics block library, do the following steps:

A. Open SIMULINK library > Simscape > Simscape electronics


You will find that the Simscape electronics library is divided into seven sections.

B. or type elec_lib in the command window to open the electronics library then type ssc_new_elec to open
simscape template that contain the most commonly used electrical components and also opens an Electrical
Starter Palette then use File > Save As to save the example model under the desired name. Then delete the
unwanted blocks and add new ones from the Electrical Starter Palette and from the block libraries.

Page 7 of 24
Exercise 1: explore the components of each section of the library.

Explore passive devices sub library. Discuss

………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………
……………………………………………………………………………………….

Explore actuators &drivers sub library. Discuss

………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………
……………………………………………………………………………………….

Explore integrated circuits sub library. Discuss

………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………
……………………………………………………………………………………….

Explore semiconductor devices sub library. Discuss

………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………
……………………………………………………………………………………….

Explore sources sub library. Discuss

………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………
……………………………………………………………………………………….

Explore sensors sub library. Discuss

Page 8 of 24
………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………
……………………………………………………………………………………….

Exercise 2: Create simple electronic model.

Description: In this example, you model a DC motor driven by a constant input signal that approximates a pulse-width
modulated signal and look at the current and rotational motion at the motor output.

Build Model:

1-Create a new model by typing ssc_new.

2-Add to the model the blocks listed in the following table.

block Library Path Quantity


Solver Configuration Simscape > Utilities 1
DC Voltage Source Simscape > Foundation Library > Electrical > Electrical Sources 1
Controlled PWM Voltage Simscape > Electronics > Actuators & Drivers > Drivers 1
H-Bridge Simscape > Electronics > Actuators & Drivers > Drivers 1
Current Sensor Simscape > Foundation Library > Electrical > Electrical Sensors 1
Ideal Rotational Motion Sensor Simscape > Foundation Library > Mechanical > Mechanical Sensors 1
DC Motor Simscape > Electronics > Actuators & Drivers > Rotational Actuators 1
PS-Simulink Converter Simscape > Utilities 2
Scope Simulink > Commonly Used Blocks 2
Electrical Reference Simscape > Foundation Library > Electrical > Electrical Elements 1
Mechanical Rotational Simscape > Foundation Library > Mechanical > Rotational Elements 1
Reference
3-the function of the blocks is as follows:

block function
Solver Configuration Defines solver settings that apply to all physical modelling blocks.
DC Voltage Source Generates a DC signal.
Controlled PWM Voltage Generates the signal that approximates a pulse-width modulated motor input signal.
H-Bridge Drives the DC motor.
Current Sensor Converts the electrical current that drives the motor into a physical signal proportional
to the current.
Ideal Rotational Motion Converts the rotational motion of the motor into a physical signal proportional to the
Sensor motion.
DC Motor Converts input electrical signal into mechanical motion.
PS-Simulink Converter Converts the input physical signal to a Simulink® signal.
Scope Displays motor current and rotational motion.
Electrical Reference Provides the electrical ground.
Mechanical Rotational Provides the mechanical ground.
Reference

Page 9 of 24
4-Arrange and connect blocks as shown in the following illustration.

5-Set the DC Voltage Source block parameters as follows.

6-Set the Controlled PWM Voltage block parameters as follows:


PWM frequency = 4000
Simulation mode = Averaged
This value tells the block to generate an output signal whose value is the average value of the PWM signal. Simulating
the motor with an averaged signal estimates the motor behaviour in the presence of a PWM signal. To validate this
approximation, use value of PWM for this parameter.

Page 10 of 24
7-Set the H-Bridge block parameters as follows:

Simulation mode = Averaged

This value tells the block to generate an output signal whose value is the average value of the PWM signal. Simulating
the motor with an averaged signal estimates the motor behaviour in the presence of a PWM signal. To validate this
approximation, use value of PWM for this parameter.

Page 11 of 24
8- Set the motor parameters.

Electrical Torque tab:

Model parameterization = By rated power, rated speed & no-load speed

Armature inductance = 0.01

No-load speed = 4000

Rated speed (at rated load) = 2500

Rated load (mechanical power) = 10

Rated DC supply voltage = 12

Mechanical tab:

Rotor inertia = 2000

Rotor damping = 1e-06

9-Configuring the Solver Parameters

In the model window, select Simulation > Model Configuration Parameters to open the Configuration Parameters dialog
box.

Select ode15s (Stiff/NDF) from the Solver list.

Expand Additional options and enter 1 for the Max step size parameter value.

Click OK.

10-Run the Simulation and Analyze the Results

Page 12 of 24
Reference:

https://www.mathworks.com/help/physmod/elec/ug/example--modeling-a-dc-motor.html

Exercise 3: Modelling of JFET Amplifier and Frequency Response Analysis

Description: This example shows an audio amplifier circuit based on an N-channel JFET. The junction gate field-effect
transistor (JFET) is the simplest type of field-effect transistor. They are three-terminal semiconductor devices that can be
used as electronically-controlled switches, amplifiers, or voltage-controlled resistors.

Build Model:
1-Build the following model using simscape electronics library.

2- set the JFET parameters as follows:

Page 13 of 24
3- The desired operating point is taken to be Vds=5V, Id=2mA and Vgs=-2V.

The bias resistor values are calculated as follows:


Resistor R1 effectively ties the gate to ground(R1=1M ohm).

Hence the voltage across resistor R3 is -Vgs, and must be 2V.


Hence R3=-Vgs/Id=2/2e-3 = 1K ohm.
The total voltage across R3, the JFET drain-source connections and R2 must be 15V. Hence the voltage across R2 is 8V
if Vds is 5V, and
R2=8/2e-3 = 4K ohm.

Rload=500 ohm.

C3 has to be large enough such that at the lowest frequency of interest (20Hz), it is effectively a short circuit as follows.

C4 is chosen so that the loss in gain compared to the mid-band gain is about 6dB as follow.

Page 14 of 24
C1 is value is

The sine wave source frequency is set to 2*pi*1000 rad/s and the amplitude to 0.1

4- View the scopes and comment on the results

5- Find the current consumed at the controlled voltage source and compare it to the current at the load

6- Plot the frequency response, select Analysis->Control Design-> Linear Analysis to open the Linear Analysis Tool.
Change the Plot Result to New Bode, and then click on Linearize. The linearization points were defined in this model by
right-clicking on a Simulink® line, and selecting Linearization Points.

Page 15 of 24
Reference : https://www.mathworks.com/help/physmod/elec/examples/jfet-amplifier-and-frequency-response-
analysis.html

4. Modeling of Dynamic Systems: (Unsolved)

Exercise 1: The resistor and capacitor in the circuits shown in the Figure below are connected to obtain the model of
the capacitor voltage v1. Assume that the values of the supply voltage vs , is, R, C, L and plot v1 and vo on scopes. Then
similar to previous example find the frequency response of these systems. Note: frequency response, select Analysis-
>Control Design-> Linear Analysis to open the Linear Analysis Tool. Change the Plot Result to New Bode, and then
click on Linearize. The linearization points were defined in this model by right-clicking on a Simulink® line, and
selecting Linearization Points.

(a) (b)

(d)
(c)

Page 16 of 24
(f)
(e)

(g)

Exercise 4: Modelling of Linear Electric Actuator with worm gear and screw.

Description: This example shows a detailed implementation model of a controlled linear actuator. The actuator consists
of a DC motor driving a worm gear which in turn drives a lead screw to produce linear motion. The model includes
quantization effects of the Hall-effect sensor and the implementation of the control. There are multiple variant subsystems
in this model that have models at varying levels of fidelity.

The speed control and current control models are implemented using pure Simulink blocks. This permits us to easily
specify the control algorithm and identify the requirements for an analog circuit implementation, which is shown in
another variant

The motor drive circuit model is implemented in an abstract circuit which can simulate in two different simulation modes.
In average mode, the voltage applied to the motor varies continuously between the maximum and minimum values
depending upon the voltages at its input pins. In PWM mode, a PWM voltage is applied to the motor and its duty cycle
depends on the voltage applied at its input pins.

1- Type elec_linact_control in the command window

Page 17 of 24
2- Examine the speed controller subsystem and identify the function of each block.

3- Examine the current controller subsystem and identify the function of each block.

4- Examine the PWM and H-bridge subsystem and identify the function of each block.

Page 18 of 24
5- Open the motor current scope and comment on the result.

6- Change the simulation mode to PWM in both the Controlled PWM and H-Bridge blocks.

7- Comment on the results

Page 19 of 24
Reference:
https://www.mathworks.com/examples/simelectronics/mw/elec_product-elec_motor_linact_control-linear-electric-
actuator-with-control

Page 20 of 24
Exercise 5: Modelling of Automotive Electrical System.

Description:This example shows a simplified dynamic model of an automotive electrical system. The model contains
electrical, mechanical, and thermal systems, and is able to simulate the effect of engine starting on the electrical network.

1-type elec_auto_electrical_system in the command window

Page 21 of 24
2- Examine the alternator subsystems (look under musk) and identify its operation.

Page 22 of 24
3- Examine the alternator thermal environment model.

4- Examine the starter solenoid subsystem and identify the rotational and translational and electric domains.

Page 23 of 24
5- Open the script file and identify its function.

6- Plot the simulation results and comment on it.

7-try to start the engine with the light turned on, what is the change in battery voltage?

Reference:
https://www.mathworks.com/examples/simelectronics/mw/elec_product-elec_auto_network-automotive-electrical-
system

Page 24 of 24

You might also like