Example #1
0
        public ActuatorBase(string name, ActuatorConfig config, IActuatorState initialState = null)
        {
            Config = new ActuatorConfig(config);

            initialState = initialState ?? Config.GetDefaultInitialActuatorState();

            slewRateLimitTool = new SlewRateLimitTool(minValue: 0.0, maxValue: 100.0, initialValue: initialState.PositionInPercent, initialTarget: initialState.TargetPositionInPercent, maxRatePerSec: 0.0);

            UpdateMotionRates();

            privateState = new ActuatorState(initialState);

            logger = new Logging.Logger(name, Logging.LogGate.All);

            if (config.InitialPos.IsTargetPositionValid(allowInBetween: true))
            {
                privateState.TargetPos = privateState.PosState = config.InitialPos;
                privateState.TargetPositionInPercent = privateState.PositionInPercent = GetTargetPositionInPercent(config.InitialPos, mapInBetweenToHalfWay: true);
                privateState.TargetPosStr            = privateState.PosStateStr = config.ToString(config.InitialPos);
            }

            logger.Debug.Emit("Initial state is:{0} [{1} {2:f0}%]", privateState.PosStateStr, privateState.PosState, privateState.PositionInPercent);

            PublishState();
        }
Example #2
0
 public ActuatorConfig(ActuatorConfig other)
 {
     Pos1Name       = other.Pos1Name;
     Pos2Name       = other.Pos2Name;
     Motion1To2Time = other.Motion1To2Time;
     Motion2To1Time = other.Motion2To1Time;
     InitialPos     = other.InitialPos;
 }
Example #3
0
        public ActuatorBase(ActuatorConfig config, ActuatorState state)
        {
            Config = config;
            PrivateState = state;

            logger = new Logging.Logger(config.Name, Logging.LogGate.All);

            PrivateState.TargetPos = PrivateState.PosState = config.InitialPos;
            PrivateState.TargetPosStr = PrivateState.PosStateStr = config.ToString(config.InitialPos);
            PrivateState.TimeStamp = QpcTimeStamp.Now;

            logger.Info.Emit("Initial state is:{0} [{1}]", PrivateState.PosStateStr, PrivateState.PosState);

            PublishState();
        }
Example #4
0
 public ActuatorPlugin(string name, ActuatorConfig config, IActuatorState initialState = null)
     : base(name, config, initialState)
 {
 }
Example #5
0
 public ActuatorConfig(ActuatorConfig rhs)
 {
     Name = rhs.Name;
     Pos1Name = rhs.Pos1Name;
     Pos2Name = rhs.Pos2Name;
     Motion1To2Time = rhs.Motion1To2Time;
     Motion2To1Time = rhs.Motion2To1Time;
     InitialPos = rhs.InitialPos;
 }