// Created by libAntimony v2.13.0
function oxygenation(phi, Vc, Vj, Vp)
  phi*((Vc + Vj - abs(Vc - Vj))/2 + Vp - abs((Vc + Vj - abs(Vc - Vj))/2 - Vp))/2;
end

oxygenation is "Oxygenation"

function carboxylation(Vc, Vj, Vp)
  ((Vc + Vj - abs(Vc - Vj))/2 + Vp - abs((Vc + Vj - abs(Vc - Vj))/2 - Vp))/2;
end

carboxylation is "Carboxylation"

function NADPH_production(j, S1, Nt)
  (j/2)*(S1/Nt);
end

NADPH_production is "NADPH production"

function PGA_consumption(S1, Rp, R, Nt, Vc)
  (S1/Rp)*(R/Nt)*Vc;
end

PGA_consumption is "PGA consumption"


model *Arnold2011_Damour2007_RuBisCO-CalvinCycle()

  // Compartments and Species:
  compartment chloroplast;
  species $RuBP in chloroplast, PGA in chloroplast, NADPH in chloroplast;
  species $CO2 in chloroplast, $O2 in chloroplast, $NADP in chloroplast, $starch in chloroplast;

  // Assignment Rules:
  NADP := Nt - NADPH;
  J := Cst*alpha*0.9*Q/sqrt(1 + (alpha*0.9*Q/Jmax)^2)/(65*0.5);
  Cst := exp(-0.0398*starch*a);
  Gamma := O2/(2*exp(-7.458 + 37830/(8.3143*298.15)));
  Vj := (J/4)*CO2/(CO2 + 2*Gamma);
  phi := 0.21*(O2/Ko)/(CO2/Kc);
  Vc := Vcmax*CO2/((1 + O2/Ko)*(CO2 + Kc));
  Vp := 3*TPU/(1 - Gamma/CO2);

  // Reactions:
  PGA_prod_Vc: $RuBP + $CO2 + 2 NADPH => 2 PGA; chloroplast*carboxylation(Vc, Vj, Vp);
  PGA_prod_Vo: $RuBP + $O2 + 2 NADPH => 1.5 PGA; chloroplast*oxygenation(phi, Vc, Vj, Vp);
  PGA_cons: PGA => $RuBP; chloroplast*PGA_consumption(PGA, Rp, NADPH, Nt, Vcmax);
  NADPH_prod: $NADP => NADPH; chloroplast*NADPH_production(J, NADP, Nt);

  // Species initializations:
  RuBP = 2;
  PGA = 2.4;
  NADPH = 0.21;
  CO2 = 24.5;
  O2 = 21000;
  starch = 0.5;

  // Compartment initializations:
  chloroplast = 1;

  // Variable initializations:
  Nt = 0.5;
  Rp = 3.2;
  alpha = 0.24;
  Q = 1000;
  Jmax = 142.047003854271;
  Vcmax = 1.91141270310584;
  Kc = 26.7125313821435;
  Ko = 187891.032274486;
  TPU = 0.259027750094988;
  a = 0.0434;

  // Other declarations:
  var J, Cst, Gamma, Vj, phi, Vc, Vp;
  const chloroplast, Nt, Rp, alpha, Q, Jmax, Vcmax, Kc, Ko, TPU, a;

  // Unit definitions:
  unit substance = 1e-3 mole;

  // Display Names:
  PGA_prod_Vc is "PGA production - v_c";
  PGA_prod_Vo is "PGA production - v_o";
  PGA_cons is "PGA consumption";
  NADPH_prod is "NADPH production";

  // SBO terms:
  Nt.sboTerm = 9
  Rp.sboTerm = 9
  alpha.sboTerm = 9
  J.sboTerm = 9
  Cst.sboTerm = 9
  Q.sboTerm = 9
  Jmax.sboTerm = 9
  Gamma.sboTerm = 9
  Vcmax.sboTerm = 9
  Kc.sboTerm = 9
  Ko.sboTerm = 9
  Vj.sboTerm = 9
  phi.sboTerm = 9
  Vc.sboTerm = 9
  Vp.sboTerm = 9
  TPU.sboTerm = 196
  a.sboTerm = 9

  // CV terms:
  RuBP hypernym "http://identifiers.org/obo.chebi/CHEBI:16710"
  PGA hypernym "http://identifiers.org/obo.chebi/CHEBI:17050"
  NADPH hypernym "http://identifiers.org/obo.chebi/CHEBI:16474"
  CO2 hypernym "http://identifiers.org/obo.chebi/CHEBI:16526"
  O2 hypernym "http://identifiers.org/obo.chebi/CHEBI:15379"
  NADP hypernym "http://identifiers.org/obo.chebi/CHEBI:25523"
  starch hypernym "http://identifiers.org/obo.chebi/CHEBI:28017"
end

Arnold2011_Damour2007_RuBisCO-CalvinCycle is "Arnold2011_Damour2007_RuBisCO-CalvinCycle"

Arnold2011_Damour2007_RuBisCO-CalvinCycle model_entity_is "http://identifiers.org/biomodels.db/MODEL1109270003"
Arnold2011_Damour2007_RuBisCO-CalvinCycle model_entity_is "http://identifiers.org/biomodels.db/BIOMD0000000387"
Arnold2011_Damour2007_RuBisCO-CalvinCycle description "http://identifiers.org/pubmed/22001849"
Arnold2011_Damour2007_RuBisCO-CalvinCycle encodement "http://identifiers.org/obo.go/GO:0019253"
Arnold2011_Damour2007_RuBisCO-CalvinCycle taxon "http://identifiers.org/taxonomy/33090"
