diff --git a/devices/WireScanner motor.properties b/devices/WireScanner motor.properties index 61bbf91..9883cf3 100644 --- a/devices/WireScanner motor.properties +++ b/devices/WireScanner motor.properties @@ -1,12 +1,12 @@ -#Thu Apr 27 10:34:03 CEST 2017 -defaultSpeed=1000.0 +#Thu Apr 27 11:59:57 CEST 2017 +defaultSpeed=6000.0 estbilizationDelay=0 hasEnable=false homingType=None maxSpeed=8000.0 -maxValue=64000.0 +maxValue=51500.0 minSpeed=50.0 -minValue=-47600.0 +minValue=-56300.0 offset=0.0 precision=1 resolution=0.1 diff --git a/plugins/WireScan.form b/plugins/WireScan.form index 1f2af81..929cd8a 100644 --- a/plugins/WireScan.form +++ b/plugins/WireScan.form @@ -80,18 +80,13 @@ - - - - - - - - - - - - + + + + + + + @@ -361,7 +356,7 @@ - + diff --git a/plugins/WireScan.java b/plugins/WireScan.java index b242d96..2c73103 100644 --- a/plugins/WireScan.java +++ b/plugins/WireScan.java @@ -16,10 +16,8 @@ import ch.psi.pshell.ui.Panel; import ch.psi.pshell.ui.Plugin; import ch.psi.utils.Convert; import ch.psi.utils.State; -import ch.psi.utils.swing.SwingUtils; import java.awt.BorderLayout; import java.awt.Color; -import java.awt.Component; import java.awt.Dimension; import java.util.ArrayList; import java.util.List; @@ -30,7 +28,6 @@ import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; -import javax.swing.JSpinner; import javax.swing.JTextField; /** @@ -67,7 +64,7 @@ public class WireScan extends Panel { DefaultComboBoxModel model = new DefaultComboBoxModel(); eval("run('Devices/Elements')", true); model.addElement(""); - List ret = (List) ((Plugin)this).eval("get_wire_scans()", true); + List ret = (List) ((Plugin)this).eval("get_wire_scanners()", true); for (String scan: ret){ model.addElement(scan); } @@ -191,8 +188,9 @@ public class WireScan extends Panel { if ("WireScan".equals(getContext().getExecutionPars().getName())) { double position = (Double) record.getValues()[0]; for (int i=0; i< series.length; i++){ - if (record.getValues()[4 + i] != null){ - series[i].appendData(position,(Double) record.getValues()[5 + i]); + Double val = (Double) record.getValues()[5 + i]; + if (val != null){ + series[i].appendData(position, val); } } } @@ -228,6 +226,7 @@ public class WireScan extends Panel { if (parked && moved){ System.out.println("Parking scanner"); Epics.putq(currentScannner + ":GARAGE_SEL.PROC", 1); + Epics.putq(currentScannner + ":INIT.PROC", 1); } } catch (Exception ex){ ex.printStackTrace(); @@ -383,7 +382,7 @@ public class WireScan extends Panel { plot.setTitle(""); - buttonPark.setText("Park"); + buttonPark.setText("Garage"); buttonPark.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { buttonParkActionPerformed(evt); @@ -499,16 +498,13 @@ public class WireScan extends Panel { .addComponent(panelStatus, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(comboBpm1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(comboBpm2, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(spinnerStartY) .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(spinnerStartY) - .addGroup(layout.createSequentialGroup() - .addComponent(spinnerVel, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(18, 18, Short.MAX_VALUE) - .addComponent(jLabel9) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(spinnerCycles))) - .addGap(0, 0, Short.MAX_VALUE)) + .addComponent(spinnerVel, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, Short.MAX_VALUE) + .addComponent(jLabel9) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(spinnerCycles)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() @@ -640,7 +636,7 @@ public class WireScan extends Panel { cb.setSelectedItem(""); } } else { - List ret = (List) ((Plugin)this).eval("get_wire_scans_bpms('" + currentScannner + "')", true); + List ret = (List) ((Plugin)this).eval("get_wire_scanners_bpms('" + currentScannner + "')", true); comboBpm1.setSelectedItem((ret==null) ? "" : ret.get(0)); comboBpm2.setSelectedItem((ret==null) ? "" : ret.get(1)); int selection = Epics.get(currentScannner + ":WIRE_SP", Integer.class); @@ -716,6 +712,7 @@ public class WireScan extends Panel { bpms.add(cb.getSelectedItem().toString()); } } + parameters.add(bpms); getContext().addScanListener(scanListener); try { runAsync("Diagnostics/WireScan", parameters).handle((ret, ex) -> { @@ -750,6 +747,15 @@ public class WireScan extends Panel { private void buttonMoveStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonMoveStartActionPerformed try { + int type = comboScanType.getSelectedIndex(); + boolean isSet1 = (type==0) || (type==1) || (type==4); + boolean isX = (type==0) || (type==2) || (type>=4); + + if (isSet1){ + Epics.putq(currentScannner + ":WIRE_SP", isX ? 1 : 2); + } else { + Epics.putq(currentScannner + ":WIRE_SP", isX ? 3 : 4); + } Epics.putq(currentScannner + ":INIT.PROC", 1); } catch (Exception ex) { showException(ex); @@ -759,6 +765,7 @@ public class WireScan extends Panel { private void buttonParkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonParkActionPerformed try { Epics.putq(currentScannner + ":GARAGE_SEL.PROC", 1); + Epics.putq(currentScannner + ":INIT.PROC", 1); } catch (Exception ex) { showException(ex); } diff --git a/script/Devices/Elements.py b/script/Devices/Elements.py index b865acc..333c890 100644 --- a/script/Devices/Elements.py +++ b/script/Devices/Elements.py @@ -186,7 +186,7 @@ def get_bpms(): ret.append(element[1]) return ret -def get_wire_scans(): +def get_wire_scanners(): ret = [] for element in elements: if element[0]==DWSC: @@ -195,7 +195,7 @@ def get_wire_scans(): -def get_wire_scans_bpms(wire_scan): +def get_wire_scanners_bpms(wire_scan): last = None ret = [] for element in elements: @@ -209,6 +209,6 @@ def get_wire_scans_bpms(wire_scan): return None -#for w in get_wire_scans(): -# print w, get_wire_scans_bpms(w) +#for w in get_wire_scanners(): +# print w, get_wire_scanners_bpms(w) diff --git a/script/Devices/WireScanner.py b/script/Devices/WireScanner.py index 848dc33..631ae6a 100644 --- a/script/Devices/WireScanner.py +++ b/script/Devices/WireScanner.py @@ -147,10 +147,13 @@ class WireScanner(WireScanInfo): caputq(self.prefix + ":ABORT.PROC", 1) def init(self): + #if self.selection is not None: + # self.wire_sel.put(WireScanner.Selection.index(self.selection)) caputq(self.prefix + ":INIT.PROC", 1) def park(self): caputq(self.prefix + ":GARAGE_SEL.PROC", 1) + caputq(self.prefix + ":INIT.PROC", 1) def scan(self): self.cycles = self.nb_cycles.get() diff --git a/script/Diagnostics/WireScan.py b/script/Diagnostics/WireScan.py index 0ff5721..1cdfee0 100644 --- a/script/Diagnostics/WireScan.py +++ b/script/Diagnostics/WireScan.py @@ -11,12 +11,12 @@ scan_type = args[1] if is_panel else WireScanner.WireX1 scan_range = args[2] if is_panel else [-2000, 2000, -2000, 2000] cycles = args[3] if is_panel else 5 velocity = args[4] if is_panel else 200 -bpms = args[5] if is_panel else get_wire_scans_bpms(prefix) +bpms = args[5] if is_panel else get_wire_scanners_bpms(prefix) print "WireScan parameters: ", prefix, scan_type, scan_range, cycles, cycles, bpms #Creating WireScanner object print "Creating scanner..." -if prefix not in get_wire_scans(): +if prefix not in get_wire_scanners(): raise Exception("Invalid wire scan: " + prefix) scanner = WireScanner(prefix, scan_range, cycles, velocity, True) scanner.set_selection(get_scan_selection(scan_type))