public class IndirectSet
extends java.lang.Object
We use a class instead of just a method so that caller can obtain resulting voltage and current without performing time-consuming readVoltage() and readCurrent() invocataions.
Modifier and Type | Field and Description |
---|---|
boolean |
achievedCurrent
True if successfully set
amps to approximately
setAmps |
float |
amps
Current measured when voltage equals
volts |
static float |
EXCESS_RESOLUTION
Fraction of
ampsError to set readCurrent()
resolution to. |
static float |
MAX_CURRENT_OVERSHOOT
Maximum fraction by which we ever expect to overshoot the target used to
set range for
readCurrent() . |
static int |
MAX_VOLTS_STEPS
Maximum number of convergence steps
|
float |
volts
Best guess so far at voltage required to produce
setAmps |
Constructor and Description |
---|
IndirectSet(CurrentReadable dial,
float setAmps,
float ampsError,
PowerChannel knob,
float initVolts,
float maxVolts)
Adjust the voltage on
knob until current on
dial reaches the setpoint. |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getState()
Returns a string giving the complete state of the
IndirectSet object. |
static void |
main(java.lang.String[] args) |
public static final int MAX_VOLTS_STEPS
public static final float MAX_CURRENT_OVERSHOOT
readCurrent()
.public static final float EXCESS_RESOLUTION
ampsError
to set readCurrent()
resolution to.public float volts
setAmps
public float amps
volts
public boolean achievedCurrent
amps
to approximately
setAmps
public IndirectSet(CurrentReadable dial, float setAmps, float ampsError, PowerChannel knob, float initVolts, float maxVolts)
knob
until current on
dial
reaches the setpoint. A safe non-zero starting value
initVolts
must be provided.
Assumes knob
provides the correct resolution for the power
supply. If the current readback is noisier than ampsError
,
the routine may fail.
dial
- object providing current readbacksetAmps
- desired current setpointampsError
- allowed deviation from setAmpsknob
- object providing voltage controlinitVolts
- initial guess at correct voltage, must be non-zeromaxVolts
- maximum allowed voltagePowerChannel.getVoltageResolution()
public java.lang.String getState()
IndirectSet
object.public static void main(java.lang.String[] args)