Renamed template files

This commit is contained in:
2013-10-09 09:23:37 +02:00
parent 5d2c2b94d6
commit 3532f95acb
10 changed files with 35 additions and 35 deletions

View File

@@ -60,7 +60,7 @@ import ch.psi.fda.core.actors.PseudoActuatorSensor;
import ch.psi.fda.core.guard.ChannelAccessGuard;
import ch.psi.fda.core.guard.ChannelAccessGuardCondition;
import ch.psi.fda.core.loops.ActorSensorLoop;
import ch.psi.fda.core.loops.OTFBean;
import ch.psi.fda.core.loops.TemplateOTF;
import ch.psi.fda.core.loops.OTFLoop;
import ch.psi.fda.core.loops.cr.CrlogicLoop;
import ch.psi.fda.core.loops.cr.ParallelCrlogic;
@@ -1030,7 +1030,7 @@ public class Acquisition {
Map<String,String> macros = new HashMap<>();
macros.put("PREFIX", configuration.getOtfChannelPrefix());
OTFBean template = new OTFBean();
TemplateOTF template = new TemplateOTF();
createTemplateChannels(template, macros);
OTFLoop actionLoop = new OTFLoop(template, configuration.getOtfNfsServer(), configuration.getOtfNfsShare(), configuration.getOtfSmbShare(), zigZag);

View File

@@ -97,7 +97,7 @@ public class OTFLoop implements ActionLoop {
/**
* Bean holding all OTF channels and functionality.
*/
private OTFBean obean;
private TemplateOTF obean;
/**
* List of actions that are executed at the beginning of the loop.
@@ -146,7 +146,7 @@ public class OTFLoop implements ActionLoop {
* @param smbShare SMB share to get the data written by the OTF C Logic
* @param zigZag Operate loop in zig zag mode
*/
public OTFLoop(OTFBean obean, String server, String share, String smbShare, boolean zigZag){
public OTFLoop(TemplateOTF obean, String server, String share, String smbShare, boolean zigZag){
this.obean = obean;

View File

@@ -32,7 +32,7 @@ import ch.psi.jcae.ChannelException;
* @author ebner
*
*/
public class OTFBean {
public class TemplateOTF {
public enum Status { SETUP, INACTIVE, INITIALIZE, ACTIVE, STOP, FAULT, ERROR };
public enum Command { NONE, START, STOP };

View File

@@ -118,8 +118,8 @@ public class CrlogicLoop implements ActionLoop {
*/
private String prefix;
private CrlogicChannelsTemplate template;
private MotorChannelsTemplate motortemplate;
private TemplateCrlogic template;
private TemplateMotor motortemplate;
/**
* Semaphore to ensure that data is read in correct sequence
@@ -358,20 +358,20 @@ public class CrlogicLoop implements ActionLoop {
Long timeout = 600000l; // 10 minutes move timeout
// Check if logic is inactive, otherwise return early
if(!template.getStatus().getValue().equals(CrlogicChannelsTemplate.Status.INACTIVE.toString())){
if(!template.getStatus().getValue().equals(TemplateCrlogic.Status.INACTIVE.toString())){
logger.info("CRLOGIC is not inactive!");
// TODO Decide what to do in this situation
if(template.getStatus().getValue().equals(CrlogicChannelsTemplate.Status.FAULT.toString())){
if(template.getStatus().getValue().equals(TemplateCrlogic.Status.FAULT.toString())){
// If in fault show message and recover
logger.info("CRLOGIC in FAULT state");
logger.info("Error message: "+template.getMessage().getValue());
logger.info("Recover logic and set it to INACTIVE");
template.getStatus().setValue(CrlogicChannelsTemplate.Status.INACTIVE.toString());
template.getStatus().setValue(TemplateCrlogic.Status.INACTIVE.toString());
}
else if(template.getStatus().getValue().equals(CrlogicChannelsTemplate.Status.ACTIVE.toString())){
template.getStatus().setValue(CrlogicChannelsTemplate.Status.STOP.toString());
template.getStatus().waitForValue(CrlogicChannelsTemplate.Status.INACTIVE.toString(), startStopTimeout);
else if(template.getStatus().getValue().equals(TemplateCrlogic.Status.ACTIVE.toString())){
template.getStatus().setValue(TemplateCrlogic.Status.STOP.toString());
template.getStatus().waitForValue(TemplateCrlogic.Status.INACTIVE.toString(), startStopTimeout);
}
else{
throw new RuntimeException("CRLOGIC is not inactive");
@@ -502,17 +502,17 @@ public class CrlogicLoop implements ActionLoop {
// Start crlogic logic
logger.info("Start CRLOGIC");
template.getStatus().setValue(CrlogicChannelsTemplate.Status.INITIALIZE.toString());
template.getStatus().setValue(TemplateCrlogic.Status.INITIALIZE.toString());
try{
template.getStatus().waitForValue(CrlogicChannelsTemplate.Status.ACTIVE.toString(), startStopTimeout);
template.getStatus().waitForValue(TemplateCrlogic.Status.ACTIVE.toString(), startStopTimeout);
}
catch(ChannelException | ExecutionException | TimeoutException e){
logger.info( "Failed to start CRLOGIC. Logic in status: "+template.getStatus().getValue() );
if(template.getStatus().getValue().equals(CrlogicChannelsTemplate.Status.FAULT.toString())){
if(template.getStatus().getValue().equals(TemplateCrlogic.Status.FAULT.toString())){
logger.info("Error message: "+template.getMessage().getValue());
}
// Recover to inactive
template.getStatus().setValue(CrlogicChannelsTemplate.Status.INACTIVE.toString());
template.getStatus().setValue(TemplateCrlogic.Status.INACTIVE.toString());
// TODO Improve error handling
throw new RuntimeException("Failed to start CRLOGIC. Logic in status: "+template.getStatus().getValue()+ " Error message: "+template.getMessage().getValue(), e);
@@ -526,8 +526,8 @@ public class CrlogicLoop implements ActionLoop {
catch (InterruptedException e) {
if(abort & (!abortForce)){
// Abort motor move
motortemplate.getCommand().setValue(MotorChannelsTemplate.Commands.Stop.ordinal());
motortemplate.getCommand().setValue(MotorChannelsTemplate.Commands.Go.ordinal());
motortemplate.getCommand().setValue(TemplateMotor.Commands.Stop.ordinal());
motortemplate.getCommand().setValue(TemplateMotor.Commands.Go.ordinal());
}
else{
throw e;
@@ -537,11 +537,11 @@ public class CrlogicLoop implements ActionLoop {
// Stop crlogic logic
logger.info("Stop CRLOGIC");
template.getStatus().setValue(CrlogicChannelsTemplate.Status.STOP.toString());
template.getStatus().setValue(TemplateCrlogic.Status.STOP.toString());
// Wait until stopped
logger.info("Wait until stopped");
try{
template.getStatus().waitForValue(CrlogicChannelsTemplate.Status.INACTIVE.toString(), startStopTimeout);
template.getStatus().waitForValue(TemplateCrlogic.Status.INACTIVE.toString(), startStopTimeout);
}
catch(ChannelException | ExecutionException | TimeoutException e){
logger.info( "Failed to stop CRLOGIC. Logic in status: "+template.getStatus().getValue() );
@@ -652,14 +652,14 @@ public class CrlogicLoop implements ActionLoop {
try{
// Connect crlogic channels
template = new CrlogicChannelsTemplate();
template = new TemplateCrlogic();
logger.info("Connect channels");
Map<String,String> map = new HashMap<>();
map.put("PREFIX", prefix);
cservice.createAnnotatedChannels(template, map);
// Connect motor channels
motortemplate = new MotorChannelsTemplate();
motortemplate = new TemplateMotor();
map = new HashMap<>();
map.put("PREFIX", actuator.getName());
cservice.createAnnotatedChannels(motortemplate, map);
@@ -667,7 +667,7 @@ public class CrlogicLoop implements ActionLoop {
useReadback = motortemplate.getUseReadback().getValue();
useEncoder = motortemplate.getUseEncoder().getValue();
logger.info("Motor type: "+ MotorChannelsTemplate.Type.values()[motortemplate.getType().getValue()]);
logger.info("Motor type: "+ TemplateMotor.Type.values()[motortemplate.getType().getValue()]);
logger.info("Motor use readback: "+useReadback);
logger.info("Motor use encoder: "+useEncoder);
@@ -703,13 +703,13 @@ public class CrlogicLoop implements ActionLoop {
// Fill readback encoder settings
// Connect to encoder
EncoderChannelsTemplate encodertemplate = new EncoderChannelsTemplate();
TemplateEncoder encodertemplate = new TemplateEncoder();
map = new HashMap<>();
map.put("PREFIX", readback);
cservice.createAnnotatedChannels(encodertemplate, map);
// Read encoder settings
if(encodertemplate.getDirection().getValue()==EncoderChannelsTemplate.Direction.Positive.ordinal()){
if(encodertemplate.getDirection().getValue()==TemplateEncoder.Direction.Positive.ordinal()){
crlogicDataFilter.setEncoderDirection(1);
}
else{
@@ -737,7 +737,7 @@ public class CrlogicLoop implements ActionLoop {
}
// Fill Motor specific settings
if(motortemplate.getDirection().getValue()==MotorChannelsTemplate.Direction.Positive.ordinal()){
if(motortemplate.getDirection().getValue()==TemplateMotor.Direction.Positive.ordinal()){
crlogicDataFilter.setMotorDirection(1);
}
else{

View File

@@ -26,7 +26,7 @@ import ch.psi.jcae.annotation.CaChannel;
* @author ebner
*
*/
public class CrlogicChannelsTemplate {
public class TemplateCrlogic {
/**
* Status of the OTFSCAN IOC logic

View File

@@ -22,7 +22,7 @@ package ch.psi.fda.core.loops.cr;
import ch.psi.jcae.Channel;
import ch.psi.jcae.annotation.CaChannel;
public class EncoderChannelsTemplate {
public class TemplateEncoder {
/**
* Resolution - $(P)$(E)_SCL

View File

@@ -26,7 +26,7 @@ import ch.psi.jcae.annotation.CaChannel;
* @author ebner
*
*/
public class MotorChannelsTemplate {
public class TemplateMotor {
public enum Type {SOFT_CHANNEL, MOTOR_SIMULATION, OMS_VME58, OMS_MAXv};

View File

@@ -28,7 +28,7 @@ import ch.psi.jcae.annotation.CaChannel;
* @author ebner
*
*/
public class VSC16ScalerChannelsTemplate {
public class TemplateVSC16Scaler {
public enum Command {Done, Count};

View File

@@ -79,7 +79,7 @@ public class OTFLoopTest {
Map<String, String> macros = new HashMap<>();
macros.put("PREFIX", configuration.getOtfPrefix());
OTFBean template = new OTFBean();
TemplateOTF template = new TemplateOTF();
cservice.createAnnotatedChannels(template);

View File

@@ -100,7 +100,7 @@ public class ParallelCrlogicTest {
// Initialize scaler template
VSC16ScalerChannelsTemplate scalertemplate = new VSC16ScalerChannelsTemplate();
TemplateVSC16Scaler scalertemplate = new TemplateVSC16Scaler();
Map<String,String> macros = new HashMap<>();
macros.put("PREFIX", c.getPrefixScaler());
cservice.createAnnotatedChannels(scalertemplate, macros);
@@ -109,14 +109,14 @@ public class ParallelCrlogicTest {
ParallelCrlogic pcrlogic = new ParallelCrlogic(crlogic, scrlogic);
logger.info("Start scaler");
scalertemplate.getCommand().setValueNoWait(VSC16ScalerChannelsTemplate.Command.Count.ordinal());
scalertemplate.getCommand().setValueNoWait(TemplateVSC16Scaler.Command.Count.ordinal());
pcrlogic.prepare();
pcrlogic.execute();
pcrlogic.cleanup();
logger.info("Stop scaler");
scalertemplate.getCommand().setValue(VSC16ScalerChannelsTemplate.Command.Done.ordinal());
scalertemplate.getCommand().setValue(TemplateVSC16Scaler.Command.Done.ordinal());
System.out.println("PARALLEL CRLOGIC data:");
BlockingQueue<Message> queue = pcrlogic.getDataQueue().getQueue();