// 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 PGA_consumption(S1, Rp, R, Nt, Vc)
  (S1/Rp)*(R/Nt)*Vc;
end

PGA_consumption is "PGA consumption"

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

NADPH_production is "NADPH production"

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"


model *Arnold2011_Sharkey2007_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;

  // Assignment Rules:
  NADP := Nt - NADPH;
  phi := 0.21*(gm*O2/Ko)/(((gm*CO2 - v_c) + Rd)/Kc);
  v_c := (abs((abs(Vc + Vj) - abs(Vc - Vj))/2 + Vp) - abs((abs(Vc + Vj) - abs(Vc - Vj))/2 - Vp))/2;
  Vc := Vcmax*(CO2 - (1/2)*(CO2 + Kc*(1 + O2/Ko) + (Vcmax - Rd)/gm - sqrt((CO2 + Kc*(1 + O2/Ko) + (Vcmax - Rd)/gm)^2 + (4/gm)*(Rd*(CO2 + Kc*(1 + O2/Ko)) + Vcmax*(Gamma - CO2)))))/((CO2 - (1/2)*(CO2 + Kc*(1 + O2/Ko) + (Vcmax - Rd)/gm - sqrt((CO2 + Kc*(1 + O2/Ko) + (Vcmax - Rd)/gm)^2 + (4/gm)*(Rd*(CO2 + Kc*(1 + O2/Ko)) + Vcmax*(Gamma - CO2))))) + Kc*(1 + O2/Ko));
  Vj := (J/4)*(CO2 - (1/2)*(CO2 + 2*Gamma + (J - 4*Rd)/(4*gm) - sqrt((CO2 + 2*Gamma + (J - 4*Rd)/(4*gm))^2 + (4/gm)*(Rd*(CO2 + 2*Gamma) + (J/4)*(Gamma - CO2)))))/((CO2 - (1/2)*(CO2 + 2*Gamma + (J - 4*Rd)/(4*gm) - sqrt((CO2 + 2*Gamma + (J - 4*Rd)/(4*gm))^2 + (4/gm)*(Rd*(CO2 + 2*Gamma) + (J/4)*(Gamma - CO2))))) + 2*Gamma);
  Vp := 3*TPU*((CO2 - (3*TPU - Rd)/gm)/(CO2 - (3*TPU - Rd)/gm - Gamma));

  // 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 = 21;

  // Compartment initializations:
  chloroplast = 1;

  // Variable initializations:
  Nt = 0.5;
  Rp = 3.2;
  Rd = 0.0307674936008629;
  J = 0.0307678189755062;
  gm = 0.0307740792044142;
  Gamma = 3.74116898182615;
  Vcmax = 0.0307602623029146;
  Kc = 27.2372124161502;
  Ko = 16.5788431231261;
  TPU = 0.0307585098788555;

  // Other declarations:
  var phi, v_c, Vc, Vj, Vp;
  const chloroplast, Nt, Rp, Rd, J, gm, Gamma, Vcmax, Kc, Ko, TPU;

  // 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
  Rd.sboTerm = 9
  J.sboTerm = 9
  gm.sboTerm = 9
  Gamma.sboTerm = 9
  Vcmax.sboTerm = 9
  Kc.sboTerm = 9
  Ko.sboTerm = 9
  phi.sboTerm = 9
  v_c.sboTerm = 9
  TPU.sboTerm = 196
  Vc.sboTerm = 9
  Vj.sboTerm = 9
  Vp.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"
end

Arnold2011_Sharkey2007_RuBisCO-CalvinCycle is "Arnold2011_Sharkey2007_RuBisCO-CalvinCycle"

Arnold2011_Sharkey2007_RuBisCO-CalvinCycle model_entity_is "http://identifiers.org/biomodels.db/MODEL1109270002"
Arnold2011_Sharkey2007_RuBisCO-CalvinCycle model_entity_is "http://identifiers.org/biomodels.db/BIOMD0000000386"
Arnold2011_Sharkey2007_RuBisCO-CalvinCycle description "http://identifiers.org/pubmed/22001849"
Arnold2011_Sharkey2007_RuBisCO-CalvinCycle model_entity_is "http://identifiers.org/obo.go/GO:0019253"
Arnold2011_Sharkey2007_RuBisCO-CalvinCycle taxon "http://identifiers.org/taxonomy/33090"
