From 4b4cfe29f5da6c77a7050de458ed9d82bb20e341 Mon Sep 17 00:00:00 2001 From: Jochen Vothknecht <jochen3120@gmail.com> Date: Tue, 27 Jul 2021 17:54:52 +0200 Subject: [PATCH] Adding PT calculator --- PT4115.py | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 PT4115.py diff --git a/PT4115.py b/PT4115.py new file mode 100644 index 0000000..da613fa --- /dev/null +++ b/PT4115.py @@ -0,0 +1,64 @@ + +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 -- GitLab