~ubuntu-branches/ubuntu/natty/electric/natty

« back to all changes in this revision

Viewing changes to com/sun/electric/tool/simulation/test/Agilent6031AChannel.java

  • Committer: Bazaar Package Importer
  • Author(s): Onkar Shinde
  • Date: 2010-01-09 16:26:04 UTC
  • mfrom: (1.1.4 upstream) (3.1.6 sid)
  • Revision ID: james.westby@ubuntu.com-20100109162604-1ypvmy8ijmlc6oq7
Tags: 8.10-1
* New upstream version.
* debian/control
  - Add libjava3d-java and quilt build dependencies.
  - Update standards version to 3.8.3.
  - Add libjava3d-java as recommends to binary package.
* debian/rules
  - Use quilt patch system instead of simple patchsys.
  - Add java3d related jar files to DEB_JARS.
* debian/patches/*
  - Update as per current upstream source. Convert to quilt.
* debian/ant.properties
  - Do not disable 3D plugin anymore.
  - Use new property to disable compilation of OS X related classes.
* debian/wrappers/electric
  - Add java3d related jar files to runtime classpath.
* debian/README.source
  - Change text to the appropriate one for quilt.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package com.sun.electric.tool.simulation.test;
 
2
 
 
3
/* Agilent6031AChannel.java
 
4
 * 
 
5
 * Copyright (c) 2008 by Sun Microsystems, Inc.
 
6
 *
 
7
 * Created on Jul 17, 2008
 
8
 */
 
9
 
 
10
/**
 
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}.
 
14
 * <P>
 
15
 * This class should now be instantiated from a {@link Model#createPowerChannel(String, String, int, int, String)}
 
16
 *
 
17
 * @author Nathaniel Pinckney (np227454)
 
18
 * @author Tom O'Neill (toneill)
 
19
 */
 
20
public class Agilent6031AChannel extends PowerChannel {
 
21
 
 
22
    /**
 
23
     * The Agilent 6031A programmable DC power supply that provides the voltage level
 
24
     * in question
 
25
     */
 
26
    private final Agilent6031A supply;
 
27
 
 
28
    /**
 
29
     * Creates an object to control a Agilent 6031A power supply using the methods of
 
30
     * the device-independent PowerChannel abstract class.
 
31
     * <P>
 
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. 
 
35
     * 
 
36
     * @param channelName
 
37
     *            name of signal on this power supply
 
38
     * @param supplyName
 
39
     *            <code>gpibconf</code> identifier for the power supply
 
40
     */
 
41
    public Agilent6031AChannel(String channelName, String supplyName) {
 
42
        this.name = channelName + " (" + supplyName + ")";
 
43
        supply = new Agilent6031A(supplyName);
 
44
        logInit("Initialized Agilent6031AChannel " + this.name);
 
45
    }
 
46
 
 
47
    /** @return Returns the name of the Agilent6031A */
 
48
    public String getSupplyName() {
 
49
        return supply.getName();
 
50
    }
 
51
 
 
52
    /**
 
53
     * Returns string indicating state of the channels
 
54
     */
 
55
    public String getState() {
 
56
        return supply.getState();
 
57
    }
 
58
 
 
59
    /**
 
60
     * Reads back the voltage provided by this channel of the power supply.
 
61
     * 
 
62
     * @return voltage drawn over this channel, in Volts
 
63
     */
 
64
    public float readVoltage() {
 
65
        logOther("Reading voltage on " + getName());
 
66
        return this.supply.readVoltage();
 
67
    }
 
68
 
 
69
    /**
 
70
     * Set the channel's voltage to the value provided
 
71
     * 
 
72
     * @param volts
 
73
     *            new voltage for the channel, in Volts
 
74
     */
 
75
    public void setVoltageNoWait(float volts) {
 
76
        logSet("Agilent6031AChannel setting voltage on " + getName() + " to "
 
77
                + volts + " V");
 
78
        supply.setVoltage(volts);
 
79
    }
 
80
 
 
81
    public void waitForVoltage(float setVolts) {
 
82
        if (supply.isDisabled())
 
83
            return;
 
84
        super.waitForVoltage(setVolts);
 
85
    }
 
86
 
 
87
    /**
 
88
     * Get the channel's voltage setpoint
 
89
     * 
 
90
     * @return voltage setpoint for the channel, in Volts
 
91
     */
 
92
    public float getVoltageSetpoint() {
 
93
        logOther("Reading voltage setpoint on " + getName());
 
94
        return this.supply.getVoltageSetpoint();
 
95
    }
 
96
 
 
97
    /**
 
98
     * Returns voltage resolution of power supply.
 
99
     * 
 
100
     * @return voltage resolution of power supply
 
101
     */
 
102
    public float getVoltageResolution() {
 
103
        logOther("Getting voltage resolution on " + getName());
 
104
        return Agilent6031A.getVoltageResolution();
 
105
    }
 
106
 
 
107
    /**
 
108
     * Reads back the current provided by this channel of the power supply.
 
109
     * 
 
110
     * @return current drawn over this channel, in Amps
 
111
     */
 
112
    public float readCurrent() {
 
113
        logOther("Reading current on " + getName());
 
114
        return this.supply.readCurrent();
 
115
    }
 
116
 
 
117
    /**
 
118
     * Set the channel's current limit to the value provided
 
119
     * 
 
120
     * @param amps
 
121
     *            new current limit for the channel, in Amps
 
122
     */
 
123
    public void setCurrent(float amps) {
 
124
        logSet("Setting current limit on " + getName() + " to " + amps);
 
125
        supply.setCurrent(amps);
 
126
    }
 
127
 
 
128
    /**
 
129
     * Get the channel's current setpoint
 
130
     * 
 
131
     * @return current setpoint for the channel, in Amps
 
132
     */
 
133
    public float getCurrentSetpoint() {
 
134
        logOther("Reading current setpoint on " + getName());
 
135
        return supply.getCurrentSetpoint();
 
136
    }
 
137
 
 
138
    /**
 
139
     * Gets the foldback mode or turns it off.
 
140
     *
 
141
     */
 
142
    public int getFoldback() {
 
143
        return supply.getFoldback();
 
144
    }
 
145
  
 
146
    /**
 
147
     * Sets the foldback mode or turns it off.
 
148
     *
 
149
     * @param mode
 
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
 
154
     */
 
155
    public void setFoldback(int mode) {
 
156
                supply.setFoldback(mode);
 
157
    }
 
158
 
 
159
        /**
 
160
         * Gets the over voltage protection value.
 
161
         *
 
162
         */
 
163
        public float getOverVoltageProtection() {
 
164
        return supply.getOverVoltageProtection();
 
165
        }
 
166
 
 
167
    /**
 
168
     * Unit tests, prints current as function of voltage for channel 1. Should
 
169
     * disconnect supply from any chips before waiting.
 
170
     * 
 
171
     * @param args
 
172
     *            Ignored
 
173
     */
 
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");
 
179
    }
 
180
}