<<

Electronic Load Applications and Examples Application Note

V 3032009

22820 Savi Ranch Parkway Yorba Linda CA, 92887-4610 www.bkprecision.com Table of Contents

INTRODUCTION...... 3 Overview of software examples...... 3 POWER SUPPLY TESTING...... 4 Load Transient Response...... 4 Load Regulation...... 5 Current Limiting...... 6 BATTERY TESTING...... 7 Battery Discharge Curves...... 7 Battery Internal Resistances...... 8 PERFORMANCE TESTING OF DC LOADS...... 10 Slew Rate...... 10 OTHER DC LOAD APPLICATIONS...... 12 Voltmeter...... 12 Fuse...... 12 SOFTWARE EXAMPLES...... 12 Battery Discharge ...... 13 Voltmeter Reading...... 15 Fuse Application...... 15 Reference...... 16 in the later sections utilize INTRODUCTION B&K Precision's DC load model Unfortunately, the software 8500 as part of the different files are supported only for setups and test configurations. Windows platforms. However, applications can be due to the excellent cross- simulated in the same fashion platform capabilities of with other brands of DC loads, As technology is constantly python, some users may be with the exception of all the advancing, demands for able to get the library ( software examples. They are quality test instruments does not have to be utilized written specifically for full increase due to the need for via COM) working on other compatibility with B&K making better and accurate platforms. Please see the Precision's 8500 series DC measurements to library's documentation for loads and are not intended to accommodate newer details. technologies. For most support other brands of DC electronic applications today, loads. In general, any measurements made with B&K using energy efficient and Although the software and Precision's equipments are reliable power sources is examples are written in typical, but not guaranteed. critical. For this reason, it is python, users have other important to have a test particular preferences in terms instrument that can accurately Overview of software of the programming language portray results that define the examples to use can easily use the COM performance of the power library provided in the sources used to provide software package to electricity for devices such as Throughout some of the similar examples in the electrical vehicles, computer sections in this application language of their choice. power supplies, 3G cellular note, software examples are Some languages that have phones, and even consumer provided to enhance and been found to work well with standard household batteries. simplify test methods as well the COM library are Visual Programmable DC Electronic as to bolster features of B&K Basic and Visual C#. Other loads are one such instrument Precision's 8500 series DC languages are also expected that will aid in testing various loads that can be controlled to work with the library, given settings, configurations, remotely with a PC computer the correct declarations and schemes, and methodologies. via RS-232 interface. Unless modifications within the The intention of this otherwise noted, all examples program. application note is to provide a are written in python general scope of a DC load's programming language. They usage. Some standard also require two python performance tests for testing libraries and the 8500 DC load power supplies will be COM library installed on the PC described in details. used for communication in Furthermore, several methods order to operate correctly. To for testing the DC load itself obtain all these as well as will be included in the later instructional documentation sections. Additional details on for installation and setup, practical DC load applications please visit one of our DC load and setup information are product pages : provided as a source to assist http://www.bkprecision.com/p in performing various test roducts/categories/sub_catego setups and measuring data. ries/models/? As a note, all applications and model=8500#software. software examples contained

3 of 17 POWER SUPPLY TESTING

For design testing and verification, the need for regulated power supplies are increasing with ongoing advancement in technology. More so, it has become a necessity in newer electronic devices to be tested with precise and sophisticated power supplies. There are some specifications that determine some underlying performance factors in typical power supplies. Particularly, Figure 2. Transient Response for B&K Precision 9130 the load transient response, load regulation, and current limit. In the following are ignored, and therefore the load current. In order to sections, each of these factors results may vary and may not verify the response, are addressed as an example reflect exactly what is shown measurements of the rise and to describe and demonstrate in the following sections. fall times upon a step change the setup, configuration, and in the load is necessary. Generally, this of test equipment required for testing Load Transient and verification. Each requires a load that is able to example will utilize B&K Response produce a rise and fall Precision's 8500 DC load as approximately five times part of the setup. An important element to faster than the power supply. power supply testing is a The following application Disclaimer: The following measurable unit of load demonstrates an effective sections include general transient response, which approach to testing the load setups with some settings characterizes the capability of transient response of a B&K specified for the test the power supply to stabilize Precision power supply model environment. Some details itself upon a step change in 9130.

Power Supply DC Load Settings: 5 V Mode: Transient Trigger: Pulse 0.1 A to 3.0 A Digital Oscilloscope Limit: 3.1 A Trigger: negative slope + - + -

Figure 1. Load Transient Response Test Setup

4 of 17 Objective transient response is observed to the rated current load of during the rise time in the load the power supply. Characterize the time it takes with a step change from 1.5 A for a power supply to stabilize to 3 A. The output voltage Approach its output voltage after a step dropped by approximately 1.6 change in the load. . Use a DC voltmeter to measure the voltage change Approach when the DC load is used to step the power supply from 0 Connect a DC load (B&K Load Regulation current to rated current. Precision 8500 DC load) to a power supply. Use the DC load's transient mode to apply Load regulation is another Setup a step change in load to the important element when The measurement is power supply. testing a power supply. It is a performance measurement conceptually simple, but it is that requires setting the power critical that the voltmeter Setup supply to its rated voltage. To used to measure the voltage be specific, the test for change is connected to the A B&K Precision 9130 power measuring this element is output terminals of the power supply was set to 5 V output based on measuring the supply independently of the with the current limit set to 3 output voltage levels of the leads used to connect to the A. A B&K Precision 2542 supply when a load connected DC load. Failure to do this will digital oscilloscope was used to it changes from zero measure the contact to view the power supply's current to rated current, which resistance of the power leads, output voltage. The scope differs depending on the overestimating the load was AC coupled and set to model used under testing. regulation and output trigger on a negative slope. The purpose for this test is to resistance of the power ensure the accuracy and supply. Connect the voltmeter DC Load Setup capability for a power supply and DC load in parallel to the to maintain its voltage output power supply's terminals (See The DC load was set to level under rated load current Figure 3 for setup diagram). transient mode from 1.5 A to changes. Before testing, 3 A. Pulse triggering mode verify that the load used for DC Load Setup was selected for the DC load, the test supports the which means a trigger signal maximum rated current and Press the I-set button (for B&K causes the load to go from 1.5 voltage of the power supply. Precision 8500) to change the A to 3 A, then back to 1.5 A. DC load to constant current mode (you may have to press Objective Results the button twice). Set the Measure the change in output current to the rated current of Looking at Figure 2, the load voltage from no current load the power supply.

DC Load Power Supply Mode: CC mode Voltmeter Current: Rated current of Settings: Rated output V pow er supply Current: Max. limit + - + - + -

Figure 3. Load Regulation Test Setup

5 of 17 Procedure measuring 30 V with 100  V characteristics look like Figure resolution is required to have 4, with small or very minimal 1. Turn on the power supply two significant figures in the bending near the crossover and set it to its rated load regulation number. This point. It is good practice to output voltage. Ensure measurement would require a test the current limits of a that the current adjust 6 digit voltmeter. power supply because it will knob, if present, is set to aid in protecting the its maximum value. equipment for its application. Current Limiting 2. Write down the measured Without a certain degree of voltage of the power current regulation, the supply Power supplies in constant supply. Call this value V0. may even over power or voltage mode generally have a damage certain devices. The 3. Press I-set on the DC load preset limit to the maximum following describes a test to set to power supply's current output. Current limit setup for testing current limit rated value. Turn on the testing consists of of a B&K Precision 9120A input of the load by measurements that define the power supply. pressing On/Off. behavior of a power supply and its current regulation. 4. Write down the measured Objective voltage of the power These measurements can be supply. Call this value V. characterized by a voltage vs. Determine the current limit of current curve, which portrays a power supply under test. 5. Turn off the DC load's input how and when the power by pressing the On-Off supply enters from CV to CC button. mode. Ideally, precise current Approach 6. Turn off the power supply. regulation reflects a voltage Use a power supply, DC load, vs. current curve similar to and a computer to analyze Calculate the load regulation Figure 4. (in percent) of the power voltage versus current supply by characteristics. For CV/CC mode power supplies, typical current limit V −V 100 0 (1) V0

You can also calculate the output resistance of the power V −V  supply as 0 where i i is the current drawn in this test.

High quality power supplies have low output resistances in the order of 1 m or .

This means measuring V0 and V with enough digits is necessary to avoid loss of significance in the subtraction. As an example, for a 30 V supply rated at 3 A with an Figure 4. Voltage vs. Current Curve output resistance of 1 m ,

6 of 17 Setup Power supply for electronic products have measurements been discovered and are far Connect the power supply in more complex than they were (readings from power supply) parallel to the DC load. Set several decades ago. With the power supply to its rated Voltage Current Mode increasing need in our society voltage and set a preset value 32.0001 V 0.00024 A CV for clean and efficient energy, for current. The DC load 31.9999 V 2.65178 A CV engineers have now turned should display the rated their focus to develop 31.9999 V 2.99467 A CV voltage if power supply's applications that utilize, for output is on. Incrementally 0.1569 V 2.99999 A CC example, fuel cells, increase the current drawn supercapacitors, and from the load and observe the Table 1: Measured Data from B&K Precision 9120A. photovoltaic energy. Due to behavior of the voltage in the the complexity in the design of power supply. When the these sources, it is useful to current on the load gets close It follows that the have a programmable test to the power supply preset measurements demonstrate a instrument that can verify current limit, observe before, voltage vs. current curve precise details of the sources' during, and after the crossover similar to Figure 4. Drawing behavior. This is often where point, where the power supply from the data, the voltage a DC load comes in handy switches from CV to CC mode. drops immediately upon because of its programmable reaching the crossover point, flexibility as well as its DC Load Setup which is at 2.99467 A in this capability to run discharge case. The power supply tests on power sources like Set the DC load to CC mode changes to CC mode after this batteries. This section will by pressing I-set (for B&K point, and voltage remains at provide a basic overview that Precision 8500). You have 0.1569 V, with current limited demonstrate an efficient way have to press twice. Turn on to 2.99999 A. This behavior is to perform battery discharge DC load's input. normal and expected for a CV/ and internal resistance testing. CC power supply. There are Results other types of power supplies with different current limit Battery Discharge A B&K Precision 9120A DC designs such as foldback Curves power supply rated at 32 V current and CV power supplies and 3 A was tested with a DC (without CC mode). The When designing and testing a load. The voltage from before voltage versus current curve battery for powering a device, to after the current crossover will greatly differ from that of a great deal of attention point was observed. Table 1 CV/CC power supplies, so it is reflects on energy efficiency shows the data of some advised to test their current and lifetime. For this reason, measurements to demonstrate limit characteristics before a standard performance test the power supply behavior utilizing them in devices or consists of analyzing discharge before and after the crossover applications. curves that characterize the point. behavior of the battery. By observing these curves, the BATTERY TESTING battery life can be measured, and its efficiency can be computed. Some DC loads provide this feature to allow battery discharge measurement, in which the The forms and standards for total charge is provided in Ah storing, renewing, and using (ampere*hour) to a specified energy are evolving. New voltage. B&K Precision's 8500 methods for providing power DC load series all provide this

7 of 17 useful built-in function for data is aa_test and “78deg quick setup and testing. F” is a string included at the Battery discharge can also be end of each line of the file. tested with the provided DC Load Note: For more details on the program under the “Software program commands and to Examples” section of this note. run the test, the + - Additionally, small changes to instructions and use the the program will offer even python script provided greater control for the test, towards the end of this allowing measurements to be application note categorized made under different modes under “Battery Discharge and settings. The following Test”. + AA size battery - describes the discharge test setup for a consumer “AA” size battery. Similar setups can Battery Internal Figure 5. Battery Discharge Test also be used for other types of Resistances Setup batteries.

The DC load is an effective to idealize the internal losses Setup tool for measuring the internal in the battery when current is resistance of a battery. The flowing. If the battery's Connect the battery to the DC battery is typically modeled as electrochemistry is regarded load. You can either solder the dashed area in the circuit as a network of voltage wires to the battery or use a illustrated in Figure 8. The sources and resistances, then battery holder. voltage source Vo is considered Vo and Ri comprise the ideal and is the open circuit Thevenin equivalent circuit. DC Load Setup voltage of the battery. The For alkaline batteries, the internal resistance Ri is used internal resistance goes up as The setup is controlled by the program, but be sure to manually set the voltage and current range prior to running the test program. If the current is reasonably large, you might also want to suggest they use the remote voltage sensing feature of the DC load.

Results Provided as an example is a plot (see Figure 6) of the battery discharge curve for the AA Alkaline battery tested with the setup in Figure 5. The command line used to run the program for the data is shown in Figure 7. The settings of the command are indicated in order as set to com port 5 in constant current mode with 0.5 A and a off voltage of 0.5 V. The file name for the Figure 6. AA Alkaline Battery Discharge Curve

8 of 17 the battery's chemical energy python battery.py 5 cc 0.5 0.5 aa_test 78deg F is used up. The internal resistance drops as the Figure 7. Command Used to Run Program temperature increases.

If VL is the voltage across the measured as: displayed and label this as V. load, we have V −V Use equation (4) to calculate =  = o the internal resistance. A V V iR (2) Ri (4) L o i 0.5 setup diagram is provided in Thus, Figure 9 for the purpose of illustration. ∣V −V ∣ Setup R = L o (3) i i Connect the battery to the DC DC Load Setup This gives us a way to load. Use a battery holder or evaluate the internal solder wires to the battery if 1. Turn on DC Load's resistance using the DC load, necessary. If soldering wires, remote sense feature. do not overheat the battery either manually or by a 2. Set trigger to due to risk of rupture. program. immediate. Connect two wires as close to For smaller batteries, a the battery terminals as 3. Set load to CC mode at programming approach is an possible and run these to the 0.005 A. advantage. Measurements remote sense terminals on the 4. Setup transient mode can be made quickly, causing DC load (be sure to observe with current levels from less drain on the battery. the proper polarity). Turn on 0 A for 0.5 ms to 0.505 Using an oscilloscope, a load with the configurations A for 2000 ms in pulse millisecond-wide current pulse under “DC Load Setup” below. mode. can be used to a useful Make sure the battery voltage internal resistance has stabilized and write this measurement. The approach down as the starting voltage Results for measuring a “D” size V0. Then trigger the transient battery's internal resistance is current levels and immediately Using the test setup in Figure observed in the following. the displayed voltage. 9, the stabilization voltage Note that this is only one of Within two seconds, make (V0) for the measured battery the practical ways for note of the lowest voltage is 1.496 V. With 0.505 A load, measuring internal resistance. There are other methods not mentioned here.

Approach Measure the battery's voltage at two different current loads. The remote sense capability of B&K Precision's 8500 DC load will be used to avoid errors due to wire resistances. The test method follows the recommendation of [1] by applying a stabilization current of 5 mA, measuring the battery's voltage V0, applying a current of 505 mA, and measuring the voltage V. The internal resistance is Figure 8. Circuit Model of Battery and Internal Resistance

9 of 17 the voltage (V) is 1.415 V. series with a resistance Slew Rate Using equation (4) gives an captures the first order internal resistance of 0.16 Ω. behavior (see Figure 8). More The slew rate of a DC load is a complex models have also performance measurement been used. Using DC loads that determines how quickly a Batteries are complex like B&K Precision's 8500 DC load can draw current nonlinear electrochemical series, batteries can be within different ranges of devices. The two common characterized in a manner current transition. In general, electrical measurements of which will mirror their the slew rate for low current batteries used to gauge their application and construct a transitions, say 0 to 0.5 A, is state are the DC internal model appropriate for the significantly lower than slew resistance and the AC internal design. rate for current transitions impedance. In the "old" days, from 30 to 70 A. Generally, AC characteristics of a battery the appropriate way to test were not terribly important for PERFORMANCE slew rate is to observe a DC operation. However, TESTING OF DC portion of the timing during modern digital electronic maximum current transition. devices can draw sharp LOADS The in Figure 10 current spikes from their illustrates this. Between the power source (e.g., switching 10% and 90% region, the a cell phone to transmit). In a slew rate can be measured by 1 kW car audio system, observing the steepest slope currents can exceed 100 A and portion. The indicated the AC behavior of batteries, Just as it is important to have measured time would be used stiffening capacitors, and stray a good power supply that will to calculate the slew rate. inductances can all play a role. perform accurate Hence, the slew rate DC loads can be useful in measurements under various calculation is simply (rated helping investigate the test conditions, it is essential max. current – 0 A) / T, where dynamic behavior of these to have a DC load that is T is the measured time from systems. robust and perform under 10% to 90% region and rated required specifications and max. current is the specified test setups. Some of the most maximum current of each The simple model of a battery common tests used for load. The following will as an ideal voltage source in verifying features of a DC load demonstrate how to test the include trigger delay, switching slew rate of B&K Precision's Remote sense time, and slew rate. In the 8510 DC Load. following section, slew rate + - testing for the B&K Precision DC Load 8510 DC load will be Setting: Immediate Trigger highlighted. Approach Mode: CC at 0.005A Disclaimer: The following Transient: Pulse 0 to 0.505A Set the DC load to transient sections include general mode and allow it to draw + - setups with some settings current from 0 to maximum specified for the test rated current. Observe environment. Some details current transition changes and are ignored, and therefore timing on an oscilloscope. results may vary and may not reflect exactly what is shown + D size battery - in the following sections. Setup

Figure 9. Test Setup For Battery Three B&K Precision's 1796 Internal Resistance high current power supplies are connected in parallel.

10 of 17 Figure 11. Connect the BNC to binding post adapter into a B&K Precision's 2542 oscilloscope. Follow the setup below for the DC load and oscilloscope.

DC Load Setup 1. Setup transient mode with current levels from 0 A for 0.5 ms to 120 A for 1000 ms in pulse mode. 2. Set load to CC mode 3. Turn on input for a short moment. Turn off once oscilloscope setup is complete.

Oscilloscope Setup 1. Set to single run. 2. Adjust trigger level Figure 10. Slew Rate Measurement Graph until waveform trace is Since each supply can output simplify the same setup and captured. maximum of 50 A, it can reduce the temperature from 3. Adjust vertical and produce enough current for heat dissipation. Since high horizontal scale and the B&K Precision's 8510 DC load current will be drawn, it is trigger level and run to draw at its maximum range important to note here that once again. (0-120 A). A handful of shunt heavy gauge wires should be resistors rated at 5 0.22 ΩJ used to connect the power 4. Repeat steps 2 and 3 are connected in parallel and supplies to each other and to until a good sampled are connected to a BNC-to- the load. Connect the power trace is captured. binding post adapter. A larger supply to the DC load and shunt can also be used to shunt resistors as illustrated in Results Observe the trace on the oscilloscope and compare it to Power supply Oscilloscope Figure 10. Use the scope's Mode: Single Trigger + - cursors to approximate the 10% and 90 % mark. Power supply Observe the steepest slope in + - between the cursor lines. A DC Load rough estimate can be made Mode: CC by taking the difference of the Power supply Shunt Transient: 0 A to 120 A two cursor lines. Since this Resistance + - + - setup tests a current transition from 0 A to 120 A, slew rate can be calculated by dividing Figure 11. Slew Rate Test Setup the change in current over the

11 of 17 change in time; that is the rates of B&K Precision's 8500 conducting current and, thus, difference of the cursors. For DC load. This load can it may jump past a low B&K Precision's 8510 DC load, measure with a millivolt current setting. Thus, please slew rate is measured to be 1 resolution before indicating an test this fuse application A/μs. overrange. Refer to the carefully before using it to section for detailed protect valuable circuitry. information on setting up and OTHER DC LOAD running the software application. APPLICATIONS

SOFTWARE Fuse EXAMPLES

DC loads can be very The application described in resourceful for various tests this section is to demonstrate and applications. Sometimes, how to use a DC load as a fuse they may even act as a in a circuit. Under program different type of test control, the load can shut off The following sections include instrument for measurement. when either current, voltage, the source codes for all A good example would be a or power measured exceeds a software based applications voltmeter. Other practical set value in the load. This is a and examples previously applications that will be basic application for a fuse, mentioned. If not done mentioned in this section is a and due to some delays from already, please read the fuse. DC loads can also act as the software control, it is not documentation provided from a fuse in a circuit for recommended for use if fast B&K Precision's website at: monitoring current thresholds responses are required. The http://www.bkprecision.com/p to prevent possible program codes to run this roducts/categories/sub_catego damage from overcurrent or application can be found in the ries/models/? overpower. “Software Examples” section model=8500#software for under “Fuse Application”. successful installation of the Details of usage and operation python libraries. This must are provided in the same be setup correctly prior to Voltmeter section. using any of the source codes provided in this note. Be sure In any design or test Setup to also read the instructions environment, a voltmeter is under each software examples required in one way or another Connect load in series with a for correct usage. for measurements. It is one circuit. Be sure that remote of the most useful test tool sense is off. Run the program today. For this reason, it is to monitor current. Threshold often convenient to have a DC value is set in the program. load that can read voltages when a voltmeter is not around. For simplicity, a test Note: The DC load does not program script has been behave like a pure resistance. provided under “Software For this fuse application, it Examples” at the end of the may be hard to test low note under section labeled currents in the few mA range. “Voltmeter Reading” to For B&K Precision's 8500 load, perform simple voltage there is a turn-on threshold measurements and reading voltage of around 0.1 volts before the load starts

12 of 17 Battery Discharge Test

The objective of this program is to characterize the discharge curves of common household batteries. It can be used to monitor and log data when a battery is discharged by one of B&K Precision's 8500 series DC loads.

Instructions There are two settings that can be modified in the code to cater particular test settings. These two settings are the interval between each reading, defined as “interval_s” in beginning of the program, and baudrate, defined as “baudrate” at the end of main(). By default, interval_s = 1 and baudrate = 38400. To run the command, lets use the example given previously. python battery.py 5 cc 0.5 0.5 aa_test 78deg F The above command is in a specific order, which is read as port 5, CC mode, 0.5 A in CC mode, 0.5 V cut off voltage, filename to save data as “aa_test.dat”, and extra added at the end of each record is “78deg F”. Refer to Table 2 below for detailed instructions. Note: The program will NOT overwrite any existing data files.

Run command Python file Port # Mode: Decimal value Cut off voltage Filename of Any string to name for constant recorded data attach at end of mode each line python Name of the COM port # cc: constant Any value set Decimal value Files are saved Any strings of python program used to connect current for the of cut off in same folder text can be to PC cv: constant respective voltage to end as the python added for voltage mode. (i.e. 0.5 program program file reference : constant in cc mode is with .dat power 0.5 A, 2 in cv extension cr: constant mode is 2 V) resistance

Table 2. Instructions on Command for Battery Discharge Test Script

battery.py

Data file: msg = '''Usage: %(name)s port mode value cov filename [docstring] Header : Test a battery with a DC load until the specified cut-off voltage is reached. # Command line Arguments are: # Date and time for start of test port Entry info: COM port that the load is at. time voltage current power mode cc for constant current time is in seconds since start of test cv for constant voltage Other measurements are in V, A, and W cp for constant power cr for constant resistance We to a DC load using COM. value ''' Decimal value of desired constant mode value. cov import sys, dcload Cut-off voltage in volts. from win32com.client import Dispatch filename from string import Data will be stored in filename.dat. from time import time, docstring from msvcrt import kbhit, getch Any further text is just logged to the data file. out = sys.stdout.write ''' % locals() = "\n" print msg interval_s = 1 # Interval between readings (1)

def Usage(): def ProcessCommandLine(): name = sys.argv[0] if len(sys.argv) < 6:

13 of 17 Usage() log("# Command line: %s\n" % join(sys.argv[1:])) port = int(sys.argv[1]) 'log("# %s\n" % version)' mode = sys.argv[2] msg = "# Test start time = " + load.TimeNow() + nl value = float(sys.argv[3]) LogMsg(msg) cov = float(sys.argv[4]) Set("Turn load on", load.TurnLoadOn()) filename = sys.argv[5] + ".dat" voltage, current, power = GetCurrentVoltagePower(load) docstring = "" start_time = time() if len(sys.argv) > 6: while voltage >= cov: docstring = join(sys.argv[6:]) voltage, current, power = GetCurrentVoltagePower(load) # Check values current_time = time() - start_time assert(port >= 0) LogMsg("%9.2f %9.4f %8.4f %9.4f\n" % \ assert(mode in ("cc", "cv", "cp", "cr")) (current_time, voltage, current, power)) assert(value > 0) sleep(interval_s) assert(cov > 0) if kbhit(): from os.path import exists c = getch() assert(not exists(filename)) if c == "Q": out("Mode = %s\n" % mode) break out("Value = %s\n" % value) Set("Turn load off", load.TurnLoadOff()) out("cov = %s\n" % cov) LogMsg("# Test finish time = " + load.TimeNow() + nl) out("filename = %s\n" % filename) load.SetLocalControl() return port, mode, value, cov, filename, docstring def main(): def Set(task, error_message): port, mode, value, cov, filename, docstring = ProcessCommandLine() if error_message: load = Dispatch('BKServers.DCLoad85xx') out("Error on task '%s':\n" % task) baudrate = 38400 out(error_message) load.Initialize(port, baudrate) # Open a serial connection exit(1) log = open(filename, "w").write RunTest(log, load, mode, value, cov) def SetModeAndValue(load, mode, value): # Set mode and value. Also check that the maximum setting is at main() # least the value we want. Set("Set to mode %s" % mode, load.SetMode(mode)) if mode == "cc": max_current = float(load.GetMaxCurrent()) if max_current < value: out("Max current setting is less than desired value" + nl) exit(1) Set("Set to value %g" % value, load.SetCCCurrent(value)) elif mode == "cv": max_voltage = float(load.GetMaxVoltage()) if max_voltage < value: out("Max voltage setting is less than desired value" + nl) exit(1) Set("Set to value %g" % value, load.SetCVVoltage(value)) elif mode == "cp": max_power = float(load.GetMaxPower()) if max_power < value: out("Max power setting is less than desired value" + nl) exit(1) Set("Set to value %g" % value, load.SetCWPower(value)) else: Set("Set to value %g" % value, load.SetCRResistance(value)) def GetCurrentVoltagePower(load): def get_value(f): value, unit = f.() return float(value) s = load.GetInputValues() fields = s.split("\t") voltage = get_value(fields[0]) current = get_value(fields[1]) power = get_value(fields[2]) return voltage, current, power def RunTest(log, load, mode, value, cov): def LogMsg(msg): out(msg) log(msg) load.SetRemoteControl() SetModeAndValue(load, mode, value)

14 of 17 Voltmeter Reading

In this section, the codes provided below are used for the “voltmeter” application using the DC load. It provides a convenient and remote way to collect voltage readings into a data file to serve its purpose.

Instructions Two settings must be configured correctly to run the script. They are port and baudrate. In the code of voltmeter.py, they are declared at the beginning as “port = 5” and “baudrate = 38400” by default. Please change the values to match the port and baudrate settings used to interface on the PC. Note: The DC load must have the same baudrate configurations as in the code, and port number has to match the COM port on the PC used to connect to DC load.

voltmeter.py

import sys, dcload from time import time from win32com.client import Dispatch from msvcrt import kbhit

port = 5 baudrate = 38400

load = Dispatch('BKServers.DCLoad85xx') load.Initialize(port, baudrate) # Open a serial connection load.SetRemoteControl() of = open("fast.dat", "w") start = time() count = 1 while True: msg = "%6d %8.2f s %s\n" % (count, time() - start, load.GetInputValues()) of.write(msg) if kbhit(): break count += 1 finish = time() - start load.SetLocalControl() of.write("\nReading rate = %.1f readings/second\n" % (count/finish)) print "\nReading rate = %.1f readings/second\n" % (count/finish)

Fuse Application

A practical feature in most DC loads is the overpower, overcurrent, and overvoltage protection. With this, a DC load can behave like a fuse in a circuit, monitoring current, voltage, or power from exceeding design specifications of the circuit. An excellent way to demonstrate this application is to use a program. Provided in the following is an example python script for monitoring current using B&K Precision's 8500 DC load.

Instructions Two settings must be configured correctly to run the script. They are port and baudrate. In the code of voltmeter.py, they are declared at the beginning as “port = 5” and “baudrate = 38400” by

15 of 17 default. Please change the values to match the port and baudrate settings used to interface on the PC. Here's an example to run the command: python fuse.py 5 The value “5” represents the fuse value to set. In this example, it is 5 A. With slight modifications to the script, the program can also monitor voltage and power.

fuse.py

import sys, dcload from time import time from win32com.client import Dispatch from msvcrt import kbhit

port = 5 baudrate = 38400

def ReadCurrent(load): fields = load.GetInputValues().split("\t") # Split on tab characters current = float(fields[0].split()[0]) # Remove the "A" return current

def main(): # Check the command line if len(sys.argv) != 2: print "Usage: %s fuse_value_in_A" % sys.argv[0] exit(1) # Get the desired fuse value from the command line fuse_value_A = float(sys.argv[1]) assert(fuse_value_A) > 0 # Establish a load connection load = Dispatch('BKServers.DCLoad85xx') load.Initialize(port, baudrate) # Open a serial connection load.SetRemoteControl() load.SetMode("cc") # Set to constant current mode load.SetCCCurrent(fuse_value_A) # We won't exceed this value load.TurnLoadOn() current = ReadCurrent(load) while current < fuse_value_A: if kbhit(): break current = ReadCurrent(load) load.TurnLoadOff() load.SetLocalControl()

main()

Reference

[1] http://data.energizer.com/PDFs/BatteryIR.pdf A technical bulletin on internal resistance.

16 of 17 © 2009 B&K Precision Corp.

17 of 17