from ChemPlugin import * print("I made a titration model!\n") # Create ChemPlugin instance cp = ChemPlugin("stdout") # Configure the instance cmds = ("Ca++ = 1 mmol/kg", "Na+ = 1 mmol/kg", "Cl- = 3 mmol/kg", "HCO3- = 2 mmol/kg", "pH = 4") cmds += ("react 3 mmol/kg NaOH", "delxi = 0.01") # >>> use "cmds" to configure "cp" <<< # Initialize the instance # >>> initialize "cp" <<< print(" Titrated %4.2f mmol, pH = %4.2f" % (cp.Report1("mass_reacted", "mmol"), cp.Report1("pH"))) # Time Marching loop while True: # >>> Report time step <<< # >>> Advance time step <<< # >>> Advance chemical equations <<< print(" Titrated %4.2f mmol, pH = %4.2f" % (cp.Report1("mass_reacted", "mmol"), cp.Report1("pH"))) input("Done!")