some cleanup in CRLOGIC

This commit is contained in:
2013-10-15 16:13:08 +02:00
parent b65764ac57
commit ca871ad478
9 changed files with 16 additions and 316 deletions
@@ -20,8 +20,7 @@
package ch.psi.fda.core.loops.cr;
/**
* @author ebner
*
* Filter calculating the delta of two subsequent values
*/
public class CrlogicDeltaDataFilter {
@@ -47,8 +47,6 @@ import ch.psi.jcae.ChannelException;
import ch.psi.jcae.ChannelService;
/**
* @author ebner
*
* While using Crlogic the IOC system clock rate should/must be set to 1000 (default 60)
*
* sysClkRateSet 1000
@@ -756,7 +754,6 @@ public class CrlogicLoop implements ActionLoop {
readoutThread.interrupt();
try {
cservice.destroyAnnotatedChannels(template);
cservice.destroyAnnotatedChannels(motortemplate);
template = null;
@@ -30,8 +30,9 @@ import ch.psi.fda.core.messages.EndOfStreamMessage;
import ch.psi.fda.core.messages.Message;
/**
* @author ebner
*
* Class to merge two data streams into one. The secondary queues data is added to the primary queues data.
* The resulting queue therefor will hold the same amount of elements as the primary queue does.
* The datagroup flag set in the end of stream message will be set according to the flag set in the primary queue.
*/
public class ParallelCrlogicStreamMerge {
@@ -41,10 +42,6 @@ public class ParallelCrlogicStreamMerge {
private DataQueue secondaryQueue;
/**
* Class to merge two data streams into one. The secondary queues data is added to the primary queues data.
* The resulting queue therefor will hold the same amount of elements as the primary queue does.
* The datagroup flag set in the end of stream message will be set according to the flag set in the primary queue.
*
* @param pqueue Primary/master queue
* @param squeue Secondary queue
*/
@@ -78,13 +75,10 @@ public class ParallelCrlogicStreamMerge {
long milliseconds = (long) (timestamp*1000);
long nanoOffset = (long)((timestamp*1000-milliseconds)*1000000);
// System.out.println("timestamp: "+new Date(milliseconds)+" "+milliseconds+" ."+nanoOffset);
while(true){
// Assumption: the secondary Queue holds at least the data up to the
// timestamp of the primary queue
Message mess = secondaryQueue.getQueue().peek();
// Message mess = secondaryQueue.getQueue().take();
if(mess instanceof EndOfStreamMessage){
break;
@@ -99,20 +93,15 @@ public class ParallelCrlogicStreamMerge {
// message from the primary queue - if the timestamp is bigger do not take message out of the queue
DataMessage msCheck = (DataMessage) mess;
// System.out.println("Mess: "+mess);
long currMilliCheck = ((Double) msCheck.getData().get(0)).longValue();
long currNanoCheck = ((Double) msCheck.getData().get(1)).longValue();
// Check
if(currMilliCheck>milliseconds || (currMilliCheck==milliseconds && currNanoCheck>nanoOffset)){
break;
}
DataMessage ms = (DataMessage) secondaryQueue.getQueue().take();
// System.out.println("Ms: "+ms);
currData = ms.getData();
// Remove timestamps
currData.remove(0);
@@ -22,17 +22,8 @@ package ch.psi.fda.core.loops.cr;
import ch.psi.jcae.Channel;
import ch.psi.jcae.annotation.CaChannel;
/**
* @author ebner
*
*/
public class TemplateCrlogic {
/**
* Status of the OTFSCAN IOC logic
*/
public enum Status { SETUP, INACTIVE, INITIALIZE, ACTIVE, STOP, FAULT, ERROR };
/**
* Ticks per second - IOC setting
* ATTENTION - This field must only be set bu the IOC - ATTENTION
@@ -43,6 +34,7 @@ public class TemplateCrlogic {
/**
* Status of the OTFSCAN IOC logic
*/
public enum Status { SETUP, INACTIVE, INITIALIZE, ACTIVE, STOP, FAULT, ERROR };
@CaChannel(type=String.class, name ="${PREFIX}:STATUS")
private Channel<String> status;
@@ -83,7 +75,6 @@ public class TemplateCrlogic {
@CaChannel(type=Boolean.class, name ="${PREFIX}:FAPPE")
private Channel<Boolean> appendFile;
/**
* Readout resources
*/
@@ -91,65 +82,31 @@ public class TemplateCrlogic {
private Channel<String[]> readoutResources;
/**
* @return the ticksPerSecond
*/
public Channel<Integer> getTicksPerSecond() {
return ticksPerSecond;
}
/**
* @return the status
*/
public Channel<String> getStatus() {
return status;
}
/**
* @return the message
*/
public Channel<String> getMessage() {
return message;
}
/**
* @return the ticksBetweenInterrupts
*/
public Channel<Integer> getTicksBetweenInterrupts() {
return ticksBetweenInterrupts;
}
/**
* @return the nfsServer
*/
public Channel<String> getNfsServer() {
return nfsServer;
}
/**
* @return the nfsShare
*/
public Channel<String> getNfsShare() {
return nfsShare;
}
/**
* @return the dataFile
*/
public Channel<String> getDataFile() {
return dataFile;
}
/**
* @return the appendFile
*/
public Channel<Boolean> getAppendFile() {
return appendFile;
}
/**
* @return the readoutResources
*/
public Channel<String[]> getReadoutResources() {
return readoutResources;
}
@@ -44,6 +44,7 @@ public class TemplateEncoder {
private Channel<Integer> direction;
public Channel<Double> getResolution() {
return resolution;
}
@@ -22,10 +22,6 @@ package ch.psi.fda.core.loops.cr;
import ch.psi.jcae.Channel;
import ch.psi.jcae.annotation.CaChannel;
/**
* @author ebner
*
*/
public class TemplateMotor {
public enum Type {SOFT_CHANNEL, MOTOR_SIMULATION, OMS_VME58, OMS_MAXv};
@@ -334,317 +330,140 @@ public class TemplateMotor {
@CaChannel(type=Boolean.class, name ="${PREFIX}.DMOV", monitor=true)
private Channel<Boolean> moveDone;
/**
* @return the highLimit
*/
public Channel<Double> getHighLimit() {
return highLimit;
}
/**
* @return the lowLimit
*/
public Channel<Double> getLowLimit() {
return lowLimit;
}
/**
* @return the readbackValue
*/
public Channel<Double> getReadbackValue() {
return readbackValue;
}
/**
* @return the setValue
*/
public Channel<Double> getSetValue() {
return setValue;
}
/**
* @return the relativeMoveValue
*/
public Channel<Double> getRelativeMoveValue() {
return relativeMoveValue;
}
/**
* @return the tweakValue
*/
public Channel<Double> getTweakValue() {
return tweakValue;
}
/**
* @return the tweakReverse
*/
public Channel<Integer> getTweakReverse() {
return tweakReverse;
}
/**
* @return the tweakForward
*/
public Channel<Integer> getTweakForward() {
return tweakForward;
}
/**
* @return the jogReverse
*/
public Channel<Integer> getJogReverse() {
return jogReverse;
}
/**
* @return the jogForward
*/
public Channel<Integer> getJogForward() {
return jogForward;
}
/**
* @return the homeReverse
*/
public Channel<Integer> getHomeReverse() {
return homeReverse;
}
/**
* @return the homeForward
*/
public Channel<Integer> getHomeForward() {
return homeForward;
}
/**
* @return the engineeringUnit
*/
public Channel<String> getEngineeringUnit() {
return engineeringUnit;
}
/**
* @return the type
*/
public Channel<Integer> getType() {
return type;
}
/**
* @return the description
*/
public Channel<String> getDescription() {
return description;
}
/**
* @return the dialHighLimit
*/
public Channel<Double> getDialHighLimit() {
return dialHighLimit;
}
/**
* @return the dialLowLimit
*/
public Channel<Double> getDialLowLimit() {
return dialLowLimit;
}
/**
* @return the dialReadbackValue
*/
public Channel<Double> getDialReadbackValue() {
return dialReadbackValue;
}
/**
* @return the dialSetValue
*/
public Channel<Double> getDialSetValue() {
return dialSetValue;
}
/**
* @return the rawValue
*/
public Channel<Integer> getRawValue() {
return rawValue;
}
/**
* @return the rawReadbackValue
*/
public Channel<Integer> getRawReadbackValue() {
return rawReadbackValue;
}
/**
* @return the command
*/
public Channel<Integer> getCommand() {
return command;
}
/**
* @return the calibration
*/
public Channel<Integer> getCalibration() {
return calibration;
}
/**
* @return the userOffset
*/
public Channel<Double> getOffset() {
return offset;
}
/**
* @return the offsetMode
*/
public Channel<Integer> getOffsetMode() {
return offsetMode;
}
/**
* @return the direction
*/
public Channel<Integer> getDirection() {
return direction;
}
/**
* @return the velocity
*/
public Channel<Double> getVelocity() {
return velocity;
}
/**
* @return the backlashVelocity
*/
public Channel<Double> getBacklashVelocity() {
return backlashVelocity;
}
/**
* @return the baseSpeed
*/
public Channel<Double> getBaseSpeed() {
return baseSpeed;
}
/**
* @return the accelerationTime
*/
public Channel<Double> getAccelerationTime() {
return accelerationTime;
}
/**
* @return the backlashAccelerationTime
*/
public Channel<Double> getBacklashAccelerationTime() {
return backlashAccelerationTime;
}
/**
* @return the backlashDistance
*/
public Channel<Double> getBacklashDistance() {
return backlashDistance;
}
/**
* @return the moveFracion
*/
public Channel<Double> getMoveFracion() {
return moveFracion;
}
/**
* @return the motorResolution
*/
public Channel<Double> getMotorResolution() {
return motorResolution;
}
/**
* @return the encoderResolution
*/
public Channel<Double> getEncoderResolution() {
return encoderResolution;
}
/**
* @return the readbackResolution
*/
public Channel<Double> getReadbackResolution() {
return readbackResolution;
}
/**
* @return the retryDeadband
*/
public Channel<Double> getRetryDeadband() {
return retryDeadband;
}
/**
* @return the maxRetryCount
*/
public Channel<Integer> getMaxRetryCount() {
return maxRetryCount;
}
/**
* @return the retryCount
*/
public Channel<Integer> getRetryCount() {
return retryCount;
}
/**
* @return the useEncoder
*/
public Channel<Boolean> getUseEncoder() {
return useEncoder;
}
/**
* @return the useReadback
*/
public Channel<Boolean> getUseReadback() {
return useReadback;
}
/**
* @return the readbackDelay
*/
public Channel<Double> getReadbackDelay() {
return readbackDelay;
}
/**
* @return the readbackLink
*/
public Channel<String> getReadbackLink() {
return readbackLink;
}
/**
* @return the outputMode
*/
public Channel<Integer> getOutputMode() {
return outputMode;
}
/**
* @return the moveDone
*/
public Channel<Boolean> getMoveDone() {
return moveDone;
}
@@ -24,17 +24,12 @@ import java.util.List;
import ch.psi.jcae.Channel;
import ch.psi.jcae.annotation.CaChannel;
/**
* @author ebner
*
*/
public class TemplateVSC16Scaler {
public enum Command {Done, Count};
/**
* Command
*/
public enum Command {Done, Count};
@CaChannel(type=Integer.class, name ="${PREFIX}.CNT")
private Channel<Integer> command;
@@ -65,39 +60,21 @@ public class TemplateVSC16Scaler {
@CaChannel(type=Integer.class, name={"${PREFIX}.PR1", "${PREFIX}.PR2", "${PREFIX}.PR3", "${PREFIX}.PR4", "${PREFIX}.PR5", "${PREFIX}.PR6", "${PREFIX}.PR7", "${PREFIX}.PR8", "${PREFIX}.PR9", "${PREFIX}.PR10", "${PREFIX}.PR11", "${PREFIX}.PR12", "${PREFIX}.PR13", "${PREFIX}.PR14", "${PREFIX}.PR15", "${PREFIX}.PR16"})
private List<Channel<Integer>> channelPresetCount;
/**
* @return the command
*/
public Channel<Integer> getCommand() {
return command;
}
/**
* @return the mode
*/
public Channel<Integer> getMode() {
return mode;
}
/**
* @return the channelDescription
*/
public List<Channel<Boolean>> getChannelDescription() {
return channelDescription;
}
/**
* @return the channelGate
*/
public List<Channel<Boolean>> getChannelGate() {
return channelGate;
}
/**
* @return the channelPresetCount
*/
public List<Channel<Integer>> getChannelPresetCount() {
return channelPresetCount;
}
}
@@ -19,15 +19,11 @@
package ch.psi.fda.core.loops.cr;
/**
* @author ebner
*
*/
public class TimestampedValue {
private Double value;
private long timestamp;
private long nanosecondsOffset;
private final Double value;
private final long timestamp;
private final long nanosecondsOffset;
public TimestampedValue(Double value, long timestamp, long nanosecondsOffset){
this.value = value;
@@ -35,47 +31,13 @@ public class TimestampedValue {
this.nanosecondsOffset = nanosecondsOffset;
}
/**
* @return the value
*/
public Double getValue() {
return value;
}
/**
* @param value the value to set
*/
public void setValue(Double value) {
this.value = value;
}
/**
* @return the timestamp
*/
public long getTimestamp() {
return timestamp;
}
/**
* @param timestamp the timestamp to set
*/
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
/**
* @return the nanosecondsOffset
*/
public long getNanosecondsOffset() {
return nanosecondsOffset;
}
/**
* @param nanosecondsOffset the nanosecondsOffset to set
*/
public void setNanosecondsOffset(long nanosecondsOffset) {
this.nanosecondsOffset = nanosecondsOffset;
}
}
@@ -22,8 +22,7 @@ package ch.psi.fda.core.loops.cr;
import java.util.Comparator;
/**
* @author ebner
*
* Comparator for comparint 2 timestamped values
*/
public class TimestampedValueComparator implements Comparator<TimestampedValue> {