File size: 8,328 Bytes
2737675
 
 
 
 
 
 
 
bf9b840
2737675
 
bf9b840
 
 
2737675
 
 
 
 
 
93a28dc
1c86ac2
 
bf9b840
1c86ac2
 
 
 
 
bf9b840
1c86ac2
 
 
 
 
bf9b840
1c86ac2
 
 
 
 
bf9b840
1c86ac2
 
 
 
 
bf9b840
1c86ac2
 
 
 
 
 
 
93a28dc
 
 
 
 
 
 
 
 
 
1c86ac2
 
 
2737675
93a28dc
2737675
 
93a28dc
 
 
 
1c86ac2
 
93a28dc
 
3eae11a
95a95fd
5a49b9e
 
 
 
 
 
 
 
 
 
 
95a95fd
 
5a49b9e
 
 
 
 
 
 
95a95fd
 
 
 
 
 
3eae11a
95a95fd
3eae11a
 
 
95a95fd
 
3eae11a
 
 
 
8d6fcca
95a95fd
3eae11a
8d6fcca
3eae11a
 
 
95a95fd
3eae11a
8d6fcca
3eae11a
 
8d6fcca
 
 
 
 
 
 
 
 
 
 
 
95a95fd
3eae11a
 
 
8d6fcca
3eae11a
8d6fcca
 
3eae11a
5a49b9e
3eae11a
 
 
8d6fcca
3eae11a
 
 
 
 
 
 
 
 
95a95fd
93a28dc
2737675
93a28dc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<!DOCTYPE html>
<html lang="ru">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Расчёт удобрений с азотом</title>
    <style>
        body { font-family: Arial, sans-serif; margin: 20px; }
        input { padding: 8px; margin: 5px; width: 100px; }
        button { padding: 8px 12px; cursor: pointer; margin-top: 10px; }
        .result { margin-top: 20px; }
        .fertilizer-group { margin-bottom: 15px; display: flex; align-items: center; }
        .fertilizer-group label { margin-right: 10px; }
        .fertilizer-group input { margin-right: 20px; }
    </style>
</head>
<body>
    <h1>Расчёт удобрений для смешивания с азотом</h1>

    <div>
        <h3>Введите состав удобрений (%):</h3>
        <div class="fertilizer-group">
            <label>Ca в Ca(NO₃)₂·4H₂O:</label>
            <input type="number" id="ca_content_ca" value="19.3" step="0.1">
            <label>N в Ca(NO₃)₂·4H₂O:</label>
            <input type="number" id="ca_content_n" value="14.9" step="0.1">
        </div>
        <div class="fertilizer-group">
            <label>P в KH₂PO₄:</label>
            <input type="number" id="kh2po4_content_p" value="21.8" step="0.1">
            <label>K в KH₂PO₄:</label>
            <input type="number" id="kh2po4_content_k" value="27.4" step="0.1">
        </div>
        <div class="fertilizer-group">
            <label>K в KNO₃:</label>
            <input type="number" id="kno3_content_k" value="38" step="0.1">
            <label>N в KNO₃:</label>
            <input type="number" id="kno3_content_n" value="13.5" step="0.1">
        </div>
        <div class="fertilizer-group">
            <label>Mg в MgSO₄·7H₂O:</label>
            <input type="number" id="mgso4_content_mg" value="10.14" step="0.1">
            <label>S в MgSO₄·7H₂O:</label>
            <input type="number" id="mgso4_content_s" value="13.5" step="0.1">
        </div>
        <div class="fertilizer-group">
            <label>K в K₂SO₄:</label>
            <input type="number" id="k2so4_content_k" value="41.5" step="0.1">
            <label>S в K₂SO₄:</label>
            <input type="number" id="k2so4_content_s" value="18" step="0.1">
        </div>
        <div class="fertilizer-group">
            <label>N в NH₄NO₃:</label>
            <input type="number" id="nh4no3_content_n" value="34" step="0.1">
        </div>

        <h3>Требуемые концентрации (мг/л):</h3>
        <label>Ca:</label><input type="number" id="ca" placeholder="50" step="0.1"><br>
        <label>P:</label><input type="number" id="p" placeholder="50" step="0.1"><br>
        <label>K:</label><input type="number" id="k" placeholder="100" step="0.1"><br>
        <label>Mg:</label><input type="number" id="mg" placeholder="25" step="0.1"><br>
        <label>S:</label><input type="number" id="s" placeholder="20" step="0.1"><br>
        <label>N:</label><input type="number" id="nitrogen" value="50" step="0.1"><br>

        <h3>Соотношение N (NH₄NO₃):</h3>
        <label>NH₄NO₃ (0-1):</label>
        <input type="range" id="n_ratio" min="0" max="10" value="5">
        <span id="n_ratio_value">0.5</span><br>

        <button onclick="calculate()">Рассчитать</button>
    </div>

    <div class="result" id="result"></div>

    <script>
        document.getElementById('n_ratio').addEventListener('input', function() {
            const ratio = (this.value / 10).toFixed(1);
            document.getElementById('n_ratio_value').textContent = ratio;
        });

function calculate() {
    // Состав удобрений (% → доли)
    const caContentCa = parseFloat(document.getElementById("ca_content_ca").value) / 100;
    const caContentN = parseFloat(document.getElementById("ca_content_n").value) / 100;
    const kh2po4ContentP = parseFloat(document.getElementById("kh2po4_content_p").value) / 100;
    const kh2po4ContentK = parseFloat(document.getElementById("kh2po4_content_k").value) / 100;
    const kno3ContentK = parseFloat(document.getElementById("kno3_content_k").value) / 100;
    const kno3ContentN = parseFloat(document.getElementById("kno3_content_n").value) / 100;
    const mgso4ContentMg = parseFloat(document.getElementById("mgso4_content_mg").value) / 100;
    const mgso4ContentS = parseFloat(document.getElementById("mgso4_content_s").value) / 100;
    const k2so4ContentK = parseFloat(document.getElementById("k2so4_content_k").value) / 100;
    const k2so4ContentS = parseFloat(document.getElementById("k2so4_content_s").value) / 100;
    const nh4no3ContentN = parseFloat(document.getElementById("nh4no3_content_n").value) / 100;

    // Требуемые концентрации (мг/л)
    const ca = parseFloat(document.getElementById("ca").value) || 0;
    const p = parseFloat(document.getElementById("p").value) || 0;
    const k = parseFloat(document.getElementById("k").value) || 0;
    const mg = parseFloat(document.getElementById("mg").value) || 0;
    const s = parseFloat(document.getElementById("s").value) || 0;
    const nitrogen = parseFloat(document.getElementById("nitrogen").value) || 0;
    const nRatio = parseFloat(document.getElementById("n_ratio").value) / 10;

    // Проверка ввода
    if ([ca, p, k, mg, s, nitrogen].some(v => isNaN(v))) {
        document.getElementById("result").innerHTML = "Введите все значения!";
        return;
    }

    // Расчёт
    let kh2po4 = p / kh2po4ContentP;
    let kFromKH2PO4 = kh2po4 * kh2po4ContentK;

    let caNO3FromCa = ca / caContentCa;
    let nFromCaNO3Min = caNO3FromCa * caContentN;

    let nFromNH4NO3 = nitrogen * nRatio;
    let nh4no3 = nFromNH4NO3 / nh4no3ContentN;

    let mgso4 = mg / mgso4ContentMg;
    let sFromMgSO4 = mgso4 * mgso4ContentS;

    let kRemaining = k - kFromKH2PO4;
    let kno3 = kRemaining > 0 ? kRemaining / kno3ContentK : 0;
    let nFromKNO3 = kno3 * kno3ContentN;

    let totalN = nFromCaNO3Min + nFromNH4NO3 + nFromKNO3;
    let nDelta = nitrogen - totalN;
    let caNO3Extra = nDelta > 0 ? nDelta / caContentN : 0;
    let caNO3Total = caNO3FromCa + caNO3Extra;

    let totalS = sFromMgSO4;
    let sRemaining = s - totalS;
    let k2so4 = sRemaining > 0 ? sRemaining / k2so4ContentS : 0;
    let kFromK2SO4 = k2so4 * k2so4ContentK;

    // Проверка, не превышает ли K₂SO₄ допустимое количество калия
    let totalK = kFromKH2PO4 + kFromK2SO4 + kno3 * kno3ContentK;
    if (totalK > k) {
        let excessK = totalK - k;
        let k2so4Reduction = excessK / k2so4ContentK;
        k2so4 = Math.max(0, k2so4 - k2so4Reduction);
        totalK = kFromKH2PO4 + (k2so4 * k2so4ContentK) + kno3 * kno3ContentK;
    }

    totalN = (caNO3Total * caContentN + nh4no3 * nh4no3ContentN + kno3 * kno3ContentN).toFixed(2);
    let totalP = (kh2po4 * kh2po4ContentP).toFixed(2);
    totalK = totalK.toFixed(2);
    let totalCa = (caNO3Total * caContentCa).toFixed(2);
    let totalMg = (mgso4 * mgso4ContentMg).toFixed(2);
    totalS = ((mgso4 * mgso4ContentS) + (k2so4 * k2so4ContentS)).toFixed(2);

    // Отображение результатов
    const result = `
        <h3>Результат расчёта (г/1000 л):</h3>
        <p>MgSO₄·7H₂O: ${mgso4.toFixed(2)} (Mg: ${totalMg}, S: ${sFromMgSO4.toFixed(2)})</p>
        <p>K₂SO₄: ${k2so4.toFixed(2)} (K: ${(k2so4 * k2so4ContentK).toFixed(2)}, S: ${(k2so4 * k2so4ContentS).toFixed(2)})</p>
        <p>KH₂PO₄: ${kh2po4.toFixed(2)} (P: ${totalP}, K: ${kFromKH2PO4.toFixed(2)})</p>
        <p>KNO₃: ${kno3.toFixed(2)} (N: ${nFromKNO3.toFixed(2)}, K: ${(kno3 * kno3ContentK).toFixed(2)})</p>
        <p>Ca(NO₃)₂·4H₂O: ${caNO3Total.toFixed(2)} (N: ${(caNO3Total * caContentN).toFixed(2)}, Ca: ${totalCa})</p>
        <p>NH₄NO₃: ${nh4no3.toFixed(2)} (N: ${nFromNH4NO3.toFixed(2)})</p>
        <h3>Итоговые концентрации (мг/л):</h3>
        <p>N: ${totalN}, P: ${totalP}, K: ${totalK}, Ca: ${totalCa}, Mg: ${totalMg}, S: ${totalS}</p>
    `;
    document.getElementById("result").innerHTML = result;
}

    </script>
</body>
</html>