actualizacion
This commit is contained in:
parent
8a19683b30
commit
b958790378
@ -63,23 +63,28 @@ def simular(tensionCap, Rtotal, Lbobina, Ctotal, lts_path, tSim = 100e-3, toff_s
|
|||||||
|
|
||||||
simulador.run(netlist)
|
simulador.run(netlist)
|
||||||
|
|
||||||
for raw_path, log_path in simulador:
|
raw_path, log_path = next(iter(simulador)) # Obtener el único resultado
|
||||||
raw = RawRead(raw_path)
|
raw = RawRead(raw_path)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return{
|
return {
|
||||||
'tiempo' : np.array(raw.get_trace('time')),
|
'tiempo': np.array(raw.get_trace('time')),
|
||||||
'vCap' : np.array(raw.get_trace('V(condensador)')),
|
'vCap': np.array(raw.get_trace('V(condensador)')),
|
||||||
'vBob' : np.array(raw.get_trace('V(V1)')) - np.array(raw.get_trace('V(V2)')),
|
'vBob': np.array(raw.get_trace('V(v1)')) - np.array(raw.get_trace('V(v2)')),
|
||||||
'iBob' : np.array(raw.get_trace('I(L1)'))
|
'iBob': np.array(raw.get_trace('I(L1)'))
|
||||||
}
|
}
|
||||||
|
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
print(f'Error: {e}')
|
print(f'Error al leer señal del archivo .raw: {e}')
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def dibujar(resultado):
|
||||||
|
plt.figure()
|
||||||
|
plt.plot(resultado['tiempo'], resultado['vCap'], label='Tension Cap [V]')
|
||||||
|
plt.plot(resultado['tiempo'], resultado['vBob'], label='Tension Bobina [V]')
|
||||||
|
plt.plot(resultado['tiempo'], resultado['iBob'], label='Corriente Bobina [A]')
|
||||||
|
plt.grid()
|
||||||
|
plt.legend()
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
@ -105,11 +110,5 @@ if __name__ == '__main__':
|
|||||||
toff_sw = tiempoSwitch,
|
toff_sw = tiempoSwitch,
|
||||||
ton_mos = tiempoMos)
|
ton_mos = tiempoMos)
|
||||||
|
|
||||||
|
dibujar(resultado)
|
||||||
|
|
||||||
plt.figure()
|
|
||||||
plt.plot(resultado['tiempo'], resultado['vCap'], label='Tension Cap [V]')
|
|
||||||
plt.plot(resultado['tiempo'], resultado['vBob'], label='Tension Bobina [V]')
|
|
||||||
plt.plot(resultado['tiempo'], resultado['iBob'], label='Corriente Bobina [A]')
|
|
||||||
plt.grid()
|
|
||||||
plt.legend()
|
|
||||||
plt.show()
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user