UniCB and Uni.RegValve functionality, ver. 3.1.1602

This commit is contained in:
Milan Hanajik
2021-03-04 11:28:39 +01:00
parent cdca702738
commit 9495b9f3a3
7 changed files with 242 additions and 90 deletions
+160 -48
View File
@@ -1,6 +1,7 @@
///
/// Copyright (c) 2021 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using log4net;
using Dirichlet.Numerics;
@@ -10,12 +11,15 @@ namespace TBF.BenchControl.ControlBoard.Uni
public enum ActionID
{
/// Basic
ChangeRoute = 1, /// Change digital outputs (route)
SetFlow = 2, /// Set flow
MeasureFlow = 4, /// Activate a flow meter to measure the flow
StartTest = 8, /// Start a test
Stop = 16, /// Stop a test or a flow regulation
SwitchDiverter = 32, /// Switch diverter to tank/sink
ChangeRoute = 1, /// Change digital outputs (route)
MeasureFlow = 2, /// Activate a flow meter to measure the flow
SetFlow = 4, /// Set flow
StartTest = 8, /// Start a test
StopTest = 0x10, /// Stop a test or a flow regulation
RegVlvIncrMove = 0x20,
RegVlvMoveToPos = 0x40,
RegVlvStop = 0x80,
SwitchDiverter = 0x100, /// Switch diverter to tank/sink
/// Advanced
GetDiverterTransitionData,
@@ -38,13 +42,14 @@ namespace TBF.BenchControl.ControlBoard.Uni
public bool ToTank { get; set; } /// SwitchDiverter argument
public int TotalPulsesCount { get; set; } /// StartTest argument
public int MassPulsesCount { get; set; } /// StartTest argument
public int FlowRegP1 { get; set; } /// SetFlow
public int FlowRegP2 { get; set; } /// SetFlow
public RegValveMode RegVMode { get; set; } /// SetFlow, RegVlvIncrMove, RegVlvMoveToPos, RegVlvStop
public int RVMovePar1 { get; set; } /// SetFlow, RegVlvIncrMove, RegVlvMoveToPos
public int RVMovePar2 { get; set; } /// SetFlow, RegVlvIncrMove, RegVlvMoveToPos
public int PID { get; set; } /// SetFlow
public int TolerRV { get; set; } /// SetFlow
public int StabTime { get; set; } /// SetFlow
public int DivThreshold { get; set; } /// StartTest argument
int StartStop { get; set; } /// Implicitly used by SetFlow, StartTest and Stop: -1=not defined, 0=stop, 1=start
int StartStop { get; set; } /// Implicitly used by StartTest and StopTest: -1=not defined, 0=stop, 1=start
public Action()
@@ -53,14 +58,15 @@ namespace TBF.BenchControl.ControlBoard.Uni
FlowMId = -1;
RegVId = -1;
DivId = -1;
RegVMode = RegValveMode.None;
StartStop = -1;
/// These values are used by one action type only. No conflicts possible
Route = 0;
FlowRegP1 = 0;
FlowRegP2 = 0;
TotalPulsesCount = 0;
MassPulsesCount = 0;
RVMovePar1 = 0;
RVMovePar2 = 0;
}
@@ -71,7 +77,7 @@ namespace TBF.BenchControl.ControlBoard.Uni
public bool IsStop()
{
return (ActionId & ActionID.Stop) != 0;
return (ActionId & ActionID.StopTest) != 0;
}
///----------------------------------------------------------------------------------------------
@@ -87,9 +93,10 @@ namespace TBF.BenchControl.ControlBoard.Uni
{
Route = action.Route;
}
bool CompareChangeRouteArgs(Action action)
/// Check whether new action arguments are compatible with alredy collected arguments (true = yes)
bool CheckSharedChangeRouteArgs(Action newAction)
{
return Route == action.Route;
return Route == newAction.Route;
}
///----------------------------------------------------------------------------------------------
@@ -105,44 +112,51 @@ namespace TBF.BenchControl.ControlBoard.Uni
{
FlowMId = action.FlowMId;
}
bool CompareMeasureFlowArgs(Action action)
/// Check whether new action arguments are compatible with alredy collected arguments (true = yes)
bool CheckSharedMeasureFlowArgs(Action newAction)
{
return (FlowMId == -1 || FlowMId == action.FlowMId);
return (FlowMId == -1 || FlowMId == newAction.FlowMId);
}
///----------------------------------------------------------------------------------------------
public static Action SetFlow(int flowMeterId, int regValveId, int flowRegPar1, int flowRegPar2,
public static Action SetFlow(int flowMeterId, int regValveId, double freqLo, double freqHi,
int pid, int tolerRV, int stabTime)
{
int rvMovePar1 = Convert.ToInt32(Math.Round(13.1072 * freqLo));
int rvMovePar2 = Convert.ToInt32(Math.Round(13.1072 * freqHi));
return new Action
{
ActionId = ActionID.SetFlow,
FlowMId = flowMeterId,
RegVId = regValveId,
FlowRegP1 = flowRegPar1,
FlowRegP2 = flowRegPar2,
RegVMode = RegValveMode.TargetFrequency,
RVMovePar1 = rvMovePar1,
RVMovePar2 = rvMovePar2,
PID = pid,
TolerRV = tolerRV,
StabTime = stabTime,
StartStop = 1,
};
}
void SetSetFlowArgs(Action action)
{
FlowMId = action.FlowMId;
RegVId = action.RegVId;
FlowRegP1 = action.FlowRegP1;
FlowRegP2 = action.FlowRegP2;
RegVMode = action.RegVMode;
RVMovePar1 = action.RVMovePar1;
RVMovePar2 = action.RVMovePar2;
PID = action.PID;
TolerRV = action.TolerRV;
StabTime = action.StabTime;
StartStop = 1;
}
bool CompareSetFlowArgs(Action action)
/// Check whether new action arguments are compatible with alredy collected arguments (true = yes)
bool CheckSharedSetFlowArgs(Action newAction)
{
return (FlowMId == -1 || FlowMId == action.FlowMId) &&
(RegVId == -1 || RegVId == action.RegVId) &&
(StartStop == -1 || StartStop == 1);
return (FlowMId == -1 || FlowMId == newAction.FlowMId) &&
(RegVId == -1 || RegVId == newAction.RegVId) &&
(RegVMode == RegValveMode.None || RegVMode == newAction.RegVMode) &&
(RVMovePar1 == -1 || RVMovePar1 == newAction.RVMovePar1) &&
(RVMovePar2 == -1 || RVMovePar2 == newAction.RVMovePar2);
}
///----------------------------------------------------------------------------------------------
@@ -173,31 +187,128 @@ namespace TBF.BenchControl.ControlBoard.Uni
MassPulsesCount = action.MassPulsesCount;
StartStop = 1;
}
bool CompareStartTestArgs(Action action)
/// Check whether new action arguments are compatible with alredy collected arguments (true = yes)
bool CheckSharedStartTestArgs(Action newAction)
{
return (FlowMId == -1 || FlowMId == action.FlowMId) &&
(DivId == -1 || DivId == action.DivId) &&
return (FlowMId == -1 || FlowMId == newAction.FlowMId) &&
(DivId == -1 || DivId == newAction.DivId) &&
(StartStop == -1 || StartStop == 1);
}
///----------------------------------------------------------------------------------------------
public static Action Stop()
public static Action StopTest()
{
return new Action()
{
ActionId = ActionID.Stop,
ActionId = ActionID.StopTest,
StartStop = 0,
};
}
void SetStopArgs(Action action)
void SetStopTestArgs(Action action)
{
StartStop = 0;
}
bool CompareStopArgs(Action action)
/// Check whether new action arguments are compatible with alredy collected arguments (true = yes)
bool CheckSharedStopTestArgs(Action action)
{
return (StartStop == -1 || StartStop == 0);
}
///----------------------------------------------------------------------------------------------
public static Action RegVlvIncrMove(int regValveId, double timeSec)
{
int rvMovePar = Math.Abs(Convert.ToInt32(Math.Round(timeSec / 0.050))); /// Step is 50 ms
return new Action
{
ActionId = ActionID.RegVlvIncrMove,
RegVId = regValveId,
RegVMode = (timeSec >= 0) ? RegValveMode.PulseWidth : RegValveMode.PulseWidthNeg,
RVMovePar1 = rvMovePar,
RVMovePar2 = rvMovePar,
};
}
void SetRegVlvIncrMoveArgs(Action action)
{
RegVId = action.RegVId;
RegVMode = action.RegVMode;
RVMovePar1 = action.RVMovePar1;
RVMovePar2 = action.RVMovePar2;
}
/// Check whether new action arguments are compatible with alredy collected arguments (true = yes)
bool CheckSharedRegVlvIncrMoveArgs(Action newAction)
{
return (RegVId == -1 || RegVId == newAction.RegVId) &&
(RegVMode == RegValveMode.None || RegVMode == newAction.RegVMode);
}
///----------------------------------------------------------------------------------------------
public static Action RegVlvMoveToPos(int regValveId, double positionLo, double positionHi = -1)
{
int rvMovePar1, rvMovePar2; /// TODO
///
if (positionHi < 0)
{
/// Center position specified, calculate a range
rvMovePar1 = 0; // TODO
rvMovePar2 = 0; // TODO
}
else
{
/// Lower and upper range of position specified
rvMovePar1 = 0; // TODO
rvMovePar2 = 0; // TODO
}
return new Action
{
ActionId = ActionID.RegVlvMoveToPos,
RegVId = regValveId,
RegVMode = RegValveMode.TargetPosition,
RVMovePar1 = rvMovePar1,
RVMovePar2 = rvMovePar2,
};
}
void SetRegVlvMoveToPosArgs(Action action)
{
RegVId = action.RegVId;
RegVMode = action.RegVMode;
RVMovePar1 = action.RVMovePar1;
RVMovePar2 = action.RVMovePar2;
}
/// Check whether new action arguments are compatible with alredy collected arguments (true = yes)
bool CheckSharedRegVlvMoveToPosArgs(Action newAction)
{
return (RegVId == -1 || RegVId == newAction.RegVId) &&
(RegVMode == RegValveMode.None || RegVMode == newAction.RegVMode);
}
///----------------------------------------------------------------------------------------------
public static Action RegVlvStop(int regValveId)
{
return new Action
{
ActionId = ActionID.RegVlvMoveToPos,
RegVId = regValveId,
RegVMode = RegValveMode.Stop,
RVMovePar1 = 0,
RVMovePar2 = 0,
};
}
void SetRegVlvStopArgs(Action action)
{
RegVId = action.RegVId;
RegVMode = action.RegVMode;
RVMovePar1 = action.RVMovePar1;
RVMovePar2 = action.RVMovePar2;
}
/// Check whether new action arguments are compatible with alredy collected arguments (true = yes)
bool CheckSharedRegVlvStopArgs(Action newAction)
{
return (RegVId == -1 || RegVId == newAction.RegVId) &&
(RegVMode == RegValveMode.None || RegVMode == newAction.RegVMode);
}
///----------------------------------------------------------------------------------------------
public static Action SwitchDiverter(int divId, bool toTank)
{
@@ -213,7 +324,8 @@ namespace TBF.BenchControl.ControlBoard.Uni
DivId = action.DivId;
ToTank = action.ToTank;
}
bool CompareSwitchDiverterArgs(Action action)
/// Check whether new action arguments are compatible with alredy collected arguments (true = yes)
bool CheckSharedSwitchDiverterArgs(Action action)
{
return (DivId == -1 || DivId == action.DivId);
}
@@ -229,27 +341,27 @@ namespace TBF.BenchControl.ControlBoard.Uni
case ActionID.MeasureFlow: SetMeasureFlowArgs(action); return;
case ActionID.SetFlow: SetSetFlowArgs(action); return;
case ActionID.StartTest: SetStartTestArgs(action); return;
case ActionID.Stop: SetStopArgs(action); return;
case ActionID.StopTest: SetStopTestArgs(action); return;
case ActionID.SwitchDiverter: SetSwitchDiverterArgs(action); return;
default: return;
}
}
/// <summary>
/// Checks whether there is a conflict in usage of arguments.
/// Check whether new action arguments are compatible with alredy collected arguments
/// </summary>
/// <param name="action">2nd action</param>
/// <returns>true if there is no conflict</returns>
bool CompareSharedArgs(Action action)
/// <param name="action">Action to be executed together with already collected actions</param>
/// <returns>true when compatible</returns>
bool CheckSharedArgs(Action action)
{
switch (action.ActionId)
{
case ActionID.ChangeRoute: return CompareChangeRouteArgs(action);
case ActionID.MeasureFlow: return CompareMeasureFlowArgs(action);
case ActionID.SetFlow: return CompareSetFlowArgs(action);
case ActionID.StartTest: return CompareStartTestArgs(action);
case ActionID.Stop: return CompareStopArgs(action);
case ActionID.SwitchDiverter: return CompareSwitchDiverterArgs(action);
case ActionID.ChangeRoute: return CheckSharedChangeRouteArgs(action);
case ActionID.MeasureFlow: return CheckSharedMeasureFlowArgs(action);
case ActionID.SetFlow: return CheckSharedSetFlowArgs(action);
case ActionID.StartTest: return CheckSharedStartTestArgs(action);
case ActionID.StopTest: return CheckSharedStopTestArgs(action);
case ActionID.SwitchDiverter: return CheckSharedSwitchDiverterArgs(action);
default: return false;
}
}
@@ -267,7 +379,7 @@ namespace TBF.BenchControl.ControlBoard.Uni
while (queue.Count > 0)
{
var peekA = queue.Peek();
if ((resultA.ActionId & peekA.ActionId) == 0 && resultA.CompareSharedArgs(peekA) == true)
if ((resultA.ActionId & peekA.ActionId) == 0 && resultA.CheckSharedArgs(peekA) == true)
{
/// ActionId would not be repeated and arguments are compatible => apply the new action
resultA.SetArgs(peekA);
@@ -293,7 +405,7 @@ namespace TBF.BenchControl.ControlBoard.Uni
args = string.Format("Route={0}", Route.ToString("X16"));
break;
case ActionID.SetFlow:
args = string.Format("Etalon={0} RV={1} Par1={2} Par2={3}", FlowMId, RegVId, FlowRegP1, FlowRegP2);
args = string.Format("Etalon={0} RV={1} Par1={2} Par2={3}", FlowMId, RegVId, RVMovePar1, RVMovePar2);
break;
case ActionID.MeasureFlow:
args = string.Format("Etalon={0}", FlowMId);
@@ -58,11 +58,11 @@ namespace TBF.BenchControl.ControlBoard.Uni
message[26] = 0;
/// Regulation valve
message[27] = (action.RegVId < 0) ? (byte)0 : (byte)action.RegVId;
message[28] = (byte)(action.FlowRegP1 & 0xFF);
message[29] = (byte)((action.FlowRegP1 >> 8) & 0xFF);
message[30] = (byte)(action.FlowRegP2 & 0xFF);
message[31] = (byte)((action.FlowRegP2 >> 8) & 0xFF);
message[27] = (action.RegVId < 0) ? (byte)0 : (byte)(action.RegVId | (int)action.RegVMode);
message[28] = (byte)(action.RVMovePar1 & 0xFF);
message[29] = (byte)((action.RVMovePar1 >> 8) & 0xFF);
message[30] = (byte)(action.RVMovePar2 & 0xFF);
message[31] = (byte)((action.RVMovePar2 >> 8) & 0xFF);
message[32] = action.IsStop() ? (byte)0x20 : action.IsStart() ? (byte)0x42 : (byte)0; /// ZStavReg
/// DA1
@@ -154,10 +154,10 @@ namespace TBF.BenchControl.ControlBoard.Uni
public enum TestMethods
{
Diverter = 0x01, /// bit 0: 1=Mass method (diverters are used), 0=Volume method
FixedStart = 0x02, /// bit 1: 1=fixed start method, 0=flying start method
Synchro = 0x04, /// bit 2: 1=Synchro method, 0=Pulse counting
MassAndContinue = 0x10, /// bit 4: 1=Method with mass measurement followed by a volume method
Diverter = 0x01, /// bit 0: 1=Mass method (diverters are used), 0=Volume method
FixedStart = 0x02, /// bit 1: 1=fixed start method, 0=flying start method
Synchro = 0x04, /// bit 2: 1=Synchro method, 0=Pulse counting
MassAndContinue = 0x10, /// bit 4: 1=Method with mass measurement followed by a volume method
}
public enum ValveChgFlag : byte
@@ -170,10 +170,11 @@ namespace TBF.BenchControl.ControlBoard.Uni
public enum RegValveMode : byte
{
None = 0,
PulseWidth = 1, /// Pulse width 0.05 .. 2 sec.
TargetPosition = 2, /// Low and high position (=DAC value) limits (0..100%) are specified
TargetFrequency = 3, /// Low and high frequency limits (0..2000Hz,0..2200Hz) are specified
Stop = 4, /// Stop regulation
TargetFrequency = 0x10, /// Low and high frequency limits (0..2000Hz,0..2200Hz) are specified
TargetPosition = 0x20, /// Low and high position (=DAC value) limits (0..100%) are specified
Stop = 0x30, /// Stop regulation
PulseWidth = 0x40, /// Pulse width 0.05 .. 2 sec.
PulseWidthNeg = 0xC0, /// Pulse width 0.05 .. 2 sec.
}
public enum RegValveState : byte
+26 -3
View File
@@ -440,9 +440,7 @@ namespace TBF.BenchControl.ControlBoard.Uni
///
public IOperation SetFlowOp(double flowLimLo, double flowLimHi, TBF.Boxes.DoubleBox measuredFlow, int timeout)
{
//var msg = new OutputMessage(Command.Start, );
// scheduledActionQueue.Enqueue(Action.Stop());
return null;
return Devices.RegValve.SetFlowOp(Devices.FlowMeter,flowLimLo, flowLimHi, measuredFlow, timeout);
}
public IOperation StopFlowRegulationOp()
@@ -532,6 +530,31 @@ namespace TBF.BenchControl.ControlBoard.Uni
#endregion
public void SetFlow(int flowMeterId, int regVId, double freqLo, double freqHi)
{
scheduledActionQueue.Enqueue(Action.SetFlow(flowMeterId, regVId, freqLo, freqHi, Convert.ToInt32(Math.Round(Devices.PidCoef)), 0, 200));
}
/// <summary>
/// Perform incremental movement of a regulation valve
/// </summary>
/// <param name="rvId">Reg. valve ID</param>
/// <param name="time">Time in seconds, positive value opens the reg. valve</param>
public void RegVlvIncrMove(int regVId, double time)
{
scheduledActionQueue.Enqueue(Action.RegVlvIncrMove(regVId, time));
}
/// <summary>
/// Move a regulation valve to specfied position
/// </summary>
/// <param name="rvId">Reg. valve ID</param>
/// <param name="position">Reg. valve position (0 .. 1.0)</param>
public void RegVlvMoveToPos(int regVId, double positionLo, double positionHi = -1)
{
scheduledActionQueue.Enqueue(Action.RegVlvMoveToPos(regVId, positionLo, positionHi));
}
public void DiverterToTank(int divNr1)
{
scheduledActionQueue.Enqueue(Action.SwitchDiverter(divNr1, true));
+35 -19
View File
@@ -23,7 +23,7 @@ namespace TBF.BenchControl.Uni.RegValve
IDictionary<double, float> dict;
public IDictionary<double, float> Dict { get { return dict; } }
readonly UniCB cBoard;
readonly UniCB uniCB;
public ValveCategory Category { get { return regValveCfg.Category; } }
public int Idx1 { get { return regValveCfg.Idx1; } } /// 1..7
@@ -34,7 +34,7 @@ namespace TBF.BenchControl.Uni.RegValve
///
public bool IsCoax { get { return false; } }
///
public float Position { get { return Raw2Position(cBoard.AnalogInput(AdcChannel)); } } /// 0 .. 100%
public float Position { get { return Raw2Position(uniCB.AnalogInput(AdcChannel)); } } /// 0 .. 100%
///
public double SetpointVal
{
@@ -73,11 +73,31 @@ namespace TBF.BenchControl.Uni.RegValve
/// TODO
}
public void ValveMove(RegValveMode mode, float[] values)
public void SetFlow(int flowMeterId, double freqLo, double freqHi)
{
/// TODO
uniCB.SetFlow(flowMeterId, Idx1, freqLo, freqHi);
}
/// <summary>
/// Incremental movement of the regulation valve.
/// </summary>
/// <param name="time">Time in seconds, positive value opens the reg. valve</param>
public void IncrementalMovement(double time)
{
uniCB.RegVlvIncrMove(Idx1, time);
}
/// <summary>
/// Move a regulation valve to specfied position
/// </summary>
/// <param name="rvId">Reg. valve ID</param>
/// <param name="position">Reg. valve position (0 .. 1.0)</param>
public void MoveToPosition(double positionLo, double positionHi = -1)
{
uniCB.RegVlvMoveToPos(Idx1, positionLo, positionHi);
}
#region Configuration Change Handling
public static void OnCfgChange(object sender, CfgChangeArgs args)
@@ -103,19 +123,15 @@ namespace TBF.BenchControl.Uni.RegValve
}
else if (args.Command == CfgChangeCmd.RVOpenStep)
{
ValveMove(RegValveMode.PulseWidth, new float[2] { 2.0f, 2.0f });
// TODO: avoid conflicts
// TOTEST
IncrementalMovement(0.5);
}
else if (args.Command == CfgChangeCmd.RVCloseStep)
{
ValveMove(RegValveMode.PulseWidth, new float[2] { -2.0f, -2.0f });
// TODO: avoid conflicts
// TOTEST
}
IncrementalMovement(-0.5);
}
else if (args.Command == CfgChangeCmd.GetAdc1 || args.Command == CfgChangeCmd.GetAdc2)
{
Int16 adcValue = cBoard.AnalogInput(AdcChannel);
short adcValue = uniCB.AnalogInput(AdcChannel);
RegValveCfgCtrl.OnCmdResponse(this, new CmdResponseArgs(args.Command, Idx1, adcValue));
}
}
@@ -134,8 +150,8 @@ namespace TBF.BenchControl.Uni.RegValve
{
regValveCfg = cfg as RegValveCfg;
this.cBoard = TbfComponents.FindComponent(cfg.ParentName, components) as UniCB;
if (this.cBoard == null) throw new Exception(string.Format("Cannot find {0} (a parent of {1})", cfg.ParentName, Name));
this.uniCB = TbfComponents.FindComponent(cfg.ParentName, components) as UniCB;
if (this.uniCB == null) throw new Exception(string.Format("Cannot find {0} (a parent of {1})", cfg.ParentName, Name));
this.dict = new Dictionary<double, float>();
@@ -151,7 +167,7 @@ namespace TBF.BenchControl.Uni.RegValve
public void Initialize() { }
public void RunDeviceBefore()
{
Int16 adcValue = cBoard.Data.AnalogInput[AdcChannel];
Int16 adcValue = uniCB.Data.AnalogInput[AdcChannel];
Handlers.OnAdcChanged(this, new CmdResponseArgs(CfgChangeCmd.GetAdc, Idx1, adcValue));
}
public void RunDeviceAfter() { }
@@ -172,7 +188,7 @@ namespace TBF.BenchControl.Uni.RegValve
/// <returns>SetFlowOp instance</returns>
public IOperation SetFlowOp(GenericDevices.IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow, int timeout)
{
return new SetFlowOp(cBoard, this, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, regValveCfg.ReTryCommands, timeout);
return new SetFlowOp(uniCB, this, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, regValveCfg.ReTryCommands, timeout);
}
/// <summary>
@@ -188,7 +204,7 @@ namespace TBF.BenchControl.Uni.RegValve
public IOperation SetFlowAndMeasureOp(GenericDevices.IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi,
DoubleBox measuredFlow, int timeout, float filterConstant)
{
return new SetFlowOp(cBoard, this, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, regValveCfg.ReTryCommands, timeout, true);
return new SetFlowOp(uniCB, this, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, regValveCfg.ReTryCommands, timeout, true);
}
/// <summary>
@@ -200,12 +216,12 @@ namespace TBF.BenchControl.Uni.RegValve
/// <returns>SetPositionOp instance</returns>
public IOperation SetRegulValvePositionOp(float pctLo, float pctHi, int timeoutMs)
{
return new SetRegValvePositionOp(cBoard, this, pctLo, pctHi, timeoutMs);
return new SetRegValvePositionOp(uniCB, this, pctLo, pctHi, timeoutMs);
}
public IOperation ChangeRegulValvePositionOp(float timePulseSec)
{
return new ChangeRegulValvePositionOp(cBoard, this, timePulseSec);
return new ChangeRegulValvePositionOp(uniCB, this, timePulseSec);
}
}
}
+4 -4
View File
@@ -259,7 +259,7 @@ namespace TBF.BenchControl.Uni.RegValve
else if (opState == OpState.ValveMoveToPosition2) /// Move to position
{
/// Issues the appropriate ValveMove(...) command
regV.ValveMove(RegValveMode.TargetPosition, new float[2] { targetPositionLo, targetPositionHi });
regV.MoveToPosition(targetPositionLo, targetPositionHi);
opState = OpState.SettingPosition;
return Event.Starting;
@@ -286,7 +286,7 @@ namespace TBF.BenchControl.Uni.RegValve
else if (regV.RegValveState != RegValveState.DacValueRegul)
{
/// Repeat appropriate ValveMove(...) command
regV.ValveMove(RegValveMode.TargetPosition, new float[2] { targetPositionLo, targetPositionHi });
regV.MoveToPosition(targetPositionLo, targetPositionHi);
log.InfoFormat("SetFlowOp: ValveMove({0}, Position, {1}, {2}, {3})",
regulValveNr, targetPositionLo, targetPositionHi, regV.StableTime);
@@ -329,7 +329,7 @@ namespace TBF.BenchControl.Uni.RegValve
double freqLo = 2000.0 * currentReqFlowLo / nominalFlow;
double freqHi = 2000.0 * currentReqFlowHi / nominalFlow;
regV.ValveMove(RegValveMode.TargetFrequency, new float[2] { (float)freqLo, (float)freqHi });
regV.SetFlow(flowMeter.Idx1,freqLo, freqHi);
opState = OpState.ValveMoveToFlow3;
return Event.Starting;
@@ -359,7 +359,7 @@ namespace TBF.BenchControl.Uni.RegValve
/// Done once, issues an appropriate ValveMove(...) command
double freqLo = 2000.0 * currentReqFlowLo / nominalFlow;
double freqHi = 2000.0 * currentReqFlowHi / nominalFlow;
regV.ValveMove(RegValveMode.TargetFrequency, new float[2] { (float)freqLo, (float)freqHi });
regV.SetFlow(flowMeter.Idx1, freqLo, freqHi);
log.InfoFormat("SetFlowOp: ValveMove({0}, Frequency, {1}, {2}, {3})",
regulValveNr, freqLo, freqHi, regV.StableTime);
@@ -107,7 +107,7 @@ namespace TBF.BenchControl.Uni.RegValve
firstRun = false;
regV.ValveMove(RegValveMode.TargetPosition, new float[2] { posLoPct, posHiPct });
regV.MoveToPosition(posLoPct, posHiPct);
opState = OpState.CheckState;
return Event.None;
}