Skip to main content

hydrosolver

Documentation Status

Optimization driven hydroponic nutrient calculator and a domain-specific language.

Author: Dmytro Strelnikov
License: GNU GPLv3


Enjoy the power of mathematical optimization:

>>> MKP = Composition.from_dict(
... {'Monopotassium phosphate': {'P': 0.2276, 'K': 0.2873}}
... )
>>> MS = Composition.from_dict(
... {'Magnesium sulfate heptahydrate': {'Mg': 0.0986, 'S': 0.1301}}
... )
>>> CaN = Composition.from_dict(
... {'Calcium nitrate tetrahydrate': {'N (NO3-)': 0.1186, 'Ca': 0.1697}}
... )
>>> composition_target = Composition.from_dict(
... {'Target composition': {
...     'N (NO3-)': 0.000120, 'P': 0.000040, 'K': 0.000055,
...     'Mg': 0.000100, 'Ca': 0.000170, 'S': 0.000130,
...     }
... }
... )
>>> solution_init = Solution.dissolve(
...     100,
...     Composition(name='RO water'),
...     [CaN, MS, MKP],
... )
>>> solution_optimal = optimize(solution_init, composition_target)
Composition                       Amount in kg    Amount in g
------------------------------  --------------  -------------
Calcium nitrate tetrahydrate         0.100507        100.507
Magnesium sulfate heptahydrate       0.10047         100.47
Monopotassium phosphate              0.0185388        18.5388
RO water                            99.7805        99780.5
Total:                             100            100000

Composition: Resulting composition

Nutrient          Ratio    Amount mg/kg
----------  -----------  --------------
N (NO3-)    0.000119201        119.201
P           4.21942e-05         42.1942
K           5.32619e-05         53.2619
Mg          9.90635e-05         99.0635
Ca          0.00017056         170.56
S           0.000130712        130.712

What is it?

Hydrosolver is a Python module implementing a domain-specific language for operations with hydroponic nutrient solutions. It also features mathematical optimization tools helping to mix the most suitable solution using only available ingredients.

Why?

I've recently got a new hobby - hydroponic plant growing. I checked many of the available hydroponics calculators and found out that each of them has a fatal flaw - it wasn't written by me.

Also, I got terribly sick on the weekend and promised myself to not work until a full recovery. On the second day I got bored and took my laptop to bed. My cat and I had an exciting programming session and the first version of hydrosolver appeared.

Who can use it?

If you feel more comfortable in Python REPL and a text editor than in a sophisticated GUI application, just like me, then give hydrosolver a try.

How to use it?

Hydrosolver introduces two main entities: Composition and Solution.

Composition is an arbitrary substance which can contain some of the nutrients which are usually considered in hydroponic plant growing. It will mostly represent the water you use, a salt or a complex fertilizer. You can define a composition on the go or load one from a file.

Compositions are internally represented as vectors (see composition.nutrients_stencil). Therefore they generate a vector space, i.e. compositions may be added and scaled.

Solution is a mix of a few Compositions in given amounts. Normally, one or more compositions constituting the solution must be water. However, in hydrosolver there is no artificial limitation preventing you from creating dry "solutions".

Similarly to the vector space of compositions, there is an infinite-dimensional vector space of solutions. Solutions defined in the same basis (i.e. consisting of the same compositions listed in the same order) generate a finite-dimensional subspace. Such solutions may be added and scaled in the usual way.

There are also operations (for instance, add and merge) which take their results in subspaces of higher dimensions.

Documentations

The online documentation is available on Read the Docs.

Several hints for a quick-start are provided in the examples/ directory.

Metadata

Release files for hydrosolver 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hydrosolver 0.1
File Size Uploaded
hydrosolver-0.1.tar.gz 29.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hydrosolver 0.1
File Interpreter ABI Platform
hydrosolver-0.1-py3-none-any.whl Python 3 none any Details

Total release size: 55.5 kB

Release files / hydrosolver-0.1.tar.gz

Download URL hydrosolver-0.1.tar.gz
Size 29.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d23667307978b23beae2c590a7abfd4e297294209380e001c5fb3415af0422cd
BLAKE2b-256 checksum
How to use checksums
92a9d1fd8d424771e396e0a723f3d85c3c1d40e36f96a6728f338922f9432d8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

Release files / hydrosolver-0.1-py3-none-any.whl

Download URL hydrosolver-0.1-py3-none-any.whl
Size 25.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b2cead59ffd300b0214e4e40899d3cdf323ffa41ad269e707be4811c3cd40086
BLAKE2b-256 checksum
How to use checksums
c0d868982b884cbe73f4fe8bfcf5e0f487888b9948159e83a16fb8b618acf367
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

Release history Release notifications | RSS feed

This release

0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page