function dae = shower(u,d,x,p)
% model for temprature mixer (shower)

m    = p(1);                                            % [kg], tank holdup
T    = x;                                        % [K], temperature = state

F1   = u(1);                                     % [kg/s], original input 1
F2   = u(2);                                     % [kg/s], original input 2

T1   = d(1);                                          % [degC], disturbance
T2   = d(2);                                          % [degC], disturbance

F    = F1+F2;                                   % steady-state mass balance
tau  = m/F;                                                % rezidence time
dTdt = 1/tau*((F1*T1+F2*T2)/(F1+F2)-T);            % dynamic energy balance

%dTdt = F1/m*(T1-T)+F2/m*(T2-T);    % dynamic energy balance considering
%varying mass

dae = [F; dTdt];                                                    % model
end