Spaces:
Sleeping
Sleeping
Update nutri_call.html
Browse files- nutri_call.html +47 -99
nutri_call.html
CHANGED
@@ -1003,11 +1003,10 @@ document.getElementById('calculate-btn').addEventListener('click', function() {
|
|
1003 |
// Обновляем поля NH4 и NO3
|
1004 |
updateNitrogenFields(call_data);
|
1005 |
|
1006 |
-
|
1007 |
-
calculateOxidePercentages(call_data);
|
1008 |
// Обновляем значения NPK
|
1009 |
|
1010 |
-
|
1011 |
|
1012 |
// Получаем температуру из формы
|
1013 |
const temperature = parseFloat(document.getElementById('profile_temp').value) || 25;
|
@@ -1094,108 +1093,57 @@ function updateNitrogenFields(data) {
|
|
1094 |
|
1095 |
|
1096 |
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
const
|
1104 |
-
|
1105 |
-
|
1106 |
-
const
|
1107 |
-
|
1108 |
-
|
1109 |
-
const
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
//
|
1118 |
-
|
1119 |
-
|
1120 |
-
const
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
document.getElementById("
|
|
|
|
|
1140 |
}
|
1141 |
|
1142 |
|
1143 |
|
1144 |
|
1145 |
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
function calculateOxidePercentages(data) {
|
1152 |
-
console.log("=== РАСЧЕТ ПРОЦЕНТОВ ОКСИДОВ ===");
|
1153 |
-
|
1154 |
-
// Извлекаем данные из ответа сервера
|
1155 |
-
const actualProfile = data.actual_profile;
|
1156 |
-
const totalPpm = data.total_ppm;
|
1157 |
-
|
1158 |
-
// Молярные массы элементов и оксидов
|
1159 |
-
const molarMasses = {
|
1160 |
-
Ca: 40.08,
|
1161 |
-
Mg: 24.3,
|
1162 |
-
S: 32.07,
|
1163 |
-
CaO: 56.08,
|
1164 |
-
MgO: 40.3,
|
1165 |
-
SO: 48.07
|
1166 |
-
};
|
1167 |
-
|
1168 |
-
// Масса чистых элементов
|
1169 |
-
const caMass = actualProfile["Ca"] || 0;
|
1170 |
-
const mgMass = actualProfile["Mg"] || 0;
|
1171 |
-
const sMass = actualProfile["S"] || 0;
|
1172 |
-
|
1173 |
-
// Преобразуем массы чистых элементов в массы оксидов
|
1174 |
-
const caOMass = caMass * (molarMasses.CaO / molarMasses.Ca);
|
1175 |
-
const mgOMass = mgMass * (molarMasses.MgO / molarMasses.Mg);
|
1176 |
-
const sOMass = sMass * (molarMasses.SO / molarMasses.S);
|
1177 |
-
|
1178 |
-
// Рассчитываем проценты оксидов
|
1179 |
-
const caOPercentage = ((caOMass / totalPpm) * 100).toFixed(2);
|
1180 |
-
const mgOPercentage = ((mgOMass / totalPpm) * 100).toFixed(2);
|
1181 |
-
const sOPercentage = ((sOMass / totalPpm) * 100).toFixed(2);
|
1182 |
-
|
1183 |
-
console.log(`Проценты оксидов: CaO=${caOPercentage}%, MgO=${mgOPercentage}%, SO=${sOPercentage}%`);
|
1184 |
-
|
1185 |
-
// Обновляем значения на странице (только проценты)
|
1186 |
-
document.getElementById("caMaS-ca-value").textContent = `${caOPercentage}%`;
|
1187 |
-
document.getElementById("caMaS-mg-value").textContent = `${mgOPercentage}%`;
|
1188 |
-
document.getElementById("caMaS-so-value").textContent = `${sOPercentage}%`;
|
1189 |
-
}
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
|
1200 |
|
1201 |
function calculateCationsAndAnions(data) {
|
|
|
1003 |
// Обновляем поля NH4 и NO3
|
1004 |
updateNitrogenFields(call_data);
|
1005 |
|
1006 |
+
|
|
|
1007 |
// Обновляем значения NPK
|
1008 |
|
1009 |
+
calculateAndUpdate(call_data);
|
1010 |
|
1011 |
// Получаем температуру из формы
|
1012 |
const temperature = parseFloat(document.getElementById('profile_temp').value) || 25;
|
|
|
1093 |
|
1094 |
|
1095 |
|
1096 |
+
function calculateAndUpdate(data) {
|
1097 |
+
console.log("=== РАСЧЕТ И ОБНОВЛЕНИЕ ДАННЫХ ===");
|
1098 |
+
|
1099 |
+
// Извлекаем значения из actual_profile
|
1100 |
+
const nValue = (data.actual_profile["N (NH4+)"] || 0) + (data.actual_profile["N (NO3-)"] || 0);
|
1101 |
+
const pValue = data.actual_profile["P"] || 0;
|
1102 |
+
const kValue = data.actual_profile["K"] || 0;
|
1103 |
+
const caValue = data.actual_profile["Ca"] || 0;
|
1104 |
+
const mgValue = data.actual_profile["Mg"] || 0;
|
1105 |
+
const sValue = data.actual_profile["S"] || 0;
|
1106 |
+
|
1107 |
+
// Принимаем общий азот за 16%
|
1108 |
+
const totalMass = nValue / 0.16;
|
1109 |
+
|
1110 |
+
// Переводим элементы в оксидную форму
|
1111 |
+
const nPercent = 16; // Азот уже принят за 16%
|
1112 |
+
const pOxide = pValue * 2.29; // P → P2O5
|
1113 |
+
const kOxide = kValue * 1.2; // K → K2O
|
1114 |
+
const caOxide = caValue * 1.4; // Ca → CaO
|
1115 |
+
const mgOxide = mgValue * 1.67; // Mg → MgO
|
1116 |
+
const sOxide = sValue * 2.5; // S → SO3
|
1117 |
+
|
1118 |
+
// Рассчитываем проценты от общей массы
|
1119 |
+
const pPercent = (pOxide / totalMass) * 100;
|
1120 |
+
const kPercent = (kOxide / totalMass) * 100;
|
1121 |
+
const caPercent = (caOxide / totalMass) * 100;
|
1122 |
+
const mgPercent = (mgOxide / totalMass) * 100;
|
1123 |
+
const sPercent = (sOxide / totalMass) * 100;
|
1124 |
+
|
1125 |
+
console.log(`Результаты расчета:
|
1126 |
+
N: ${nPercent.toFixed(2)}%,
|
1127 |
+
P2O5: ${pPercent.toFixed(2)}%,
|
1128 |
+
K2O: ${kPercent.toFixed(2)}%,
|
1129 |
+
CaO: ${caPercent.toFixed(2)}%,
|
1130 |
+
MgO: ${mgPercent.toFixed(2)}%,
|
1131 |
+
SO3: ${sPercent.toFixed(2)}%`);
|
1132 |
+
|
1133 |
+
// Обновляем HTML-элементы
|
1134 |
+
document.getElementById("npk-n-value").textContent = nPercent.toFixed(2);
|
1135 |
+
document.getElementById("npk-p-value").textContent = pPercent.toFixed(2);
|
1136 |
+
document.getElementById("npk-k-value").textContent = kPercent.toFixed(2);
|
1137 |
+
|
1138 |
+
document.getElementById("caMaS-ca-value").textContent = caPercent.toFixed(2);
|
1139 |
+
document.getElementById("caMaS-mg-value").textContent = mgPercent.toFixed(2);
|
1140 |
+
document.getElementById("caMaS-so-value").textContent = sPercent.toFixed(2);
|
1141 |
}
|
1142 |
|
1143 |
|
1144 |
|
1145 |
|
1146 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1147 |
|
1148 |
|
1149 |
function calculateCationsAndAnions(data) {
|