You are on page 1of 27

AIN SHAMS UNIVERSITY

FACULTY OF ENGINEERING
MECHATRONICS ENGINEERING DEPARTMENT
Credit Hours Programs

Spring Semester, 2018


MCT 456: Dynamic Modeling and Simulation
Lab. 9: Modeling of Fluidic, Thermal and Electromechanical Systems Using Simscape

Contents*

1- Create physical models (Hydraulic, Pneumatic, Thermal Liquid Models, etc.)


2- Modeling of Solenoid
3- Modeling of Motor Thermal Circuit
4- Modeling House Heating System
5- Backhoe Model

1. Exercise 1: Modeling a Hydraulic Cylinder using Simscape Fluids

 Description: Hydraulic circuits are an important component of many mechatronic systems. A basic
hydraulic system usually includes:

1. A tank (Hydraulic reference) to store the hydraulic fluid.


2. The hydraulic fluid itself (usually a type of oil).
3. A pump to circulate the hydraulic fluid in the circuit.
4. Hydraulic valves to control the flow of the fluid in the circuit.
5. A Hydraulic actuator (Hydraulic cylinder, hydraulic motor, …, etc) which converts the fluid flow
into a mechanical motion.

 The following figure shows a basic hydraulic circuit to control the extension and retraction of a hydraulic
cylinder:

Piston Mechanical
System

Hydraulic
Cylinder

Valve

Spool

Tank
Pump

 By controlling the position of the spool, we could force the hydraulic fluid to move the piston of the
hydraulic cylinder forward and backward.

 Hydraulic schematics are usually used to represent hydraulic circuits, the shown hydraulic cylinder is
represented by the following diagram:

*
Parts of this lab sheet are based on the Simscape documentation, provided by Mathworks
 The hydraulics section in the foundation library is used to model basic hydraulic elements and many
hydraulic components could be modelled using them. Implementing the hydraulic components like valves
and pumps using the basic hydraulic elements is usually difficult and time consuming.

 Simscape Fluids® (previously Simhydraulics) is an add on module to Simscape to provide hydraulic


components that are usually needed in hydraulic circuits.

 We will use Simscape Fluids to model the hydraulic circuit shown above.

 Build Model

1. At the MATLAB® command prompt, enter ssc_new to create a new Simscape file.
2. Add the following blocks to the diagram:

Library Block Quantity


Simscape > Foundation Hydraulic Reference 1
Library>Hydraulic>Hydraulic Elements
Simscape > Fluids>Hydraulic (Isothermal)>Pumps Fixed-Displacement Pump 1
and Motors
Simscape > Fluids>Hydraulic 4-Way Directional Valve 1
(Isothermal)>Valves>Directional Valves
Simscape > Fluids>Hydraulic Double-Acting Hydraulic Cylinder 1
(Isothermal)>Hydraulic Cylinders
Simscape > Fluids>Hydraulic Pressure Relief Valve 1
(Isothermal)>Valves>Pressure Control Valves
3. Connect the placed components as shown in the hydraulic schematic.
4. The Fixed displacement pump needs to be operated using input mechanical motion. We will use an ideal
velocity source for this task. Place the following components and connect them to the S port of the pump.

Library Block Quantity


Simscape > Foundation Ideal Angular Velocity Source 1
Library>Mechanical>Mechanical Sources
Simscape > Foundation Library>Mechanical>Rotational Rotational Mechanical Reference 1
Elements
Simscape > Foundation Library>Physical PS Constant 1
Signals>Sources

Page 2 of 27
The PS Constant block is used to directly provide a constant physical signal. We will use it to specify the
angular velocity of the source.
The rotational mechanical reference will be connected to the C port.
5. The hydraulic cylinder is a translational mechanical actuator that is operated using a hydraulic circuits. We
will now place a mechanical system for the cylinder to act against.
Note that the cylinder block itself has no mass or inertia specified and thus using it without connecting it
to a load will cause the simulation to fail.
Add the following elements to the diagram:

Library Block Quantity


Simscape > Foundation Library>Mechanical>Translational Mass 1
Elements
Simscape > Foundation Library>Mechanical>Translational Translational Spring 1
Elements
Simscape > Foundation Library>Mechanical>Translational Mechanical 2
Elements Translational Reference

6. Connect the mechanical elements as shown below:

7. Note that we left the physical properties of all the added components to their default values.
8. We now need a signal to drive the spool of the directional control valve. Add a Sine block and use the S
PS block to provide this signal. Make sure to change the units of the S PS block to mm as the motion of
the spool is usually very limited.
9. Run the simulation and try to fix any errors that might appear.
10. Notice that we haven’t added any sensors or scopes yet. When using Simscape, we could monitor the
status of all physical elements using the Simscape Results Explorer. In Simulation>Model Configuration
Parameters>Simscape (See Figure 1 in page 5) change the “Log simulation data” combo box to “All”.
After running the simulation again, right click on any physical element>Simscape>View Simulation
Data>simlog to view its parameters.
Note: The Simscape Results Explorer is not available before R2014b, for those who have older versions,
you will still need to add a sensor and scope for any variable you wish to plot.

Page 3 of 27
Note that in the figure above we are monitoring the parameters of the translational spring and its
displacement (x) is the same as that of the cylinder.
11. Note that the displacement of the spring does not go below 0. This is because, by default, the hydraulic
cylinder is in full retracted position. To adjust this double click on the hydraulic cylinder and in the “Initial
conditions” tab. Set “Piston initial distance from cap A” to 0.05m which is half the total stroke of the
cylinder.
12. Note that the cylinder doesn’t reach its full stroke (0.05m). Could you modify the system to increase the
velocity of the piston?
………………………………………………………………………………………………………………
………………………………………………………………………………………………………………
………………………………………………………………………………………………………………
13. Note that we didn’t specify the properties of the fluid. In order to do that add the following block to the
system and connect it to the hydraulic reference.

Simscape > Foundation Library>Hydraulic>Hydraulic Utilites Custom Hydraulic Fluid 1

What happens to the velocity of the piston when you increase the amount of trapped air in the fluid to 0.5?
………………………………………………………………………………………………………………
………………………………………………………………………………………………………………
………………………………………………………………………………………………………………

2. Modeling of Dynamic Fluid Systems: (Unsolved)

Use Simscape Foundation Library to model and simulate the following system. Assume any needed parameters for
the modelling

a. The Figure below shows a double-acting piston and cylinder. The device moves the load mass m in
response to the pressure sources p1 and p2. Assume the fluid is incompressible, the resistances
are linear, and the piston mass is included in m.
 Derive the equation of motion for m.
 Construct a Simscape model.
 Plot the results of x
Page 4 of 27
Use these values to simulate the model:
m = 1kg (Mass of load), A = 5×10-04 m2 (Piston area), ρ= 850 kg/m3 (Density of hydraulic fluid), p1 =
2×105 Pa (Source pressure), p2 = p1 (Source pressure), R1 = 1010 Pa/(m^3/s) (Linear flow resistance),
R2 = R1.

3. Exercise: Heat Transfer through Iron Rod.

 Description: This exercise shows the usage of thermal blocks for developing a model of a long iron rod that is
heated with a heat source through face A. Face B and the outer cylindrical surface are open to atmosphere and
subjected to forced heat convection. The rod is made of iron, is 20 cm in length and 2.25 cm in diameter. The
rod is treated as a single thermal mass. There is one convective heat transfer element for the single cylindrical
surface and two equally divided conductive heat transfer elements for the two halves of the rod.

 Build Model

1. Drag the following blocks into the model.

Library Block Qt.


Simscape > Foundation > Thermal >Thermal elements Thermal Mass 1
Simscape > Foundation > Thermal >Thermal elements Conductive Heat Transfer 2
Simscape > Foundation > Thermal >Thermal elements Convective Heat Transfer 2
Simscape > Foundation > Thermal >Thermal elements Thermal Reference 3
Simscape > Foundation > Thermal >Thermal Sources Ideal Heat Flow Source 1
Simscape > Foundation > Thermal >Thermal Sources Ideal Temperature Source 1
Simscape > Foundation > Thermal >Thermal Sensors Ideal Temperature Sensor 1
Simscape> Utilities Solver Configuration 1
Simscape> Utilities Simulink-PS Converter 2
Simscape> Utilities PS- Simulink Converter 1
Simulink>Sources Constant 2

Simulink>Sinks Scope 1

2. Connect the blocks as shown below

Page 5 of 27
3. Assign 120 for Constant1 which represents the source signal for the ideal heat flow source block; and 300
for Constant2
4. Specify the following parameters for both of Conductive Heat Transfer and Conductive Heat
Transfer1 Blocks

5. For Convective Heat Transfer and Convective Heat Transfer1 Blocks, Specify the following parameters

Block Parameter Value


Convective Heat Area 141.796e-4 m^2
Transfer Heat transfer coefficient: 32.1 W/(m^2 * K)
Convective Heat Area 4e-4 m^2
Transfer1 Heat transfer coefficient: 32.1 W/(m^2 * K)

6. Increase the simulation time to 10000 seconds and then run the simulation. The simulation results are
shown in the following illustration.

Page 6 of 27
7. Change Constant1 value which represents the source signal for the ideal heat flow source block to be
Zero, Run the simulation, and comment.
………………………………………………………………………………………………………………
………………………………………………………………………………………………………………
………………………………………………………………………………………………………………

4. Unsolved Thermal Dynamic Systems

a. Hardness and other properties of metal can be improved by the rapid cooling that occurs during quenching, a
process in which a heated object is placed into a liquid bath (see the Figure below).
Consider a lead cube with a side length of d = 20 mm. The cube is immersed in an oil bath for which h = 200
W/(m2 · ◦C). The oil temperature is Tb. Thermal conductivity varies as function of temperature, but for lead the
variation is relatively small (k for lead varies from 35.5 W/m· ◦C at 0◦C to 31.2 W/m·◦C at 327◦C). The density
of lead is 1.134 × 104 kg/m3. Take the specific heat of lead to be 129 J/kg·◦C.
Develop a simulation model to predict the temperature T as a function of time, for a given constant bath
temperature 𝑻𝒃 . Consider Tb = 50

Solution guide:
You will need the following elements in order to build a Simscape model for this thermal system:
1. a model of the thermal mass,
2. a model of the convective resistance,
3. a reference temperature,
4. a source temperature to specify 𝑇𝑏 , and
5. a way to measure the cube temperature T.

b. Using simscape to mode the system in the figure below if you consider the quenching process treated in the
previous example. If the thermal capacitance of the liquid bath is not large, the heat energy transferred from the
cube will change the bath temperature, and we will need a model to describe its dynamics. Consider the
representation shown in the Figure below. The temperature outside the bath is To, which is assumed to be known.
The convective resistance between the cube and the bath is R1, and the combined convective/conductive
resistance of the container wall and the liquid surface is R2. The capacitances of the cube and the liquid bath are
C and Cb, respectively

Page 7 of 27
Figure: Quenching with a variable bath temperature.

5. Exercise : Solenoid (Electromechanical Example)

This Exercise shows a solenoid with a spring return. The solenoid is modelled as an inductance whose value L depends
on the plunger position x. The back emf for a time-varying inductance is given by:

As L depends on x, this becomes:

can be derived from manufacturer force-stroke data using the relationship:

can then be integrated to get L as a function of x.

In the model, equation 2 is rearranged to solve for i, and then implemented using Physical Signal blocks. A controlled
current source then constrains the current to equate to i.

Steps:

1- Create a new model by typing ssc_new.


2- You are asked to make the model out of the following components based on this hierarchy.

Solenoid Model (Target)

A- Solenoid subsystem

Page 8 of 27
a) Voltage Current Interface subsystem

Block Library Path Quantity

Controlled Simscape/Foundation Library/Electrical/Electrical Sources 1


Current Source
Voltage Sensor Simscape/Foundation Library/Electrical/Electrical Sources 1

Connection Port Simscape/Utilities 4

i- Controlled Current Source : The Controlled Current Source block represents an ideal current
source that is powerful enough to maintain the specified current through it regardless of the
voltage across the source. The output current is I = Is, where Is is the numerical value presented
at the physical signal port. The positive direction of the current flow is indicated by the arrow.

ii- Voltage Sensor: The Voltage Sensor block represents an ideal voltage sensor, that is, a device
that converts voltage measured between two points of an electrical circuit into a physical signal
proportional to the voltage. Connections + and – are electrical conserving ports through which
the sensor is connected to the circuit. Connection V is a physical signal port that outputs the
measurement result. The block has the following ports: + Electrical conserving port associated
with the sensor positive terminal. - Electrical conserving port associated with the sensor negative
terminal. V Physical signal output port for voltage.

iii- Connection Ports: Two of which (1 & 2) need location to be Left and the other Two (3&4)
needs it to be Right.

Then finalize connections as follows:

Page 9 of 27
b) Calculate Force and Current subsystem

Block Library Path Quantity

PS Add, Multiply, Simscape/Foundation Library/Physical Signals/Functions


sub,gain
PS integrator Simscape/Foundation Library/Physical Signals/Linear operators 1

Connection Port Simscape/Utilities 5

PS Lookup Table (1D) Simscape/Foundation Library/Physical Signals/Lookup Tables 2

i- Current Current Subsystem :

ii- Current Force Subsystem :

iii- Connection Ports: 1&2&3 locations on parent subsystems are Right and 4&5 locations are Left

iv- PS Lookup Table (1D):


- LUT P to dL/dx

Page 10 of 27
- LUT PtoL

c) Position Velocity Force Interface subsystem


Block Library Path Quantity

Ideal Translational Simscape/Foundation Library/Mechanical/Mechanical Sensors 1


Motion Sensor
Ideal Force Source Simscape/Foundation Library/Mechanical/Mechanical Sources 1

Connection Port Simscape/Utilities 5

i- Ideal Translational motion sensor : Set initial Position to 5 mm .


ii- Ideal Force Source .
iii- Connection Ports: 1&2locations on parent subsystems are Left and 3&4&5 locations are Right

Page 11 of 27
d- Other Blocks

Block Library Path Quantity

Mass Simscape/Foundation Library/Mechanical/Translational Elements 1

Translational Spring Simscape/Foundation Library/Mechanical/Translational Elements 1

Translational Damper Simscape/Foundation Library/Mechanical/Translational Elements 1

Resistor Simscape/Foundation Library/Electrical/Electrical Elements 1

Connection Port Simscape/Utilities 5

i- Mass: Set to 0.1 Kg.


ii- Translational Spring : Set to 200 N/m.
iii- Translational Damper : Set to 20 N/(m/s).
iv- Resistor: Set to 1000 Ohm.
v- Connection Ports: 1&4 locations on parent subsystems are Right and 2&3 locations are Left.

Then finalize connections as follows:

B- Position Sensor subsystem


Set initial position of Translational motion Sensor to 5 mm .

C- Force Input subsystem


Set step time to 0.3 , Initial value =0, final value = 10.

D- Energise subsystem

Page 12 of 27
Set step time to 0.1 , Initial value =0, final value = 1.

E- DC Voltage Source
Set Constant voltage to 50 V.
Hint: You can find it at Simscape/Foundation Library/Electrical/Electrical Sources
F- Switch
Set Closed resistance R_closed: to 0.01 Ohm.

Hint: You can find it at Simscape/Foundation Library/Electrical/Electrical Elements

Block Library Path Quantity

Electrical Reference Simscape/Foundation Library/Electrical/Electrical Elements 1

Mechanical Simscape/Foundation Library/Mechanical/Translational Elements 2


translational reference
Ideal Force Source Simscape/Foundation Library/Mechanical/Mechanical Sources 1

Then finalize connections as follows:

One Last Step is to log and show the model variables: From Model Configuration Parameters:

Page 13 of 27
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 14 of 27
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 15 of 27
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 16 of 27
Reference:
https://www.mathworks.com/examples/simelectronics/mw/elec_product-elec_motor_linact_control-linear-electric-
actuator-with-control

6. Unsolved Dynamic Electromechanical Systems

1. Create a model of Loudspeaker shown in Figure 2. Consider coil resistance (R)=6Ω, inductance
(L)=0.2mH, speed proportional constant of electromechanical converter= 3 V/(m/s), voice coil and
diaphragm mass=50 gm, stiffness (k)= 500 kN/m, damping coefficient (B)= 6×10 -3N/(m/s). Measure
the steady state electric power consumed by the speaker and the time it takes for the diaphragm
oscillation (x) to settle (reach steady state) if the input electrical signal was sinusoidal with frequency
500 Hz and amplitude 12V.

Page 17 of 27
Figure 2
2. Figure 3 shows a schematic diagram of a microphone which is used as a transducer to convert
acoustic waves into electric signal. It consists of a diaphragm attached to a circular coil of wire that
moves back and forth through a magnetic field when sound waves hit the diaphragm. The magnetic
field is supplied by a cylindrical permanent magnet having concentric north and south poles. Create a
model for a microphone using Simscape given that: The resistance connected to the microphone is 50
Ohm, Microphone Diameter is 12.7 mm, its thickness is 0.1mm and it is made from Aluminum
(density 2700 kg/m3), Equivalent damping is 2 N/(m/s), electromechanical speed constant is and K m
= 10 V/(m/s). The inductance of the microphone coil is 0.5 mH. The equivalent stiffness is 10 N/mm.

a) What is the system response for static input of 100 Pa?


b) Estimate the voltage output when an acoustic wave of amplitude 1 Pa and frequency 1kHz is incident on
the diaphragm.

Figure 3
3. Use Simscape Foundation library and Driveline to solve this problem
The specifications of a machine that utilizes a lead screw mechanism are:

 Power screw: Diameter: 14 mm, length: 500 mm, pitch: 0.5 rev/mm, efficiency: 45%, material: steel (steel
density=7800kg/m3)
 Mechanical data: Friction coefficient (μ): 0.1, load: 6 kg.
 A geared DC motor was used to drive Taking into consideration that the motor parameters are:
Ra = armature winding resistance = 0.2 Ω

La = armature winding inductance = 0.1 mH

Kb = back-emf constant = 5.5 × 10-2 V/(rad/s)

Km = motor-torque constant = 5.5 × 10-2 Nm/A

Kb=Km (ideal motor)

Jr = moment of inertia of the rotor of the motor = 1.35 × 10 -5 kg m2

br = viscous-friction coefficient of the rotor of the motor = 5.4 x 10 -4 Nm/(rad/s)

Gear reduction ratio=10:1

Measure the motor current (A), motor torque (Nm), motor speed (rpm), load speed (m/s), and load
displacement (mm) if the motor is continuous running.

Page 18 of 27
4. Consider a machine with a rotary motion axis driven by an electric geared servo motor; as shown in
the figure below. The machine is connected to the geared motor shaft through timing belt. The
following specifications summarize the system: The motor gear box reduction: 10:1, the timing belt
reduction ratio: 2:1, the rotary load is a solid cylindrical shape made of steel material, d= 100 mm, l=
60mm, ρ= 7800 kg/m3, the equivalent viscous damping coefficient of the bearings on machine shaft is
1.5N.m.s/rad. A friction load is applied to the load (μ= 0.2)

The geared DC motor was used to drive the load through the belt. Taking into consideration that the motor
parameters are:

Ra = armature winding resistance = 0.2 Ω

La = armature winding inductance = 0.1 mH

Kb = back-emf constant = 5.5 × 10-2 V/(rad/s)

Km = motor-torque constant = 5.5 × 10-2 Nm/A

Kb=Km (ideal motor)

Jr = moment of inertia of the rotor of the motor = 1.35 × 10 -5 kg m2

br = viscous-friction coefficient of the rotor of the motor = 5.4 x 10 -4 Nm/(rad/s)

Gear reduction ratio=10:1

Measure the motor current (A), motor torque (Nm), motor speed (rpm), load speed (rpm), and load torque
(Nm) if the motor is continuous running.

Note: You may need to consider the pretension in the belt to prevent pulleys slip, by setting a high priority deformation
in the spring (belt stiffness) e.g. you can use 0.01m.

7. Extra Exercises:

Exercise : Motor Thermal Circuit


This Exercise shows how the thermal behavior of a brushless servomotor can be simulated using a lumped parameter
model. Heat generated due to power losses in the stator iron stack, stator winding and rotor is represented by three heat
flow sources: stator iron losses (Q_Iron), winding power losses (Q_Wind), and magnetizing and eddy current rotor
losses (Q_Rotor). The losses were recorded during a motor typical cycle simulation and stored in the motor_losses.mat
Page 19 of 27
file. The motor thermal circuit is built of thermal conductances, thermal masses, and convective heat transfer blocks,
which reproduce heat paths in the motor parts: winding, stator iron, motor case, rotor, front and rear bearing plates, and
motor mounting flange. The motor exchanges heat with the atmosphere through the case-atmosphere, flange-
atmosphere, and rear plate-atmosphere contacts. The ambient conditions are simulated with the ideal temperature source
set to 300 K.

Steps:

1- Create a new model by typing ssc_new.


2- You are asked to make the model out of the following components based on this hierarchy.

Motor Thermal Circuit Model (Target)

A- Building Blocks(Other than subsystems)

Block Library Path Quantity

From File Simulink/Sources 1

Goto Simulink/Signal Routing 3

Thermal Mass Foundation Library/Thermal/Thermal Elements 7

Conductive Heat Foundation Library/Thermal/Thermal Elements 8


Transfer

Convective Heat Foundation Library/Thermal/Thermal Elements 4


Transfer

Ideal Temperature Foundation Library/Thermal/Thermal Sources 1


Source

Thermal Reference Foundation Library/Thermal/Thermal Elements 1

a- From File:
make input file “motor_losses.mat” (Find it attached)

Page 20 of 27
b- Goto:
Set each Goto tag to one of the above variable names and make the Tag visibility global as follows.

c- Thermal Masses:

Thermal mass Mass(Kg) Specific Heat(J/kg/K)


Motor Case 3.8 903
Stator Iron 4.1 447

Winding 6.3 358

Bearing PlateF 0.6 447

Bearing PlateR 0.6 447

Flange 1.6 447

Rotor 3.6 447

d- Conductive Heat parameters

Conductive Heat Area (cm^2) Thickness(cm) Thermal


Conductivity
W/(m*K)
BearingF-Case 145 18 80.2
BearingR-Case 145 25 80.2
BearingR-Flange 34.5 14 80.2
Iron Stack-Case 4350 26 80.2
Rotor-BearingF 26.4 2.5 80.2
Rotor-BearingR 26.4 2.5 80.2
Winding Conductance 250.2 30 401
Winding-Iron Conductance 250 30 360

Page 21 of 27
e- Convective Heat Parameters :

Convective Heat Area (cm^2) Heat transfer coefficient (W/(m^2 * K))


Bearing-Atmosphere 274.6 123.5
Case-Atmosphere 4240 26.8

Flange-Atmosphere 324 123.4

Rotor-Iron 1240 156.8

B- Subsystems
a- Q_Rotor:
i- Find Ideal Heat Flow Source at Foundation Library/Thermal/Thermal Sources
ii- From: Find it at Simulink/Signal Routing, Set Goto tag to Q_Rotor.
iii- Input signal unit is W.

b- Q_Wind:
i- Find Ideal Heat Flow Source at Foundation Library/Thermal/Thermal Sources
ii- From: Find it at Simulink/Signal Routing, Set Goto tag to Q_Wind.
iii- Input signal unit is W.

c- Q_Stator:
i- Find Ideal Temperature sensor at Foundation Library/Thermal/Thermal Sensors.
ii- Input signal unit is W, Output signal unit is 1.

d- Atmosphere Temperature:
i- Input signal unit is 1.

Page 22 of 27
Then finalize connections as follows:

One Last Step is to log and show the model variables: From Model Configuration Parameters, as in
last step in Solenoid Exercise.

Exercise 3: House Heating System

This exercise shows how to model a simple house heating system. The model contains a heater, thermostat, and a house
structure with four parts: inside air, house walls, windows, and roof.

The house exchanges heat with the environment through its walls, windows, and roof. Each path is simulated as a
combination of a thermal convection, thermal conduction, and the thermal mass. The heater starts pumping hot air if
room temperature falls below 18 degrees C and is turned off if the temperature exceeds 23 degrees C. The simulation
calculates the heating cost and indoor temperatures.
The manual switch allows you to investigate system behaviour with the heating system turned off.

Steps:

1- Create a new model by typing ssc_new.


2- You are asked to make the model out of the following components based on this hierarchy.

House Heating System Model (Target)

Page 23 of 27
A- Building Blocks(Other than subsystems)
a- Daily Temp Variation : Sine Wave

b- Manual Switch can be found at Simulink/Signal Routing.


c- Assign Other Components as Shown

B- Building Blocks(subsystems)

a- Heater Switch

b- Thermostat:
It’s a MATLAB Function at Library path (Simulink/User Defined Functions).
Make an m-file with the following code, and name it Thermostat.m and add it to your model directory and
set the MATLAB Function block to Thermostat.

function heat = thermostat(power, Troom, max_temp, min_temp)

%Implement the thermostat logic for the heating system

%#codegen

persistent HEAT

if isempty(HEAT)

HEAT = false;

end

if HEAT && (Troom > max_temp || ~power)

HEAT = false;

elseif ~HEAT && Troom < min_temp && power


c- House Thermal
HEAT Network:
= true;
You end
Need to construct the Subsystem as shown:

heat = HEAT;

end

Page 24 of 27
Block Library Path Quantity

Thermal Mass Foundation Library/Thermal/Thermal Elements 4

Conductive Heat Foundation Library/Thermal/Thermal Elements 6


Transfer

Convective Heat Foundation Library/Thermal/Thermal Elements 6


Transfer

Ideal Temperature Foundation Library/Thermal/Thermal Sources 1


Source

Thermal Reference Foundation Library/Thermal/Thermal Elements 1

i- Temp. Sensor Subsystem:


o Output Signal Unit is degC

ii- Simulink-PS converter input signal unit is degC.


iii- Thermal Masses:

Thermal mass Mass(Kg) Specific Heat(J/kg/K)


Air M_air c_air
Roof roofMass c_roof

Wall wallMass c_wall

Window windowMass c_window

Page 25 of 27
iv- Conductive Heat parameters:

Conductive Heat Area (m^2) Thickness(m) Thermal Conductivity W/(m*K)


Half Roof-Air roofArea LRoof/2 kRoof
Half Roof-Atm roofArea LRoof/2 kRoof

Half Wall-Air wallArea LWall/2 kWall

Half Wall-Atm wallArea LWall/2 kWall

Half Window-Air windowArea LWindow/2 kWindow

Half Window-Atm windowArea LWindow/2 kWindow

v- Convective Heat Parameters :

Convective Heat Area (m^2) Heat transfer coefficient (W/(m^2 * K))


Air-Roof roofArea h_A_R
Air-Wall wallArea h_A_W

Air-Window windowArea h_A_Wnd

Atm-Roof roofArea h_R_Atm

Atm-Wall wallArea h_W_Atm

Atm-Window windowArea h_Wnd_Atm

One Last Step is to log and show the model variables: From Model Configuration Parameters, as in last step in
Solenoid Exercise.

Exercise: Backhoe Model (in the compressed file attached)

This file contains a model of a backhoe arm built using Simscape. The hydraulic actuation system, including pump,
valves, and hydraulic cylinders, actuates the arm and bucket. The three-dimensional mechanical system is modeled,
including the arm joints and bucket linkage. Examples in this submission show how to model custom hydraulic valves,
tune controller and physical system parameters, and generate C code from the entire model.
Please read the README.txt file to get started.
See an overview of this model in this video (5 min):
https://www.mathworks.com/videos/applications-and-tasks-in-simhydraulics-74107.html

Page 26 of 27
Here are some key points about this demonstration model:

1. You must run "startup_Backhoe.m" to set the path and load key values.
2. Double click on the grey block labelled "Script" to open an HTML page within MATLAB that will guide
you through the different examples included in this submission.

1- Explore Different subsystems in the Backhoe Arm using multibody blocks second generation.

Comment :
……………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………
………………………………………………………………………………………………

2- Explore Different subsystems in the Controller Arm.

Comment :
……………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………
……………………………………

3- Open and explore tilt actuator lib.

Comment :
……………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………
…………………………………………………………………………………………………

4- Run and explore the parameter estimation Model.

Comment :
……………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………
……………………

Page 27 of 27

You might also like