1
package com.sun.electric.tool.simulation.test;
3
/* Agilent6031AChannel.java
5
* Copyright (c) 2008 by Sun Microsystems, Inc.
7
* Created on Jul 17, 2008
11
* Class for setting a voltage level supplied by an Agilent 6031A 20V/120A
12
* programmable DC power supply, using the device-independent interface
13
* {@link PowerChannel}.
15
* This class should now be instantiated from a {@link Model#createPowerChannel(String, String, int, int, String)}
17
* @author Nathaniel Pinckney (np227454)
18
* @author Tom O'Neill (toneill)
20
public class Agilent6031AChannel extends PowerChannel {
23
* The Agilent 6031A programmable DC power supply that provides the voltage level
26
private final Agilent6031A supply;
29
* Creates an object to control a Agilent 6031A power supply using the methods of
30
* the device-independent PowerChannel abstract class.
32
* Instead of this, you should use
33
* {@link Model#createPowerChannel(String, String, int, int, String)}.
34
* I have left it public for backwards compatability.
37
* name of signal on this power supply
39
* <code>gpibconf</code> identifier for the power supply
41
public Agilent6031AChannel(String channelName, String supplyName) {
42
this.name = channelName + " (" + supplyName + ")";
43
supply = new Agilent6031A(supplyName);
44
logInit("Initialized Agilent6031AChannel " + this.name);
47
/** @return Returns the name of the Agilent6031A */
48
public String getSupplyName() {
49
return supply.getName();
53
* Returns string indicating state of the channels
55
public String getState() {
56
return supply.getState();
60
* Reads back the voltage provided by this channel of the power supply.
62
* @return voltage drawn over this channel, in Volts
64
public float readVoltage() {
65
logOther("Reading voltage on " + getName());
66
return this.supply.readVoltage();
70
* Set the channel's voltage to the value provided
73
* new voltage for the channel, in Volts
75
public void setVoltageNoWait(float volts) {
76
logSet("Agilent6031AChannel setting voltage on " + getName() + " to "
78
supply.setVoltage(volts);
81
public void waitForVoltage(float setVolts) {
82
if (supply.isDisabled())
84
super.waitForVoltage(setVolts);
88
* Get the channel's voltage setpoint
90
* @return voltage setpoint for the channel, in Volts
92
public float getVoltageSetpoint() {
93
logOther("Reading voltage setpoint on " + getName());
94
return this.supply.getVoltageSetpoint();
98
* Returns voltage resolution of power supply.
100
* @return voltage resolution of power supply
102
public float getVoltageResolution() {
103
logOther("Getting voltage resolution on " + getName());
104
return Agilent6031A.getVoltageResolution();
108
* Reads back the current provided by this channel of the power supply.
110
* @return current drawn over this channel, in Amps
112
public float readCurrent() {
113
logOther("Reading current on " + getName());
114
return this.supply.readCurrent();
118
* Set the channel's current limit to the value provided
121
* new current limit for the channel, in Amps
123
public void setCurrent(float amps) {
124
logSet("Setting current limit on " + getName() + " to " + amps);
125
supply.setCurrent(amps);
129
* Get the channel's current setpoint
131
* @return current setpoint for the channel, in Amps
133
public float getCurrentSetpoint() {
134
logOther("Reading current setpoint on " + getName());
135
return supply.getCurrentSetpoint();
139
* Gets the foldback mode or turns it off.
142
public int getFoldback() {
143
return supply.getFoldback();
147
* Sets the foldback mode or turns it off.
150
* Foldback mode to set. Can be <code>Agilent6031A.FOLDBACK_CV</code>,
151
* <code>FOLDBACK_CC</code>, or <code>FOLDBACK_OFF</code>.
152
* @throws IllegalArgumentException
153
* if mode not in 0..2
155
public void setFoldback(int mode) {
156
supply.setFoldback(mode);
160
* Gets the over voltage protection value.
163
public float getOverVoltageProtection() {
164
return supply.getOverVoltageProtection();
168
* Unit tests, prints current as function of voltage for channel 1. Should
169
* disconnect supply from any chips before waiting.
174
public static void main(String[] args) {
175
Infrastructure.gpibControllers = new int[] { 1 };
176
Agilent6031AChannel channel = new Agilent6031AChannel("aAgilent6031A", "power");
177
System.out.println(channel.getState());
178
System.out.println("res " + channel.getVoltageResolution() + "\n");