function dxBoilerdt = DAEBoiler(x,u,m2,TG1,T0,mG,P)
M1 = x(1); H1 = x(2); T1 = x(3); TG2 = x(4); Q1 = x(5); % Dynamic and static states
m1 = u(1);  % Input 

Cpg = P(1); dHvap45 = P(2);  CpgG = P(11); UA1 = P(13); % Parameters

h0 = 0; h1 = dHvap45 + Cpg*(T1 - T0); % Specific enthalpy [J/kg]

dM1dt = m1 - m2;  % Dynamic massbalance for the boiler
dH1dt = Q1 + m1*h0 - m2*h1;  % Dynamic energybalance for the boiler

f1 = (H1 - M1*h1)/500; % AE to calculated T1
f2 = (Q1 - mG*CpgG*(TG1-TG2))/300; % AE to calculate TG2
f3 = (mG*CpgG*(TG1-TG2) - UA1*((TG1 + TG2)/2 - T1))/1.75e7; % AE to calculate Q1

dxBoilerdt = [dM1dt; dH1dt; f1; f2; f3];  % [M1 H1 T1 TG2 Q2]
end

