diff --git a/ch.psi.fda/src/main/java/ch/psi/fda/core/actors/ChannelAccessFunctionActuator.java b/ch.psi.fda/src/main/java/ch/psi/fda/core/actors/ChannelAccessFunctionActuator.java index 478da04..e9c727e 100644 --- a/ch.psi.fda/src/main/java/ch/psi/fda/core/actors/ChannelAccessFunctionActuator.java +++ b/ch.psi.fda/src/main/java/ch/psi/fda/core/actors/ChannelAccessFunctionActuator.java @@ -28,37 +28,15 @@ import ch.psi.fda.core.EngineConfiguration; import ch.psi.jcae.ChannelBean; import ch.psi.jcae.ChannelBeanFactory; -/** - * This actuator sets an Channel Access channel from a start to an end value by doing discrete steps. - * @author ebner - * - */ public class ChannelAccessFunctionActuator implements Actor { - // Get Logger private static Logger logger = Logger.getLogger(ChannelAccessFunctionActuator.class.getName()); private boolean asynchronous = false; - - /** - * Start value of the actuator - */ private double start; - - /** - * End value of the actuator - */ private double end; - - /** - * Step size of the move - */ private double stepSize; - - /** - * Move direction (start<end = 1, start>end = -1) - */ - private int direction; + private int direction; // Move direction (start<end = 1, start>end = -1) /** * Execution count of actuator. This variable is used to minimize the floating point @@ -84,14 +62,9 @@ public class ChannelAccessFunctionActuator implements Actor { private double accuracy; /** - * Channel Access channel of the actuator + * Move timeout */ - private ChannelBean channel; - - /** - * Channel Access channel of the actuator - */ - private ChannelBean doneChannel = null; + private Long timeout; private final T doneValue; private final long doneDelay; @@ -100,11 +73,8 @@ public class ChannelAccessFunctionActuator implements Actor { private final double originalEnd; private final int originalDirection; - - /** - * Move timeout - */ - private Long timeout; + private ChannelBean channel; + private ChannelBean doneChannel = null; private final Function function; @@ -189,9 +159,6 @@ public class ChannelAccessFunctionActuator implements Actor { } } - /* (non-Javadoc) - * @see ch.psi.fda.engine.Actor#set() - */ @Override public void set() throws InterruptedException { @@ -255,17 +222,11 @@ public class ChannelAccessFunctionActuator implements Actor { } } - /* (non-Javadoc) - * @see ch.psi.fda.engine.Actor#hasNext() - */ @Override public boolean hasNext() { return next; } - /* (non-Javadoc) - * @see ch.psi.fda.core.Actor#init() - */ @Override public void init() { this.count = 0; @@ -282,9 +243,6 @@ public class ChannelAccessFunctionActuator implements Actor { this.next = true; } - /* (non-Javadoc) - * @see ch.psi.fda.core.Actor#reverse() - */ @Override public synchronized void reverse() { double oldStart = start; @@ -299,9 +257,6 @@ public class ChannelAccessFunctionActuator implements Actor { } - /* (non-Javadoc) - * @see ch.psi.fda.core.Actor#reset() - */ @Override public void reset() { this.start = this.originalStart; @@ -309,9 +264,6 @@ public class ChannelAccessFunctionActuator implements Actor { this.direction = this.originalDirection; } - /* (non-Javadoc) - * @see ch.psi.fda.core.Actor#destroy() - */ @Override public void destroy() { // Destroy channel @@ -333,18 +285,10 @@ public class ChannelAccessFunctionActuator implements Actor { } } - /** - * @return the asynchronous - */ public boolean isAsynchronous() { return asynchronous; } - - /** - * @param asynchronous the asynchronous to set - */ public void setAsynchronous(boolean asynchronous) { this.asynchronous = asynchronous; } - } diff --git a/ch.psi.fda/src/main/java/ch/psi/fda/core/actors/ChannelAccessLinearActuator.java b/ch.psi.fda/src/main/java/ch/psi/fda/core/actors/ChannelAccessLinearActuator.java index 7279eca..26c8b62 100644 --- a/ch.psi.fda/src/main/java/ch/psi/fda/core/actors/ChannelAccessLinearActuator.java +++ b/ch.psi.fda/src/main/java/ch/psi/fda/core/actors/ChannelAccessLinearActuator.java @@ -35,29 +35,13 @@ import ch.psi.jcae.ChannelBeanFactory; */ public class ChannelAccessLinearActuator implements Actor { - // Get Logger private static Logger logger = Logger.getLogger(ChannelAccessLinearActuator.class.getName()); private boolean asynchronous = false; - /** - * Start value of the actuator - */ private double start; - - /** - * End value of the actuator - */ private double end; - - /** - * Step size of the move - */ private double stepSize; - - /** - * Move direction (start<end = 1, start>end = -1) - */ private int direction; /** @@ -83,15 +67,7 @@ public class ChannelAccessLinearActuator implements Actor { */ private double accuracy; - /** - * Channel Access channel of the actuator - */ - private ChannelBean channel; - /** - * Channel Access channel of the actuator - */ - private ChannelBean doneChannel = null; private final T doneValue; private final long doneDelay; @@ -100,12 +76,10 @@ public class ChannelAccessLinearActuator implements Actor { private final double originalEnd; private final int originalDirection; + private Long timeout; // Set timeout - /** - * Move timeout - */ - private Long timeout; - + private final ChannelBean channel; + private final ChannelBean doneChannel; /** * Constructor @@ -159,6 +133,7 @@ public class ChannelAccessLinearActuator implements Actor { } catch (InterruptedException e) { throw new RuntimeException("Unable to initialize actuator channel [name:"+channelName+"]",e); } + if(doneChannelName != null){ try { doneChannel = ChannelBeanFactory.getFactory().createChannelBean((Class) doneValue.getClass(), doneChannelName, false); @@ -169,11 +144,11 @@ public class ChannelAccessLinearActuator implements Actor { throw new RuntimeException("Unable to initialize actuator channel [name:"+doneChannelName+"]",e); } } + else{ + doneChannel=null; + } } - /* (non-Javadoc) - * @see ch.psi.fda.engine.Actor#set() - */ @Override public void set() throws InterruptedException { @@ -232,17 +207,11 @@ public class ChannelAccessLinearActuator implements Actor { } } - /* (non-Javadoc) - * @see ch.psi.fda.engine.Actor#hasNext() - */ @Override public boolean hasNext() { return next; } - /* (non-Javadoc) - * @see ch.psi.fda.core.Actor#init() - */ @Override public void init() { this.count = 0; @@ -259,9 +228,6 @@ public class ChannelAccessLinearActuator implements Actor { this.next = true; } - /* (non-Javadoc) - * @see ch.psi.fda.core.Actor#reverse() - */ @Override public synchronized void reverse() { double oldStart = start; @@ -276,9 +242,6 @@ public class ChannelAccessLinearActuator implements Actor { } - /* (non-Javadoc) - * @see ch.psi.fda.core.Actor#reset() - */ @Override public void reset() { this.start = this.originalStart; @@ -286,9 +249,6 @@ public class ChannelAccessLinearActuator implements Actor { this.direction = this.originalDirection; } - /* (non-Javadoc) - * @see ch.psi.fda.core.Actor#destroy() - */ @Override public void destroy() { // Destroy channel @@ -310,20 +270,10 @@ public class ChannelAccessLinearActuator implements Actor { } } - /** - * @return the asynchronous - */ public boolean isAsynchronous() { return asynchronous; } - - /** - * @param asynchronous the asynchronous to set - */ public void setAsynchronous(boolean asynchronous) { this.asynchronous = asynchronous; } - - - } diff --git a/ch.psi.fda/src/main/java/ch/psi/fda/core/actors/ChannelAccessTableActuator.java b/ch.psi.fda/src/main/java/ch/psi/fda/core/actors/ChannelAccessTableActuator.java index 60eb4fe..2e049be 100644 --- a/ch.psi.fda/src/main/java/ch/psi/fda/core/actors/ChannelAccessTableActuator.java +++ b/ch.psi.fda/src/main/java/ch/psi/fda/core/actors/ChannelAccessTableActuator.java @@ -35,7 +35,6 @@ import ch.psi.jcae.ChannelBeanFactory; */ public class ChannelAccessTableActuator implements Actor { - // Get Logger private static Logger logger = Logger.getLogger(ChannelAccessTableActuator.class.getName()); private boolean asynchronous = false; @@ -157,9 +156,6 @@ public class ChannelAccessTableActuator implements Actor { } } - /* (non-Javadoc) - * @see ch.psi.fda.engine.Actor#set() - */ @Override public void set() throws InterruptedException { @@ -223,17 +219,11 @@ public class ChannelAccessTableActuator implements Actor { } } - /* (non-Javadoc) - * @see ch.psi.fda.engine.Actor#hasNext() - */ @Override public boolean hasNext() { return next; } - /* (non-Javadoc) - * @see ch.psi.fda.core.Actor#init() - */ @Override public void init() { @@ -250,9 +240,6 @@ public class ChannelAccessTableActuator implements Actor { } } - /* (non-Javadoc) - * @see ch.psi.fda.core.Actor#reverse() - */ @Override public void reverse() { if(positiveDirection){ @@ -263,17 +250,11 @@ public class ChannelAccessTableActuator implements Actor { } } - /* (non-Javadoc) - * @see ch.psi.fda.core.Actor#reset() - */ @Override public void reset() { this.positiveDirection = this.originalPositiveDirection; } - /* (non-Javadoc) - * @see ch.psi.fda.core.Actor#destroy() - */ @Override public void destroy() { // Destroy channel @@ -295,20 +276,10 @@ public class ChannelAccessTableActuator implements Actor { } } - /** - * @return the asynchronous - */ public boolean isAsynchronous() { return asynchronous; } - - /** - * @param asynchronous the asynchronous to set - */ public void setAsynchronous(boolean asynchronous) { this.asynchronous = asynchronous; } - - - } diff --git a/ch.psi.fda/src/main/java/ch/psi/fda/core/actors/ComplexActuator.java b/ch.psi.fda/src/main/java/ch/psi/fda/core/actors/ComplexActuator.java index 393da75..b3fbb27 100644 --- a/ch.psi.fda/src/main/java/ch/psi/fda/core/actors/ComplexActuator.java +++ b/ch.psi.fda/src/main/java/ch/psi/fda/core/actors/ComplexActuator.java @@ -37,7 +37,6 @@ import ch.psi.fda.core.Actor; */ public class ComplexActuator implements Actor { - // Get Logger private static Logger logger = Logger.getLogger(ComplexActuator.class.getName()); /** @@ -90,9 +89,6 @@ public class ComplexActuator implements Actor { this.firstrun = true; } - /* (non-Javadoc) - * @see ch.psi.fda.core.Actor#set() - */ @Override public void set() throws InterruptedException { // Throw an IllegalStateException in the case that set is called although there is no next step. @@ -139,17 +135,11 @@ public class ComplexActuator implements Actor { } - /* (non-Javadoc) - * @see ch.psi.fda.core.Actor#hasNext() - */ @Override public boolean hasNext() { return next; } - /* (non-Javadoc) - * @see ch.psi.fda.core.Actor#init() - */ @Override public void init() { @@ -191,9 +181,6 @@ public class ComplexActuator implements Actor { this.firstrun = true; } - /* (non-Javadoc) - * @see ch.psi.fda.core.Actor#reverse() - */ @Override public void reverse() { // Reverse all actors this actor consist of @@ -202,9 +189,6 @@ public class ComplexActuator implements Actor { } } - /* (non-Javadoc) - * @see ch.psi.fda.core.Actor#reset() - */ @Override public void reset() { // Reset all actors this actor consist of @@ -213,31 +197,6 @@ public class ComplexActuator implements Actor { } } - /** - * Get the list of actors of this ComplexActor - * @return the actors - */ - public List getActors() { - return actors; - } - - /** - * @return the preActions - */ - public List getPreActions() { - return preActions; - } - - /** - * @return the postActions - */ - public List getPostActions() { - return postActions; - } - - /* (non-Javadoc) - * @see ch.psi.fda.core.Actor#destroy() - */ @Override public void destroy() { // Destroy preActions @@ -255,7 +214,14 @@ public class ComplexActuator implements Actor { a.destroy(); } } - - + public List getPreActions() { + return preActions; + } + public List getActors() { + return actors; + } + public List getPostActions() { + return postActions; + } } diff --git a/ch.psi.fda/src/main/java/ch/psi/fda/core/actors/Function.java b/ch.psi.fda/src/main/java/ch/psi/fda/core/actors/Function.java index e4689f4..9079d09 100644 --- a/ch.psi.fda/src/main/java/ch/psi/fda/core/actors/Function.java +++ b/ch.psi.fda/src/main/java/ch/psi/fda/core/actors/Function.java @@ -19,10 +19,6 @@ package ch.psi.fda.core.actors; -/** - * @author ebner - * - */ public interface Function { public double calculate(double parameter); } diff --git a/ch.psi.fda/src/main/java/ch/psi/fda/core/actors/JythonFunction.java b/ch.psi.fda/src/main/java/ch/psi/fda/core/actors/JythonFunction.java index 1779ccd..4c0fc3b 100644 --- a/ch.psi.fda/src/main/java/ch/psi/fda/core/actors/JythonFunction.java +++ b/ch.psi.fda/src/main/java/ch/psi/fda/core/actors/JythonFunction.java @@ -36,22 +36,16 @@ import ch.psi.fda.core.scripting.JythonGlobalVariable; */ public class JythonFunction implements Function { - // Get Logger private static final Logger logger = Logger.getLogger(JythonFunction.class.getName()); public static final String ENTRY_FUNCTION_NAME = "calculate"; private static final String ENTRY_FUNCTION_PATTERN = "def "+ENTRY_FUNCTION_NAME+"\\((.*)\\):"; - /** - * Script engine of the manipulator - */ private ScriptEngine engine; - private String additionalParameter = ""; public JythonFunction(String script, Map map){ - // Create new script engine this.engine = new ScriptEngineManager().getEngineByName("python"); // Determine script entry function and the function parameters @@ -95,9 +89,6 @@ public class JythonFunction implements Function { } } - /* (non-Javadoc) - * @see ch.psi.fda.core.actors.Function#calculate(double) - */ @Override public double calculate(double parameter) { logger.fine("Function called"); diff --git a/ch.psi.fda/src/main/java/ch/psi/fda/core/actors/OTFActuator.java b/ch.psi.fda/src/main/java/ch/psi/fda/core/actors/OTFActuator.java index 0f6fc46..1052924 100644 --- a/ch.psi.fda/src/main/java/ch/psi/fda/core/actors/OTFActuator.java +++ b/ch.psi.fda/src/main/java/ch/psi/fda/core/actors/OTFActuator.java @@ -25,31 +25,16 @@ import ch.psi.fda.core.Actor; * Special actuator for the OTFLoop. This type of actor must not be used in any other * type of loop than OTFLoop. If it is used it will, depending on the loop, immediately stop the loop * as it no single step. - * @author ebner - * */ public class OTFActuator implements Actor { - /** - * Name of the motor channel - */ - private final String name; - - /** - * Channel name of the encoder; - */ - private final String readback; - + private final String id; + private final String name; // name of the motor channel + private final String readback; // name of the encoder channel private double start; private double end; private final double stepSize; private final double integrationTime; - - private final String id; - - /** - * Additional backlash for the motor - */ private final double additionalBacklash; @@ -64,125 +49,57 @@ public class OTFActuator implements Actor { this.additionalBacklash = additionalBacklash; } - /* (non-Javadoc) - * @see ch.psi.fda.core.Actor#set() - */ @Override public void set() { - // Do nothing } - /* (non-Javadoc) - * @see ch.psi.fda.core.Actor#hasNext() - */ @Override public boolean hasNext() { return false; } + @Override + public void init() { + } + + @Override + public void reverse() { + double aend = end; + end=start; + start=aend; + } + + @Override + public void reset() { + } + + @Override + public void destroy() { + } - /** - * @return the name - */ public String getName() { return name; } - - /** - * @return the readback - */ public String getReadback() { return readback; } - - /** - * @return the start - */ public double getStart() { return start; } - - /** - * @return the end - */ public double getEnd() { return end; } - - /** - * @return the stepSize - */ public double getStepSize() { return stepSize; } - - /** - * @return the integrationTime - */ public double getIntegrationTime() { return integrationTime; } - - /** - * @return the additionalBacklash - */ public double getAdditionalBacklash() { return additionalBacklash; } - - /** - * @return the id - */ public String getId() { return id; } - - /* (non-Javadoc) - * @see ch.psi.fda.core.Actor#init() - */ - @Override - public void init() { - // Not implemented - } - - /* (non-Javadoc) - * @see ch.psi.fda.core.Actor#reverse() - */ - @Override - public void reverse() { - // Not implemented - } - - /* (non-Javadoc) - * @see ch.psi.fda.core.Actor#reset() - */ - @Override - public void reset() { - // Not implemented - } - - /* (non-Javadoc) - * @see ch.psi.fda.core.Actor#destroy() - */ - @Override - public void destroy() { - // Nothing to be done - - } - - /** - * @param start the start to set - */ - public void setStart(double start) { - this.start = start; - } - - /** - * @param end the end to set - */ - public void setEnd(double end) { - this.end = end; - } - } diff --git a/ch.psi.fda/src/main/java/ch/psi/fda/core/loops/cr/CrlogicLoop.java b/ch.psi.fda/src/main/java/ch/psi/fda/core/loops/cr/CrlogicLoop.java index 8c9e967..7084d51 100644 --- a/ch.psi.fda/src/main/java/ch/psi/fda/core/loops/cr/CrlogicLoop.java +++ b/ch.psi.fda/src/main/java/ch/psi/fda/core/loops/cr/CrlogicLoop.java @@ -579,10 +579,7 @@ public class CrlogicLoop implements ActionLoop { // t.start(); if(zigZag){ - // Swap start and end - double aend = actuator.getEnd(); - actuator.setEnd(actuator.getStart()); - actuator.setStart(aend); + actuator.reverse(); } synchronized(this){