Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -746,6 +746,12 @@ class NutrientCalculator:
|
|
746 |
self.target_profile['N (NO3-)'] = TOTAL_NITROGEN * (NO3_RATIO / total_parts)
|
747 |
self.target_profile['N (NH4+)'] = TOTAL_NITROGEN * (NH4_RATIO / total_parts)
|
748 |
|
|
|
|
|
|
|
|
|
|
|
|
|
749 |
def calculate(self):
|
750 |
try:
|
751 |
self.actual_profile = {k: 0.0 for k in self.target_profile}
|
@@ -875,6 +881,26 @@ class NutrientCalculator:
|
|
875 |
for elem in self.fertilizers[fert_name]:
|
876 |
self.results[fert_name][f'внесет {elem}'] = 0.0
|
877 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
878 |
def calculate_ec(self):
|
879 |
return round(self.total_ec, 2)
|
880 |
|
|
|
746 |
self.target_profile['N (NO3-)'] = TOTAL_NITROGEN * (NO3_RATIO / total_parts)
|
747 |
self.target_profile['N (NH4+)'] = TOTAL_NITROGEN * (NH4_RATIO / total_parts)
|
748 |
|
749 |
+
# Сохраняем исходный профиль азота
|
750 |
+
self.initial_n_profile = {
|
751 |
+
"NO3-": self.target_profile['N (NO3-)'],
|
752 |
+
"NH4+": self.target_profile['N (NH4+)']
|
753 |
+
}
|
754 |
+
|
755 |
def calculate(self):
|
756 |
try:
|
757 |
self.actual_profile = {k: 0.0 for k in self.target_profile}
|
|
|
881 |
for elem in self.fertilizers[fert_name]:
|
882 |
self.results[fert_name][f'внесет {elem}'] = 0.0
|
883 |
|
884 |
+
def generate_report(self):
|
885 |
+
"""Генерация отчета о питательном растворе"""
|
886 |
+
try:
|
887 |
+
report = "============================================================\n"
|
888 |
+
report += "ПРОФИЛЬ ПИТАТЕЛЬНОГО РАСТВОРА (ИТОГО):\n"
|
889 |
+
report += "============================================================\n"
|
890 |
+
report += f"{'Элемент':<10} {'ppm':>10}\n"
|
891 |
+
report += "-" * 20 + "\n"
|
892 |
+
for element, value in self.actual_profile.items():
|
893 |
+
report += f"{element:<10} {value:>10.2f}\n"
|
894 |
+
|
895 |
+
report += "\nИсходный расчёт азота:\n"
|
896 |
+
report += f" NO3-: {self.initial_n_profile['NO3-']:.2f} ppm\n"
|
897 |
+
report += f" NH4+: {self.initial_n_profile['NH4+']:.2f} ppm\n"
|
898 |
+
|
899 |
+
return report
|
900 |
+
except Exception as e:
|
901 |
+
print(f"Ошибка при выводе отчёта: {str(e)}")
|
902 |
+
raise
|
903 |
+
|
904 |
def calculate_ec(self):
|
905 |
return round(self.total_ec, 2)
|
906 |
|