function [dTjdt]=CLTI_Tjfunc(p,T_jin_del,T_jin,T_jout_del,T_jout,T_jav,x,c,dT_jout_deldt)

m_M = x(1);
m_P = x(2);
T = x(3);

T_inlet = p(44);
T_steam = p(45);
m_C = p(11);
c_pC= p(13);
mdot_C = p(12);
theta1 = p(33);
theta2 = p(34);
d_0 = p(24);
d_1 = p(25);
c_0 = p(18);
c_1 = p(19);
c_2 = p(20);
c_3 = p(21);
a_0 = p(22);
rho_M = p(4);
rho_P = p(5);
rho_W = p(6);
m_W = p(3);
P = p(50);
B_1 = p(49);
B_2 = p(51);

tau_p = p(32);

A = (m_M/rho_M+m_P/rho_P+m_W/rho_W)*(P/B_1)+B_2;
T_wall = (T+T_jav)/2;
f = m_P / (m_M+m_P+m_C);
mu_wall = c_0 * exp(c_1*f)*10^(c_2*((a_0/T_wall)-c_3));
h = d_0 * exp(d_1*mu_wall);
hf = 0;
U = 1/((1/h)+hf);

if c < 50
    Kp = 0.8 * 30^(-c/50)*(T_inlet-T_jin);
elseif c > 50
    Kp = 0.15 * 30^((c/50)-2)*(T_steam-T_jin); 
else
    Kp = 0;
end

dTjdt(1) = dT_jout_deldt+(T_jout_del-T_jin)/tau_p+Kp/tau_p;
dTjdt(2) = (1/(m_C*c_pC))*(mdot_C*c_pC*(T_jin_del-T_jout)+U*A*(T-T_jav));

end