/** Creates new BpmAgent */ public BpmAgent(AcceleratorSeq aSequence, BPM newBpmNode) { bpmNode = newBpmNode; sequence = aSequence; xavgch = bpmNode.getChannel(BPM.X_TBT_HANDLE); yavgch = bpmNode.getChannel(BPM.Y_TBT_HANDLE); xavgch.requestConnection(); yavgch.requestConnection(); bpmNode.getChannel(BPM.X_AVG_HANDLE).requestConnection(); bpmNode.getChannel(BPM.Y_AVG_HANDLE).requestConnection(); // xavgch.setSyncRequest(true); // yavgch.setSyncRequest(true); // xavgch.connect(); // yavgch.connect(); // xavgch.pendIO(5); // yavgch.pendIO(5); // xavgch.setSyncRequest(false); // yavgch.setSyncRequest(false); }
/** Get the vertical TBT array * */ public double[] getYAvgTBTArray() { double[] value; int size = 0; try { size = yavgch.elementCount(); } catch (ConnectionException e) { } value = new double[size]; try { value = yavgch.getArrDbl(); } catch (ConnectionException e) { System.err.println("Unable to connect to channel access."); } catch (GetException e) { System.err.println("Unable to get process variables."); } return value; }
/** Test if the BPM node is okay */ public boolean isConnected() { return xavgch.isConnected() && yavgch.isConnected() && bpmNode.getChannel(BPM.X_AVG_HANDLE).isConnected() && bpmNode.getChannel(BPM.Y_AVG_HANDLE).isConnected(); }