DmitrMakeev commited on
Commit
0369830
·
verified ·
1 Parent(s): 4f99b12

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -704,7 +704,6 @@ def nutri_call():
704
 
705
 
706
 
707
-
708
 
709
 
710
  from tabulate import tabulate
@@ -722,7 +721,7 @@ INPUT_DATA = {
722
  },
723
  "profileSettings": {
724
  "P": 60, "K": 194, "Mg": 48.5, "Ca": 121.25, "S": 79.445,
725
- "NO3_RAT": 18.5, "TOTAL_NITROG": 138.57, "liters": 100
726
  }
727
  }
728
 
@@ -798,11 +797,13 @@ class NutrientCalculator:
798
  anions = self.actual["N (NO3-)"] + self.actual["S"] + self.actual["P"] + self.actual["Cl"]
799
  balance = cations - anions
800
 
801
- if balance > 0:
802
- ca_needed = max(0, self.target["Ca"] - self.actual["Ca"])
803
- cl_needed = balance * 0.5
804
- self._apply_fertilizer("Кальций хлорид", "Ca", ca_needed)
805
- self._apply_fertilizer("Кальций хлорид", "Cl", cl_needed)
 
 
806
 
807
  def _verify_results(self):
808
  deficits = {}
 
704
 
705
 
706
 
 
707
 
708
 
709
  from tabulate import tabulate
 
721
  },
722
  "profileSettings": {
723
  "P": 60, "K": 194, "Mg": 48.5, "Ca": 121.25, "S": 79.445,
724
+ "NO3_RAT": 9.5, "TOTAL_NITROG": 138.57, "liters": 100
725
  }
726
  }
727
 
 
797
  anions = self.actual["N (NO3-)"] + self.actual["S"] + self.actual["P"] + self.actual["Cl"]
798
  balance = cations - anions
799
 
800
+ # Проверяем соотношение NO3:NH4
801
+ if self.profile["NO3_RAT"] < 8: # Используем CaCl2 только если NO3_RAT < 8
802
+ if balance > 0: # Если катионов больше
803
+ ca_needed = max(0, self.target["Ca"] - self.actual["Ca"])
804
+ cl_needed = balance * 0.5 # Компенсируем половину дисбаланса
805
+ self._apply_fertilizer("Кальций хлорид", "Ca", ca_needed)
806
+ self._apply_fertilizer("Кальций хлорид", "Cl", cl_needed)
807
 
808
  def _verify_results(self):
809
  deficits = {}