% 01.12.2018. determine steady-state values

syms  Q3 UA3 TG3                             % Symbolic variables

% parameters
m3      = 6.2356;                                        % [kg/s], water flow in
T0      = 45+273.15;                        % [degC], water temperature of flow in
dHvap45 = 2400e3;                             % [J] vaporisation heat at T0
mG      = 7;                                        % [kg/s], gas mass flow
cpG     = 3e3;                            % [J/kg/K], methane specific heat
cpSteam = 2e3;                              % [J/kg/K], steam specific heat
                                    % perfect level control
T4x1     = 318.15;                                   % [degC], drum temperature
H4x1     = dHvap45 + cpSteam*(T4x1-T0);  
h4x1     = m3*H4x1;                                % [J], enthalpy of flow out

T3mid    = 613.9593;                       % [degC] superheated steam temperature
H3mid    = dHvap45 + cpSteam*(T3mid-T0);
h3mid    = m3*H3mid;                               % [kJ], enthalpy of flow out

TG0     = 1000+273.15;                                     % inlet gas temperature

eqn(1) = Q3-mG*cpG*(TG0-TG3)==0; % energy balance SH
eqn(2) = mG*cpG*(TG0-TG3)-UA3*((TG0+TG3)/2-(T4x1+T3mid)/2)==0;
eqn(3) = h4x1-h3mid+Q3 == 0;                  % Energy balance steam side (dynamic)

sol    = solve(eqn,UA3,Q3,TG3);
UA3    = sol.UA3                                          % [W/m2/K], boiler
Q3     = sol.Q3                       % [J], heat transfered in the boiler
TG3    = sol.TG3               % [degC], gas temperature at boiler outlet






