actualizacion
This commit is contained in:
		
							parent
							
								
									8a19683b30
								
							
						
					
					
						commit
						b958790378
					
				| @ -63,25 +63,30 @@ def simular(tensionCap, Rtotal, Lbobina, Ctotal, lts_path, tSim = 100e-3, toff_s | ||||
|      | ||||
|     simulador.run(netlist) | ||||
| 
 | ||||
|     for raw_path, log_path in simulador: | ||||
|         raw = RawRead(raw_path) | ||||
|     raw_path, log_path = next(iter(simulador))  # Obtener el único resultado | ||||
|     raw = RawRead(raw_path) | ||||
| 
 | ||||
|     try: | ||||
|         return { | ||||
|             'tiempo': np.array(raw.get_trace('time')), | ||||
|             'vCap': np.array(raw.get_trace('V(condensador)')), | ||||
|             'vBob': np.array(raw.get_trace('V(v1)')) - np.array(raw.get_trace('V(v2)')), | ||||
|             'iBob': np.array(raw.get_trace('I(L1)')) | ||||
|         } | ||||
|     except KeyError as e: | ||||
|         print(f'Error al leer señal del archivo .raw: {e}') | ||||
|         return None | ||||
|      | ||||
|         try: | ||||
|             return{ | ||||
|                 'tiempo' : np.array(raw.get_trace('time')), | ||||
|                 'vCap' : np.array(raw.get_trace('V(condensador)')), | ||||
|                 'vBob' : np.array(raw.get_trace('V(V1)')) - np.array(raw.get_trace('V(V2)')), | ||||
|                 'iBob' : np.array(raw.get_trace('I(L1)'))  | ||||
|                 } | ||||
|          | ||||
|         except KeyError as e:  | ||||
|             print(f'Error: {e}') | ||||
|             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__': | ||||
| 
 | ||||
|     lts_path = "C:/Users/osuescuneli/AppData/Local/Programs/ADI/LTspice/LTspice.exe" | ||||
| @ -105,11 +110,5 @@ if __name__ == '__main__': | ||||
|                         toff_sw = tiempoSwitch, | ||||
|                         ton_mos = tiempoMos) | ||||
|      | ||||
| 
 | ||||
|     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() | ||||
|     dibujar(resultado) | ||||
|      | ||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Oscar Suescun Elizalde
						Oscar Suescun Elizalde