Class: Solution

chemistry/Solution~Solution(dataIn)

new Solution(dataIn)

Parameters:
Name Type Description
dataIn Object
Properties
Name Type Description
name String

Name of the solution

description String

Description of the solution

temperature Number

Temperature of the solution

volume Number

Volume of the solution (liquid, in liters)

insulated Boolean

True if the solution is insulated

kb KnowledgeBase

KnowledgeBase to use for this solution

species Array.<Object>

Array of species information for the solution; can specify speciesInSolution instead

speciesInSolution Array.<SpeciesNode>

Array of speciesNodes for the solution

equilibriumSettings Object

Settings for equilibrium calculations

Source:

Methods

add(s)

This method adds the argument SpeciesNode, first checking to see if it is already present, and if it is not, checking it with other species.json to see if it incorporates a new reaction. If so that reaction is created.

Parameters:
Name Type Description
s SpeciesNode
Source:

addReaction(r)

Checks to see if a reaction is already present in the solution (which should never occur; if it's already present, then all reacting species.json would already be present, but it never hurts to check), exiting if the reaction is found.

It then checks to see if each individual component to the Reaction is already present. If so, it is included in the ReactionNode. If not, a new SpeciesNode is produced for it.

Parameters:
Name Type Description
r
Source:

calculateLiquidVolume()

Return the liquid volume of the solution

Source:

changeTemperature(solutionTemperature)

Sets the temperature, which will result in a re-equilibration. Similar to setTemperature, this method will modify the thermal devices if necessary.

Parameters:
Name Type Description
solutionTemperature
Source:

clone() → {Solution}

Create a copy of the current solution, not a reference

Source:
Returns:

other

Type
Solution

filtrate()

Removes all the solids for this solution

Source:

findEquilibrium(convergenceCriterion, maxIter, constantTemperature)

Calls the full findEquilibrium with default convergenceCriterion, and maximumIterations, but allows the user to specify whether or not the equilibrium is found with constant temperature or not.

Parameters:
Name Type Description
convergenceCriterion Number
maxIter Number
constantTemperature Boolean
Source:

findEquilibriumTemp(constantTemp)

Calls the full findEquilibrium with default convergenceCriterion, and maximumIterations, but allows the user to specify whether or not the equilibrium is found with constant temperature or not.

Parameters:
Name Type Description
constantTemp Boolean
Source:

getColor()

Returns the color of the liquid solution.

Source:

getDensity()

Returns the density of this solution

Source:
Returns:

Density in g/mL.

getFiltrate() → {Solution}

Returns a filtrated clone of the solution

Source:
Returns:

noSolidsSolution the filtrated solution

Type
Solution

getPH() → {*}

Gets the pH of the solution.

Source:
Returns:
Type
*

getSolidAt()

Get the i'th solid in this solution, null if bad index.

Source:

getSolidColor()

Gets the color for the solids in the solution

Source:

getSolidCount()

Returns a Vector containing all SpeciesNodes in this solution that are solids.

Source:

getSolidVolume()

Returns the volume of the solids in the solution in Liters

Source:

getSolutionWeight() → {Number}

Returns the weight (in grams) of the solution exact and without the flask

Source:
Returns:
Type
Number

getSolventWeight()

Needs testing! What about solids? Looks like solids are included in the "solution", so this should work.

Source:

getSpeciesAt()

Returns the SpeciesNode at the specified index.

Source:

getSpeciesCount()

Returns the number of Species in this solution.

Source:

getSpeciesData() → {Array}

Returns an array containing useful information about the present species.json.

Source:
Returns:
Type
Array

getSpeciesNode(species) → {SpeciesNode}

Returns the corresponding SpeciesNode in the solution for the input Species, if it is in the solution

Parameters:
Name Type Description
species

a Species object

Source:
Returns:
Type
SpeciesNode

getSpecificHeat() → {Number}

Return the specific heat of the solution in cal/g/K

Source:
Returns:

Specific heat in cal/g/K

Type
Number

getTemperature()

Returns the temperature in Kelvin.

Source:

getVolume()

Returns the total volume in Liters (including solid volume).

Source:
Returns:

Volume in L

initialize()

Since Solutions are created in mass, we delay the initialization from instantiation. This method does the time-consuming initialization steps.

Source:

isAtRoomTemperature() → {boolean}

Returns true if this solution is at room temperature.

Source:
Returns:
Type
boolean

isPresent(species) → {boolean}

Whether a species.json is present in the solution

Parameters:
Name Type Description
species

a Species object

Source:
Returns:
Type
boolean

mix(s, volumeRequested) → {Number}

Mixes a solution into the current solution. If volumeRequested > volume of the solution, only the available volume is poured. The actual volume poured is returned. Notify if this action should be replicate for collaborative mode.

Parameters:
Name Type Description
s Solution

the solution to be mixed

volumeRequested Number

how much to mix

Source:
Returns:

actual volume poured

Type
Number

pourAwayLiquid(volumePoured)

Dumps out the specified amount of the liquid in the solution.

Parameters:
Name Type Description
volumePoured

the amount of the solution to be poured

Source:

setInsulated(b)

Sets the insulated state of the solution

Parameters:
Name Type Description
b
Source:

setTemperature()

Sets the temperature, which may result in a change in the thermal device. This differs from changeTemperature in that it should only be called by the Solution. Hence it will not inform listeners of the change, or check for initialization.

Source:

setThermal(device)

Sets the thermal device. Only one thermal device can be active at any one time. This will automatically start the device.

Parameters:
Name Type Description
device
Source:

toggleClone()

TODO: Remove this method, used purely for testing

Source: