// 3 kwietnia 2015.cpp
//
#include "stdafx.h"
#include <conio.h>
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
//deklaracje nowego typu, paru funkcji oraz struktury
#pragma region deklaracje
typedef long double ld;
struct MEDIUM
{
//caly czas w mg/l
ld nitrogen;
ld phosphorus;
ld potassium;
ld calcium;
ld magnesium;
ld chlorine;
ld sulfur;
ld carbonates; //im wyzsze pH, tym wiecej woda zawiera weglanow (nie pomyl, najpierw ph potem weglany)
ld sodium;
ld iron;
ld boron;
ld zinc;
ld manganese;
ld copper;
ld molybdenum;
double pH;
double EC;
};
bool maxForElements(MEDIUM Initial_medium);
MEDIUM loadInitialtMedium();
ld acid_ratio(double weglany, ld &quantityOfNitrogenIn1dm4);
ld acid_dose(ld W, double weglany, ld &dawka_kwasu);
ld nitrogen_introduced_f(ld dk, ld quantityOfNitrogenIn1dm4);
MEDIUM loadDesiredMedium();
void mediumReplenishment(ld nitrogen_introduced, MEDIUM Initial_medium2, MEDIUM desired_medium2, MEDIUM fixed_medium, ld dawka_kwasu);
MEDIUM loadInitialMedium();
void showHowManyFertilizersAreNeeded(
ld calcium_nitrate,
ld potassium_phosphate,
ld magnessium_nitrate,
ld potassium_nitrate,
ld amonium_nitrate);
#pragma endregion
int _tmain(int argc, _TCHAR* argv[])
{
cout << "******************************************\n\n\trk 10 lipca 2015:\n\tMedium Composition Program\n\n******************************************\n\n\n";
//wprowadzanie danych
cout << "\n\n------------\n\tProsze podawac wartosci w jednostkach miligramow na litr [mg/l]" << endl;
MEDIUM Initial_medium2 = loadInitialMedium();
//sprawdzenie czy zaden ze skladnikow nie przekracza dozwolonego pulapu
if (!(maxForElements(Initial_medium2)))
{
cout << "\n\n------------\n\tJeden z elementow przekracza dozwolona wartosc." << endl;
cout << "\tKontynuowac? Wpisz 'y' lub 'n' i zatwierdz enterem\t";
char znak;
cin >> znak;
if (znak == 'n')
{
cout << "\n\n\t>>program sequence aborted<<";
_getch();
return 0;
}
}
ld dawka_kwasu; //brzydkie rozwiązanie, ale potrzebowalem tej wartosci w poznym etapie pisania kodu (8 lipca 2015)
ld quantityOfNitrogenIn1dm4 = 0; //jw lol
//uwaga, 3 funkcje zagniezdzone acid_ratio -> acid_dose -> nitrogen_introduced
//dobra, skoncze na 3 zagniezdzeniu funkcji bo to źle wygląda
ld dawka_kwasu222 = acid_dose(acid_ratio(Initial_medium2.carbonates, quantityOfNitrogenIn1dm4), Initial_medium2.carbonates, dawka_kwasu);
ld nitrogen_introduced = nitrogen_introduced_f(dawka_kwasu222, quantityOfNitrogenIn1dm4);
//zapytanie usera, ile chce miec skladnikow w pozywce
MEDIUM desired_medium2 = loadDesiredMedium();
//fixed medium jest strukturą danych, na której będą dokonywane faktyczne zmiany
MEDIUM fixed_medium = Initial_medium2;
//wyslanie do funkcji tego ile juz azotu zostalo wprwoadzonego + aktualne parametry pozywki
mediumReplenishment(nitrogen_introduced, Initial_medium2, desired_medium2, fixed_medium, dawka_kwasu);
return 0;
}
void mediumReplenishment(ld nitrogen_introduced, MEDIUM Initial_medium2, MEDIUM desired_medium2, MEDIUM fixed_medium, ld dawka_kwasu)
{
//dodanie do wartosci pola struktury .nitrogen ilosci wprowadzonego juz azotu z kwasem azotowym
fixed_medium.nitrogen += nitrogen_introduced;
struct percentage_of_nutrient_in_fertilizer //ponf
{
//calcium nitrate - saletra wapniowa
//EC 1.24
double calcium_nitrate_Ca = 0.19; //19%
double calcium_nitrate_N = 0.155; //15.5%
double calcium_nitrate_EC = 1.24;
//potassium phosphate - fosforan potasu
//EC 0.68 //albo 0.56, ale raczej 0.68, nie idzie tego odczytac
double potassium_phosphate_P = 0.23; //23%
double potassium_phosphate_K = 0.28; //28%
double potassium_phosphate_EC = 0.68;
////ferticare
////EC 1.0
//double ferticare_N = 0.07; //7%
//double ferticare_P = 0.048;
//double ferticare_K = 0.21; //21%
//double ferticare_Mg = 0.028;
//double ferticare_S = 0.05; //5%
//potassium nitrate - saletra potasowa Multi Top
//ruru, siarczan potasu, nie mam saletry potasowej
//EC 1.54
double potassium_nitrate_N = 0.135; //13.5%
double potassium_nitrate_K = 0.386; //38.6%
double potassium_nitrate_EC = 1.54;
//magnesium nitrate - saletra magnezowa
//ruru, zastepczo podaje EC dla innej saletry magnezowej (inne %)
//EC 0.54
double magnesium_nitrate_N = 0.11; //11%
double magnesium_nitrate_Mg = 0.081; //8.1%
double magnesium_nitrate_EC = 0.54;
//magnesium sulfate - siarczan magnezu
//EC 0.94
double magnesium_sulfate_Mg = 0.1; //10%
double magnesium_sulfate_S = 0.27; //27%
double magnessium_sulfate_EC = 0.94;
//amonium nitrate - saletra amonowa
//EC 0.86
//double amonium_nitrate_N = 0.34; //34%
//double amonium_nitrate_EC = 0.86;
//potassium sulfate - siarczan potasu
//EC zapozyczone od siarczanu magnezu
double potassium_sulfate_K = 0.415; //41.5%
double potassium_sulfate_S = 0.18;
double potassium_sulfate_EC = 0.94;
//superba czerwona
double superba_N = 0.073; //7.3%
double superba_P = 0.04; //4%
double superba_K = 0.214; //21.4%
double superba_Mg = 0.035; //3.5%
double superba_EC = 1.0;
}percent; //uzycie: percent.potassium_sulfate_K
enum
{
ZBIORNIK_A = 1,
ZBIORNIK_B = 2,
ZBIORNIK_C = 3
};
//2 tablice typu
//string przechowywujaca nazwe nawozu
//ld przechowywujaca ilosc nawozu
const int maksiumum_fertilizers_that_can_be_used = 7;
string fertilizer_name[maksiumum_fertilizers_that_can_be_used];
ld fertilizer_quantity[maksiumum_fertilizers_that_can_be_used] = { 0 }; //inicjalizacja wstepna
double fertilizer_EC[maksiumum_fertilizers_that_can_be_used];
int ktory_zbiornik[maksiumum_fertilizers_that_can_be_used];
//test
//cout << "\ntest\t\tKwas azotowy" << endl;
//cout << "fixed_medium.nitrogen\t\t" << fixed_medium.nitrogen << endl;
//cout << "fixed_medium.phosphorus\t\t" << fixed_medium.phosphorus << endl;
//cout << "fixed_medium.potassium\t\t" << fixed_medium.potassium << endl;
//cout << "fixed_medium.calcium\t\t" << fixed_medium.calcium << endl;
//cout << "fixed_medium.magnesium\t\t" << fixed_medium.magnesium << endl;
//_getch();
#pragma region Saletra_wapniowa
int counter = 0;
//saletra wapniowa - wapń (100%) i azot
ld quantity_of_calcium_nitrate_fertilizer = (desired_medium2.calcium - fixed_medium.calcium) / percent.calcium_nitrate_Ca;
fertilizer_name[counter] = "Saletra wapniowa\t\t";
fertilizer_quantity[counter] = quantity_of_calcium_nitrate_fertilizer;
fertilizer_EC[counter] = percent.calcium_nitrate_EC;
ktory_zbiornik[counter] = ZBIORNIK_A;
//wapń
fixed_medium.calcium += quantity_of_calcium_nitrate_fertilizer * percent.calcium_nitrate_Ca;
//azot
fixed_medium.nitrogen += quantity_of_calcium_nitrate_fertilizer * percent.calcium_nitrate_N;
//ok
//test
//cout << "\ntest\t\tSaletra wapniowa" << endl;
//cout << "fixed_medium.nitrogen\t\t" << fixed_medium.nitrogen << endl;
//cout << "fixed_medium.phosphorus\t\t" << fixed_medium.phosphorus << endl;
//cout << "fixed_medium.potassium\t\t" << fixed_medium.potassium << endl;
//cout << "fixed_medium.calcium\t\t" << fixed_medium.calcium << endl;
//cout << "fixed_medium.magnesium\t\t" << fixed_medium.magnesium << endl;
//_getch();
#pragma endregion
#pragma region Superba_czerwona
++counter;
//superba czerwona
//uzupelnic potas pierwszy -> brak mozliwosci uzupelnienia fosforu
//uzupelnic fosfor pierwszy -> mozliwosc uzupelnienia potasu innym nawozem (jezeli wartosc K nie przekroczona)
ld quantity_of_superba_czerwona_fertilizer = (desired_medium2.phosphorus - fixed_medium.phosphorus) / percent.superba_P;
fertilizer_name[counter] = "Superba czerwona\t\t";
fertilizer_quantity[counter] = quantity_of_superba_czerwona_fertilizer;
fertilizer_EC[counter] = percent.superba_EC;
ktory_zbiornik[counter] = ZBIORNIK_B;
//fosfor
fixed_medium.phosphorus += quantity_of_superba_czerwona_fertilizer * percent.superba_P;
//azot
fixed_medium.nitrogen += quantity_of_superba_czerwona_fertilizer * percent.superba_N;
//potas
fixed_medium.potassium += quantity_of_superba_czerwona_fertilizer * percent.superba_K;
//magnez
fixed_medium.magnesium += quantity_of_superba_czerwona_fertilizer * percent.superba_Mg;
if (fixed_medium.potassium > desired_medium2.potassium ||
fixed_medium.nitrogen > desired_medium2.nitrogen ||
fixed_medium.magnesium > desired_medium2.magnesium)
{
cout << "\n\n------------\n\tUzycie superby czerwonej niemozliwe, poniewaz jej uzycie " << endl;
cout << "\tspowoduje przekroczenie dopuszczalnej ilosci";
if (fixed_medium.potassium > desired_medium2.potassium)
{
cout << "\n\tpotasu o " << fixed_medium.potassium - desired_medium2.potassium << endl;
cout << "\t-> Aktualna ilosc potasu\t" << fixed_medium.potassium << endl;
cout << "\t-> Pozadana ilosc potasu\t" << desired_medium2.potassium << endl;
}
if (fixed_medium.nitrogen > desired_medium2.nitrogen)
{
cout << "\n\tazotu o " << fixed_medium.nitrogen - desired_medium2.nitrogen << endl;
cout << "\t-> Aktualna ilosc azotu\t\t" << fixed_medium.nitrogen << endl;
cout << "\t-> Pozadana ilosc azotu\t\t" << desired_medium2.nitrogen << endl;
}
if (fixed_medium.magnesium > desired_medium2.magnesium)
{
cout << "\n\tmagnezu o " << fixed_medium.magnesium - desired_medium2.magnesium << endl;
cout << "\t-> Aktualna ilosc magnezu\t" << fixed_medium.magnesium << endl;
cout << "\t-> Pozadana ilosc magnezu\t" << desired_medium2.magnesium << endl;
}
//odwracanie skutkow poprzedniej operacji
//fosfor
fixed_medium.phosphorus -= quantity_of_superba_czerwona_fertilizer * percent.superba_P;
//azot
fixed_medium.nitrogen -= quantity_of_superba_czerwona_fertilizer * percent.superba_N;
//potas
fixed_medium.potassium -= quantity_of_superba_czerwona_fertilizer * percent.superba_K;
//magnez
fixed_medium.magnesium -= quantity_of_superba_czerwona_fertilizer * percent.superba_Mg;
//wyzerowanie ilosci superby - teraz, bo inaczej powyzsze przeliczniki nie mialyby sensu
quantity_of_superba_czerwona_fertilizer = 0;
fertilizer_quantity[counter] = quantity_of_superba_czerwona_fertilizer;
}
//test
//cout << "\ntest\t\tSuperba czerwona" << endl;
//cout << "fixed_medium.nitrogen\t\t" << fixed_medium.nitrogen << endl;
//cout << "fixed_medium.phosphorus\t\t" << fixed_medium.phosphorus << endl;
//cout << "fixed_medium.potassium\t\t" << fixed_medium.potassium << endl;
//cout << "fixed_medium.calcium\t\t" << fixed_medium.calcium << endl;
//cout << "fixed_medium.magnesium\t\t" << fixed_medium.magnesium << endl;
//_getch();
#pragma endregion
#pragma region Fosforan_potasu
++counter;
//fosforan potasu - fosfor (100%) i potas
ld quantity_of_potassium_phosphate_fertilizer = (desired_medium2.phosphorus - fixed_medium.phosphorus) / percent.potassium_phosphate_P;
fertilizer_name[counter] = "Fosforan potasu\t\t\t";
fertilizer_quantity[counter] = quantity_of_potassium_phosphate_fertilizer;
fertilizer_EC[counter] = percent.potassium_phosphate_EC;
ktory_zbiornik[counter] = ZBIORNIK_B;
//fosfor
fixed_medium.phosphorus += quantity_of_potassium_phosphate_fertilizer * percent.potassium_phosphate_P;
//potas
fixed_medium.potassium += quantity_of_potassium_phosphate_fertilizer * percent.potassium_phosphate_K;
//ok
//test
//cout << "\ntest\t\tFosforan potasu" << endl;
//cout << "fixed_medium.nitrogen\t\t" << fixed_medium.nitrogen << endl;
//cout << "fixed_medium.phosphorus\t\t" << fixed_medium.phosphorus << endl;
//cout << "fixed_medium.potassium\t\t" << fixed_medium.potassium << endl;
//cout << "fixed_medium.calcium\t\t" << fixed_medium.calcium << endl;
//cout << "fixed_medium.magnesium\t\t" << fixed_medium.magnesium << endl;
//_getch();
#pragma endregion
#pragma region Saletra_magnezowa
++counter;
//saletra magnezowa - azot (100%) i magnez
ld quantity_of_magnesium_nitrate_fertilizer = (desired_medium2.nitrogen - fixed_medium.nitrogen) / percent.magnesium_nitrate_N;
fertilizer_name[counter] = "Saletra magnezowa\t\t";
fertilizer_quantity[counter] = quantity_of_magnesium_nitrate_fertilizer;
fertilizer_EC[counter] = percent.magnesium_nitrate_EC;
ktory_zbiornik[counter] = ZBIORNIK_A;
//azot
fixed_medium.nitrogen += quantity_of_magnesium_nitrate_fertilizer * percent.magnesium_nitrate_N;
//magnez
fixed_medium.magnesium += quantity_of_magnesium_nitrate_fertilizer * percent.magnesium_nitrate_Mg;
//sprawdz czy wartosc magnezu nie zostala przekroczona
if (fixed_medium.magnesium > desired_medium2.magnesium)
{
//odejmij dwa powyzsze wyniki: -= zamiast +=
//azot
fixed_medium.nitrogen -= quantity_of_magnesium_nitrate_fertilizer * percent.magnesium_nitrate_N;
//magnez
fixed_medium.magnesium -= quantity_of_magnesium_nitrate_fertilizer * percent.magnesium_nitrate_Mg;
//saletra magnezowa - magnez (100%) i azot
ld quantity_of_magnesium_nitrate_fertilizer = (desired_medium2.magnesium - fixed_medium.magnesium) / percent.magnesium_nitrate_Mg;
fertilizer_name[counter] = "Saletra magnezowa\t\t";
fertilizer_quantity[counter] = quantity_of_magnesium_nitrate_fertilizer;
//magnez
fixed_medium.magnesium += quantity_of_magnesium_nitrate_fertilizer * percent.magnesium_nitrate_Mg;
//azot
fixed_medium.nitrogen += quantity_of_magnesium_nitrate_fertilizer * percent.magnesium_nitrate_N;
}
//test
//cout << "\ntest\t\tSaletra magnezowa" << endl;
//cout << "fixed_medium.nitrogen\t\t" << fixed_medium.nitrogen << endl;
//cout << "fixed_medium.phosphorus\t\t" << fixed_medium.phosphorus << endl;
//cout << "fixed_medium.potassium\t\t" << fixed_medium.potassium << endl;
//cout << "fixed_medium.calcium\t\t" << fixed_medium.calcium << endl;
//cout << "fixed_medium.magnesium\t\t" << fixed_medium.magnesium << endl;
//_getch();
#pragma endregion
#pragma region Saletra_potasowa
++counter;
//potassium nitrate, saletra potasowa - azot 100% + potas
ld quantity_of_potassium_nitrate_fertilizer = (desired_medium2.nitrogen - fixed_medium.nitrogen) / percent.potassium_nitrate_N;
fertilizer_name[counter] = "Saletra potasowa\t\t";
fertilizer_quantity[counter] = quantity_of_potassium_nitrate_fertilizer;
fertilizer_EC[counter] = percent.potassium_nitrate_EC;
ktory_zbiornik[counter] = ZBIORNIK_A;
//azot
fixed_medium.nitrogen += quantity_of_potassium_nitrate_fertilizer * percent.potassium_nitrate_N;
//potas
fixed_medium.potassium += quantity_of_potassium_nitrate_fertilizer * percent.potassium_nitrate_K;
//ok
if (fixed_medium.potassium > desired_medium2.potassium)
{
//odejmij dwa powyzsze wyniki: -= zamiast +=
fixed_medium.nitrogen -= quantity_of_potassium_nitrate_fertilizer * percent.potassium_nitrate_N;
//potas
fixed_medium.potassium -= quantity_of_potassium_nitrate_fertilizer * percent.potassium_nitrate_K;
//potassium nitrate, saletra potasowa - potas 100% + azot
ld quantity_of_potassium_nitrate_fertilizer = (desired_medium2.potassium - fixed_medium.potassium) / percent.potassium_nitrate_K;
fertilizer_name[counter] = "Saletra potasowa\t\t";
fertilizer_quantity[counter] = quantity_of_potassium_nitrate_fertilizer;
//potas
fixed_medium.potassium += quantity_of_potassium_nitrate_fertilizer * percent.potassium_nitrate_K;
//azot
fixed_medium.nitrogen += quantity_of_potassium_nitrate_fertilizer * percent.potassium_nitrate_N;
}
//test
//cout << "\ntest\t\tSaletra potasowa" << endl;
//cout << "fixed_medium.nitrogen\t\t" << fixed_medium.nitrogen << endl;
//cout << "fixed_medium.phosphorus\t\t" << fixed_medium.phosphorus << endl;
//cout << "fixed_medium.potassium\t\t" << fixed_medium.potassium << endl;
//cout << "fixed_medium.calcium\t\t" << fixed_medium.calcium << endl;
//cout << "fixed_medium.magnesium\t\t" << fixed_medium.magnesium << endl;
//_getch();
#pragma endregion
#pragma region Siarczan_potasu
//jezeli brakuje jeszcze potasu, uzupelnij go
if (fixed_medium.potassium < desired_medium2.potassium)
{
++counter;
//potassium sulfate, siarczan potasu - potas 100% + siarczany
ld quantity_of_potassium_sulfate_fertilizer = (desired_medium2.potassium - fixed_medium.potassium) / percent.potassium_sulfate_K;
fertilizer_name[counter] = "Siarczan potasu\t\t\t";
fertilizer_quantity[counter] = quantity_of_potassium_sulfate_fertilizer;
fertilizer_EC[counter] = percent.potassium_sulfate_EC;
ktory_zbiornik[counter] = ZBIORNIK_B;
//potas
fixed_medium.potassium += quantity_of_potassium_sulfate_fertilizer * percent.potassium_sulfate_K;
//siarczany
fixed_medium.sulfur += quantity_of_potassium_sulfate_fertilizer * percent.potassium_sulfate_S;
}
//test
//cout << "\ntest\t\tSiarczan potasu" << endl;
//cout << "fixed_medium.nitrogen\t\t" << fixed_medium.nitrogen << endl;
//cout << "fixed_medium.phosphorus\t\t" << fixed_medium.phosphorus << endl;
//cout << "fixed_medium.potassium\t\t" << fixed_medium.potassium << endl;
//cout << "fixed_medium.calcium\t\t" << fixed_medium.calcium << endl;
//cout << "fixed_medium.magnesium\t\t" << fixed_medium.magnesium << endl;
//_getch();
#pragma endregion
#pragma region Siarczan_magnezu
//jezeli brakuje jeszcze magnezu, uzupelnij go
if (fixed_medium.magnesium < desired_medium2.magnesium)
{
++counter;
//siarczan magnezu - magnez (100%) i siarczany
ld quantity_of_magnesium_sulfate_fertilizer = (desired_medium2.magnesium - fixed_medium.magnesium) / percent.magnesium_sulfate_Mg;
fertilizer_name[counter] = "Siarczan magnezu\t\t";
fertilizer_quantity[counter] = quantity_of_magnesium_sulfate_fertilizer;
fertilizer_EC[counter] = percent.magnessium_sulfate_EC;
ktory_zbiornik[counter] = ZBIORNIK_B;
//magnez
fixed_medium.magnesium += quantity_of_magnesium_sulfate_fertilizer * percent.magnesium_sulfate_Mg;
//siarczany
fixed_medium.sulfur += quantity_of_magnesium_sulfate_fertilizer * percent.magnesium_sulfate_S;
}
//test
//cout << "\ntest\t\tSiarczan magnezu" << endl;
//cout << "fixed_medium.nitrogen\t\t" << fixed_medium.nitrogen << endl;
//cout << "fixed_medium.phosphorus\t\t" << fixed_medium.phosphorus << endl;
//cout << "fixed_medium.potassium\t\t" << fixed_medium.potassium << endl;
//cout << "fixed_medium.calcium\t\t" << fixed_medium.calcium << endl;
//cout << "fixed_medium.magnesium\t\t" << fixed_medium.magnesium << endl;
//_getch();
#pragma endregion
//109 nie ma mikroelementow, bo nie wiem skad je wziac
cout << "\n\n------------\n\tPodsumowanie wartosci skladnikow w mg/dm^3\n\tPozywka poczatkowa \\ Pozywka pozadana \\ Pozywka ustalona" << endl;
cout << "\tAzot\t\t" << Initial_medium2.nitrogen << "\t" << desired_medium2.nitrogen << "\t" << fixed_medium.nitrogen << endl;
cout << "\tFosfor\t\t" << Initial_medium2.phosphorus << "\t" << desired_medium2.phosphorus << "\t" << fixed_medium.phosphorus << endl;
cout << "\tPotas\t\t" << Initial_medium2.potassium << "\t" << desired_medium2.potassium << "\t" << fixed_medium.potassium << endl;
cout << "\tWapn\t\t" << Initial_medium2.calcium << "\t" << desired_medium2.calcium << "\t" << fixed_medium.calcium << endl;
cout << "\tMagnez\t\t" << Initial_medium2.magnesium << "\t" << desired_medium2.magnesium << "\t" << fixed_medium.magnesium << endl;
//cout << "\tChlor\t\t" << Initial_medium2.chlorine << "\t" << desired_medium2.chlorine << "\t" << fixed_medium.chlorine << endl;
cout << "\tSiarczany\t" << Initial_medium2.sulfur << "\t" << desired_medium2.sulfur << "\t" << fixed_medium.sulfur << endl;
// ponieważ zneutralizowane cout << "\tWeglany\t\t" << Initial_medium2.carbonates << "\t" << desired_medium2.carbonates << "\t" << fixed_medium.carbonates << endl;
cout << "\tSod\t\t" << Initial_medium2.sodium << "\t" << desired_medium2.sodium << "\t" << fixed_medium.sodium << endl;
cout << "\tZelazo\t\t" << Initial_medium2.iron << "\t" << desired_medium2.iron << "\t" << fixed_medium.iron << endl;
cout << "\tBor\t\t" << Initial_medium2.boron << "\t" << desired_medium2.boron << "\t" << fixed_medium.boron << endl;
cout << "\tCynk\t\t" << Initial_medium2.zinc << "\t" << desired_medium2.zinc << "\t" << fixed_medium.zinc << endl;
cout << "\tMangan\t\t" << Initial_medium2.manganese << "\t" << desired_medium2.manganese << "\t" << fixed_medium.manganese << endl;
cout << "\tMiedz\t\t" << Initial_medium2.copper << "\t" << desired_medium2.copper << "\t" << fixed_medium.copper << endl;
cout << "\tMolibden\t" << Initial_medium2.molybdenum << "\t" << desired_medium2.molybdenum << "\t" << fixed_medium.molybdenum << endl;
//cout << "\tpH\t\t" << Initial_medium2.pH << "\t" << desired_medium2.pH << "\t" << fixed_medium.pH << endl;
//cout << "\tEC\t\t" << Initial_medium2.EC << "\t" << desired_medium2.EC << "\t" << fixed_medium.EC << endl;
ofstream write_data;
write_data.open("wartosci liczbowe dla pozywki.txt", std::ios::out | std::ios::app);
write_data << "\n\n------------\n\tPodsumowanie wartosci skladnikow w mg/dm^3\n\tPozywka poczatkowa \\ Pozywka pozadana \\ Pozywka ustalona" << endl;
write_data << "\tAzot\t\t" << Initial_medium2.nitrogen << "\t" << desired_medium2.nitrogen << "\t" << fixed_medium.nitrogen << endl;
write_data << "\tFosfor\t\t" << Initial_medium2.phosphorus << "\t" << desired_medium2.phosphorus << "\t" << fixed_medium.phosphorus << endl;
write_data << "\tPotas\t\t" << Initial_medium2.potassium << "\t" << desired_medium2.potassium << "\t" << fixed_medium.potassium << endl;
write_data << "\tWapn\t\t" << Initial_medium2.calcium << "\t" << desired_medium2.calcium << "\t" << fixed_medium.calcium << endl;
write_data << "\tMagnez\t\t" << Initial_medium2.magnesium << "\t" << desired_medium2.magnesium << "\t" << fixed_medium.magnesium << endl;
//cout << "\tChlor\t\t" << Initial_medium2.chlorine << "\t" << desired_medium2.chlorine << "\t" << fixed_medium.chlorine << endl;
write_data << "\tSiarczany\t" << Initial_medium2.sulfur << "\t" << desired_medium2.sulfur << "\t" << fixed_medium.sulfur << endl;
// ponieważ zneutralizowane cout << "\tWeglany\t\t" << Initial_medium2.carbonates << "\t" << desired_medium2.carbonates << "\t" << fixed_medium.carbonates << endl;
write_data << "\tSod\t\t" << Initial_medium2.sodium << "\t" << desired_medium2.sodium << "\t" << fixed_medium.sodium << endl;
write_data << "\tZelazo\t\t" << Initial_medium2.iron << "\t" << desired_medium2.iron << "\t" << fixed_medium.iron << endl;
write_data << "\tBor\t\t" << Initial_medium2.boron << "\t" << desired_medium2.boron << "\t" << fixed_medium.boron << endl;
write_data << "\tCynk\t\t" << Initial_medium2.zinc << "\t" << desired_medium2.zinc << "\t" << fixed_medium.zinc << endl;
write_data << "\tMangan\t\t" << Initial_medium2.manganese << "\t" << desired_medium2.manganese << "\t" << fixed_medium.manganese << endl;
write_data << "\tMiedz\t\t" << Initial_medium2.copper << "\t" << desired_medium2.copper << "\t" << fixed_medium.copper << endl;
write_data << "\tMolibden\t" << Initial_medium2.molybdenum << "\t" << desired_medium2.molybdenum << "\t" << fixed_medium.molybdenum << endl;
write_data.close();
cout << "\n\n------------\n\tAby uzyskac wartosci skladnikow podanych powyzej jako \n\t\"pozywka ustalona\", nalezy wprowadzic nastepujace ilosci nawozow:" << endl;
cout << "\n\tJednostka:\tmiligramy na litr [mg/dm^3]" << endl;
for (int a = 0; a <= counter; ++a)
{
cout << "\t" << fertilizer_name[a] << fertilizer_quantity[a] << " mg/l" << endl;
}
cout << "\n\n------------\n" << endl;
//zamiana z miligramow na gramy
for (int a = 0; a <= counter; ++a)
{
fertilizer_quantity[a] /= 1000;
}
//cout i ofstream
write_data.open("wartosci liczbowe dla pozywki.txt", std::ios::out | std::ios::app);
cout << "\n\n\tJednostka:\tgramy na litr [g/dm^3]" << endl;
write_data << "\n\n------------\n\tJednostka:\tgramy na litr [g/dm^3]" << endl;
for (int a = 0; a <= counter; ++a)
{
cout << "\t" << fertilizer_name[a] << fertilizer_quantity[a] << " g/l" << endl;
write_data << "\t" << fertilizer_name[a] << fertilizer_quantity[a] << " g/l" << endl;
}
write_data.close();
//przeliczanie EC dla kazdego nawozu, uwzgledniajac ilosc wprowadzonych gramow
ld suma = 0;
for (int a = 0; a <= counter; ++a)
{
suma += fertilizer_quantity[a] * fertilizer_EC[a];
}
cout << "\n\n------------\n" << endl;
cout << "\tSuma EC wprowadzonych nawozow:\t" << suma << " mS/cm^2" << endl;
fixed_medium.EC += suma;
cout << "\tSuma EC calej pozywki:\t\t" << fixed_medium.EC << " mS/cm^2" << endl;
write_data.open("wartosci liczbowe dla pozywki.txt", std::ios::out | std::ios::app);
write_data << "\n\n------------\n" << endl;
write_data << "\tSuma EC wprowadzonych nawozow:\t" << suma << " mS/cm^2" << endl;
write_data << "\tSuma EC calej pozywki:\t\t" << fixed_medium.EC << " mS/cm^2" << endl;
write_data.close();
#pragma region A_BARREL
cout << "\n------------\n" << endl;
cout << "\n\tPodaj pojemnosc beczki A w litrach (nawozy wapniowe): ";
double volumeA;
cin >> volumeA;
cin.sync();
cin.clear();
cout << "\tPodaj zatezenie nawozow w beczce A: ";
double concentrationA;
cin >> concentrationA;
cin.sync();
cin.clear();
//obliczenia tylko dla zbiornika A = 1
//pętla która przerobi wszystkie nawozy, zależna od var counter
for (int a = 0; a <= counter; ++a)
{
//warunek przepusci tyko te, ktorych wartosc jest rowna 1, czyli nawozy przypisane
if (ktory_zbiornik[a] == 1)
{
fertilizer_quantity[a] = fertilizer_quantity[a] * volumeA * concentrationA;
}
}
write_data.open("wartosci liczbowe dla pozywki.txt", std::ios::out | std::ios::app);
cout << "\n\tDo beczki A o pojemnosci " << volumeA << " litrow \n\ti o zatezeniu " << concentrationA << "x nalezy wsypac " << endl;
write_data << "\n------------\n\tDo beczki A o pojemnosci " << volumeA << " litrow \n\ti o zatezeniu " << concentrationA << "x nalezy wsypac " << endl;
for (int a = 0; a <= counter; ++a)
{
if (ktory_zbiornik[a] == 1)
{
cout << "\t\t" << fertilizer_name[a] << "" << (fertilizer_quantity[a] / 1000) << " kg" << endl;
write_data << "\t\t" << fertilizer_name[a] << "" << (fertilizer_quantity[a] / 1000) << " kg" << endl;
}
}
write_data.close();
#pragma endregion
#pragma region B_BARREL
cout << "\n------------\n" << endl;
cout << "\n\tPodaj pojemnosc beczki B w litrach (fosforany i siarczany): ";
double volumeB;
cin >> volumeB;
cin.sync();
cin.clear();
cout << "\tPodaj zatezenie nawozow w beczce B: ";
double concentrationB;
cin >> concentrationB;
cin.sync();
cin.clear();
//obliczenia tylko dla zbiornika B = 2
//pętla która przerobi wszystkie nawozy, zależna od var counter
for (int a = 0; a <= counter; ++a)
{
//warunek przepusci tyko te, ktorych wartosc jest rowna 2, czyli nawozy przypisane
if (ktory_zbiornik[a] == 2)
{
fertilizer_quantity[a] = fertilizer_quantity[a] * volumeB * concentrationB;
}
}
write_data.open("wartosci liczbowe dla pozywki.txt", std::ios::out | std::ios::app);
cout << "\n\tDo beczki B o pojemnosci " << volumeB << " litrow \n\ti o zatezeniu " << concentrationB << "x nalezy wsypac " << endl;
write_data << "\n\tDo beczki B o pojemnosci " << volumeB << " litrow \n\ti o zatezeniu " << concentrationB << "x nalezy wsypac " << endl;
for (int a = 0; a <= counter; ++a)
{
if (ktory_zbiornik[a] == 2)
{
cout << "\t\t" << fertilizer_name[a] << "" << (fertilizer_quantity[a] / 1000) << " kg" << endl;
write_data << "\t\t" << fertilizer_name[a] << "" << (fertilizer_quantity[a] / 1000) << " kg" << endl;
}
}
write_data.close();
#pragma endregion
#pragma region C_BARREL
cout << "\n------------\n\tPodaj pojemnosc beczki C w litrach (kwas azotowy): ";
double volumeC;
cin >> volumeC;
cin.sync();
cin.clear();
cout << "\tPodaj zatezenie kwasu w beczce C: ";
double concentrationC;
cin >> concentrationC;
cin.sync();
cin.clear();
dawka_kwasu = (dawka_kwasu * volumeC * concentrationC) / 1000; //z cm^3 na dm^3
cout << "\n\tDo beczki C o pojemnosci " << volumeC << " litrow \n\ti o zatezeniu " << concentrationC << "x nalezy wlac\t\t" << dawka_kwasu << " dm^3 kwasu" << endl;
write_data.open("wartosci liczbowe dla pozywki.txt", std::ios::out | std::ios::app);
write_data << "\n\tDo beczki C o pojemnosci " << volumeC << " litrow \n\ti o zatezeniu " << concentrationC << "x nalezy wlac\t\t" << dawka_kwasu << " dm^3 kwasu" << endl;
write_data.close();
#pragma endregion
//dotąd, wszystko jest w porządku, 22:24, 8 lipiec 2015
//napisy końcowe
cout << "\n------------\n\tProgram automatycznie utworzy oraz zapisze dane do pliku tekstowego" << endl;
cout << "\tNacisnij dowolny klawisz, aby zamknac";
_getch();
}
MEDIUM loadDesiredMedium()
{
//108 usunąć lub skomentować wartości do testów
MEDIUM desired_medium = { 0 };
//usunac przed oddaniem programu, nie chce mi sie wpisywac caly czas te wartosci
//0.02 to najmniejsza dopuszczalna wartosc
//1azot 2fosfor 3potas 4wapn 5magnez 6chlor 7siarczany 8weglany 9sod 10zelazo 11bor 12cynk 13mangan 14miedz 15molibden 16odczyn 17EC
//mininum desired medium
//desired_medium = { 200, 40, 200, 160, 30, 50, 180, 50, 0, 0.7, 0.3, 0.26, 0.1, 0.03, 0.03, 5.5, 3.0 };
//maximum desired medium
//desired_medium = { 410, 60, 400, 500, 140, 50, 180, 50, 0, 2.5, 1.0, 0.78, 0.9, 0.15, 0.21, 5.5, 3.0 };
//wersja z moich notatek
//desired_medium = { 230, 50, 230, 190, 60, 0.02, 0.02, 220.0, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 4, 0.5 };
//wersja kowalskiej - brak (podala tylko ile jej woda zrodlana ma zwykle jonow)
//wersja metodyki
//desired_medium = { 220, 60, 340, 210, 70, 50, 180 /*<180*/, 50, 0 /*zawartosc Na bez zmian*/, 2.5, 0.33, 0.33, 0.8, 0.15, 0.05, 5.5/*odczyn ma wynosic 5.5 zawsze po traktowaniu kwasem*/, 3.0 };
cout << "\n------------\n\tWprowadz pozadane wartosci skladnikow pokarmowych\n\tktore maja znajdowac sie w pozywce" << endl;
cout << "\tAzot:\t\t";
cin >> desired_medium.nitrogen;
cin.sync();
cout << "\tFosfor:\t\t";
cin >> desired_medium.phosphorus;
cin.sync();
cout << "\tPotas:\t\t";
cin >> desired_medium.potassium;
cin.sync();
cout << "\tWapn:\t\t";
cin >> desired_medium.calcium;
cin.sync();
cout << "\tMagnez:\t\t";
cin >> desired_medium.magnesium;
cin.sync();
//cout << "\tChlor:\t\t";
//cin >> desired_medium.chlorine;
//cin.sync();
//cout << "\tSiarczany:\t";
//cin >> desired_medium.sulfur;
//cin.sync();
//cout << "\tWeglany:\t";
//cin >> desired_medium.carbonates;
//cin.sync();
//cout << "\tSod:\t\t";
//cin >> desired_medium.sodium;
//cin.sync();
//cout << "\tZelazo:\t\t";
//cin >> desired_medium.iron;
//cin.sync();
//cout << "\tBor:\t\t";
//cin >> desired_medium.boron;
//cin.sync();
//cout << "\tCynk:\t\t";
//cin >> desired_medium.zinc;
//cin.sync();
//cout << "\tMangan:\t\t";
//cin >> desired_medium.manganese;
//cin.sync();
//cout << "\tMiedz:\t\t";
//cin >> desired_medium.copper;
//cin.sync();
//cout << "\tMolibden:\t";
//cin >> desired_medium.molybdenum;
//cin.sync();
//cout << "\tpH:\t\t";
//cin >> desired_medium.pH;
//cin.sync();
//cout << "\tEC:\t\t";
//cin >> desired_medium.EC;
//cin.sync();
return desired_medium;
}
ld nitrogen_introduced_f(ld dk, ld quantityOfNitrogenIn1dm4)
{
/*
uwaga, poniewaz zastosowano kwas % wagowo 63.23%, co odpowiada 195.36 mg czystego N w 1cm^3 kwasu,
bedzie to stala - ale w przyszlosci ew. moze byc wsadzona do tablicy typu struct
*/
//105, w zależności od wcześniej wybranego stężenia kwasu azotowego, przesłać tutaj (do tej funkcji) dane, jakiej ilości azotu odpowiada to
//103
//const double mgNin1cm3ofAcid = 195.36; //mg N w 1cm^3 kwasu WYŁĄCZNIE dla 63.23% wagowo kwasu //106
const int oneCm3ofAcid = 1; //1cm^3 HNO
//tak wiem, moglem po prostu 1, ale magic numbers
ld nitrogen_introduced = (dk * quantityOfNitrogenIn1dm4) / oneCm3ofAcid;
ofstream write_data;
write_data.open("wartosci liczbowe dla pozywki.txt", std::ios::out | std::ios::app);
cout << "\n\n------------\n\tAzot wprowadzony wraz z kwasem azotowym = " << nitrogen_introduced << "mg / dm^3" << endl;
write_data << "\n\n------------\n\tAzot wprowadzony wraz z kwasem azotowym = " << nitrogen_introduced << "mg / dm^3" << endl;
write_data.close();
return nitrogen_introduced;
}
ld acid_dose(ld W, double weglany, ld &dawka_kwasu) //ten 3 argument to brzydkie rozwiazanie.. ale koniecznosc, bo musze miec ta wartosc gdzies indziej
{
/*
dawka kwasu (dk) = (((ilość_węglanów : 61) - 0.7) * W) 1000
cout << DK << " cm^3 / dm^3" << endl;
61 - magic number
*/
const int magic_number = 61;
const double cNumber = 0.7; //milimole HCO3- pozostawione w wodzie dla roslin
const int cNumber2 = 1000;
ld dk = (((weglany / magic_number) - cNumber) * W) / cNumber2; //104
ofstream write_data;
write_data.open("wartosci liczbowe dla pozywki.txt", std::ios::out | std::ios::app);
cout << "\n\n------------\n\tDawka kwasu = " << dk << "cm^3 / dm^3" << endl;
write_data << "\n\n------------\n\tDawka kwasu = " << dk << "cm^3 / dm^3" << endl;
write_data.close();
dawka_kwasu = dk;
return dk;
//ok
}
ld acid_ratio(double weglany, ld &quantityOfNitrogenIn1dm4) //wspolczynnik przeliczeniowy dla kwasu
{
const int ilosc_elementow_kolumny = 14;
const int ilosc_kolumn = 5;
ld tabela[ilosc_kolumn][ilosc_elementow_kolumny] =
{
//"procent_wagowy" kwas azotowy HNO3 w % wagowym
{ 20.23, 30.88, 32.36, 35.28, 36.78, 38.29, 50.71, 57.57, 59.39, 61.27, 63.23, 65.30, 67.50, 69.80 },
//"gestosc_kwasu" gestosc kwasu (symbol d w przeliczeniach) w 15 stopniach celsjusza, w gramach na cm^3
{ 1.120, 1.190, 1.200, 1.220, 1.230, 1.240, 1.320, 1.360, 1.370, 1.380, 1.390, 1.400, 1.410, 1.420 },
//"ilosc_miligramow" azotu w 1cm^3 kwasu
{ 50.36, 81.68, 86.32, 95.67, 100.56, 148.79, 174.04, 180.86, 187.95, 195.36, 203.21, 211.56, 220.32 },
//ilosc kwasu w cm3 potrzebna do uzyskania stezenia 1mg N/dm3 w
//1dm3 wody
{ 0.0199, 0.0122, 0.0116, 0.0105, 0.0099, 0.0095, 0.0067, 0.0057, 0.0055, 0.0053, 0.0051, 0.0049, 0.0047, 0.0045 },
//1000dm3 wody
{ 19.86, 12.24, 11.59, 10.45, 0.94, 9.48, 6.72, 5.75, 5.53, 5.32, 5.12, 4.92, 4.73, 4.54 }
};
const int procent_wagowy = 0;
const int gestosc_kwasu = 1;
const int ilosc_miligramow = 2;
/*kolejne kolumny niedostepne - i tak nie beda potrzebne w obliczeniach*/
//program prosi usera o podanie % wagowego kwasu azotowego
cout << "\n\n------------\n\tWprowadzanie % wagowego kwasu azotowego" << endl;
cout << "\tNalezy wprowadzic wartosci podane z ponizszych " << endl;
cout << "\t20.23, 30.88, 32.36, 35.28, 36.78, 38.29, 50.71, \n\t57.57, 59.39, 61.27, 63.23, 65.30, 67.50, 69.80" << endl;
cout << "\tNalezy pamietac o podaniu cyfr z kropka (nie przecinkiem)" << endl;
// [odkomentowac]
ld choice;
bool is_input_correct = false;
int index;
do
{
cout << "\tWartosc: ";
cin >> choice;
for (index = 0; index <= ilosc_elementow_kolumny; ++index)
{
if (choice == tabela[procent_wagowy][index])
{
is_input_correct = true;
break;
}
}
if (is_input_correct == false)
{
cout << "\tW tabeli nie ma takiej wartosci. Podaj wartosc ponownie." << endl;
}
} while (!(is_input_correct));
//cout << "is_input_correct\t\t" << is_input_correct << endl;
//cout << "index\t\t" << index << endl;
//cout << "tabela[procent_wagowy][index]\t\t" << tabela[procent_wagowy][index] << endl;
//_getch();
// [/odkomentowac]
//do funkcji jest przesylana np. 220mg HCO3- na 1 litr
/*
wzór
W = a : b : d
gdzie
W - współczynnik przeliczeniowy dla kwasu
a - ciężar cząsteczkowy HNO3 (63.01287g)
b - procentowość wagowa HNO3 np. 63,23% zamieniamy na mozliwe do uzycia w obliczeniach 0,6323 (dzielimy przez 100)
d - gęstość HNO3- w g*cm-3
*/
const ld a = 63.01287; //stała, masa molowa HNO3 w gramach na 1 mol
//wartosciami zmiennymi, mozliwymi do wyboru przez usera sa b i d
ld b = ( tabela[procent_wagowy][index] / 100); //przelicznik z 63.23% na 0.6323
ld d = tabela[gestosc_kwasu][index];
//ld b = 0.6323; //101 //107
//ld d = 1.390; //102
ld W = a / b / d;
ofstream write_data;
write_data.open("wartosci liczbowe dla pozywki.txt", std::ios::out | std::ios::trunc);
cout << "\n\n------------\n\tStezenie kwasu wynosi " << (b *100) << " %"<< endl;
write_data << "\n\n------------\n\tStezenie kwasu wynosi " << (b * 100) << " %" << endl;
cout << "\n\n------------\n\tWspolczynnik przeliczeniowy dla kwasu = " << W << endl;
write_data << "\n\n------------\n\tWspolczynnik przeliczeniowy dla kwasu = " << W << endl;
write_data.close();
quantityOfNitrogenIn1dm4 = tabela[ilosc_miligramow][index];
return W;
}
MEDIUM loadInitialMedium()
{
MEDIUM Initial_medium = { 0 };
//usunac przed oddaniem programu, nie chce mi sie wpisywac caly czas te wartosci
//1azot 2fosfor 3potas 4wapn 5magnez 6chlor 7siarczany 8weglany 9sod 10zelazo 11bor 12cynk 13mangan 14miedz 15molibden 16odczyn 17EC
//minimum initial medium
//Initial_medium = { 0, 0, 0, 75, 0, 0, 0, 210, 0, 0, 0, 0, 0, 0, 0, 7.5, 0.5 };
//maxium initial medium
//Initial_medium = { 4, 0, 10, 150, 15, 23, 38, 230, 10, 0.1, 0.03, 0.2, 0.2, 0.2, 0.2, 8.0, 0.65 };
//wersja z moich notatek
//Initial_medium = { 4, 0, 10, 75, 5, 0.02, 0.02, 220.0, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 7.5, 0.5 };
//wersja Kowalskiej
//Initial_medium = { 4, 0, 8, 75, 10, 23, 12, 230.0 /*210-230*/, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 8.0, 0.5 };
//wersja metodyki
//Initial_medium = { 0.28, 0.9, 2.37, 98, 14.5, 14, 38, 234, 10.1, 0.01, 0.03, 0.21, 0.01, 0.01, 0, 6.7, 0.65 };
cout << "\n\n------------\tWprowadz aktualne wartosci skladnikow pokarmowych \n\tznajdujacych sie w pozywce" << endl;
cout << "\tAzot:\t\t";
cin >> Initial_medium.nitrogen;
cout << "\tFosfor:\t\t";
cin >> Initial_medium.phosphorus;
cout << "\tPotas:\t\t";
cin >> Initial_medium.potassium;
cout << "\tWapn:\t\t";
cin >> Initial_medium.calcium;
cout << "\tMagnez:\t\t";
cin >> Initial_medium.magnesium;
//cout << "\tChlor:\t\t";
//cin >> Initial_medium.chlorine;
//cout << "\tSiarczany:\t";
//cin >> Initial_medium.sulfur;
cout << "\tWeglany:\t";
cin >> Initial_medium.carbonates;
//cout << "\tSod:\t\t";
//cin >> Initial_medium.sodium;
//cout << "\tZelazo:\t\t";
//cin >> Initial_medium.iron;
//cout << "\tBor:\t\t";
//cin >> Initial_medium.boron;
//cout << "\tCynk:\t\t";
//cin >> Initial_medium.zinc;
//cout << "\tMangan:\t\t";
//cin >> Initial_medium.manganese;
//cout << "\tMiedz:\t\t";
//cin >> Initial_medium.copper;
//cout << "\tMolibden:\t";
//cin >> Initial_medium.molybdenum;
//cout << "\tpH:\t\t";
//cin >> Initial_medium.pH;
//cout << "\tEC:\t\t";
//cin >> Initial_medium.EC;
return Initial_medium;
}
bool maxForElements(MEDIUM Initial_medium2)
{
//1azot 2fosfor 3potas 4wapn 5magnez 6chlor 7siarczany 8weglany 9sod 10zelazo 11bor 12cynk 13mangan 14miedz 15molibden 16odczyn 17EC
MEDIUM allowed_quantity = { 5, 5, 5, 120, 25, 100, 200, 350, 30, 5, 0.5, 0.5, 1.0, 0.2, 0.02, 7.5, 1.0 };
if (allowed_quantity.nitrogen < Initial_medium2.nitrogen)
return false;
if (allowed_quantity.phosphorus < Initial_medium2.phosphorus)
return false;
if (allowed_quantity.potassium < Initial_medium2.potassium)
return false;
if (allowed_quantity.calcium < Initial_medium2.calcium)
return false;
if (allowed_quantity.magnesium < Initial_medium2.magnesium)
return false;
if (allowed_quantity.chlorine < Initial_medium2.chlorine)
return false;
if (allowed_quantity.carbonates < Initial_medium2.carbonates)
return false;
if (allowed_quantity.sodium < Initial_medium2.sodium)
return false;
if (allowed_quantity.iron < Initial_medium2.iron)
return false;
if (allowed_quantity.boron < Initial_medium2.boron)
return false;
if (allowed_quantity.zinc < Initial_medium2.zinc)
return false;
if (allowed_quantity.manganese < Initial_medium2.manganese)
return false;
if (allowed_quantity.copper < Initial_medium2.copper)
return false;
if (allowed_quantity.molybdenum < Initial_medium2.molybdenum)
return false;
if (allowed_quantity.pH < Initial_medium2.pH)
return false;
if (allowed_quantity.EC < Initial_medium2.EC)
return false;
//jezeli dojdziesz tutaj, zaden ze skladnikow lub wlasciwosci pozywki nie przekracza dopuszczalnej wartosci
return true;
}