minor changes

This commit is contained in:
2013-10-21 13:21:01 +02:00
parent 3cb7458e64
commit 795b269bd0
13 changed files with 21 additions and 57 deletions
@@ -70,7 +70,7 @@ import ch.psi.fda.core.scripting.JythonParameterMappingChannel;
import ch.psi.fda.core.scripting.JythonParameterMappingGlobalVariable;
import ch.psi.fda.core.scripting.JythonParameterMappingID;
import ch.psi.fda.core.sensors.ChannelAccessSensor;
import ch.psi.fda.core.sensors.MillisecondTimestampSensor;
import ch.psi.fda.core.sensors.TimestampSensor;
import ch.psi.fda.model.ModelManager;
import ch.psi.fda.model.v1.Action;
import ch.psi.fda.model.v1.ArrayDetector;
@@ -966,7 +966,7 @@ public class Acquisition {
Timestamp dd = (Timestamp) detector;
// Ad sensor
MillisecondTimestampSensor sensor = new MillisecondTimestampSensor(dd.getId());
TimestampSensor sensor = new TimestampSensor(dd.getId());
aLoop.getSensors().add(sensor);
}
else{
@@ -1027,7 +1027,7 @@ public class Acquisition {
Timestamp detector = dimension.getTimestamp();
if(detector != null){
actionLoop.getSensors().add(new MillisecondTimestampSensor(detector.getId()));
actionLoop.getSensors().add(new TimestampSensor(detector.getId()));
}
actionLoop.getPostActions().addAll(mapActions(dimension.getPostAction()));
@@ -58,7 +58,6 @@ public class Manipulator {
manipulation.initialize(this.metadata);
// Add manipulation id to metadata
System.out.println(""+manipulation.getId());
this.metadata.add(new Metadata(manipulation.getId(),0)); // Calculated component always belongs to lowes dimension
}
}
@@ -42,6 +42,11 @@ public class JythonFunction implements Function {
public JythonFunction(String script, Map<String, JythonGlobalVariable> map){
// Workaround for Jython memory leak
// http://blog.hillbrecht.de/2009/07/11/jython-memory-leakout-of-memory-problem/
System.setProperty("python.options.internalTablesImpl","weak");
this.engine = new ScriptEngineManager().getEngineByName("python");
// Determine script entry function and the function parameters
@@ -56,7 +56,6 @@ public class PseudoActuatorSensor implements Actor, Sensor {
@Override
public void set() {
// Throw an IllegalStateException in the case that set is called although there is no next step.
if(!hasNext()){
throw new IllegalStateException("The actuator does not have any next step.");
}
@@ -71,7 +70,7 @@ public class PseudoActuatorSensor implements Actor, Sensor {
@Override
public void init() {
count=0; // Set count back to 0
count=0;
}
@Override
@@ -70,7 +70,6 @@ public class ChannelAccessGuard implements Guard {
try{
if(! (condition.getChannel().getValue(true)).equals(condition.getValue()) ){
check=false;
// Early exit
break;
}
}
@@ -95,12 +95,6 @@ public class ActorSensorLoop implements ActionLoop {
*/
private List<Sensor> sensors;
// /**
// * Data queue sensor data is posted to. A message consists of a list of data objects
// * that are read out of the sensors of this loop.
// */
// private BlockingQueue<Message> dataQueue;
/**
* Guard used to check whether the environment was ok while reading out the sensors
*/
@@ -364,8 +358,6 @@ public class ActorSensorLoop implements ActionLoop {
@Override
public void prepare() {
// Put in prepare code here
// Create callable for all actors
pactors.clear();
for(final Actor a: actors){
@@ -385,8 +377,6 @@ public class ActorSensorLoop implements ActionLoop {
@Override
public void cleanup() {
// Put in cleanup code here
// Recursively call cleanup() method of all registered action loops
for(ActionLoop actionLoop: actionLoops){
actionLoop.cleanup();
@@ -35,7 +35,7 @@ import ch.psi.fda.core.Sensor;
import ch.psi.fda.core.messages.DataMessage;
import ch.psi.fda.core.messages.EndOfStreamMessage;
import ch.psi.fda.core.messages.Metadata;
import ch.psi.fda.core.sensors.MillisecondTimestampSensor;
import ch.psi.fda.core.sensors.TimestampSensor;
/**
* ActionLoop that is implementing the OTF Scan logic.
@@ -237,7 +237,7 @@ public class OTFLoop implements ActionLoop {
}
dataIndexes.add(2+so.getIndex()); // scalers follow directly after the readback
}
else if (s instanceof MillisecondTimestampSensor){
else if (s instanceof TimestampSensor){
dataIndexes.add(2+numberOfScalerChannels+numberOfMonitoredChannels);
}
// else if (s instanceof OTFReadbackSensor){
@@ -22,13 +22,13 @@ package ch.psi.fda.core.sensors;
import ch.psi.fda.core.Sensor;
/**
* Reads the current time in milliseconds
* Sensor to read the current time in milliseconds
*/
public class MillisecondTimestampSensor implements Sensor {
public class TimestampSensor implements Sensor {
private final String id; // Global id of the sensor
public MillisecondTimestampSensor(String id){
public TimestampSensor(String id){
this.id = id;
}
@@ -174,9 +174,6 @@ public class DataDeserializerTXT implements DataDeserializer {
Integer i = iindex.get(t);
if(dindex.get(t)>0){
Double d = (Double) message.getData().get(i);
// if(checklist.get(i)==null){
// checklist.set(i, d);
// }
if(checklist.get(i)!=null &&!checklist.get(i).equals(d)){
// If value changes issue a dimension delimiter message
bus.post(new StreamDelimiterMessage(dindex.get(t)-1));
@@ -196,9 +193,7 @@ public class DataDeserializerTXT implements DataDeserializer {
for(int i=dindex.size()-1;i>=0;i--){
bus.post(new StreamDelimiterMessage(dindex.get(i)));
}
// queue.getQueue().put(new DimensionDelimiterMessage(dindex.get(0)-1));
// queue.getQueue().put(new DimensionDelimiterMessage(dindex.get(0)));
// Place end of stream message
bus.post(new EndOfStreamMessage());
@@ -259,44 +259,21 @@ public class Visualizer {
return panels;
}
/**
* @return the updateAtStreamElement
*/
public boolean isUpdateAtStreamElement() {
return updateAtStreamElement;
}
/**
* @param updateAtStreamElement the updateAtStreamElement to set
*/
public void setUpdateAtStreamElement(boolean updateAtStreamElement) {
this.updateAtStreamElement = updateAtStreamElement;
}
/**
* @return the updateAtStreamDelimiter
*/
public boolean isUpdateAtStreamDelimiter() {
return updateAtStreamDelimiter;
}
/**
* @param updateAtStreamDelimiter the updateAtStreamDelimiter to set
*/
public void setUpdateAtStreamDelimiter(boolean updateAtStreamDelimiter) {
this.updateAtStreamDelimiter = updateAtStreamDelimiter;
}
/**
* @return the updateAtEndOfStream
*/
public boolean isUpdateAtEndOfStream() {
return updateAtEndOfStream;
}
/**
* @param updateAtEndOfStream the updateAtEndOfStream to set
*/
public void setUpdateAtEndOfStream(boolean updateAtEndOfStream) {
this.updateAtEndOfStream = updateAtEndOfStream;
}
@@ -42,7 +42,7 @@ import ch.psi.fda.core.loops.otf.TemplateOTF;
import ch.psi.fda.core.messages.ControlMessage;
import ch.psi.fda.core.messages.DataMessage;
import ch.psi.fda.core.messages.Message;
import ch.psi.fda.core.sensors.MillisecondTimestampSensor;
import ch.psi.fda.core.sensors.TimestampSensor;
import ch.psi.jcae.Channel;
import ch.psi.jcae.ChannelDescriptor;
import ch.psi.jcae.ChannelException;
@@ -71,7 +71,7 @@ public class OTFLoopTest {
OTFScalerChannelSensor s2 = new OTFScalerChannelSensor("id1", 0);
OTFScalerChannelSensor s3 = new OTFScalerChannelSensor("id2", 1);
MillisecondTimestampSensor s4 = new MillisecondTimestampSensor("id3");
TimestampSensor s4 = new TimestampSensor("id3");
OTFNamedChannelSensor s5 = new OTFNamedChannelSensor("id4", configuration.getAnalogIn1());
Map<String, String> macros = new HashMap<>();
@@ -28,7 +28,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import ch.psi.fda.core.sensors.MillisecondTimestampSensor;
import ch.psi.fda.core.sensors.TimestampSensor;
/**
* Test class for MillisecondsTimestampSensor
@@ -60,7 +60,7 @@ public class MillisecondTimestampSensorTest {
*/
@Test
public void testRead() throws CAException {
MillisecondTimestampSensor sensor = new MillisecondTimestampSensor("id0");
TimestampSensor sensor = new TimestampSensor("id0");
// Get sensor readout value
Double value = (Double) sensor.read();
@@ -150,11 +150,11 @@ public class DataVisualizerTest {
Thread.sleep(10000);
}
@Ignore
// @Ignore
@Test
public void testRun2D() throws InterruptedException {
int nx = 100;
int nx = 1000;
int ny = 1000;
List<Metadata> metadata = new ArrayList<>();