%% model architecture and initial conditions
potato_parameters

%Number of cellular compartments
p   = N_load + N_1 + N_1_un + N_2 + N_2_un;      %phloem
x   = p;     %xylem
a   = p;     %apoplast               

%total number of compartments
total=p+x+a;

%Compartment locations in vector 
phloem_c_sucrose  = 0*total + (1:p) ;
phloem_c_water    = 1*total + (1:p) ;
phloem_c_pressure = 2*total + (1:p) ;

phloem_a_sucrose  = 0*total + (phloem_c_sucrose(end)+1:phloem_c_sucrose(end)+a) ;
phloem_a_water    = 1*total + (phloem_c_sucrose(end)+1:phloem_c_sucrose(end)+a) ;
phloem_a_pressure = 2*total + (phloem_c_sucrose(end)+1:phloem_c_sucrose(end)+a) ;

xylem_c_sucrose   = 0*total + (phloem_a_sucrose(end)+1:phloem_a_sucrose(end)+x) ;
xylem_c_water     = 1*total + (phloem_a_sucrose(end)+1:phloem_a_sucrose(end)+x) ;
xylem_c_pressure  = 2*total + (phloem_a_sucrose(end)+1:phloem_a_sucrose(end)+x) ;

%Locations architecture
Loc_load    = 1:N_load;
Loc_1    = Loc_load(end)+1 : Loc_load(end) + N_1;
Loc_1_un = Loc_1(end)+1    : Loc_1(end)    + N_1_un;
Loc_2    = Loc_1_un(end)+1 : Loc_1_un(end) + N_2;
Loc_2_un = Loc_2(end)+1    : Loc_2(end)    + N_2_un;


%% Initial conditions model
C_ini(phloem_c_sucrose)    = 0;
C_ini(phloem_c_pressure)   = 0;         

C_ini(phloem_c_water(Loc_load)) = M_p_load;
C_ini(phloem_c_water(Loc_1))    = M_p_1;
C_ini(phloem_c_water(Loc_1_un)) = M_p_1_un;
C_ini(phloem_c_water(Loc_2))    = M_p_2;
C_ini(phloem_c_water(Loc_2_un)) = M_p_2_un;

C_ini(phloem_a_sucrose)    = 0;          
C_ini(phloem_a_pressure)   = 0;           

C_ini(phloem_a_water(Loc_load)) = 10* M_p_load;
C_ini(phloem_a_water(Loc_1))    = 10* M_p_1;
C_ini(phloem_a_water(Loc_1_un)) = 10* M_p_1_un;
C_ini(phloem_a_water(Loc_2))    = 10* M_p_2;
C_ini(phloem_a_water(Loc_2_un)) = 10* M_p_2_un;

C_ini(xylem_c_sucrose)     = 0;      
C_ini(xylem_c_pressure)    = 0;       

C_ini(xylem_c_water(Loc_load)) = M_x_load;
C_ini(xylem_c_water(Loc_1))    = M_x_1;
C_ini(xylem_c_water(Loc_1_un)) = M_x_1_un;
C_ini(xylem_c_water(Loc_2))    = M_x_2;
C_ini(xylem_c_water(Loc_2_un)) = M_x_2_un;