From 2d61b8e0f71e94a1a120ea73cca1079cf09555c7 Mon Sep 17 00:00:00 2001 From: Ilario Gelmetti Date: Thu, 6 Jul 2017 18:39:04 +0200 Subject: [PATCH] Add an option for setting maximum current limit --- README.md | 3 ++- mppTracker.py | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 36a3304..0350a35 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ cd mppTracker $ ./mppTracker.py -h usage: mppTracker.py [-h] [--dummy] [--visa_lib VISA_LIB] [--reverse_polarity] [--file FILE] [--scan] - [address] [t_dwell] [t_total] + [address] [t_dwell] [t_total] [max_current] Max power point tracker for solar cells using a Keithley 2400 sourcemeter (hopefully robust enough for perovskites). Data is written to stdout and human @@ -36,6 +36,7 @@ positional arguments: address VISA resource name for sourcemeter t_dwell Total number of seconds for the dwell phase(s) t_total Total number of seconds to run for + max_current Maximum current limit (amperes) optional arguments: -h, --help show this help message and exit diff --git a/mppTracker.py b/mppTracker.py index bee6179..fe41618 100755 --- a/mppTracker.py +++ b/mppTracker.py @@ -17,6 +17,7 @@ parser.add_argument("address", nargs='?', default=None, type=str, help="VISA resource name for sourcemeter") parser.add_argument("t_dwell", nargs='?', default=None, type=int, help="Total number of seconds for the dwell phase(s)") parser.add_argument("t_total", nargs='?', default=None, type=int, help="Total number of seconds to run for") +parser.add_argument("max_current", nargs='?', default=None, type=float, help="Maximum current limit (amperes)") parser.add_argument('--dummy', default=False, action='store_true', help="Run in dummy mode (doesn't need sourcemeter, generates simulated device data)") parser.add_argument('--visa_lib', type=str, help="Path to visa library in case pyvisa can't find it, try C:\\Windows\\system32\\visa64.dll") parser.add_argument('--reverse_polarity', default=False, action='store_true', help="Swaps voltage polarity on output terminals.") @@ -263,7 +264,10 @@ def close(self): ##NOTE: what if Isc degrades the device? maybe I should only sweep backwards ##until the power output starts dropping instead of going all the way to zero volts... sweepParams = {} # here we'll store the parameters that define our sweep -sweepParams['maxCurrent'] = 0.0001 # amps +if args.max_current is None: + sweepParams['maxCurrent'] = 0.0001 # amps +else: + sweepParams['maxCurrent'] = args.max_current sweepParams['sweepStart'] = Voc # volts sweepParams['sweepEnd'] = 0 # volts sweepParams['nPoints'] = 1001