Why Choose Us?
0% AI Guarantee
Human-written only.
24/7 Support
Anytime, anywhere.
Plagiarism Free
100% Original.
Expert Tutors
Masters & PhDs.
100% Confidential
Your privacy matters.
On-Time Delivery
Never miss a deadline.
School of Engineering, Discipline of Mechanical Engineering and Mechatronics, pp
School of Engineering, Discipline of Mechanical Engineering and Mechatronics, pp. 1–12
Assignment 2: Air-conditioner simulation and safety system design
MCHA3400
Semester 1 2023
School of Engineering, Discipline of Mechanical Engineering and Mechatronics
Introduction
Air conditioners are widely used for cooling in both residential and commercial applications. In this assignment, you are tasked to construct a dynamic simulation of an air conditioner unit being installed in a industrial environment with the purpose of cooling a switch room. You are additionally required to write a functional description and validation tests for the air conditioning system.
The layout of the installed system is shown in Figure 1. Power is delivered to the air conditioner
unit via a power contactor (industrial switch). When the contactor is in the closed position, 415V
is supplied to the compressor, driving the unit. When the contactor is in the open position, the air
conditioner is stopped. Three temperature sensors and a pressure sensor are installed throughout the
air conditioner so that it can be continually monitored for safe operation.
Figure 1: Overview of the air condition system proposed for installation.
Submission instructions
Assignment 2 is due at 11:59pm, Friday 5th May. Your submission will consist of a software and a
written component.
Software submission: Problem 1 requires you to create several simulations in Matlab. Your simulation files should be labelled as per the file names indicated throughout this document. Files with
names different from those specified will be ignored.
Written submission: Your written solutions should be collected into a single .pdf file with the
name assignment2 written.pdf. For task 1, you are required to include labelled output plots from
your simulations in your written submission. Your solution to task 2 should also be included in the
written solution. Please ensure that your solutions are neatly presented and organised in the correct
order within your document. Examples of acceptable submissions include:
• Neatly handwritten on paper and scanned to a pdf,
2
MCHA3400 — Embedded Systems Engineering
• Neatly handwritten on a tablet (e.g., Surface, iPad) and saved to a pdf,
• Typed in a word processor (e.g., MS Word with equation editor) and exported to a pdf,
• Typeset in LATEX and compiled to a pdf.
If you written submission cannot be easily read, it will receive a grade of 0.
Warning
Don’t submit your initial working-out. Rewrite your solutions neatly in a logical order!
Hint
Submission format: Add both your written and software solutions into a single .zip file called
studentNumber studentName assignment2.zip1 and submit this file to Canvas for assessment. Your
final .zip folder should include the following files:
studentNumber StudentName assignment2
air conditioner simulation
convectionFuncs
thermalFuncs
Task 1 condenser.m
Task 1 airCon.m
Task 1 fullSystem.m
assignment2 written.pdf
(root directory)
Figure 2: Expected workspace directory tree after completing the assignment.
1The expressions studentNumber and studentName should be replaced with your student number and name, respectively.
3
School of Engineering, Discipline of Mechanical Engineering and Mechatronics
Task 1: Simulation of an air conditioner (75%)
In this task, you will develop a dynamic simulation of an air-conditioner system. A simple overview
of a refrigeration cycle is depicted in Figure 3. The main stage of the cycle are described below:
1. A refrigerant in vapour phase enters a compressor which results in high pressure and high
temperature gas.
2. The high pressure refrigerant vapour is passed through a condenser which extracts heat from the
refrigerant and radiates it to the ambient outside air. This causes the refrigerant to condense
into a liquid, still at a high pressure.
3. The liquid refrigerant passes through an expansion device, reducing the pressure of the refrigerant. The drop in pressure causes the temperature to drop and the liquid refrigerant becomes a
mixture of gas and liquid.
4. The cooled refrigerant is passed through an evaporator where heat is exchanged with the environment. This stage causes the remainder of the refrigerant to boil, putting the refrigerant back
into a vapour phase.
Figure 3: Abstraction of a single stage refrigeration cycle.
In order to construct your simulation, you will utilise the convection bond graph functions developed
during your labs. Before starting, copy the convectionFunctions and thermalFunctions folder (and
contained functions) into your assignment 2 working directory.
We will now construct a new macro element, called HXmacro, to describe the dynamic behaviour of
the heat exchangers used in the air conditioner. The bond graph representation of the new macro
element is shown in Figure 4.
4
MCHA3400 — Embedded Systems Engineering
Figure 4: Bond graph of the HXmacro element.
It is assumed that the CSmacro element has a constant volume. Because of this, the HX macro
element is described by two states—entropy and mass.
Task 1.1: HXmacro element (25%)
• Construct a Matlab function in the convectionFuncs folder called HXmacro output which computes the fluid outputs of the HXmacro element (as indicated by the causality in Figure 4) based
on the current state. The function should have the following inputs and outputs:
Inputs Outputs Description
HX state HX state = [S m]
>
is the current state of the HXmacro element.
S and m are the entropy and mass of the fluid contained in the
HXmacro element, respectively.
fluid name Name of the fluid being pumped (must be a valid CoolProp fluid)
HX params Structure containing the parameters of the HXmacro element.
P in Pressure of the upstream fluid.
h down Specific enthalpy of the downstream fluid.
P down Pressure of the downstream fluid.
The HX params input is a structure with the elements
Element Description
H Thermal conductivity of the heat exchanger walls [WK−1
]
V Volume of the heat exchanger [m3
]
Use your CSmacro outputs function within your HXmacro output function. Recall that the
CSmacro outputs function requires a state inputs of the form CS state = [S, V, m]>.
Tip
• Construct a Matlab function in the convectionFunctions folder called HXmacro deriv.m that
computes the derivatives of the HXmacro states given the current states and inputs. The function
should have the following inputs and outputs:
5
School of Engineering, Discipline of Mechanical Engineering and Mechatronics
Inputs Outputs Description
HX state HX state = [S m]
>
is the current state of the HXmacro element.
S and m are the entropy and mass of the fluid contained in the
HXmacro element, respectively.
h up Specific enthalpy on inlet flow
dm up Mass flow rate into the element
dm down Mass flow rate out of the element
T ext Temperature from the external thermal power bond [K].
fluid name Name of the fluid being pumped (must be a valid CoolProp fluid)
HX params Structure containing the parameters of the HXmacro element.
dHX state The time derivative of the HXmacro state vector dHX state =
[dS dm]
>
. dS and dm are the time derivatives of entropy and mass
of the HXmacro element, respectively.
dS ext Entropy flow rate on external thermal power bond [J/kg/K/s]
Use your CSmacro deriv function within your HXmacro deriv function.
Tip
Figure 5 shows a bond graph of the condenser sub-system, consisting of a HXmacro element for the
heat exchanger and an RS element for the expansion device. Use the orifice function which was
developed in Lab 5 to evaluate the CCR of the RS element.
Figure 5: Bond graph of the condenser sub-system.
• In your root directory, create a Matlab script called Task 1 condenser.m. In that script, create
a simulation for the system depicted in Figure 5. Use the following parameters for the system:
Parameter Value
condenser params.H 138.3627
condenser params.V 0.8 × 10−3
[m3
]
orifice params.A up 0.1 × 10−4
[m2
]
orifice params.A down 0.0046 × 10−4
[m2
]
fluid name “R410A”
• Using the ode23s solver with a relative tolerance of 1×10−6
, simulate the system for 100 seconds.
Initialise the condenser states with entropy Scond = 177.1135 [J/K] and mass 0.1178 [kg]. The
inputs into the system are given as follows:
Input Value
T ext 35.0 [?C]
h in 4.571 × 105
[J/kg]
dm in 0.018 [kg/s]
P out 0.9 × 106
[P a]
6
MCHA3400 — Embedded Systems Engineering
• Using the subplot command, generate a plot showing the temperature, pressure and mass of
the refrigerant within the condenser vs time. For reference, the pressure within the condenser
should agree with Figure 6.
0 20 40 60 80 100
2.1
2.2
2.3
2.4
2.5
2.6
2.7
2.8
2.9
3
Pressure [Pa]
106
Figure 6: Output of the condenser pressure.
There is a bug in the CoolProp libraries that can cause a PropsSI call to fail when given
specific entropy and density as inputs (the input pair required for evaluation of the requested plots). In your CSmacro output and CSmacro deriv functions developed in lab 7,
you should have implemented the work-around of first evaluate the temperature using the
code
Figure 7: The temperature can be computed using a nonlinear solver.
where s and D are the specific entropy and density of the CSmacro element, respectively.
The returned value T is the temperature of the element. Once returned, use the pair T and
D for subsequent PropsSI calls.
Tip
Task 1.2: AirCon macro element (35%)
Using the HXmacro element constructed above, we can now proceed to create a simulation of an
air conditioner unit. The model will consist of two HXmacro elements to model the evaporator and
condenser, a VDM element to model the compressor and an orifice element to model the expansion
valve. A bond graph of the system to be simulated is provided in Figure 8.
7
School of Engineering, Discipline of Mechanical Engineering and Mechatronics
Figure 8: Bond graph of a full air conditioner system.
• Write a function called airCon deriv in your convectionFunctions folder with the following
inputs and outputs:
Inputs Outputs Description
airCon state airCon state =
evaporator state> condenser state>
>
is the current state of the overall air conditioner system.
omega Input angular velocity for the volumetric displacement motor [rad/s]
T ext External temperature [K]
T int Internal temperature [K]
fluid name Name of the fluid being pumped (must be a valid CoolProp
fluid)
airCon params Structure containing all of the air conditioner parameters
(described below)
dairCon state Time derivative of the state vector
tau Torque of the motor
dS ext Entropy flow rate of the external thermal power bond
dS int Entropy flow rate of the internal thermal power bond
The airCon params input is a structure with the elements
Element Description
HX evap params HXmacro params structure containing the evaporator parameters
HX cond params HXmacro params structure containing the condenser parameters
expansion params orifice params structure containing the expansion device parameters
compressor params motor params structure containing the compressor parameters (see Lab 7)
Figure 9 shows a bond graph representation of an air conditioner connected to sources of temperature.
Recall that the airCon element is described by the collection of bond graph elements in Figure 8.
Your task is to simulate the system shown in Figure 9.
8
MCHA3400 — Embedded Systems Engineering
Figure 9: Bond graph of a full air conditioner system attached to temperature sources.
• Create a script in your root directory called Task 1 airCon which will be used to create your
simulation. In that file, construct a simulation for the system depicted in Figure 9. Use the
parameters detailed in the table below:
Parameter Value
HX evap params.H 71.0555
HX evap params.V 0.8 × 10−3
HX cond params.H 138.3627
HX cond params.V 0.8 × 10−3
expansion params.A up 0.1 × 10−4
expansion params.A down 0.0046 × 10−4
compressor params.nad 0.98
compressor params.nv 1
compressor params.Tm 0.9
• Simulate the system for 100 seconds using the input temperatures
Input Value
T ext 35?C
T in 25?C
For the input angular velocity, use the following values
omega(t) =
0.02 [rad/s], for t ≤ 50
0.0 [rad/s], for t > 50.
The systems initial conditions of the condenser are defined as S(0) = 176.7753, m(0) = 0.1193.
The initial conditions of the evaporator are given by S(0) = 160.5977, m(0) = 0.1051.
Use the ode23s solver with a relative tolerance of 1 × 10−4
. Generate two output plots from
your simulation. The first should show the temperature, pressure and mass within the condenser
vs time. The second should show the temperature, pressure and mass within the evaporator vs
time. In each case, use the subplot command to display the requested outputs on separate
sub-plots.
In the first instance, attempt to simulate the system with the constant input omega = 0.02
for 50 seconds. Once you have achieved this, complete the problem with the specified
time-varying input.
Tip
9
School of Engineering, Discipline of Mechanical Engineering and Mechatronics
• The plots generated in the previous step show the temperature, pressure and mass of the evaporator and condenser outlets. For your final task, generate one more plot which shows the
temperature and pressure of the fluid at the compressor outlet vs time.
Task 1.3: Simulation with room (15%)
Your final task is to simulate the system depicted in Figure 10. This bond graph represents a room,
modelled as a solid of constant volume, being cooled by an air conditioner. The behaviour of the room
is described by the thermalCapacitor function generated in lab 5. The heat flow between the room
and external environment satisfies Newton’s law of cooling. The convectionCooling function can be
used to describe this interaction.
Figure 10: Bond graph of a full air conditioner system cooling a room.
• In your root directory, create a Matlab script called Task 1 fullSystem.m. In that file, create
a simulation of the system shown in Figure 10. For the air conditioner model, use the same
parameters that were used in Task 1.2. For the room, use the following parameters:
Parameter Value
thermalCap params.S 0 6.8984 [J/K]
thermalCap params.T 0 30 [?C]
thermalCap params.c v 0.717 [ J
K·kg ]
thermalCap params.m 16.98 [kg]
thermalConvec params.h 1.8 [ W
m2K
]
thermalConvec params.A 20 [m2
]
• Simulate the system for 60 seconds using the external temperature
Input Value
T ext 30?C
Note that the internal temperature is now replaced with the temperature of the room. For the
air conditioner initial conditions, use the same values as were provided in Task 1.2. For the
inputs angular velocity, use the following input
omega = 0.01[rad/s] (1)
Use the ode23s solver with a relative tolerance of 1 × 10−4
for your simulation. Create three
output plots from your simulation. One for the both the evaporator and the condenser, each
showing the temperature, pressure and mass of the refrigerant as a function of time. Additionally,
create a third plot showing the temperature of the room as a function of time.
10
MCHA3400 — Embedded Systems Engineering
Task 2: Safety system design (25%)
The air conditioner system modelled in Task 1 is to be installed in a hazardous area on an industrial
site. A number of potential hazards related to possible failure modes of the unit have been identified.
To mitigate against potential hazards, a safety instrumented system (SIS) is to be installed which will
monitor the unit’s operation and disable the unit in the case of a hazardous event. As shown in Figure
11, a number of sensors have been proposed to monitor the unit’s operation which are connected back
to a PLC. In the case of a hazardous event, the power contactor should be opened, disabling the
device.
Figure 11: Overview of the safety instrumented system.
Temperature sensor 1 is installed to detect a dangerous high temperature at the compressor outlet. A
temperature above 140?C should trigger the SIS whereas a temperature above 120?C that persists for
more than 10 seconds should also trigger the SIS. Temperature sensor 2 and the pressure sensor 1 are
installed to detect any liquid present at the compressor intake. If liquid is detected, the SIS should
be triggered. Temperature sensor 3 is installed to detect sub-zero temperature at the evaporator.
Temperatures below 0?C can lead to freezing of the evaporator coils and, thus, should trigger the SIS.
An emergency stop (E-stop) is located near the device and, if pressed (closed), should trigger the SIS.
As per site requirements, the status of the SIS should be sent to the control room every 3 seconds.
Additionally, in the event that the SIS is triggered, the cause of the fault scenario should be relayed
to the control room. To reset the SIS, a ‘start’ command is sent from the control room to the PLC.
If none of the fault conditions are met, the contactor is closed, starting the air conditioner.
Before programming of the safety system can begin, a functional specification describing the required
behaviour of the programmable logic controller must be specified. This document is intended to be
passed onto a contractor for implementation of the safety systems.
11
School of Engineering, Discipline of Mechanical Engineering and Mechatronics
Task 2.1: Functional description (10%)
Prepare a function specification for the SIS depicted in Figure 11. Prepare two tables for your specifications. The first should outline the functional behaviour of the PLC in relation to stimuli from
the sensor. The second table should cover the reporting from the PLC to the control room. Use the
following template for your specifications:
ID Functional requirements
1.1 If the temperature at the compressor outlet (sensor 1) exceeds 140?C,
open the power contactor.
1.2 ...
ID Communication requirements
2.1 ...
Task 2.2: Validation test design (15%)
Once the function behaviour of the SIS has been formalised, validation tests for the system can be
prepared. These should be prepared before commencing work the the software solution to avoid
any bias test preparation that may occur from preparing tests after development. Using the format
provided in the following table, construct some tests for each of the provided functional requirements.
For these tests, assume that you have the ability to manipulate all of the physical inputs to the system.
Note that you may need more than one test pre functional requirement.
Spec
ID
Test
ID
Test Result Date Sign
1.1 1.1.1 Set the input stimuli to healthy levels (eg. Temp
1 = 40?C, Temp 2 = 40?C, Temp 3 = 40?C,
Pressure 1 = 2000kPa, E-stop = open),
send a ‘start’ signal to the PLC and observe
the contactor close. Increase temperature 1 to
150?C and observe the contactor open.
12
Expert Solution
PFA
Need this Answer?
This solution is not in the archive yet. Hire an expert to solve it for you.





