DmitrMakeev commited on
Commit
172ffc7
·
verified ·
1 Parent(s): ac67369

Update nutri_call.html

Browse files
Files changed (1) hide show
  1. nutri_call.html +12 -21
nutri_call.html CHANGED
@@ -856,40 +856,32 @@ function updateNPK(data) {
856
  }
857
 
858
 
859
- function calculateEC(data, temperature) {
860
  console.log("=== РАСЧЕТ ЭЛЕКТРОПРОВОДНОСТИ (EC) ===");
861
 
862
- // Извлекаем значения элементов из actual_profile
863
  const profile = data.actual_profile;
864
  let totalEC = 0;
865
 
866
- // Список значимых элементов для расчета EC
867
- const significantElements = ["P", "K", "Mg", "Ca", "S", "N (NO3-)", "N (NH4+)"];
868
-
869
- // Коэффициенты электропроводности
870
  const ecConstants = {
871
- 'P': 0.0012, 'K': 0.0018, 'Mg': 0.0015,
872
- 'Ca': 0.0016, 'S': 0.0014,
873
  'N (NO3-)': 0.0017, 'N (NH4+)': 0.0019
874
  };
875
 
876
- // Суммируем EC для каждого значимого элемента
 
877
  for (const element of significantElements) {
878
- if (profile[element] && ecConstants[element]) {
879
- const ppm = profile[element]; // Уже в г/л
880
- const elementEC = ppm * ecConstants[element];
881
- totalEC += elementEC;
882
- console.log(`EC для ${element}: ${elementEC.toFixed(5)} (ppm=${ppm}, const=${ecConstants[element]})`);
883
- } else {
884
- console.warn(`Пропущен элемент: ${element}`);
885
- }
886
  }
887
 
888
  console.log(`Общая EC без компенсации: ${totalEC.toFixed(5)}`);
889
 
890
- // Применяем температурную компенсацию
891
- const compensatedEC = totalEC * (1 + 0.02 * (temperature - 25));
892
- console.log(`Компенсированная EC: ${compensatedEC.toFixed(5)} (при температуре ${temperature}°C)`);
893
 
894
  return compensatedEC;
895
  }
@@ -897,7 +889,6 @@ function calculateEC(data, temperature) {
897
 
898
 
899
 
900
-
901
  // Функция для обновления полей NH4 и NO3
902
  function updateNitrogenFields(data) {
903
  console.log("=== ОБНОВЛЕНИЕ ПОЛЕЙ NH4 И NO3 ===");
 
856
  }
857
 
858
 
859
+ function calculateEC(data, temperature, alpha = 0.019) {
860
  console.log("=== РАСЧЕТ ЭЛЕКТРОПРОВОДНОСТИ (EC) ===");
861
 
 
862
  const profile = data.actual_profile;
863
  let totalEC = 0;
864
 
 
 
 
 
865
  const ecConstants = {
866
+ 'P': 0.0012, 'K': 0.0018, 'Mg': 0.0015,
867
+ 'Ca': 0.0016, 'S': 0.0014,
868
  'N (NO3-)': 0.0017, 'N (NH4+)': 0.0019
869
  };
870
 
871
+ const significantElements = Object.keys(ecConstants);
872
+
873
  for (const element of significantElements) {
874
+ const ppm = profile[element] || 0;
875
+ const ecFactor = ecConstants[element];
876
+ const elementEC = ppm * ecFactor;
877
+ totalEC += elementEC;
878
+ console.log(`EC для ${element}: ${elementEC.toFixed(5)} (ppm=${ppm}, const=${ecFactor})`);
 
 
 
879
  }
880
 
881
  console.log(`Общая EC без компенсации: ${totalEC.toFixed(5)}`);
882
 
883
+ const compensatedEC = totalEC * (1 + alpha * (temperature - 25));
884
+ console.log(`Компенсированная EC: ${compensatedEC.toFixed(5)} (T=${temperature}°C, α=${alpha})`);
 
885
 
886
  return compensatedEC;
887
  }
 
889
 
890
 
891
 
 
892
  // Функция для обновления полей NH4 и NO3
893
  function updateNitrogenFields(data) {
894
  console.log("=== ОБНОВЛЕНИЕ ПОЛЕЙ NH4 И NO3 ===");