Package: hydrosolver
hydrosolverOptimization driven hydroponic nutrient calculator and a domain-specific language.Author:Dmytro StrelnikovLicense:GNU GPLv3Enjoy 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)CompositionAmountinkgAmounting---------------------------------------------------------Calciumnitratetetrahydrate0.100507100.507Magnesiumsulfateheptahydrate0.10047100.47Monopotassiumphosphate0.018538818.5388ROwater99.780599780.5Total:100100000Composition:ResultingcompositionNutrientRatioAmountmg/kg-----------------------------------N(NO3-)0.000119201119.201P4.21942e-0542.1942K5.32619e-0553.2619Mg9.90635e-0599.0635Ca0.00017056170.56S0.000130712130.712What 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:CompositionandSolution.Compositionis 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 (seecomposition.nutrients_stencil). Therefore they generate a vector space, i.e. compositions may be added and scaled.Solutionis a mix of a fewCompositions 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,addandmerge) which take their results in subspaces of higher dimensions.DocumentationsThe online documentation is available onRead the Docs.Several hints for a quick-start are provided in theexamples/directory.