1
package com.sun.electric.tool.simulation.test;
5
* Copyright (c) 2005 by Sun Microsystems, Inc.
7
* Created on Jul 21, 2005
11
* Class for setting a voltage level supplied by a single channel of an HP 6624A
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 Tom O'Neill (toneill)
19
public class HP6624AChannel extends PowerChannel {
22
* The HP 6624A programmable DC power supply that provides the voltage level
25
private final HP6624A supply;
27
/** Channel of power supply that supplies the voltage */
28
private final int channel;
31
* Creates an object to control a HP 6624A power supply using the methods of
32
* the device-independent PowerChannel abstract class.
34
* Instead of this, you should use
35
* {@link Model#createPowerChannel(String, String, int, int, String)}.
36
* I have left it public for backwards compatability.
39
* name of signal on this channel of the power supply
41
* <code>gpibconf</code> identifier for the power supply
43
* Channel of the supply to control
45
public HP6624AChannel(String channelName, String supplyName, int channel) {
46
HP6624A.checkChannel(channel);
47
this.name = channelName + " (" + supplyName + " channel " + channel
49
supply = new HP6624A(supplyName);
50
this.channel = channel;
51
logInit("Initialized HP6624AChannel " + this.name);
54
/** @return Returns the name of the HP6624A */
55
public String getSupplyName() {
56
return supply.getName();
60
* @return Returns the channel number within the HP6624A device.
62
public int getChannel() {
67
* Returns string indicating state of the channels
69
public String getState() {
70
return supply.getState(channel);
74
* Reads back the voltage provided by this channel of the power supply.
76
* @return voltage drawn over this channel, in Volts
78
public float readVoltage() {
79
logOther("Reading voltage on " + getName());
80
return this.supply.readVoltage(this.channel);
84
* Set the channel's voltage to the value provided
87
* new voltage for the channel, in Volts
89
public void setVoltageNoWait(float volts) {
90
logSet("HP6624AChannel setting voltage on " + getName() + " to "
92
supply.setVoltage(this.channel, volts);
95
public void waitForVoltage(float setVolts) {
96
if (supply.isDisabled())
98
super.waitForVoltage(setVolts);
102
* Get the channel's voltage setpoint
104
* @return voltage setpoint for the channel, in Volts
106
public float getVoltageSetpoint() {
107
logOther("Reading voltage setpoint on " + getName());
108
return this.supply.getVoltageSetpoint(this.channel);
112
* Returns voltage resolution of power supply.
114
* @return voltage resolution of power supply
116
public float getVoltageResolution() {
117
logOther("Getting voltage resolution on " + getName());
118
return HP6624A.getVoltageResolution(this.channel);
122
* Reads back the current provided by this channel of the power supply.
124
* @return current drawn over this channel, in Amps
126
public float readCurrent() {
127
logOther("Reading current on " + getName());
128
return this.supply.readCurrent(this.channel);
132
* Set the channel's current limit to the value provided
135
* new current limit for the channel, in Amps
137
public void setCurrent(float amps) {
138
logSet("Setting current limit on " + getName() + " to " + amps);
139
supply.setCurrent(channel, amps);
143
* Get the channel's current setpoint
145
* @return current setpoint for the channel, in Amps
147
public float getCurrentSetpoint() {
148
logOther("Reading current setpoint on " + getName());
149
return supply.getCurrentSetpoint(this.channel);
152
* Changes the voltage for the over voltage protection to
153
* <code>setVolts</code> Volts.
155
* @param setVolts the new over-voltage limit
156
* @throws IllegalArgumentException
157
* if channel not in range 1..4
159
public void setOverVoltageProtection(float setVolts) {
160
logSet("Setting over voltage protection limit on " + getName() + " to " + setVolts);
161
supply.setOverVoltageProtection(this.channel, setVolts);
165
* Changes the current for the over current protection to
166
* <code>setAmps</code> Amps.
168
* @param setAmps the new over-current limit
169
* @throws IllegalArgumentException
170
* if channel not in range 1..4
172
public void setOverCurrentProtection(float setAmps) {
173
logSet("Setting over current protection limit on " + getName() + " to " + setAmps);
174
supply.setOverCurrentProtection(this.channel, setAmps);
178
* Unit tests, prints current as function of voltage for channel 1. Should
179
* disconnect supply from any chips before waiting.
184
public static void main(String[] args) {
185
Infrastructure.gpibControllers = new int[] { 1 };
186
HP6624AChannel[] channels = new HP6624AChannel[HP6624A.NUM_CHANNELS];
187
for (int chan = 1; chan <= HP6624A.NUM_CHANNELS; chan++) {
188
int ichan = chan - 1;
189
channels[ichan] = new HP6624AChannel("chan" + chan, "hHP6624A",
191
System.out.println(chan + ": " + channels[ichan].getState());
192
System.out.println("res " + channels[ichan].getVoltageResolution()