Completed channels

This commit is contained in:
gac-x09la
2021-08-30 14:52:26 +02:00
parent c1c747c22f
commit 478e0766fb
3 changed files with 176 additions and 127 deletions

View File

@@ -22,14 +22,17 @@ import java.util.logging.Logger;
*/
public class Scienta extends AreaDetector {
final ChannelInteger acquire;
final ChannelInteger slices;
final ChannelDouble lowEnergy, centerEnergy, highEnergy, stepSize, energyWidth;
final ChannelInteger energyCount, ThetaYCount, ThetaXCount;
final ChannelDouble energyWidth, ThetaYWidth, lowThetaX, highThetaX, stepSizeThetaX, ThetaXWidth;
final ControlledVariable lowEnergy, centerEnergy, highEnergy, stepSize, lowThetaY, centerThetaY, highThetaY, stepSizeThetaY, centerThetaX;
final ControlledVariable excitationEnergy;
final GenericArray data;
final ChannelInteger totalSteps, currentStep;
final ChannelString lensMode, acquisitionMode, passEnergy;
final ChannelInteger numSlices;
final ChannelInteger totalSteps, currentStep, exposuresComplete;
final ChannelString lensMode, acquisitionMode, passEnergy, estTime, detectorState, status;
final ChannelInteger slices, slicesReadback, channels, channelsReadback;
final Stats[] stats;
final String channelCtrl;
final Device[] monitoredChildren;
public Scienta(final String name, final String channelPrefix) {
this(name, channelPrefix + ":cam1", channelPrefix + ":image1");
@@ -41,22 +44,47 @@ public class Scienta extends AreaDetector {
acquire = new ChannelInteger(name + " aquire", channelCtrl + ":Acquire", false);
slices = new ChannelInteger(name + " slices", channelCtrl + ":SLICES", false);
//frames = new ChannelInteger(name + " frames", channelCtrl + ":FRAMES", false);
lowEnergy = new ChannelDouble(name + " low energy", channelCtrl + ":LOW_ENERGY", 3, false);
centerEnergy = new ChannelDouble(name + " center energy", channelCtrl + ":CENTRE_ENERGY", 3, false);
highEnergy = new ChannelDouble(name + " high energy", channelCtrl + ":HIGH_ENERGY", 3, false);
stepSize = new ChannelDouble(name + " step size", channelCtrl + ":STEP_SIZE", 3, false);
lowEnergy = new ControlledVariable(name + " low energy", channelCtrl + ":LOW_ENERGY", channelCtrl + ":LOW_ENERGY_RBV", false);
centerEnergy = new ControlledVariable(name + " center energy", channelCtrl + ":CENTRE_ENERGY", channelCtrl + ":CENTRE_ENERGY_RBV", false);
highEnergy = new ControlledVariable(name + " high energy", channelCtrl + ":HIGH_ENERGY", channelCtrl + ":HIGH_ENERGY_RBV", false);
stepSize = new ControlledVariable(name + " step size", channelCtrl + ":STEP_SIZE", channelCtrl + ":STEP_SIZE_RBV", false);
energyWidth = new ChannelDouble(name + " energy width", channelCtrl + ":ENERGY_WIDTH_RBV", 3, false);
energyWidth.setAccessType(AccessType.Read);
energyCount = new ChannelInteger(name + " energy width", channelCtrl + ":COUNT_RBV", false);
energyCount.setAccessType(AccessType.Read);
lowThetaY = new ControlledVariable(name + " low Theta Y", channelCtrl + ":LOW_THETA_Y", channelCtrl + ":LOW_THETA_Y_RBV", false);
centerThetaY = new ControlledVariable(name + " center Theta Y", channelCtrl + ":CENTRE_THETA_Y", channelCtrl + ":CENTRE_THETA_Y_RBV", false);
highThetaY = new ControlledVariable(name + " high Theta Y", channelCtrl + ":HIGH_THETA_Y", channelCtrl + ":HIGH_THETA_Y_RBV", false);
stepSizeThetaY = new ControlledVariable(name + " Theta Y step size", channelCtrl + ":THETA_Y_STEP_SIZE", channelCtrl + ":THETA_Y_STEP_SIZE_RBV", false);
ThetaYWidth = new ChannelDouble(name + " Theta Y energy width", channelCtrl + ":THETA_Y_WIDTH_RBV", 3, false);
ThetaYWidth.setAccessType(AccessType.Read);
ThetaYCount = new ChannelInteger(name + " Theta Y energy width", channelCtrl + ":THETA_Y_COUNT_RBV", false);
ThetaYCount.setAccessType(AccessType.Read);
lowThetaX = new ChannelDouble(name + " low Theta X", channelCtrl + ":LOW_SLICE_RBV", 3, false);
lowThetaX.setAccessType(AccessType.Read);
centerThetaX = new ControlledVariable(name + " center Theta X", channelCtrl + ":CENTRE_SLICE", channelCtrl + ":CENTRE_SLICE_RBV", false);
highThetaX = new ChannelDouble(name + " high Theta X", channelCtrl + ":HIGH_SLICE_RBV", 3, false);
highThetaX.setAccessType(AccessType.Read);
stepSizeThetaX = new ChannelDouble(name + " Theta X step size", channelCtrl + ":SLICE_STEP_SIZE_RBV", 3, false);
stepSizeThetaX.setAccessType(AccessType.Read);
ThetaXWidth = new ChannelDouble(name + " ThetaX energy width", channelCtrl + ":SLICE_WIDTH_RBV", 3, false);
ThetaXWidth.setAccessType(AccessType.Read);
ThetaXCount = new ChannelInteger(name + " Theta X energy width", channelCtrl + ":SLICE_COUNT_RBV", false);
ThetaXCount.setAccessType(AccessType.Read);
passEnergy = new ChannelString(name + " pass energy", channelCtrl + ":PASS_ENERGY", false);
lensMode = new ChannelString(name + " lens mode", channelCtrl + ":LENS_MODE", false);
acquisitionMode = new ChannelString(name + " lens mode", channelCtrl + ":ACQ_MODE", false);
numSlices = new ChannelInteger(name + " num slices", channelCtrl + ":SLICES_RBV", false);
numSlices.setAccessType(AccessType.Read);
slices = new ChannelInteger(name + " slices", channelCtrl + ":SLICES", false);
slicesReadback = new ChannelInteger(name + " slices rbv", channelCtrl + ":SLICES_RBV", false);
slicesReadback.setAccessType(AccessType.Read);
channels = new ChannelInteger(name + " channels", channelCtrl + ":CHANNELS", false);
channelsReadback = new ChannelInteger(name + " channels rbv", channelCtrl + ":CHANNELS_RBV", false);
channelsReadback.setAccessType(AccessType.Read);
excitationEnergy = new ControlledVariable(name + " excitation energy", channelCtrl + ":EXCITATION_ENERGY", channelCtrl + ":EXCITATION_ENERGY_RBV", false);
data = new GenericArray(name + " data", channelData + ":ArrayData", SIZE_MAX, false); //If nullable on invalidd value, read blocks on Scienta.
data.setAutoResolveType(false);
@@ -65,17 +93,31 @@ public class Scienta extends AreaDetector {
totalSteps.setAccessType(AccessType.Read);
currentStep = new ChannelInteger(name + " current step", channelCtrl + ":STEPS_COUNTER_RBV", false);
currentStep.setAccessType(AccessType.Read);
exposuresComplete = new ChannelInteger(name + " exp complete", channelCtrl + ":NumExposuresCounter_RBV", false);
exposuresComplete.setAccessType(AccessType.Read);
estTime = new ChannelString(name + " estimated time", channelCtrl + ":ETA_STR", false);
estTime.setAccessType(AccessType.Read);
detectorState= new ChannelString(name + " detector state", channelCtrl + ":DetectorState_RBV", false);
detectorState.setAccessType(AccessType.Read);
status= new ChannelString(name + " status", channelCtrl + ":StatusMessage_RBV", false);
status.setAccessType(AccessType.Read);
addChildren(new Device[]{acquire, slices,
lowEnergy, centerEnergy, highEnergy, stepSize, energyWidth,
addChildren(new Device[]{acquire,
lowEnergy, centerEnergy, highEnergy, stepSize, energyWidth,energyCount,
lowThetaY, centerThetaY, highThetaY, stepSizeThetaY, ThetaYWidth,ThetaYCount,
data,
totalSteps, currentStep,
totalSteps, currentStep, estTime, detectorState, status, exposuresComplete,
passEnergy, lensMode, acquisitionMode,
numSlices
slices, slicesReadback, channels, channelsReadback, excitationEnergy
});
monitoredChildren = new Device[]{acquire,
lowEnergy,centerEnergy,highEnergy,energyWidth,energyCount,
lowThetaY, centerThetaY, highThetaY, stepSizeThetaY, ThetaYWidth,ThetaYCount,
stepSize,totalSteps,currentStep, exposuresComplete, passEnergy, lensMode,acquisitionMode,
slices, slicesReadback, channels, channelsReadback, excitationEnergy,
estTime, detectorState, status
};
stats = new Stats[5];
stats[0] = new Stats("CountsR1", 1);
@@ -83,8 +125,7 @@ public class Scienta extends AreaDetector {
stats[2] = new Stats("CountsR3", 3);
stats[3] = new Stats("CountsR4", 4);
stats[4] = new Stats("Counts", 5);
addChildren(stats);
addChildren(stats);
}
@Override
@@ -97,39 +138,17 @@ public class Scienta extends AreaDetector {
@Override
protected void doUpdate() throws IOException, InterruptedException {
super.doUpdate();
acquire.update();
slices.update();
lowEnergy.update();
centerEnergy.update();
highEnergy.update();
energyWidth.update();
stepSize.update();
totalSteps.update();
currentStep.update();
passEnergy.update();
lensMode.update();
acquisitionMode.update();
//channelBegin.update();
//channelEnd.update();
///sliceBegin.update();
//sliceEnd.update();
for (Device dev : monitoredChildren){
dev.update();
}
}
@Override
protected void doSetMonitored(boolean value) {
super.doSetMonitored(value);
acquire.setMonitored(value);
slices.setMonitored(value);
lowEnergy.setMonitored(value);
centerEnergy.setMonitored(value);
highEnergy.setMonitored(value);
energyWidth.setMonitored(value);
stepSize.setMonitored(value);
totalSteps.setMonitored(value);
currentStep.setMonitored(value);
passEnergy.setMonitored(value);
lensMode.setMonitored(value);
acquisitionMode.setMonitored(value);
for (Device dev : monitoredChildren){
dev.setMonitored(value);
}
}
@Override
@@ -280,29 +299,97 @@ public class Scienta extends AreaDetector {
return acquire;
}
public ChannelInteger getSlices() {
return slices;
}
public ChannelDouble getLowEnergy() {
public ControlledVariable getLowEnergy() {
return lowEnergy;
}
public ChannelDouble getCenterEnergy() {
public ControlledVariable getCenterEnergy() {
return centerEnergy;
}
public ChannelDouble getHighEnergy() {
public ControlledVariable getHighEnergy() {
return highEnergy;
}
public ChannelDouble getStepSize() {
public ControlledVariable getEnergyStepSize() {
return stepSize;
}
public ChannelDouble getEnergyWidth() {
return energyWidth;
}
public ChannelInteger getEnergyCount() {
return energyCount;
}
public ControlledVariable getLowThetaY() {
return lowThetaY;
}
public ControlledVariable getCenterThetaY() {
return centerThetaY;
}
public ControlledVariable getHighThetaY() {
return highThetaY;
}
public ControlledVariable getThetaYStepSize() {
return stepSizeThetaY;
}
public ChannelDouble getThetaYWidth() {
return ThetaYWidth;
}
public ChannelInteger getThetaYCount() {
return ThetaYCount;
}
public ChannelString getEstTime() {
return estTime;
}
public ChannelString getDetectorState() {
return detectorState;
}
public ChannelString getStatus() {
return status;
}
public ChannelInteger getSlices() {
return slices;
}
public ChannelInteger getSlicesReadback() {
return slicesReadback;
}
public ChannelInteger getChannels() {
return channels;
}
public ChannelInteger getChannelsReadback() {
return channelsReadback;
}
public ChannelInteger getTotalSteps() {
return totalSteps;
}
public ChannelInteger getCurrentStep() {
return currentStep;
}
public ChannelInteger getExposuresComplete() {
return exposuresComplete;
}
public ControlledVariable getExcitationEnergy() {
return excitationEnergy;
}
public List<Double> getChannelRange() throws IOException, InterruptedException {
ArrayList<Double> ret = new ArrayList<>();
@@ -355,18 +442,15 @@ public class Scienta extends AreaDetector {
return ret;
}
public ChannelInteger getNumSlices() {
return numSlices;
public Integer readNumExposures() throws IOException, InterruptedException{
return (Integer) readCtrl("NumExposures_RBV", Integer.class);
}
public ChannelInteger getTotalSteps() {
return totalSteps;
public Double readAcqTime() throws IOException, InterruptedException{
return (Double) readCtrl("AcquireTime_RBV", Double.class);
}
public ChannelInteger getCurrentStep() {
return currentStep;
}
public Stats[] getStats() {
return stats;
}