-
Notifications
You must be signed in to change notification settings - Fork 5
/
plot.py
41 lines (36 loc) · 1 KB
/
plot.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
from math import exp
import matplotlib.pyplot as plt
import numpy as np
def calc_limit_1(temp) -> int:
""" Calculate limit for risk level 1 """
if 0 <= temp <= 50:
limit = 20 * exp( -temp * 0.15 ) + 73
return max(min(100,limit),72)
else:
return 100
def calc_limit_2(temp) -> int:
""" Calculate limit for risk level 2 """
if 0 <= temp <= 50:
limit = 17 * exp( -temp * 0.11 ) + 80
return max(min(100,limit),79)
else:
return 100
def calc_limit_3(temp) -> int:
""" Calculate limit for risk level 3 """
if 0 <= temp <= 50:
limit = 15 * exp( -temp * 0.10 ) + 85
return max(min(100,limit),84)
else:
return 100
temp = np.arange(-10., 60., 0.5)
y1 = [calc_limit_1(x) for x in temp]
plt.plot(temp, y1)
y2 = [calc_limit_2(x) for x in temp]
plt.plot(temp, y2)
y3 = [calc_limit_3(x) for x in temp]
plt.plot(temp, y3)
plt.xlabel('Temperature (°C)')
plt.ylabel('RH (%)')
plt.grid(True)
plt.axis([-10,60,70,100])
plt.show()