function v2 = Calc_v2(x,u,d,p)

%% Parameters
F     = p(1);                                                    % flowrate
m2    = p(3);                                            % holdup in tank 2
cp    = p(4);                                               % specific heat
tau02 = p(6);                                 % tuning parameter for tank 2

%% States
T1 = x(1);                                          % temperature in tank 1
T2 = x(2);                                          % temperature in tank 2

%% Disturbances
Q2 = d(2);                                                 % heat to tank 2

%% Transformed input for tank 2
v2 = tau02*(F/m2*(T1-T2) + Q2/(m2*cp)) + T2;

end