CEV Project Report
CEV Project Report
1|Page
Introduction
This model illustrates how we can implement a controlled PWM Voltage and H-Bridge
blocks to control a motor. We shall be using manufacturer datasheet parameters, which
specifies that the motor will deliver 10W as mechanical power at 2500 rpm and no-load
speed as 4000 rpm when run from a 12V DC supply. So, if the PWM reference voltage is
set to its maximum value of +5V, then the motor should run at 4000 rpm. When we set it
to +2.5V, then it should run at approximately 2000 rpm. We will also run the model with
various other parameters to compare the behaviour of the PWM towards different voltage
source. We have set the Simulation model parameter to Averaged for both the Controlled
PWM Voltage and H-Bridge blocks, resulting in fast simulation.
Application of DC motor
What is PWM?
2|Page
A Pulse Width Modulation (PWM) Signal is the method for generating an analog signal using a
digital source. A PWM signal comprises of two main components that define its behaviour, one
is a duty cycle and another one is a frequency. The duty cycle gives information about the
amount of time that the signal is in a high (ON) state as a percentage of the total time of it takes
to complete one cycle. The frequency determines how fast the PWM completes a cycle, for
instance, 5000 Hz would be 5000 cycles/second), and therefore how fast it switches between
high and low states. By cycling a digital signal off and on at a fast-enough rate, and with a
certain duty cycle, the output will appear to behave like a constant voltage analog signal when
providing power to devices.
PWM signals are used for a wide variety of control applications. Their main use is for controlling
DC motors, but it can also be used to control valves, pumps, hydraulics, and other mechanical
parts. The frequency that the PWM signal needs to be set at will be dependent on the
application and the response time of the system that is being powered. Below are a few
applications and some typical minimum PWM frequencies required.
One simple and easy way to control the speed of a motor is to regulate the amount of voltage
across its terminals and this can be achieved using “Pulse Width Modulation” or PWM.
As its name suggests, pulse width modulation speed control works by driving the motor with a
series of “ON-OFF” pulses and varying the duty cycle, the fraction of time that the output
voltage is “ON” compared to when it is “OFF”, of the pulses while keeping the frequency
constant.
The power applied to the motor can be controlled by varying the width of these applied pulses
and thereby varying the average DC voltage applied to the motors terminals. By changing or
modulating the timing of these pulses the speed of the motor can be controlled, ie, the longer
the pulse is “ON”, the faster the motor will rotate and likewise, the shorter the pulse is “ON”
the slower the motor will rotate.
In other words, the wider the pulse width, the more average voltage applied to the motor
terminals, the stronger the magnetic flux inside the armature windings and the faster the motor
will rotate
3|Page
The use of pulse width modulation to control a small motor has the advantage in that the
power loss in the switching transistor is small because the transistor is either fully “ON” or fully
“OFF”. As a result, the switching transistor has a much-reduced power dissipation giving it a
linear type of control which results in better speed stability.
Also, the amplitude of the motor voltage remains constant, so the motor is always at full
strength. The result is that the motor can be rotated much more slowly without it stalling. So
how can we produce a pulse width modulation signal to control the motor.
PWM is used throughout the automotive industry as a command signal. The Duty Cycle of
a PWM signal tells us the amount of work this signal is supposed to make the component
perform. The duty cycle of the signal is always described in percentage. So, a 10% duty
cycle means, that the component is on 10% of the time.
What is a 100% duty cycle?
Duty cycle is the proportion of time during which a component, device, or system is operated.
The duty cycle can be expressed as a ratio or as a percentage. ... The drive runs for one out
of 100 seconds, or 1/100 of the time, and its duty cycle is therefore 1/100, or 1 percent.
A Rectangular waveform has a positive pulse width (Mark time) of 10ms and a duty cycle of
25%, calculate its frequency. The duty cycle is given as 25% or 1/4 and this is equal to the mark
time which is 10ms, then the period of the waveform must be equal to: 10ms (25%) + 30ms
(75%) which equals 40ms (100%) in total.
4|Page
The REF output of this block is floating, it is not tied to the Electrical Reference. One
consequence of this is that if you connect the PWM and REF electrical ports directly to
the PWM and REF electrical ports of an H-bridge or a gate driver, we must attach
an Electrical Reference block to the REF connection line.
Controlled PWM block should not connected directly to a semiconductor gate, because
this omits the gate driver output impedance that determines switching dynamics. Use
a Gate Driver or a Half-Bridge Driver block to set the gate-source or the gate-emitter
voltage.
Controlled PWM block has not been used to drive a motor block directly. A PWM motor
driver goes open circuit in between pulses. Should use the H-Bridge block to drive a
motor block.
When driving a motor via the H-Bridge block, set the Simulation mode parameter
to Averaged to speed up simulations. We must also set the Simulation mode parameter of the
H-Bridge block to Averaged mode. This applies the average of the demanded PWM voltage to
the motor. The Averaged mode assumes that the impedance of the motor inductive term is
small at the PWM frequency.
Ports
REF: Electrical conserving port associated with the floating zero volt reference.
PWM: Electrical conserving port associated with the pulse-width modulated signal.
Ref+: Positive electrical reference voltage.
Ref-: Negative electrical reference voltage
5|Page
Simulation mode- Averaged; the output is a constant whose value is equal to the average value of
the PWM signal.
Input voltage for 0% duty cycle- Value of the input voltage at which the PWM signal has a 0%
duty cycle.
Input voltage for 100% duty cycle- Value of the input voltage at which the PWM signal has a
100% duty cycle
6|Page
Output Voltage Amplitude- Amplitude of the PWM signal when the output is high.
PWM is often used in conjunction with an H-Bridge. This configuration is so named because it
resembles the letter H, and allows the effective voltage across the load to be doubled since the
power supply can be switched across both sides of the load. In terms of inductive loads, such
as DC Motors, diodes are used to suppress inductive spikes, which may damage the
transistors. The inductance in a motor also tends to reject the high frequency component of the
waveform. This configuration can also be used with speakers for Class D audio amps.
7|Page
What &Why we use H-bridge?
An H bridge is an electronic circuit that switches the polarity of a voltage applied to a load.
These circuits are often used in robotics and other applications to allow DC motors to run
forwards or backwards.
An H-bridge is a circuit configuration commonly used to control the speed and direction of a
brushed DC motor. The convenience of an H-bridge is that a low current digital signal can be
used to control a high current motor (or other device).
H-Bridge in the Simulink
PWM — The H-Bridge block output is a controlled voltage that depends on the input signal at
the PWM port.
If the input signal has a value greater than the Enable threshold voltage parameter value,
the H Bridge block output is on and has a value equal to the value of the Output voltage
amplitude parameter. If it has a value less than the Enable threshold voltage parameter
value, the block maintains the load circuit using one of the following three Freewheeling
mode options:
Via one semiconductor switch and one freewheeling diode- In this mode, the block controls
the load by maintaining one high-side bridge arm permanently on and using the PWM signal
to modulate the corresponding low-side bridge arm. This means that the block uses only one of
the freewheeling diodes in completing the dissipation circuit when the bridge turns off.
Via two freewheeling diodes- In this mode, all bridge arms are off during the bridge off-state.
This means that the block dissipates the load current across the power supply by two
freewheeling diodes.
Via two semiconductor switches and one freewheeling diode- In this mode, the block controls
the load by maintaining one high-side bridge arm permanently on and using the PWM signal
to toggle between enabling the corresponding low-side bridge arm and the opposite high-side
8|Page
bridge arm. This means that the block uses a freewheeling diode in parallel with a bridge arm,
plus another series bridge arm, to complete the dissipation circuit when the bridge turns off.
The first and third options are sometimes referred to as synchronous operation.
Ports
+ref - Positive electrical output voltage.
REV - Voltage that controls when to reverse the polarity of the H-Bridge block output.
The voltage is defined relative to the REF port.
The signal at the REV port determines the polarity of the output. If the value of the signal at
the REV port is less than the value of the Reverse threshold voltage parameter, the output
has positive polarity; otherwise, it has negative polarity.
BRK - Voltage that controls when to short circuit the H-Bridge block output. The voltage is
defined relative to the REF port.
Braking mode is invoked when the voltage presented at the BRK port is larger than
the Braking threshold voltage. Regardless of whether in PWM or Averaged mode, when in
braking mode the H-bridge is modeled by a series combination of two
resistances R1 and R2 where:
R1 is the resistance of a single bridge arm, that is, half the value of the Total bridge on
resistance parameter.
R2 is the resistance of a single bridge arm in parallel with a diode resistance, that
is, R1 · Rd / (R1 + Rd ), where Rd is the diode resistance.
9|Page
Various components of the model
DC Voltage Source:
A voltage source could be a two-terminal device which may maintain a set voltage. A
perfect voltage source will maintain the mounted voltage freelance of the load resistance
or the output current. However, a practical-world voltage source cannot provide limitless
current. A voltage source is that the two times of a current source. Real-world sources
of electrical current, like batteries, generators, may be developed for
analysis functions as a mix of a perfect voltage and additional combination of resistive
elements.
An ideal voltage source could be a two-terminal element that controls a fixed
voltage drop throughout its ends. It is typically used as a mathematical abstraction that
clarifies the analysis of actual electrical circuits. If the voltage across an
ideal voltage source may be specified severally of the other values in a very circuit, it
is known as independent voltage source. Conversely, if the voltage across an
ideal voltage source is decided by another voltage or current in a very circuit, it is known
as a dependent voltage source. The given diagram can be recognized as an ideal voltage
source. Here connections + and – are defending electrical ports, which would be
identified as positive and negative terminals respectively.
10 | P a g e
Ideal Voltage Source
Simply the voltage source is defined as a power supplier throughout the system. Basically, there
are two types of voltage source: AC Voltage Source and DC Voltage Source. The DC voltage
source is generally used in the automotive industries for the vehicles like, EVs, HEVs, and
PHEVs. The DC voltage source provides the DC power to the DC motor and other basic and
secondary elements placed in the system. In such DC voltage source, the output voltage is
decided by the Constant Voltage parameter, which might be positive or negative.
https://en.wikipedia.org/wiki/Voltage_source
https://www.mathworks.com/help/physmod/simscape/ref/dcvoltagesource.html
Current Sensors:
Current dimension is a critical need in electrical elements. Therefore, the current sensor proves
to be indispensable in accordance to its features such as, monitoring the distribution
of electric power, control and safety of electric motors and generators, monitoring and
controlling static converters, testing of the electricity semiconductors. The most beneficial
current sensors are categorized into two exceptional areas according to their working
principles: the electrical field and the magnetic field. The electrical field consists shunt resistors
as well as the magnetic field covers Hall Effect current probes, magneto-optical sensors,
magneto-resistive sensors and current transformers.
However, there are two kind of current sensors depends on the loop system,
11 | P a g e
i. Open loop current sensors:
Open loop current sensors consist of a Hall sensor established in the air gap of a magnetic core.
A conductor creates a magnetic field as same as to the current. The magnetic field is targeted
with the aid of the core and measured by way of the Hall sensor. The signal from the Hall
generator is below expectation, so it is amplified, and it is this amplified signal that forms the
sensor’s output. Open-loop sensors typically have circuitry that offers temperature
compensation and calibrated high-level voltage output. While they have an exact rate benefit
over closed-loop current sensors, their drawback is that they can be susceptible to saturation
and temperature drift. The drift can be minimized to some extent, however, by using injecting a
tremendous coefficient in the manage contemporary to reduce the go with the flow in
sensitivity over temperature.
12 | P a g e
Current sensor
https://www.tandfonline.com/doi/abs/10.1080/09398368.2001.11463473
https://www.mathworks.com/help/physmod/simscape/ref/currentsensor.html?s_tid=doc_ta
https://www.digikey.com/en/articles/techzone/2012/sep/the-basics-of-current-sensors
Solver Configuration:
In any kind of Simscape model each and every block need the solver settings for the simulation.
Then there should be one component which specifies the solver parameters to the simulation,
solver configuration is element which does that function. The solver configuration block has
one conserving port, which can be connected anywhere in the model. It looks like as shown
below
There are quite a few parameters in the solver configuration which are as per follows,
1. Start simulation from steady state
At the point when this case is chosen, the solver endeavors to locate the steady state that
would result if the inputs to the system were held consistent for an adequately expansive time,
beginning from the initial state got from the initial conditions calculation.
2. Consistency tolerance
This parameter influences the nonlinear solver utilized for computing introductory conditions
and for transient in-statement. It decides how precisely the arithmetical imperatives are to be
fulfilled toward the start of simulation and after each discrete occasion for instance, an
inconsistency in valve opening and a hard stop. Reduction the parameter which is tighten
tolerance, incentive to acquire a more dependable time simulation. Increment the parameter
which is relax the tolerance, esteem if illuminating for beginning conditions neglected to unite,
or to decrease the calculation time.
The default value is 1e-9.
13 | P a g e
3. Use local solver
Gives you a chance to utilize an example based local solver with an example time determined
by the Sample time parameter. In test-based simulation, all the Physical Network states, which
are generally constant, become represented to Simulink as discrete states. The solver refreshes
the states once per time step. This alternative is particularly valuable for produced code or
hardware-in-the-loop (HIL) simulations.
Solver types
Backward Euler, Trapezoidal Rule, or Partitioning these all are types of solver.
Sample time
Which defines the solver time to the simulation.
Partition method
As needed — Compute matrix inverses during simulation, as needed.
Exhaustive — Compute and store matrix inverses before simulation.
These are several vital parameters which are explained briefly however, there are some other
parameters such as, mode iterations, linear algebra, and equation formulation and so on.
https://www.mathworks.com/help/physmod/simscape/ref/solverconfiguration.html
Electrical reference:
This element provides the electrical ground to the electrical parts in the model. Each and every
Simulink model which consists electrical parts must have the electrical reference. The simple
diagram of the electrical reference is provided here,
https://www.mathworks.com/help/physmod/simscape/ref/electricalreference.html?
s_tid=doc_ta
14 | P a g e
Mechanical rotational reference:
It is as same as the electrical reference, in which the mechanical components which are
attended in the framework of the Simulink, should be attached with the mechanical rotational
reference. Each Simulink model would have the mechanical rotational reference.
https://www.mathworks.com/help/physmod/simscape/ref/mechanicalrotationalreference.htm
l
As per the diagram, connections R and C are mechanical rotational preserving ports that
interface the square to the nodes whose movement is being observed. Connections W and A
are physical signal outcome ports for speed and angular displacement, separately. Simply the
ideal rotational motion sensor produces the velocity and angular displacement through scope in
Simulink model.
https://www.mathworks.com/help/physmod/simscape/ref/idealrotationalmotionsensor.html
https://www.nhn.ou.edu/~johnson/Education/Juniorlab/Optics/Pasco/P_RotaryMot.pdf
15 | P a g e
PS Simulink converter:
The PS Simulink converter is used in every Simscape model in which the desired result would be
gotten via scope. The Simscape model and the MATLAB Simulink both are different things they
can never directly connected with each other. There should be one connection link between
them. So, PS Simulink converter is the bridge between them, which joins the Simscape model
with the scope. In PS Simulink converter, the input is the physical signal which is gained by the
component in the system which is converted into the Simulink signal. The experimental block is
as per below,
https://www.mathworks.com/help/physmod/simscape/ref/pssimulinkconverter.html
16 | P a g e