<?xml version="1.0" encoding="UTF-8"?>
<model xmlns="http://www.cellml.org/cellml/2.0#" name="PotassiumChannelModel">
  <import xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="GateModel.cellml">
    <component component_ref="gateEquations" name="importedGate"/>
  </import>
  <import xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="PotassiumChannelController.cellml">
    <component component_ref="controller" name="controller"/>
  </import>
  <units name="ms">
    <unit prefix="milli" units="second"/>
  </units>
  <units name="mV">
    <unit prefix="milli" units="volt"/>
  </units>
  <units name="mM">
    <unit prefix="milli" units="mole"/>
  </units>
  <units name="microA_per_cm2">
    <unit prefix="micro" units="ampere"/>
    <unit exponent="-2" prefix="centi" units="metre"/>
  </units>
  <units name="milliS_per_cm2">
    <unit prefix="milli" units="siemens"/>
    <unit exponent="-2" prefix="centi" units="metre"/>
  </units>
  <units name="per_ms">
    <unit exponent="-1" prefix="milli" units="second"/>
  </units>
  <units name="per_mV_ms">
    <unit exponent="-1" prefix="milli" units="second"/>
    <unit exponent="-1" prefix="milli" units="volt"/>
  </units>
  <component name="potassiumChannel">
    <variable name="t" units="ms" interface="public_and_private"/>
    <variable name="V" units="mV" interface="public_and_private"/>
    <variable name="i_K" units="microA_per_cm2" interface="public_and_private"/>
  </component>
  <component name="potassiumChannelEquations">
    <variable name="E_K" units="mV" interface="public"/>
    <variable name="i_K" units="microA_per_cm2" interface="public"/>
    <variable name="g_K" units="milliS_per_cm2" interface="public"/>
    <variable name="V" units="mV" interface="public_and_private"/>
    <variable name="t" units="ms" interface="public_and_private"/>
    <variable name="n" units="dimensionless" interface="private"/>
    <math xmlns="http://www.w3.org/1998/Math/MathML" xmlns:cellml="http://www.cellml.org/cellml/2.0#">
      <apply>
        <eq/>
        <ci>i_K</ci>
        <apply>
          <times/>
          <apply>
            <power/>
            <ci>n</ci>
            <cn cellml:units="dimensionless">4</cn>
          </apply>
          <ci>g_K</ci>
          <apply>
            <minus/>
            <ci>V</ci>
            <ci>E_K</ci>
          </apply>
        </apply>
      </apply>
    </math>
  </component>
  <component name="nGate">
    <variable name="n" units="dimensionless" interface="public_and_private"/>
    <variable name="t" units="ms" interface="public_and_private"/>
    <variable name="V" units="mV" interface="public_and_private"/>
  </component>
  <component name="nGateEquations">
    <variable name="t" units="ms" interface="public_and_private"/>
    <variable name="V" units="mV" interface="public"/>
    <variable name="alpha_n" units="per_ms" interface="private"/>
    <variable name="beta_n" units="per_ms" interface="private"/>
    <variable name="n" units="dimensionless" interface="public_and_private"/>
    <math xmlns="http://www.w3.org/1998/Math/MathML" xmlns:cellml="http://www.cellml.org/cellml/2.0#">
      <apply>
        <eq/>
        <ci>alpha_n</ci>
        <apply>
          <divide/>
          <apply>
            <times/>
            <cn cellml:units="per_mV_ms">-0.01</cn>
            <apply>
              <plus/>
              <ci>V</ci>
              <cn cellml:units="mV">65</cn>
            </apply>
          </apply>
          <apply>
            <minus/>
            <apply>
              <exp/>
              <apply>
                <divide/>
                <apply>
                  <plus/>
                  <ci>V</ci>
                  <cn cellml:units="mV">65</cn>
                </apply>
                <cn cellml:units="mV">-10</cn>
              </apply>
            </apply>
            <cn cellml:units="dimensionless">1</cn>
          </apply>
        </apply>
      </apply>
      <apply>
        <eq/>
        <ci>beta_n</ci>
        <apply>
          <times/>
          <cn cellml:units="per_ms">0.125</cn>
          <apply>
            <exp/>
            <apply>
              <divide/>
              <apply>
                <plus/>
                <ci>V</ci>
                <cn cellml:units="mV">75</cn>
              </apply>
              <cn cellml:units="mV">-80</cn>
            </apply>
          </apply>
        </apply>
      </apply>
    </math>
  </component>
  <component name="nGateParameters">
    <variable name="n" units="dimensionless" initial_value="0.325" interface="public"/>
  </component>
  <component name="potassiumChannelParameters">
    <variable name="E_K" units="mV" initial_value="-87" interface="public"/>
    <variable name="g_K" units="milliS_per_cm2" initial_value="36" interface="public"/>
    <variable name="V" units="mV" interface="public"/>
  </component>
  <connection component_1="potassiumChannel" component_2="potassiumChannelEquations">
    <map_variables variable_1="t" variable_2="t"/>
    <map_variables variable_1="V" variable_2="V"/>
    <map_variables variable_1="i_K" variable_2="i_K"/>
  </connection>
  <connection component_1="potassiumChannel" component_2="controller">
    <map_variables variable_1="t" variable_2="t"/>
    <map_variables variable_1="V" variable_2="V"/>
  </connection>
  <connection component_1="potassiumChannelEquations" component_2="potassiumChannelParameters">
    <map_variables variable_1="E_K" variable_2="E_K"/>
    <map_variables variable_1="g_K" variable_2="g_K"/>
    <map_variables variable_1="V" variable_2="V"/>
  </connection>
  <connection component_1="potassiumChannelEquations" component_2="nGate">
    <map_variables variable_1="V" variable_2="V"/>
    <map_variables variable_1="t" variable_2="t"/>
    <map_variables variable_1="n" variable_2="n"/>
  </connection>
  <connection component_1="nGate" component_2="nGateEquations">
    <map_variables variable_1="n" variable_2="n"/>
    <map_variables variable_1="t" variable_2="t"/>
    <map_variables variable_1="V" variable_2="V"/>
  </connection>
  <connection component_1="nGateEquations" component_2="importedGate">
    <map_variables variable_1="t" variable_2="t"/>
    <map_variables variable_1="alpha_n" variable_2="alpha_X"/>
    <map_variables variable_1="beta_n" variable_2="beta_X"/>
    <map_variables variable_1="n" variable_2="X"/>
  </connection>
  <connection component_1="nGateEquations" component_2="nGateParameters">
    <map_variables variable_1="n" variable_2="n"/>
  </connection>
  <encapsulation>
    <component_ref component="potassiumChannel">
      <component_ref component="potassiumChannelEquations">
        <component_ref component="nGate">
          <component_ref component="nGateEquations">
            <component_ref component="importedGate"/>
          </component_ref>
          <component_ref component="nGateParameters"/>
        </component_ref>
      </component_ref>
      <component_ref component="potassiumChannelParameters"/>
    </component_ref>
  </encapsulation>
</model>
