About this workspace
====================

This workspace documents the parameterisation of a bond graph model of intracellular pH regulation.
The bond graph model is created by Peter Hunter and his team at the Auckland Bioengineer Institute, and is described in the paper " ".
The bond graph model is implemented in CellML_ language and is parameterised to match the experimental data published in `Boron and de Weer (1976)`_.

.. _`Boron and de Weer (1976)`:  https://doi.org/10.1085/jgp.67.1.91.

.. _CellML: https://www.cellml.org/


Model overview
===================

The bond graph model diagram is shown below. The model consists of two compartments representing the cytoplasm, and the extracellular space. The model includes the following processes:

- Transmembrane transport of :math:`CO_2`
  
- Transmembrane transport of :math:`HCO_3^-`
  
- Transmembrane transport of :math:`H^+`
  
- Transmembrane transport of :math:`NH_3`
  
- Transmembrane transport of :math:`NH_4^+`
  
- The reaction of :math:`NH_3` + :math:`H^+` <-> :math:`NH_4^+` in the cytoplasm
  
- The reaction of :math:`NH_3` + :math:`H^+` <-> :math:`NH_4^+` in the extracellular space
  
- The reaction of :math:`CO_2` + :math:`H_2O` <-> :math:`HCO_3^-` + :math:`H^+` in the cytoplasm
  
- The reaction of :math:`CO_2` + :math:`H_2O` <-> :math:`HCO_3^-` + :math:`H^+` in the extracellular space

.. figure::  doc/diagram.jpg
   :width: 85%
   :align: center
   :alt: Parameters 

The 16 unknown parameters are listed in the table below.

.. csv-table:: unknown parameters
   :header: "Symbol", "Meaning", "Note"
   :widths: 3, 30, 20   
   
   ":math:`K_{CO2}^s`", " Thermodynamic constant for :math:`CO_2`", " Assuming the same value in the cytoplasm and the extracellular space"
   ":math:`K_{HCO3}^s`", " Thermodynamic constant for :math:`HCO_3^-`", " Assuming the same value in the cytoplasm and the extracellular space"
   ":math:`K_{H}^s`", " Thermodynamic constant for :math:`H^+`", " Assuming the same value in the cytoplasm and the extracellular space"
   ":math:`K_{NH3}^s`", " Thermodynamic constant for :math:`NH_3`", " Assuming the same value in the cytoplasm and the extracellular space"
   ":math:`K_{NH4}^s`", " Thermodynamic constant for :math:`NH_4^+`", " Assuming the same value in the cytoplasm and the extracellular space"
   ":math:`K_{CO2}^m`", " Thermodynamic constant for the enzyme to transport :math:`CO_2` ", " "
   ":math:`\kappa_{CO2}^3`", " Reaction rate for the enzyme to transport :math:`CO_2` ", " "
   ":math:`\kappa_{CO2}^4`", " Reaction rate for the enzyme to transport :math:`CO_2` ", " "
   ":math:`K_{NH3}^m`", " Thermodynamic constant for the enzyme to transport :math:`NH_3` ", " "
   ":math:`\kappa_{NH3}^3`", " Reaction rate for the enzyme to transport :math:`NH_3` ", " "
   ":math:`\kappa_{NH3}^4`", " Reaction rate for the enzyme to transport :math:`NH_3` ", " "
   ":math:`\kappa_{HCO3}^m`", " Reaction rate for the transmembrane transport :math:`HCO3` ", " "
   ":math:`\kappa_H^m`", " Reaction rate for the transmembrane transport :math:`H^+` ", " "
   ":math:`\kappa_{NH4}^m`", " Thermodynamic constant for the enzyme to transport :math:`NH_4^+` ", " "
   ":math:`\kappa_{CO2}`", " Reaction rate for the reaction :math:`CO_2` + :math:`H_2O` <-> :math:`HCO_3^-` + :math:`H^+` ", " "
   ":math:`\kappa_{NH4}`", " Reaction rate for the reaction :math:`NH_3` + :math:`H^+` <-> :math:`NH_4^+` ", " "

The model is located at https://models.physiomeproject.org/workspace/b61/file/b9acad600597f19e5f31907b7653906283c66ffc/models/FAIRDO%20BG%20example%205.3.cellml 

Model parameterisation
=======================
The parameter space is too large to be explored in full. Therefore, we need to fit the individual modules of the model to the experimental data. However, the experimental data taken from `Boron and de Weer (1976)`_ did not include the data of each individual process. Since `Occhipinti et al (2020)`_ reproduced the data of `Boron and de Weer (1976)`_, we will use the data from `Occhipinti et al (2020)`_ to fit the model. The `Occhipinti et al (2020)`_ models are also implemented in CellML_ language, and have been downloaded to the ``models`` folder of the current workspace.

The `Occhipinti et al (2020)`_ encoded the weak acid and base transport into two separate models, ``Boron-CO2.cellml`` and ``Boron-NH3.cellml``, respectively.

.. _`Occhipinti et al (2020)`: https://doi.org/10.36903/physiome.12871022

Fit the transmembrane transport of :math:`HCO_3^-`
---------------------------------------------------
We first implement



