Implementacion de funciones mecanicas
This commit is contained in:
parent
f045c115d8
commit
26186fc38e
3
src/debug_mecanica_disparo.py
Normal file
3
src/debug_mecanica_disparo.py
Normal file
@ -0,0 +1,3 @@
|
||||
from funcionesSimELectrica import *
|
||||
from funcionesSimFisica import *
|
||||
|
@ -71,7 +71,8 @@ def simular(tensionCap, Rtotal, Lbobina, Ctotal, lts_path, tSim = 100e-3, toff_s
|
||||
'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)'))
|
||||
'iBob': np.array(raw.get_trace('I(L1)')),
|
||||
'iMos' : np.array(raw.get_trace('Id(M1)'))
|
||||
}
|
||||
except KeyError as e:
|
||||
print(f'Error al leer señal del archivo .raw: {e}')
|
||||
@ -79,9 +80,9 @@ def simular(tensionCap, Rtotal, Lbobina, Ctotal, lts_path, tSim = 100e-3, toff_s
|
||||
|
||||
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.plot(resultado['tiempo']*1e3, resultado['vCap'], label='Tension Cap [V]')
|
||||
plt.plot(resultado['tiempo']*1e3, resultado['vBob'], label='Tension Bobina [V]')
|
||||
plt.plot(resultado['tiempo']*1e3, resultado['iBob'], label='Corriente Bobina [A]')
|
||||
plt.grid()
|
||||
plt.legend()
|
||||
plt.show()
|
||||
@ -91,10 +92,10 @@ if __name__ == '__main__':
|
||||
|
||||
lts_path = "C:/Users/osuescuneli/AppData/Local/Programs/ADI/LTspice/LTspice.exe"
|
||||
|
||||
Tension = 50
|
||||
Resistencia = 1.942
|
||||
Inductancia = 11e-6
|
||||
Capacitancia = 1e-3
|
||||
Tension = 150
|
||||
Resistencia = 4
|
||||
Inductancia = 100e-6
|
||||
Capacitancia = 500e-6
|
||||
|
||||
tiempoSimulacion = 15e-3
|
||||
tiempoSwitch = 25e-6
|
105
src/funcionesSimFisica.py
Normal file
105
src/funcionesSimFisica.py
Normal file
@ -0,0 +1,105 @@
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
global muVacio
|
||||
global muFeRel
|
||||
global kDisp
|
||||
global cteRoz
|
||||
global g
|
||||
|
||||
densidadHierro = 7800 # kg/m3
|
||||
muVacio = 4*np.pi*1e-7
|
||||
muFeRel = 5000
|
||||
kDisp = 2 # cte de dispersion
|
||||
cteRoz = 0.1
|
||||
g = 9.8
|
||||
|
||||
__author__ = 'Oscar Suescun'
|
||||
|
||||
def calcular_diametro_ext(longitudBobina, diametroCuBobina, espirasBobina, diametroInteriorBobina):
|
||||
|
||||
espirasCapa = int(longitudBobina/diametroCuBobina)
|
||||
numeroCapas = int(espirasBobina/espirasCapa +.5)
|
||||
|
||||
return 2 * numeroCapas * diametroCuBobina + diametroInteriorBobina
|
||||
|
||||
def reluctancia_funcX(longFe, diamFe, longC, diamCint, diamCu, espiras):
|
||||
'''
|
||||
Esta funcion devuelve un vector que contenga la reluctancia total en
|
||||
funcion de la distancia que recorre el vastago dentro de la bobina.
|
||||
|
||||
Para esto se utiliza un vector de 0 -> longC con un estep de longC/100
|
||||
|
||||
Entrada:
|
||||
- longFe --> longitud del vastago
|
||||
- diamFe --> diametro del vastago
|
||||
- longC --> longitud de la bobina
|
||||
- diamCint --> diametro interior de la bobina
|
||||
- diamCu --> diametro del hilo de cobre
|
||||
- espiras --> numero de espiras en la bobina
|
||||
|
||||
Salida:
|
||||
- relTotal --> devuelve un vector con la reluctancia total en
|
||||
funcion de la distancia recorrida en la bobina.
|
||||
|
||||
'''
|
||||
|
||||
diamCext = calcular_diametro_ext(longC, diamCu, espiras, diamCint)
|
||||
|
||||
seccionFe = (np.pi * diamFe**2) / 4
|
||||
seccionSc = (np.pi * diamCext**2) / 4
|
||||
seccionDisp = (np.pi * (kDisp * diamCint)**2) / 4
|
||||
|
||||
x = np.arange(0,longC + longC/100, longC/100)
|
||||
longFe = np.full(len(x), longFe)
|
||||
longC = np.full(len(x), longC)
|
||||
|
||||
|
||||
relFe = longFe / (muVacio * muFeRel * seccionFe)
|
||||
relDisp = longC / (muVacio * seccionDisp)
|
||||
relAire = (longC - x) / (muVacio * seccionSc)
|
||||
relFlujo = (longC + longFe - x) / (muVacio * seccionDisp)
|
||||
|
||||
relTotal = relFe + relDisp + relAire + relFlujo
|
||||
|
||||
return relTotal
|
||||
|
||||
|
||||
def induccion(corriente, reluctancia, espiras, diamFe):
|
||||
flujo = espiras * corriente / reluctancia
|
||||
|
||||
secFe = np.pi * diamFe**2 / 4
|
||||
|
||||
return flujo / secFe
|
||||
|
||||
def fuerza_magnetica(corriente, reluctancia, espiras, diamFe):
|
||||
|
||||
b = induccion(corriente, reluctancia, espiras, diamFe)
|
||||
|
||||
secFe = np.pi * diamFe**2 / 4
|
||||
|
||||
return 0.5 * b**2 * secFe / muVacio
|
||||
|
||||
def aceleracion(masa, anguloDisparo, fuerzaMagnetica):
|
||||
|
||||
anguloDisparo = anguloDisparo * np.pi / 180
|
||||
|
||||
return fuerzaMagnetica/masa - g*(cteRoz * np.cos(anguloDisparo) + np.sen(anguloDisparo))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
numeroModulos = 1
|
||||
|
||||
longitudBobina = 53.21e-3 # m
|
||||
diametroInteriorBobina = 6.035-3 * 2 # m
|
||||
espirasBobina = 500
|
||||
diametroCuBobina = 0.8e-3 # m
|
||||
|
||||
longitudVastago = 96e-3 # m
|
||||
diametroVastago = 3.045e-3 * 2 # m
|
||||
|
||||
|
@ -16,10 +16,10 @@ R1 condensador V1 {R}
|
||||
.param tsim 15m
|
||||
.param toff_sw 25u
|
||||
.param ton_mos 50u
|
||||
.param R 1.942
|
||||
.param C 1m
|
||||
.param L 11u
|
||||
.param V 50
|
||||
.param R 4
|
||||
.param C 500u
|
||||
.param L 100u
|
||||
.param V 150
|
||||
.param delta tsim-ton_mos
|
||||
.backanno
|
||||
.end
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user