ulong --> UInt128 in all 'route' related variables, ver. 2.12.419

This commit is contained in:
Milan Hanajik
2016-12-12 17:39:12 +01:00
parent a782d3960a
commit dd62310e59
20 changed files with 78 additions and 65 deletions
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Copyright (c) 2013-2016 Sensus Metering Systems
///
using System;
using System.Text;
@@ -110,10 +110,10 @@ namespace TBF.BenchControl.Elde
/// <summary> State of valves sent out - buffered by the last SendCommand() </summary>
public ulong Route { get { return benchModelRoute; } }
public UInt128 Route { get { return benchModelRoute; } }
ulong valvesToInvert; /// Route = valesToInvert ^ RequiredRouteWithoutInvertedVlaves
readonly ulong routeMask; /// This mask masks out virtual valves, routeMask is set in the constructor
UInt128 valvesToInvert; /// Route = valesToInvert ^ RequiredRouteWithoutInvertedVlaves
readonly UInt128 routeMask; /// This mask masks out virtual valves, routeMask is set in the constructor
///
/// Initialization data updated by constructors of children components
@@ -126,6 +126,9 @@ namespace TBF.BenchControl.Elde
#if DN100 || FUZHOU150 || FUZHOU300 || PT200IL || PUCHONG_PT200 || GENESIS
public byte[] MeretRS485Address = new byte[4];
public float[] EtCalib = new float[6] { 1, 1, 1, 1, 1, 1 };
#elif GENESIS
public byte[] MeretRS485Address = new byte[4];
public float[] EtCalib = new float[7] { 1, 1, 1, 1, 1, 1, 1 };
#elif MUNICH || TORINO50 || BADGER_MALA_TRAT || TORUN_PT50_2015 || CEVAK_PT40_272 || IPERLST || IPERLST_SPECIAL || MURES_PT40 || FUZHOU_40 || SLM_50
public byte[] MeretRS485Address = new byte[4];
public float[] EtCalib = new float[5] { 1, 1, 1, 1, 1 };
@@ -150,7 +153,7 @@ namespace TBF.BenchControl.Elde
bool sendCommandFlag;
Command cmd;
int refNr;
ulong benchModelRoute;
UInt128 benchModelRoute;
int totalRefPulses;
int massRefPulses;
TestMethods testMethods;
@@ -244,7 +247,7 @@ namespace TBF.BenchControl.Elde
{
if (i < controlBoardCfg.VirtualValvesRangeLo || i > controlBoardCfg.VirtualValvesRangeHi)
{
routeMask = routeMask | ((ulong)1 << i);
routeMask = routeMask | ((UInt128)1 << i);
}
}
@@ -269,7 +272,7 @@ namespace TBF.BenchControl.Elde
#else /// all newer benches
ControlComponent_Torino2015.UserControl1 ctrlBrdComponent,
#endif
ulong valvesToInvert,
UInt128 valvesToInvert,
double[] tankCapacities)
{
this.valvesToInvert = valvesToInvert;
@@ -433,7 +436,7 @@ namespace TBF.BenchControl.Elde
/// <param name="regConst">Coefficient used to control reg. valves (1..100)</param>
/// <param name="shortImp">0 = default value, 1 = spec. processing of very short pulses</param>
/// <param name="stopDevs">What to stop</param>
public void SendCommand(Command cmd, int refFlowmtrNr, ulong route,
public void SendCommand(Command cmd, int refFlowmtrNr, UInt128 route,
int totalRefPulses, int massRefPulses, TestMethods testMethods,
float filterConstant, int regConst, int shortImp, StopDevs stopDevs)
{
@@ -457,9 +460,9 @@ namespace TBF.BenchControl.Elde
/// <param name="valvesToOpen">'ulong' with bits of valves to open set to '1'</param>
/// <param name="valvesToClose">'ulong' with bits of valves to close set to '1'</param>
/// <returns>'ulong' with bits of valves that have changed set to '1'</returns>
public ulong SetValves(ulong valvesToOpen, ulong valvesToClose, IList<Elde.ValveEx.Valve> extendedValves)
public UInt128 SetValves(UInt128 valvesToOpen, UInt128 valvesToClose, IList<Elde.ValveEx.Valve> extendedValves)
{
ulong oldRoute = benchModelRoute;
UInt128 oldRoute = benchModelRoute;
benchModelRoute = (((benchModelRoute ^ valvesToInvert) | valvesToOpen) & (~valvesToClose)) ^ valvesToInvert;
foreach (var extV in extendedValves) extV.UpdateRoute(ref benchModelRoute);
log.DebugFormat("SetValves(x,x), new route = {0}", Utils.ShowRoute(benchModelRoute));
@@ -471,9 +474,9 @@ namespace TBF.BenchControl.Elde
/// Set Route to value returned by RRoute. Take virtual valves into account.
/// </summary>
/// <returns>'ulong' with bits of valves that have changed set to '1'</returns>
public ulong SyncRoute()
public UInt128 SyncRoute()
{
ulong oldRoute = benchModelRoute;
UInt128 oldRoute = benchModelRoute;
benchModelRoute = (RRoute & routeMask) | (benchModelRoute & (~routeMask));
log.DebugFormat("SyncRoute(), new route = {0}", Utils.ShowRoute(benchModelRoute));
return oldRoute ^ benchModelRoute;