function y=diff(t,u)

Temp = u(6);             %K
R = 8.20578e-2;          %dm^3 atm /(K mol)
RT = Temp*R;
P0 = 0;                  %atm

Tk = 500;                %Kyltemperatur (K)
kappaA = 0.5e5;            %J/(K s)
V = 1;                   %Reaktorvolym (dm^3)
dH = [-113 -184]*1000;   %J/mol
cv = 3/2*8.314;          %J/(mol K)
Cv = cv*(sum(u(1:5)))*V; %J/K
           
P = P0 + u(1:5)*RT;      %Partialtryck (atm)
%x = u(1:5)/sum(u(1:5));  %molbråk

% rate constants 
k1 = 206000*exp(-7610/Temp);   
k2 = 11.7*exp(-1920/Temp);  

% reaction rates 
r1 = k1*P(1)*P(2);
r2 = k2*P(1)*P(2); 

y=zeros(size(u));

y(1) = -r1-r2;             %Propen
y(2) = -r1-r2;             %Cl_2
y(3) = r1;                 %Alkylklorid
y(4) = r1;                 %HCl
y(5) = r2;                 %1,2-diklorpropan
y(6) = (-dH(1)*r1-dH(2)*r2)*V/Cv-kappaA/Cv*(Temp-Tk); %Temperatur

%legend('Propen','Cl_2','Allylklorid','HCl','1,2-diklorpropan')