Closedown

This commit is contained in:
sfop
2017-04-27 12:53:54 +02:00
parent e30add5aa0
commit cf505cdb61
6 changed files with 45 additions and 40 deletions

View File

@@ -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

View File

@@ -80,18 +80,13 @@
<Component id="panelStatus" alignment="0" max="32767" attributes="0"/>
<Component id="comboBpm1" max="32767" attributes="0"/>
<Component id="comboBpm2" alignment="0" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerStartY" linkSize="8" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="spinnerVel" linkSize="8" min="-2" pref="104" max="-2" attributes="0"/>
<EmptySpace type="separate" max="32767" attributes="0"/>
<Component id="jLabel9" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinnerCycles" linkSize="7" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="spinnerStartY" linkSize="8" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="spinnerVel" linkSize="8" min="-2" pref="104" max="-2" attributes="0"/>
<EmptySpace type="separate" max="32767" attributes="0"/>
<Component id="jLabel9" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinnerCycles" linkSize="7" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
@@ -361,7 +356,7 @@
</Component>
<Component class="javax.swing.JButton" name="buttonPark">
<Properties>
<Property name="text" type="java.lang.String" value="Park"/>
<Property name="text" type="java.lang.String" value="Garage"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonParkActionPerformed"/>

View File

@@ -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<String> ret = (List<String>) ((Plugin)this).eval("get_wire_scans()", true);
List<String> ret = (List<String>) ((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<String> ret = (List<String>) ((Plugin)this).eval("get_wire_scans_bpms('" + currentScannner + "')", true);
List<String> ret = (List<String>) ((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);
}

View File

@@ -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)

View File

@@ -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()

View File

@@ -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))