This commit is contained in:
boccioli_m
2015-09-02 09:13:22 +02:00
parent aea3fd41cd
commit 8d25f5700d
2 changed files with 76 additions and 80 deletions
+75 -74
View File
@@ -1,9 +1,10 @@
/*
* Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
*/
import ch.psi.pshell.dev.*;
import ch.psi.pshell.device.*;
import ch.psi.pshell.epics.*;
import ch.psi.utils.BitMask;
import java.io.IOException;
/**
*/
@@ -140,7 +141,7 @@ public class PowerSupply extends DeviceBase implements BitMask {
}
@Override
protected void doUpdate() throws InterruptedException, DeviceException {
protected void doUpdate() throws InterruptedException, IOException {
super.doUpdate();
try {
channelActualVoltage.update();
@@ -165,98 +166,98 @@ public class PowerSupply extends DeviceBase implements BitMask {
return String.format("0x%04X",value);
}
public String getFirmware() throws InterruptedException, DeviceException {
public String getFirmware() throws InterruptedException, IOException {
//return toHexString(moduleFirmware.getValue());
int value = moduleFirmware.getValue();
return String.valueOf((value&0xFF0000)>>16) + "." + String.valueOf((value&0xFF00)>>8) + String.valueOf((value&0xFF));
}
public String getSerial() throws InterruptedException, DeviceException {
public String getSerial() throws InterruptedException, IOException {
//return toHexString(moduleSerial.getValue());
return String.valueOf(moduleSerial.getValue());
}
public Integer getNumberOfChannels() throws InterruptedException, DeviceException {
public Integer getNumberOfChannels() throws InterruptedException, IOException {
return moduleNoChannels.getValue();
}
public Integer getPlacedChannels() throws InterruptedException, DeviceException {
public Integer getPlacedChannels() throws InterruptedException, IOException {
return modulePlacedChannels.getValue();
}
public Double getTemperature() throws InterruptedException, DeviceException {
public Double getTemperature() throws InterruptedException, IOException {
return moduleTemperature.getValue();
}
public Double getPower5() throws InterruptedException, DeviceException {
public Double getPower5() throws InterruptedException, IOException {
return modulePower5.getValue();
}
public Double getPower12() throws InterruptedException, DeviceException {
public Double getPower12() throws InterruptedException, IOException {
return modulePower12.getValue();
}
public Double getPower12N() throws InterruptedException, DeviceException {
public Double getPower12N() throws InterruptedException, IOException {
return modulePower12N.getValue();
}
public Double getVoltageRampReadback() throws InterruptedException, DeviceException {
public Double getVoltageRampReadback() throws InterruptedException, IOException {
return moduleVoltageRampRb.getValue();
}
public Double getCurrentRampReadback() throws InterruptedException, DeviceException {
public Double getCurrentRampReadback() throws InterruptedException, IOException {
return moduleCurrentRampRb.getValue();
}
public Double getCurrentMax() throws InterruptedException, DeviceException {
public Double getCurrentMax() throws InterruptedException, IOException {
return moduleCurrentMax.getValue();
}
public Double getVoltageMax() throws InterruptedException, DeviceException {
public Double getVoltageMax() throws InterruptedException, IOException {
return moduleVoltageMax.getValue();
}
public Integer getRestartDelayReadback() throws InterruptedException, DeviceException {
public Integer getRestartDelayReadback() throws InterruptedException, IOException {
return moduleRestartDelayRb.getValue();
}
public Integer getAdcSamplesReadback() throws InterruptedException, DeviceException {
public Integer getAdcSamplesReadback() throws InterruptedException, IOException {
return moduleAdcSamplesRb.getValue();
}
public Integer getDigFilterReadback() throws InterruptedException, DeviceException {
public Integer getDigFilterReadback() throws InterruptedException, IOException {
return moduleDigFilterRb.getValue();
}
public int getModuleControl() throws InterruptedException, DeviceException {
public int getModuleControl() throws InterruptedException, IOException {
return moduleCommandRb.getValue();
}
public String getModuleControlStr() throws InterruptedException, DeviceException {
public String getModuleControlStr() throws InterruptedException, IOException {
return toHexString(getModuleControl());
}
public int getEventMask() throws InterruptedException, DeviceException {
public int getEventMask() throws InterruptedException, IOException {
return moduleEvMaskRb.getValue();
}
public String getEventMaskStr() throws InterruptedException, DeviceException {
public String getEventMaskStr() throws InterruptedException, IOException {
return toHexString(getEventMask());
}
public int getEventChannelMask() throws InterruptedException, DeviceException {
public int getEventChannelMask() throws InterruptedException, IOException {
return moduleChMaskRb.getValue();
}
public String getEventChannelMaskStr() throws InterruptedException, DeviceException {
public String getEventChannelMaskStr() throws InterruptedException, IOException {
return toHexString(getEventChannelMask());
}
public int getChannelIlkCommand() throws InterruptedException, DeviceException {
public int getChannelIlkCommand() throws InterruptedException, IOException {
return moduleIlkCommandRb.getValue();
}
public String getChannelIlkCommandStr() throws InterruptedException, DeviceException {
public String getChannelIlkCommandStr() throws InterruptedException, IOException {
return toHexString(getChannelIlkCommand());
}
@@ -280,7 +281,7 @@ public class PowerSupply extends DeviceBase implements BitMask {
boolean killEnabled;
}
public ModuleStatus getStatus(int mask) throws InterruptedException, DeviceException {
public ModuleStatus getStatus(int mask) throws InterruptedException, IOException {
ModuleStatus ret = new ModuleStatus();
ret.mask = mask;
ret.fineAdjAct = ((mask & BIT0) != 0);
@@ -301,7 +302,7 @@ public class PowerSupply extends DeviceBase implements BitMask {
return ret;
}
public ModuleStatus getStatus() throws InterruptedException, DeviceException {
public ModuleStatus getStatus() throws InterruptedException, IOException {
Integer mask = moduleStatus.getValue();
return getStatus(mask);
}
@@ -317,7 +318,7 @@ public class PowerSupply extends DeviceBase implements BitMask {
}
public ModuleEventStatus getEventStatus() throws InterruptedException, DeviceException {
public ModuleEventStatus getEventStatus() throws InterruptedException, IOException {
Integer mask = moduleEvStatus.getValue();
ModuleEventStatus ret = new ModuleEventStatus();
ret.mask = mask;
@@ -333,43 +334,43 @@ public class PowerSupply extends DeviceBase implements BitMask {
////////////////////////////////////////////////////////////////////////////
//Public Interface - Module config
////////////////////////////////////////////////////////////////////////////
public Double getVoltageRampSetpoint() throws InterruptedException, DeviceException {
public Double getVoltageRampSetpoint() throws InterruptedException, IOException {
return moduleVoltageRamp.getValue();
}
public Double getCurrentRampSetpoint() throws InterruptedException, DeviceException {
public Double getCurrentRampSetpoint() throws InterruptedException, IOException {
return moduleCurrentRamp.getValue();
}
public Integer getAdcSamplesSetpoint() throws InterruptedException, DeviceException {
public Integer getAdcSamplesSetpoint() throws InterruptedException, IOException {
return moduleAdcSamples.getValue();
}
public void setAdcSamplesSetpoint(Integer value) throws InterruptedException, DeviceException {
public void setAdcSamplesSetpoint(Integer value) throws InterruptedException, IOException {
moduleAdcSamples.write(value);
}
public Integer getDigFilterSetpoint() throws InterruptedException, DeviceException {
public Integer getDigFilterSetpoint() throws InterruptedException, IOException {
return moduleDigFilter.getValue();
}
public void setDigFilterSetpoint(Integer value) throws InterruptedException, DeviceException {
public void setDigFilterSetpoint(Integer value) throws InterruptedException, IOException {
moduleDigFilter.write(value);
}
public Integer getRestartDelaySetpoint() throws InterruptedException, DeviceException {
public Integer getRestartDelaySetpoint() throws InterruptedException, IOException {
return moduleRestartDelay.getValue();
}
public void setRestartDelaySetpoint(Integer value) throws InterruptedException, DeviceException {
public void setRestartDelaySetpoint(Integer value) throws InterruptedException, IOException {
moduleRestartDelay.write(value);
}
public void setVoltageRampSetpoint(Double value) throws InterruptedException, DeviceException {
public void setVoltageRampSetpoint(Double value) throws InterruptedException, IOException {
moduleVoltageRamp.write(value);
}
public void setCurrentRampSetpoint(Double value) throws InterruptedException, DeviceException {
public void setCurrentRampSetpoint(Double value) throws InterruptedException, IOException {
moduleCurrentRamp.write(value);
}
@@ -388,7 +389,7 @@ public class PowerSupply extends DeviceBase implements BitMask {
CLEAR
}
public void setModuleCommand(ModuleCommand cmd) throws InterruptedException, DeviceException {
public void setModuleCommand(ModuleCommand cmd) throws InterruptedException, IOException {
moduleCommand.write(cmd.toString().replaceAll("_", " "));
}
@@ -446,7 +447,7 @@ public class PowerSupply extends DeviceBase implements BitMask {
}
}
public static ChannelStatus getChannelStatus(int mask) throws InterruptedException, DeviceException {
public static ChannelStatus getChannelStatus(int mask) throws InterruptedException, IOException {
ChannelStatus ret = new ChannelStatus();
ret.mask = mask;
ret.inputDataErr = ((mask & BIT2) != 0);
@@ -465,12 +466,12 @@ public class PowerSupply extends DeviceBase implements BitMask {
}
public ChannelStatus getChannelStatus() throws InterruptedException, DeviceException {
public ChannelStatus getChannelStatus() throws InterruptedException, IOException {
Integer mask = channelStatus.getValue();
return getChannelStatus(mask);
}
public ChannelStatus getChannelEventStatus() throws InterruptedException, DeviceException {
public ChannelStatus getChannelEventStatus() throws InterruptedException, IOException {
Integer mask = channelEvents.getValue();
ChannelStatus ret = new ChannelStatus();
ret.mask = mask;
@@ -489,130 +490,130 @@ public class PowerSupply extends DeviceBase implements BitMask {
return ret;
}
public int getChannelEventMask() throws InterruptedException, DeviceException {
public int getChannelEventMask() throws InterruptedException, IOException {
return channelEventMaskReadback.getValue();
}
public Double getChannelVoltageMax() throws InterruptedException, DeviceException {
public Double getChannelVoltageMax() throws InterruptedException, IOException {
return channelVoltageMax.getValue();
}
public Double getChannelVoltageNominalReadback() throws InterruptedException, DeviceException {
public Double getChannelVoltageNominalReadback() throws InterruptedException, IOException {
return channelVoltageNominalReadback.getValue();
}
public Double getChannelActualVoltage() throws InterruptedException, DeviceException {
public Double getChannelActualVoltage() throws InterruptedException, IOException {
return channelActualVoltage.getValue();
}
public Double getChannelCurrentMax() throws InterruptedException, DeviceException {
public Double getChannelCurrentMax() throws InterruptedException, IOException {
return channelCurrentMax.getValue();
}
public Double getChannelActualCurrent() throws InterruptedException, DeviceException {
public Double getChannelActualCurrent() throws InterruptedException, IOException {
return channelActualCurrent.getValue();
}
public Double getChannelCurrentNominalReadback() throws InterruptedException, DeviceException {
public Double getChannelCurrentNominalReadback() throws InterruptedException, IOException {
return channelCurrentNominalReadback.getValue();
}
public Double getChannelDesiredVoltageReadback() throws InterruptedException, DeviceException {
public Double getChannelDesiredVoltageReadback() throws InterruptedException, IOException {
return channelDesiredVoltageReadback.getValue();
}
public Double getChannelDesiredCurrentReadback() throws InterruptedException, DeviceException {
public Double getChannelDesiredCurrentReadback() throws InterruptedException, IOException {
return channelDesiredCurrentReadback.getValue();
}
public Double getChannelVoltageIlkMaxReadback() throws InterruptedException, DeviceException {
public Double getChannelVoltageIlkMaxReadback() throws InterruptedException, IOException {
return channelVoltageIlkMaxReadback.getValue();
}
public Double getChannelVoltageIlkMinReadback() throws InterruptedException, DeviceException {
public Double getChannelVoltageIlkMinReadback() throws InterruptedException, IOException {
return channelVoltageIlkMinReadback.getValue();
}
public Double getChannelCurrentIlkMaxReadback() throws InterruptedException, DeviceException {
public Double getChannelCurrentIlkMaxReadback() throws InterruptedException, IOException {
return channelCurrentIlkMaxReadback.getValue();
}
public Double getChannelCurrentIlkMinReadback() throws InterruptedException, DeviceException {
public Double getChannelCurrentIlkMinReadback() throws InterruptedException, IOException {
return channelCurrentIlkMinReadback.getValue();
}
public int getChannelControlReadback() throws InterruptedException, DeviceException {
public int getChannelControlReadback() throws InterruptedException, IOException {
return channelCommandReadback.getValue();
}
public String getChannelControlReadbackStr() throws InterruptedException, DeviceException {
public String getChannelControlReadbackStr() throws InterruptedException, IOException {
return toHexString(getModuleControl());
}
////////////////////////////////////////////////////////////////////////////
//Public Interface - Channel Config
////////////////////////////////////////////////////////////////////////////
public Double getChannelDesiredVoltage() throws InterruptedException, DeviceException {
public Double getChannelDesiredVoltage() throws InterruptedException, IOException {
return channelDesiredVoltageSetpoint.getValue();
}
public Double getChannelDesiredCurrent() throws InterruptedException, DeviceException {
public Double getChannelDesiredCurrent() throws InterruptedException, IOException {
return channelDesiredCurrentSetpoint.getValue();
}
public void setChannelDesiredVoltage(Double value) throws InterruptedException, DeviceException {
public void setChannelDesiredVoltage(Double value) throws InterruptedException, IOException {
channelDesiredVoltageSetpoint.write(value);
}
public void setChannelDesiredCurrent(Double value) throws InterruptedException, DeviceException {
public void setChannelDesiredCurrent(Double value) throws InterruptedException, IOException {
channelDesiredCurrentSetpoint.write(value);
}
public Double getChannelVoltageIlkMax() throws InterruptedException, DeviceException {
public Double getChannelVoltageIlkMax() throws InterruptedException, IOException {
return channelVoltageIlkMax.getValue();
}
public Double getChannelVoltageIlkMin() throws InterruptedException, DeviceException {
public Double getChannelVoltageIlkMin() throws InterruptedException, IOException {
return channelVoltageIlkMin.getValue();
}
public Double getChannelCurrentIlkMax() throws InterruptedException, DeviceException {
public Double getChannelCurrentIlkMax() throws InterruptedException, IOException {
return channelCurrentIlkMax.getValue();
}
public Double getChannelCurrentIlkMin() throws InterruptedException, DeviceException {
public Double getChannelCurrentIlkMin() throws InterruptedException, IOException {
return channelCurrentIlkMin.getValue();
}
public void setChannelVoltageIlkMax(Double value) throws InterruptedException, DeviceException {
public void setChannelVoltageIlkMax(Double value) throws InterruptedException, IOException {
channelVoltageIlkMax.write(value);
}
public void setChannelVoltageIlkMin(Double value) throws InterruptedException, DeviceException {
public void setChannelVoltageIlkMin(Double value) throws InterruptedException, IOException {
channelVoltageIlkMin.write(value);
}
public void setChannelCurrentIlkMax(Double value) throws InterruptedException, DeviceException {
public void setChannelCurrentIlkMax(Double value) throws InterruptedException, IOException {
channelCurrentIlkMax.write(value);
}
public void setChannelCurrentIlkMin(Double value) throws InterruptedException, DeviceException {
public void setChannelCurrentIlkMin(Double value) throws InterruptedException, IOException {
channelCurrentIlkMin.write(value);
}
public Double getChannelVoltageNominal() throws InterruptedException, DeviceException {
public Double getChannelVoltageNominal() throws InterruptedException, IOException {
return channelVoltageNominalSetpoint.getValue();
}
public Double getChannelCurrentNominal() throws InterruptedException, DeviceException {
public Double getChannelCurrentNominal() throws InterruptedException, IOException {
return channelCurrentNominalSetpoint.getValue();
}
public void setChannelVoltageNominal(Double value) throws InterruptedException, DeviceException {
public void setChannelVoltageNominal(Double value) throws InterruptedException, IOException {
channelVoltageNominalSetpoint.write(value);
}
public void setChannelCurrentNominal(Double value) throws InterruptedException, DeviceException {
public void setChannelCurrentNominal(Double value) throws InterruptedException, IOException {
channelCurrentNominalSetpoint.write(value);
}
@@ -627,7 +628,7 @@ public class PowerSupply extends DeviceBase implements BitMask {
AIBND_OFF
}
public void setChannelCommand(ChannelCommand cmd) throws InterruptedException, DeviceException {
public void setChannelCommand(ChannelCommand cmd) throws InterruptedException, IOException {
channelCommand.write(cmd.toString().replaceAll("_", " "));
}