-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2.py
151 lines (136 loc) · 2.66 KB
/
2.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
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
from lab_utils import *
na = nom_ar
# exp da bateria
mvc_bat = uarray(
[
0,
205,
411,
607,
754,
828,
910,
993,
1037,
870,
1263,
1358,
1406,
1436,
1467,
1487,
1497,
1498,
],
1,
)
mvi_bat = uarray(
[
138.8,
120.6,
102.4,
85.1,
72.1,
65.7,
56.5,
51.1,
47.3,
62,
27.3,
19.1,
14.8,
12.2,
9.4,
7.8,
6.8,
6.7,
],
0.1,
)
ma_i = mvi_bat / 4.7 # mA
rc = mvc_bat / ma_i # ohm
a_i = ma_i * 1e-3
pc = rc * (a_i ** 2)
ponto_troca = list(nom_ar(mvc_bat)).index(
870
) # ponto onde ocorre a troca dos potenciometros
pc_100 = pc[:ponto_troca]
rc_100 = rc[:ponto_troca]
pc_1k = pc[ponto_troca:]
rc_1k = rc[ponto_troca:]
x1, y1 = na(rc_100), na(pc_100)
x2, y2 = na(rc_1k), na(pc_1k)
mvc_ordenado = np.array(
[
0,
205,
411,
607,
754,
828,
870,
1263,
1358,
1406,
1436,
1467,
1487,
1497,
1498,
]
)
mvi_ordenado = np.array(
[
138.8,
120.6,
102.4,
85.1,
72.1,
65.7,
62,
27.3,
19.1,
14.8,
12.2,
9.4,
7.8,
6.8,
6.7,
]
)
a_i = (mvi_ordenado / 4.7) * 1e-3
curva_x = mvc_ordenado / (a_i * 1e3)
curva_y = curva_x * (a_i ** 2)
if 1:
plt.plot(x1, y1)
plt.plot(x2, y2, color='green')
plt.plot(curva_x, curva_y, color='red', ls=':')
plt.scatter(list(x1)+list(x2), list(y1)+list(y2), c='black', label='Valores Discretos')
plt.ylabel("Pc (W)")
plt.xlabel("Rc (Ohm)")
plt.title("Gráfico de Rc x Pc")
plt.show()
ri = uf(55, 6)
# gráfico de n x (rc/ri)
rc = (mvc_ordenado*1e-3) / a_i # ohm
pc = rc * (a_i ** 2)
pc = nom_ar(pc)
rc = nom_ar(rc)
pi = ri.n * (( (mvi_ordenado * 1e-3 )/4.7)**2)
n = pc / (pc + pi)
plt.plot(rc/ri.n, n)
plt.scatter(rc/ri.n, n, color='black', label='Valores Reais')
plt.xlabel("Rc/Ri")
plt.ylabel("Eficiência")
plt.title("Gráfico da Eficiência x Rc/Ri")
plt.show()
ptmax = max(pi + pc)
plt.plot(rc/ri.n, pi/ptmax, color='blue', label='Pi/Ptmax')
plt.plot(rc/ri.n, pc/ptmax, color='red', label='Pc/Ptmax')
plt.plot(rc/ri.n, np.absolute((pi/ptmax) + (pc/ptmax)), color='green', label='|(Pi/Ptmax) + (Pc/Ptmax)|')
plt.xlabel("Rc/Ri")
plt.ylabel("Potência (W)")
plt.title("Gráfico das três curvas de potência")
plt.legend(loc='best')
plt.show()
print(gerar_tabela_latex(mvc_bat, mvi_bat, usar_i=False))