File size: 6,710 Bytes
2737675
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93a28dc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2737675
93a28dc
2737675
93a28dc
2737675
 
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
<!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: 200px; }
        button { padding: 8px 12px; cursor: pointer; margin-top: 10px; }
        .result { margin-top: 20px; }
    </style>
</head>
<body>
    <h1>Расчёт удобрений для смешивания с азотом</h1>

    <div>
        <h3>Введите состав удобрений (%):</h3>
        <label>Ca в Ca(NO₃)₂·4H₂O:</label>
        <input type="number" id="ca_content" value="19.3" step="0.1"><br>
        <label>P в KH₂PO₄:</label>
        <input type="number" id="p_content" value="21.8" step="0.1"><br>
        <label>K в KH₂PO₄:</label>
        <input type="number" id="k_content_kh2po4" value="27.4" step="0.1"><br>
        <label>K в KNO₃:</label>
        <input type="number" id="k_content_kno3" value="38" step="0.1"><br>
        <label>Mg в MgSO₄·7H₂O:</label>
        <input type="number" id="mg_content" value="10.14" step="0.1"><br>
        <label>S в K₂SO₄:</label>
        <input type="number" id="s_content" value="18" step="0.1"><br>

        <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₃ (%):</label>
        <input type="range" id="n_ratio" min="0" max="100" value="50">
        <span id="n_ratio_value">50%</span><br>

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

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

    <script>
        document.getElementById('n_ratio').addEventListener('input', function() {
            document.getElementById('n_ratio_value').textContent = this.value + '%';
        });

        function calculate() {
            // Состав удобрений (% → доли)
            const caContent = parseFloat(document.getElementById("ca_content").value) / 100;
            const pContent = parseFloat(document.getElementById("p_content").value) / 100;
            const kContentKH2PO4 = parseFloat(document.getElementById("k_content_kh2po4").value) / 100;
            const kContentKNO3 = parseFloat(document.getElementById("k_content_kno3").value) / 100;
            const mgContent = parseFloat(document.getElementById("mg_content").value) / 100;
            const sContent = parseFloat(document.getElementById("s_content").value) / 100;
            const nContentCaNO3 = 0.149; // N в Ca(NO₃)₂·4H₂O
            const nContentNH4NO3 = 0.34; // N в NH₄NO₃
            const nContentKNO3 = 0.135;  // N в KNO₃

            // Требуемые концентрации (мг/л)
            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) / 100;

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

            // Расчёт массы удобрений (г/1000 л)
            const caNO3FromCa = ca / caContent; // Ca(NO₃)₂ от Ca
            const nFromCaNO3Min = caNO3FromCa * nContentCaNO3; // Минимальный N от Ca(NO₃)₂
            const nRemaining = nitrogen - nFromCaNO3Min; // Остаток N
            const nNH4NO3 = nRemaining * nRatio; // N от NH₄NO₃
            const nCaNO3Extra = nRemaining * (1 - nRatio); // Дополнительный N от Ca(NO₃)₂
            const nh4no3 = nNH4NO3 / nContentNH4NO3; // Масса NH₄NO₃
            const caNO3Total = caNO3FromCa + (nCaNO3Extra / nContentCaNO3); // Итоговая масса Ca(NO₃)₂
            const kh2po4 = p / pContent; // KH₂PO₄ от P
            const kFromKH2PO4 = kh2po4 * kContentKH2PO4; // K от KH₂PO₄
            const kRemaining = k - kFromKH2PO4; // Остаток K
            const kno3 = kRemaining > 0 ? kRemaining / kContentKNO3 : 0; // KNO₃
            const nFromKNO3 = kno3 * nContentKNO3; // N от KNO₃
            const mgso4 = mg / mgContent; // MgSO₄
            const k2so4 = s / sContent; // K₂SO₄ (S)

            // Итоговые концентрации для проверки
            const totalN = (caNO3Total * nContentCaNO3 + nh4no3 * nContentNH4NO3 + kno3 * nContentKNO3).toFixed(2);
            const totalK = (kh2po4 * kContentKH2PO4 + kno3 * kContentKNO3).toFixed(2);

            // Вывод результата
            const resultText = `
                <h3>Необходимые удобрения (г/1000 л):</h3>
                <p>Ca(NO₃)₂·4H₂O: ${caNO3Total.toFixed(2)} (N: ${(caNO3Total * nContentCaNO3).toFixed(2)}, Ca: ${ca})</p>
                <p>NH₄NO₃: ${nh4no3.toFixed(2)} (N: ${(nh4no3 * nContentNH4NO3).toFixed(2)})</p>
                <p>KH₂PO₄: ${kh2po4.toFixed(2)} (P: ${p}, K: ${kFromKH2PO4.toFixed(2)})</p>
                <p>KNO₃: ${kno3.toFixed(2)} (N: ${nFromKNO3.toFixed(2)}, K: ${(kno3 * kContentKNO3).toFixed(2)})</p>
                <p>MgSO₄·7H₂O: ${mgso4.toFixed(2)} (Mg: ${mg})</p>
                <p>K₂SO₄: ${k2so4.toFixed(2)} (S: ${s})</p>
                <h3>Итоговые концентрации (мг/л):</h3>
                <p>N: ${totalN}, P: ${p}, K: ${totalK}, Ca: ${ca}, Mg: ${mg}, S: ${s}</p>
            `;
            document.getElementById("result").innerHTML = resultText;
        }
    </script>
</body>
</html>