Featured Post

Site Navigation is in the Left Column

Friday, October 22, 2021

Library to Calculate the State of Water

At first, this seemed pretty simple.  After a few days working on it, it has become more complex. The scope of the library has creeped a bit.  Since I was finding myself writing a lot of code to do this, I decided to expand the scope to include scientific measurements.

The library has 2 modes:  a simple mode and a complex mode.  While in simple mode, it will return a simple answer in terms of SOLID, LIQUID, or GAS.

While in complex mode, it will return all known states of water including Ice I, Ice II, Ice III, Ice IV, Ice V, Ice VI, Ice VII, Ice VIII, Ice IX, Ice X, Ice XI, Ice XII, Ice XIII, Ice XIV, Ice XV, GAS, LIQUID, SUPER CRITICAL, SUBCRITICAL GAS, SUBCRITICAL LIQUID.

Additionally, the library will return hits on all triple points and phase lines appropriately.

You simply give it a temperature and pressure and the library will tell you what phase the water is in.

I currently have about 1/3 of the state-transition diagram programmed.  I will need to research some of the more exotic Ice phases to get it complete.

Saturday, October 16, 2021

Progress Bars Corrected

The software uses several progress bars to indicate positions in the process.  These were initially added to the GUI as place holders.  I have managed to get all of them functioning.  Some of them may need to be altered in the future, but they are offering feedback at this time.

Test Mode Complete

The testing mode was fully implemented.

It is currently implemented using conditional compilation directives.  I may change it to be dynamic in the future.

This will allow testing without the need to compile a test version of the software.

Thursday, October 14, 2021

Test Mode Progress


The test mode work is progressing.  Spinners have been added to the GUI to allow me to intercept the pressure and temperature sensors.  This  will allow me to manually enter readings into the program and test state transitions as temperatures and pressure changes.

Effectively, I will be able to simulate cooling and evacuation cycles etc. without having to actually wait for the unit to cool off. This will significantly reduce the time it takes to test the state transitions.


At the moment, I have the spinners showing when the code is compiled into a test version.  I use C++ conditional compilation to add the spinners and associated test code.  The spinners already have ranges and stepping programmed properly. Additionally, when the temperature or pressure units are changed, the spinners will automatically convert to the new units.


The next step is to insert the intercept code into the sensor code module. At that point, the software will read the spinners instead of the sensors when in test mode.