Created
November 30, 2017 16:26
-
-
Save VladisM/4539dabca9c5f5c2765527df0bee7ebc to your computer and use it in GitHub Desktop.
Calculator for IFX1963 voltage stabilizer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| # | |
| # ifx1963.py | |
| # | |
| # Calculate resistor values for IFX1963 adjustable stabilizer. Set | |
| # parameters and then run it from terminal. Output is in csv format, you | |
| # can pipe it into file. | |
| # | |
| # Copyright 2017 Vladislav <[email protected]> | |
| # | |
| # This program is free software; you can redistribute it and/or modify | |
| # it under the terms of the GNU General Public License as published by | |
| # the Free Software Foundation; either version 2 of the License, or | |
| # (at your option) any later version. | |
| # | |
| # This program is distributed in the hope that it will be useful, | |
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| # GNU General Public License for more details. | |
| # | |
| # You should have received a copy of the GNU General Public License | |
| # along with this program; if not, write to the Free Software | |
| # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
| # MA 02110-1301, USA. | |
| #define resistor values | |
| e24 = [1.0, 1.1, 1.2, 1.3, 1.5, 1.6, 1.8, 2.0, 2.2, 2.4, 2.7, 3.0, 3.3, 3.6, 3.9, 4.3, 4.7, 5.1, 5.6, 6.2, 6.8, 7.5, 8.2, 9.1, 10, 11, 12, 13, 15, 16, 18, 20, 22, 24, 27, 30, 33, 36, 39, 43, 47, 51, 56, 62, 68, 75, 82, 91, 100, 110, 120, 130, 150, 160, 180, 200, 220, 240, 270, 300, 330, 360, 390, 430, 470, 510, 560, 620, 680, 750, 820, 910, 1000, 1100, 1200, 1300, 1500, 1600, 1800, 2000, 2200, 2400, 2700, 3000, 3300, 3600, 3900, 4300, 4700, 5100, 5600, 6200, 6800, 7500, 8200, 9100, 10000, 11000, 12000, 13000, 15000, 16000, 18000, 20000, 22000, 24000, 27000, 30000, 33000, 36000, 39000, 43000, 47000, 51000, 56000, 62000, 68000, 75000, 82000, 91000, 100000, 110000, 120000, 130000, 150000, 160000, 180000, 200000, 220000, 240000, 270000, 300000, 330000, 360000, 390000, 430000, 470000, 510000, 560000, 620000, 680000, 750000, 820000, 910000, 1000000] | |
| e12 = [1.0, 1.2, 1.5, 1.8, 2.2, 2.7, 3.3, 3.9, 4.7, 5.6, 6.8, 8.2, 10, 12, 15, 18, 22, 27, 33, 39, 47, 56, 68, 82, 100, 120, 150, 180, 220, 270, 330, 390, 470, 560, 680, 820, 1000, 1200, 1500, 1800, 2200, 2700, 3300, 3900, 4700, 5600, 6800, 8200, 10000, 12000, 15000, 18000, 22000, 27000, 33000, 39000, 47000, 56000, 68000, 82000, 100000, 120000, 150000, 180000, 220000, 270000, 330000, 390000, 470000, 560000, 680000, 820000, 1000000] | |
| e6 = [1.0, 1.5, 2.2, 3.3, 4.7, 6.8, 100, 150, 220, 330, 470, 68, 1000, 1500, 2200, 3300, 4700, 68, 10000, 15000, 22000, 33000, 47000, 68, 100000, 150000, 220000, 330000, 470000, 68, 1000000] | |
| ################################# | |
| # Set parameters | |
| # | |
| #specify resistor values | |
| r_val = e24 | |
| #specify output voltage | |
| vout = 5 | |
| #output voltage will be vout +/- tolerance | |
| tolerance = 0.1 | |
| #specify maximum and minimum R values | |
| r1max = max(r_val) | |
| r1min = min(r_val) | |
| r2max = max(r_val) | |
| r2min = min(r_val) | |
| # | |
| # do not edit anything bellow | |
| ################################# | |
| vadj = 1.21 | |
| iadj = 1e-6 | |
| def main(): | |
| print "Vout [V]; R1 [ohm]; R2 [ohm]; error [%]" | |
| for r1 in r_val: | |
| for r2 in r_val: | |
| result = vadj * (1 + (r2/r1)) + iadj * r2 | |
| error = (vout - result)/vout * 100 | |
| if ((vout - tolerance) <= result <= (vout + tolerance)) and (r1 < 12000) and (r1min <= r1 <= r1max) and (r2min <= r2 <= r2max): | |
| print result, ";", r1, ";", r2, ";", error | |
| return 0 | |
| if __name__ == '__main__': | |
| import sys | |
| sys.exit(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment