Created
January 16, 2021 07:55
-
-
Save 0187773933/34855dbdd4954b05e8576a175aeb2aa5 to your computer and use it in GitHub Desktop.
ABCEquation.js Example 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="abc-equation" name="Current Example Calculation 2" id="CurrentExample2" > | |
<div class="title"> | |
<h3>Calculate Current from Membrane Potential, Ion's Conductance, and Ion's Equalibrium Potential</h3> | |
<hr style="background-color: black;"></hr> | |
</div> | |
<div class="equation-display"> | |
<p>$$Current\ of\ Ion \ (I) = \text{Ion's}\ Conductance\ (G) * \left(\ Membrane\ Potential\ (V_m) - \text{Ion's}\ Equalibirum\ Potentail\ (E)\ \right)$$</p> | |
<p>$$Current\ of\ Ion\ (I) = \text{Ion's}\ Conductance\ (G) * \left(\ \text{Ion's}\ Driving\ Force\ \right)$$</p> | |
</div> | |
<div class="operator" name="membrane-potential" > | |
<div class="input" unit_name="Volts" default_value="-30.0" default_base10="-3" slider_min="-100.0" slider_max="100.0" slider_step="10"></div> | |
<div class="output" default_base10="-3" ></div> | |
</div> | |
<div class="operator" name="conductance" > | |
<div class="input" unit_name="Siemens" default_value="0.5" default_base10="-6" slider_min="-100.0" slider_max="100.0" slider_step="3.0"></div> | |
<div class="output" default_base10="-6" ></div> | |
</div> | |
<div class="operator" name="equalibrium-potential" > | |
<div class="input" unit_name="Volts" default_value="55.0" default_base10="-3" slider_min="-100.0" slider_max="100.0" slider_step="3.0"></div> | |
<div class="output" default_base10="-3" ></div> | |
</div> | |
<script> | |
function CurrentExample2CalculationFunction() { | |
console.log( "CurrentExample2CalculationFunction()" ); | |
let driving_force = ( this["membrane-potential"].output.adjusted_value - this["equalibrium-potential"].output.adjusted_value ); | |
this.result = ( this["conductance"].output.adjusted_value * driving_force ); | |
// 4.) Update Equation Latex | |
// ${value}${adjustment_latex_string}\ ${output.units.label}\ ${input.unit_name} | |
this.equation_live_string_latex = String.raw`$$Current\ (I) = \left(\ ${this["conductance"].output.final_latex_string}\ \right)`; | |
this.equation_live_string_latex += String.raw` * \left(\ \left(\ ${this["membrane-potential"].output.final_latex_string} \ \right) - \left(\ ${this["equalibrium-potential"].output.final_latex_string} \ \right) \ \right)`; | |
this.equation_live_string_latex += String.raw` = ${this.result}\ ${this["conductance"].output.units.label}\ Siemens\ ⋅\ ${this["membrane-potential"].output.units.label}\ Volts$$`; | |
// 5.) Update Equation Pilot/Simple Strings | |
this.equation_live_string = `Current (I) = ( ( ${this["conductance"].output.final_string} ) * ( ( ${this["membrane-potential"].output.final_string} ) - ( ${this["equalibrium-potential"].output.final_string} ) ) )`; | |
this.equation_live_string += ` = ${this.result} ${this["conductance"].output.units.label} Siemens ⋅ ${this["membrane-potential"].output.units.label} Volts` | |
} | |
</script> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment