Skip to content
Snippets Groups Projects
PT4115.py 1016 B
Newer Older
fxk8y's avatar
fxk8y committed

Vin = 24
Vled = 10
Vd = 0.5

Iled = 1

Rshunt = 0.1
Rl = 0.1  # Inductor resistance

Rsw = 0.6  # Datasheet
ΔI = 0.3  # Datasheet

def ton(L): return (L * ΔI) / (Vin - Vled - Iled * (Rshunt + Rl + Rsw))

def toff(L): return (L * ΔI) / (Vled + Vd + Iled * (Rshunt + Rl))

def frq(L): return (1/(ton(L)+toff(L))) / 1e6

# >>> frq(33e-6)
# 0.8689533861037817











>>> def ton(L): return (L*0.3) / (24-10-1 * (0.1+0.1+0.6))
... 
>>> ton(1
... 
KeyboardInterrupt
>>> ton(1)
0.022727272727272728
>>> 2e5
200000.0
>>> 2e-5
2e-05
>>> ton(33e-6)
7.5e-07
>>> 1/ton(33e-6)
1333333.3333333333
>>> (1/ton(33e-6)) / 1e6
1.3333333333333333
>>> def tof(L): return (L*0.3) / (24+0.5+1 * (0.1+0.1))
... 
>>> def frq(L): return (1/(ton(L)+toff(L))) / 1e6
... 
>>> 
>>> 
>>> frq(33e-6)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 1, in frq
NameError: name 'toff' is not defined
>>> def toff(L): return (L*0.3) / (24+0.5+1 * (0.1+0.1))
... 
>>> frq(33e-6)
0.8689533861037817