This repository has been archived by the owner on Sep 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathecology3.py
115 lines (100 loc) · 3.21 KB
/
ecology3.py
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
from ecology2 import *
from tabulate import tabulate
import numpy
import matplotlib.pyplot as plt
def cm(M: float, F: float):
first = A * M * F * m() * kn() * n
second = (H**2) * ((V * dT) ** (1/3))
res = first / second
# print(f"{A} * {M} * {F} * {m()} * {kn()} * {n} / {H**2} * {((V * dT) ** (1/3))} = {res}")
return res
def xm(F: float):
res = ((5 * F) / 4) * d_() * H
# print(f"((5 * {F}) / 4) * {d_()} * {H}) = {res}")
return res
def d_():
if vm < 0.5:
res = 2.49 * (1 + 0.28 * (f() ** (1/3)))
elif 0.5 < vm <= 2:
res = 4.95 * vm * (1 + 0.28 + (f() ** (1/3)))
elif vm > 2:
res = 7 * (vm**(1/2)) * (1 + 0.28 * (f() ** (1/3)))
return res
def r():
res = (3 * uum) / ((2*(uum**2)) - uum + 2)
return res
def cmu(M: float, F: float):
res = r() * cm(M, F)
# print(r(), cm(M, F))
return res
def p():
if 0.25 <= uum <= 1:
res = (8.43 * ((1 - uum)**5)) + 1
elif uum > 1:
res = 0.32 * uum + 0.68
return res
def xmu(F: float):
res = p() * xm(F)
# print(p(), xm(F), res)
return res
def s(xxm_: float, F: float):
if xxm_ <= 1:
res = 3 * (xxm_**4) - 8 * (xxm_ ** 3) + 6 * (xxm_ ** 2)
return res
elif 1 < xxm_ <= 8:
res = 1.13 / (0.13 * (xxm_**2) + 1)
return res
elif F <= 1.5 and xxm_ > 8:
res = xxm_ / (3.58 * (xxm_**2) - 35.2 * xxm_ + 120)
return res
elif F > 1.5 and xxm_ > 8:
res = 1 / (0.1 * (xxm_**2) + 2.47 * xxm_ - 17.8)
return res
def c(xxm__: float, F: float, M: float):
s_ = s(xxm__, F)
res = s_ * cmu(M, F)
print(s_, cmu(M, F), res)
return res, s_
def um():
if vm < 0.5:
return 0.5
elif 0.5 < vm <= 2:
return vm
elif vm > 2:
return vm * (1 + 0.12 * (f() ** (1/2)))
if __name__ == "__main__":
dT = dt()
V = v1()
vm = vm()
u = 5.0
uum = u / um()
san_raz = [("ю", 13.5), ("c", 7.5), ("в", 15.0), ("з", 12.0)]
for emision in emisions:
if emision.name == "SO2":
x_ = []
data = []
y_ = []
range = (10, 50, 100, 300, 400, 500, 1000, 1500, 2000, 2500, 3000, 3500, 4000)
for num, x in enumerate(range):
xxm = x/xmu(emision.F)
res, s__ = c(xxm, emision.F, emision.actual_emissions)
data.append((num+1, x, xxm, s__, res, emision.name))
y_.append(res)
x_.append(x)
tab = tabulate(
data,
headers=["#", "x, м", "x/xmu", "S1", "C, мг/м**3", "Вещество"],
tablefmt="grid",
disable_numparse=True
)
print(tab)
plt.plot(x_, y_)
# plt.xticks(numpy.arange(0, max(x_)+1, 400.0))
# plt.yticks(numpy.arange(0, max(y_) + 1, 1.0 if emision.name == "CO" else 0.5))
plt.axhline(y=emision.pdkcc, color="r", linestyle='--')
plt.xlabel('Х, ми', loc="right")
plt.ylabel('С, мг/м^3', loc="top")
plt.title(emision.name)
plt.show()
for name, value in san_raz:
print(f"I_{name} = 3285*({value}/12.5) = {3285*(value/12.5)}")