-
Notifications
You must be signed in to change notification settings - Fork 14
/
Chiller.m
103 lines (90 loc) · 4.57 KB
/
Chiller.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
classdef Chiller
properties
iteration
id_condenser_inlet
id_condenser_outlet
id_evaporator_inlet
id_evaporator_outlet
time_step
matrix_size
matrix_coefficients
right_hand_side_vector
number_of_equations
specific_heat_capacity_fluid
power
coefficient_of_performance
mass_flow_rate_condenser
mass_flow_rate_evaporator
temperature_condenser_inlet
temperature_condenser_outlet
temperature_evaporator_inlet
temperature_evaporator_outlet
status
end
methods
function obj = Chiller(id_condenser_inlet, id_condenser_outlet, id_evaporator_inlet, id_evaporator_outlet, solver, specific_heat_capacity_fluid, power, coefficient_of_performance, mass_flow_rate_condenser, mass_flow_rate_evaporator, status)
if nargin > 0
obj.id_condenser_inlet = id_condenser_inlet;
obj.id_condenser_outlet = id_condenser_outlet;
obj.id_evaporator_inlet = id_evaporator_inlet;
obj.id_evaporator_outlet = id_evaporator_outlet;
obj.time_step = solver.time_step;
obj.matrix_size = solver.matrix_size;
obj.specific_heat_capacity_fluid = specific_heat_capacity_fluid;
obj.power = power;
obj.mass_flow_rate_condenser = mass_flow_rate_condenser;
obj.mass_flow_rate_evaporator = mass_flow_rate_evaporator;
obj.coefficient_of_performance = coefficient_of_performance;
obj.status = status;
obj.iteration = 0;
obj.number_of_equations = 2;
obj.matrix_coefficients = zeros(obj.number_of_equations,solver.matrix_size);
obj.right_hand_side_vector = zeros(obj.number_of_equations,1);
obj.temperature_condenser_inlet = solver.temperatures(obj.id_condenser_inlet);
obj.temperature_condenser_outlet = solver.temperatures(obj.id_condenser_outlet);
obj.temperature_evaporator_inlet = solver.temperatures(obj.id_evaporator_inlet);
obj.temperature_evaporator_outlet = solver.temperatures(obj.id_evaporator_outlet);
end
end
% evaporator inlet temperature coefficient (Eq 1)
function c = c_tei1(obj)
c = obj.mass_flow_rate_evaporator*obj.specific_heat_capacity_fluid;
end
% evaporator outlet temperature coefficient (Eq 1)
function c = c_teo1(obj)
c = - obj.mass_flow_rate_evaporator*obj.specific_heat_capacity_fluid;
end
% right-hand coefficient (Eq 1)
function c = c_r1(obj)
c = obj.power*obj.coefficient_of_performance;
end
% condenser inlet temperature coefficient (Eq 2)
function c = c_tci2(obj)
c = - obj.mass_flow_rate_condenser*obj.specific_heat_capacity_fluid;
end
% condenser outlet temperature coefficient (Eq 2)
function c = c_tco2(obj)
c = obj.mass_flow_rate_condenser*obj.specific_heat_capacity_fluid;
end
% right-hand coefficient (Eq 2)
function c = c_r2(obj)
c = obj.power*(1+obj.coefficient_of_performance);
end
% create matrix of coefficients and right-hand side vector
function obj = create(obj, solver)
obj.iteration = obj.iteration + 1;
obj.temperature_condenser_inlet = solver.temperatures(obj.id_condenser_inlet);
obj.temperature_condenser_outlet = solver.temperatures(obj.id_condenser_outlet);
obj.temperature_evaporator_inlet = solver.temperatures(obj.id_evaporator_inlet);
obj.temperature_evaporator_outlet = solver.temperatures(obj.id_evaporator_outlet);
obj.matrix_coefficients = zeros(obj.number_of_equations,obj.matrix_size);
obj.right_hand_side_vector = zeros(obj.number_of_equations,1);
obj.matrix_coefficients(1,obj.id_evaporator_inlet) = obj.c_tsi1();
obj.matrix_coefficients(1,obj.id_evaporator_outlet) = obj.c_tso1();
obj.matrix_coefficients(2,obj.id_condenser_inlet) = obj.c_tdi2();
obj.matrix_coefficients(2,obj.id_condenser_outlet) = obj.c_tdo2();
obj.right_hand_side_vector(1) = obj.c_r1();
obj.right_hand_side_vector(2) = obj.c_r2();
end
end
end