diff --git a/src/Scienta.java b/src/Scienta.java index b849699..39cd346 100644 --- a/src/Scienta.java +++ b/src/Scienta.java @@ -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 getChannelRange() throws IOException, InterruptedException { ArrayList 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; } diff --git a/src/ScientaPanel.form b/src/ScientaPanel.form index 801d98b..d647676 100644 --- a/src/ScientaPanel.form +++ b/src/ScientaPanel.form @@ -27,7 +27,7 @@ - + @@ -48,10 +48,6 @@ - - - - @@ -60,10 +56,8 @@ - - - + @@ -464,8 +458,6 @@ - - @@ -478,7 +470,6 @@ - @@ -492,8 +483,6 @@ - - @@ -508,7 +497,6 @@ - @@ -644,22 +632,14 @@ - - - - - - - - - - - - - - - + + + + + + + @@ -669,7 +649,7 @@ - + diff --git a/src/ScientaPanel.java b/src/ScientaPanel.java index fab048b..afb40f9 100644 --- a/src/ScientaPanel.java +++ b/src/ScientaPanel.java @@ -32,7 +32,7 @@ public final class ScientaPanel extends DevicePanel { } else if (origin == valueHigh) { getDevice().getHighEnergy().writeAsync(value); } else if (origin == valueSize) { - getDevice().getStepSize().writeAsync(value); + getDevice().getEnergyStepSize().writeAsync(value); } else if (origin == valueSlices) { getDevice().getSlices().writeAsync((int) value); } else if (origin == valueIterations) { @@ -92,6 +92,13 @@ public final class ScientaPanel extends DevicePanel { //cameraPanel.startTimer(3000, 0); startTimer(3000, 0); } + + valueLow.setMaxValue(getDevice().getLowEnergy().getMaxValue()); + valueLow.setMinValue(getDevice().getLowEnergy().getMinValue()); + valueCenter.setMaxValue(getDevice().getCenterEnergy().getMaxValue()); + valueCenter.setMinValue(getDevice().getCenterEnergy().getMinValue()); + valueHigh.setMaxValue(getDevice().getHighEnergy().getMaxValue()); + valueHigh.setMinValue(getDevice().getHighEnergy().getMinValue()); } DeviceListener progressListener = new DeviceAdapter() { @@ -163,7 +170,7 @@ public final class ScientaPanel extends DevicePanel { dd.high = getDevice().getHighEnergy().getValue(); dd.width = getDevice().getEnergyWidth().getValue(); //dd.frames = getDevice().getFrames().getValue(); - dd.size = getDevice().getStepSize().getValue(); + dd.size = getDevice().getEnergyStepSize().getValue(); dd.slices = getDevice().getSlices().getValue(); dd.current = getDevice().getCurrentStep().getValue().intValue(); @@ -267,7 +274,6 @@ public final class ScientaPanel extends DevicePanel { jLabel17 = new javax.swing.JLabel(); valueIterations = new ch.psi.pshell.swing.ValueSelection(); buttonZeroSupplies = new javax.swing.JButton(); - jPanel3 = new javax.swing.JPanel(); jPanel7 = new javax.swing.JPanel(); cameraPanel.setBorder(null); @@ -443,15 +449,12 @@ public final class ScientaPanel extends DevicePanel { jLabel12.setText("Low:"); valueLow.setDecimals(2); - valueLow.setMaxValue(2000.0); - valueLow.setMinValue(0.0); valueLow.setShowButtons(false); jLabel13.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel13.setText("Center:"); valueCenter.setDecimals(2); - valueCenter.setMaxValue(2000.0); valueCenter.setMinValue(0.0); valueCenter.setShowButtons(false); @@ -459,8 +462,6 @@ public final class ScientaPanel extends DevicePanel { jLabel14.setText("High:"); valueHigh.setDecimals(2); - valueHigh.setMaxValue(2000.0); - valueHigh.setMinValue(0.0); valueHigh.setShowButtons(false); jLabel15.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); @@ -469,7 +470,6 @@ public final class ScientaPanel extends DevicePanel { valueWidth.setDecimals(2); valueWidth.setEnabled(false); valueWidth.setMaxValue(2000.0); - valueWidth.setMinValue(0.0); valueWidth.setShowButtons(false); javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); @@ -644,16 +644,7 @@ public final class ScientaPanel extends DevicePanel { jPanel6Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jPanel1, jPanel4}); - javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); - jPanel3.setLayout(jPanel3Layout); - jPanel3Layout.setHorizontalGroup( - jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 100, Short.MAX_VALUE) - ); - jPanel3Layout.setVerticalGroup( - jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 100, Short.MAX_VALUE) - ); + jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder("Collect")); javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7); jPanel7.setLayout(jPanel7Layout); @@ -663,7 +654,7 @@ public final class ScientaPanel extends DevicePanel { ); jPanel7Layout.setVerticalGroup( jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 100, Short.MAX_VALUE) + .addGap(0, 125, Short.MAX_VALUE) ); javax.swing.GroupLayout scientaPanelLayout = new javax.swing.GroupLayout(scientaPanel); @@ -672,9 +663,6 @@ public final class ScientaPanel extends DevicePanel { scientaPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(scientaPanelLayout.createSequentialGroup() - .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(0, 0, Short.MAX_VALUE)) .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); scientaPanelLayout.setVerticalGroup( @@ -682,10 +670,8 @@ public final class ScientaPanel extends DevicePanel { .addGroup(scientaPanelLayout.createSequentialGroup() .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) ); @@ -702,7 +688,7 @@ public final class ScientaPanel extends DevicePanel { layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(cameraPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(0, 0, Short.MAX_VALUE)) + .addGap(0, 5, Short.MAX_VALUE)) .addComponent(scientaPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); }// //GEN-END:initComponents @@ -819,7 +805,6 @@ public final class ScientaPanel extends DevicePanel { private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; - private javax.swing.JPanel jPanel3; private javax.swing.JPanel jPanel4; private javax.swing.JPanel jPanel5; private javax.swing.JPanel jPanel6;