DmitrMakeev commited on
Commit
76dc902
·
verified ·
1 Parent(s): e678680

Update nutri_call.html

Browse files
Files changed (1) hide show
  1. nutri_call.html +67 -30
nutri_call.html CHANGED
@@ -1661,7 +1661,7 @@ populateProfileSelector();
1661
  </script>
1662
 
1663
 
1664
- <script>
1665
  class NutrientCalculator {
1666
  constructor(inputData) {
1667
  this.fertilizers = inputData.fertilizerConstants;
@@ -1754,38 +1754,66 @@ class NutrientCalculator {
1754
  }
1755
 
1756
  _distributeCalcium() {
1757
- const caTarget = this.target.Ca;
1758
- if (caTarget > 0) {
1759
- this._applyFertilizer("Кальциевая селитра", "Ca", caTarget);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1760
  }
1761
  }
 
1762
 
1763
- _generateOutput() {
1764
- const deficits = {};
1765
- for (const el in this.target) {
1766
- const diff = this.target[el] - this.actual[el];
1767
- if (Math.abs(diff) > 0.1) {
1768
- deficits[el] = parseFloat(diff.toFixed(this.roundingPrecision));
1769
- }
1770
- }
1771
 
1772
- const fertilizers = Object.fromEntries(
1773
- Object.entries(this.results).map(([name, data]) => [name, data.граммы])
1774
- );
1775
-
1776
- return {
1777
- actual_profile: this.actual,
1778
- deficits: deficits,
1779
- element_contributions: this.elementContributions,
1780
- fertilizers: fertilizers,
1781
- nitrogen_ratios: {
1782
- NH4_RATIO: this.profile.NO3_RAT,
1783
- NO3_RATIO: 1,
1784
- TOTAL_NITROGEN: this.profile.TOTAL_NITROG
1785
- },
1786
- total_ppm: parseFloat(Object.values(this.actual).reduce((sum, val) => sum + val, 0).toFixed(this.roundingPrecision))
1787
- };
1788
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1789
  }
1790
 
1791
 
@@ -1800,8 +1828,17 @@ const INPUT_DATA = {
1800
  "Калий сернокислый": { "K": 0.44874, "S": 0.18401 }
1801
  },
1802
  profileSettings: {
1803
- P: 31, K: 210, Mg: 24, Ca: 82, S: 57.5,
1804
- NO3_RAT: 8.25, TOTAL_NITROG: 125, liters: 100, rounding_precision: 3
 
 
 
 
 
 
 
 
 
1805
  }
1806
  };
1807
 
 
1661
  </script>
1662
 
1663
 
1664
+ <script>
1665
  class NutrientCalculator {
1666
  constructor(inputData) {
1667
  this.fertilizers = inputData.fertilizerConstants;
 
1754
  }
1755
 
1756
  _distributeCalcium() {
1757
+ const caTarget = this.target.Ca; // Целевой уровень кальция
1758
+ const no3Ratio = this.profile.NO3_RAT;
1759
+ const activationCacl = this.profile.activation_cacl;
1760
+ const enhancementCacl = this.profile.enhancement_cacl;
1761
+
1762
+ if (no3Ratio >= activationCacl) {
1763
+ console.log(`Соотношение NO3/NH4 >= ${activationCacl}. Хелат кальция не добавляется.`);
1764
+ // Всё кальций берётся из кальциевой селитры
1765
+ this._applyFertilizer("Кальциевая селитра", "Ca", caTarget);
1766
+ } else {
1767
+ // Часть кальция берётся из хелата кальция
1768
+ const caclTarget = caTarget * enhancementCacl;
1769
+ if (caclTarget > 0) {
1770
+ this._applyFertilizer("Хелат кальция", "Ca", caclTarget);
1771
+ }
1772
+ // Оставшийся кальций берётся из кальциевой селитры
1773
+ const remainingCa = caTarget - caclTarget;
1774
+ if (remainingCa > 0) {
1775
+ this._applyFertilizer("Кальциевая селитра", "Ca", remainingCa);
1776
  }
1777
  }
1778
+ }
1779
 
 
 
 
 
 
 
 
 
1780
 
1781
+
1782
+
1783
+
1784
+ _generateOutput() {
1785
+ const deficits = {};
1786
+ for (const el in this.target) {
1787
+ const diff = this.target[el] - this.actual[el];
1788
+ if (Math.abs(diff) > 0.1) {
1789
+ deficits[el] = parseFloat(diff.toFixed(this.roundingPrecision));
1790
+ }
 
 
 
 
 
 
1791
  }
1792
+
1793
+ // Гарантируем, что в fertilizers всегда 7 элементов
1794
+ const fertilizers = {
1795
+ "Аммоний азотнокислый": this.results["Аммоний азотнокислый"]?.граммы || 0,
1796
+ "Монофосфат калия": this.results["Монофосфат калия"]?.граммы || 0,
1797
+ "Сульфат магния": this.results["Сульфат магния"]?.граммы || 0,
1798
+ "Калий сернокислый": this.results["Калий сернокислый"]?.граммы || 0,
1799
+ "Хелат кальция": this.results["Хелат кальция"]?.граммы || 0, // Всегда присутствует
1800
+ "Кальциевая селитра": this.results["Кальциевая селитра"]?.граммы || 0,
1801
+ "Калий азотнокислый": this.results["Калий азотнокислый"]?.граммы || 0
1802
+ };
1803
+
1804
+ return {
1805
+ actual_profile: this.actual,
1806
+ deficits: deficits,
1807
+ element_contributions: this.elementContributions,
1808
+ fertilizers: fertilizers,
1809
+ nitrogen_ratios: {
1810
+ NH4_RATIO: this.profile.NO3_RAT,
1811
+ NO3_RATIO: 1,
1812
+ TOTAL_NITROGEN: this.profile.TOTAL_NITROG
1813
+ },
1814
+ total_ppm: parseFloat(Object.values(this.actual).reduce((sum, val) => sum + val, 0).toFixed(this.roundingPrecision))
1815
+ };
1816
+ }
1817
  }
1818
 
1819
 
 
1828
  "Калий сернокислый": { "K": 0.44874, "S": 0.18401 }
1829
  },
1830
  profileSettings: {
1831
+ P: 31,
1832
+ K: 210,
1833
+ Mg: 24,
1834
+ Ca: 82,
1835
+ S: 57.5,
1836
+ NO3_RAT: 6, // Соотношение NO3/NH4
1837
+ TOTAL_NITROG: 125, // Общее количество азота
1838
+ liters: 100, // Объём раствора
1839
+ rounding_precision: 3, // Точность округления
1840
+ activation_cacl: 5, // Порог активации хелата кальция
1841
+ enhancement_cacl: 0.1 // Доля ка��ьция из хелата
1842
  }
1843
  };
1844