function [u] = Transform2_chain(v2sp,x,vsp,d,p)
 
c_A = x(1);
T = x(2);

T_1 = d(1);
c_Af = d(2);
q_1 = d(3);

T_ref = p(1);                          %reference temp for rate constant [K]
V = p(2);                                                    %tank volume [m3]
c_p = p(3);                               %specific heat capacity [kJ/kgK]
E = p(4);                                     %activation energy [kJ/kmol]
rho = p(5);                                                %density [kg/m3]
k_ref = p(6);                               %reference rate constant [min-1]
R = p(7);                               %universal gas constant [kJ/Kkmol]
H_rx = p(8);                                   %heat of reaction [kJ/kmol]
%q_1 = p(9);                                     %inlet flow [m3/min]
B = p(11);

k = k_ref*exp((-E/R)*((1/T)-(1/T_ref)));

u = V*rho*c_p*(B*(T-v2sp)-((q_1*(T_1-T))/V)+(H_rx*k*c_A)/(rho*c_p));

%Q = 5000;

%u = V*rho*c_p*(-((q_1*(T_1-T))/V)+(H_rx*k*c_A)/(rho*c_p));

%Q = (((H_rx*k*c_A)/(rho*c_p))-(q_1*(T_1-T))/V)*(1/(V*rho*c_p));
end 