function AESuperheater = AESuperheater(x,T1,T0,m2,mG,P)
T2hot = x(1); TG1 = x(2); Q2 = x(3);
Cpg = P(1); dHvap45 = P(2); CpgG = P(11); TG0 = P(12); UA2 = P(14); % Parameters

h1 = m2*(dHvap45 + Cpg*(T1-T0)); % [J/s], enthalpy of flow out, Boiler
h2 = m2*(dHvap45 + Cpg*(T2hot-T0)); % [J/s], enthalpy of flow out, Superheater

f4 = (h1 - h2 + Q2)/800; % AE to find T2hot
f5 = (mG*CpgG*(TG0 - TG1) - UA2*((TG0 + TG1)/2 - (T1+T2hot)/2))/1000; % AE to find TG1
f6 = (Q2 - mG*CpgG*(TG0 - TG1))/3e5; % AE to find Q2

AESuperheater = [f4; f5; f6];
end

