Home > Back-end >  Test the linkage
Test the linkage

Time:11-25

# region - the thermostat control logic -
Public void StartTdControlTask ()
{
If (refrechTdControlTask==null)
{
CanRefresh=new CancellationTokenSource ();
RefrechTdControlTask=new Task (TdControlTask);
RefrechTdControlTask. Start ();
}
}

List TdTask=new List (a);
Public void TdControlTask ()
{
while (! CanRefresh. IsCancellationRequested)
{
Try
{
//to iterate through all thermostat mapping relation
Foreach (var obj in BAT. TD. TdBuffer. Instance. TdObject)
{
Double stdTpt=1000;
Double dPc=0;
//1. To determine whether to tempering
for (int i=0; I & lt; Obj. BatName. Count; I++)
{
//determine whether IP right
String sTempIp=obj. BatName [I];
If (sTempIp. Length & lt; 9)
break;

If (tdTask. The Contains (RealDataQueue [sTempIp]. Addr + "-" + RealDataQueue [sTempIp] Chid))
break;

//determine whether configure IP - equipment - channel right
If (obj. BatName [I]. The Split (' - '). Length & lt; 2)
break;

//judge the existence of the channel, theoretically there must be
if (! RealDataBuffer. Instance. RealDataQueue. Either ContainsKey (sTempIp))
break;

If (RealDataQueue [sTempIp]. RealtimeAuxData. Auxtempperc==null)
{
continue;
}

# region, whether to set the thermostat temperature,
//all channels in stopped, temperature cabinet configuration, is complete, disconnect the link state can temperature, other don't temperature
If ((EnumState) RealDataBuffer. Instance. RealDataQueue [sTempIp] RealtimeData. Stepname! .=EnumState WaitTempDebug & amp; &
(EnumState) RealDataBuffer. Instance. RealDataQueue [sTempIp] RealtimeData. Status!=EnumState. Stop & amp; &
(EnumState) RealDataBuffer. Instance. RealDataQueue [sTempIp] RealtimeData. Status!=EnumState.Com plete & amp; &
(EnumState) RealDataBuffer. Instance. RealDataQueue [sTempIp] RealtimeData. Status!=EnumState. Disconnect)
break;
The else
{
If (RealDataQueue [sTempIp]. RealtimeAuxData. Auxtempperc==null)
{
break;
}
}

//determine whether all channel temperature setting consistent
If ((EnumState) RealDataBuffer. Instance. RealDataQueue [sTempIp] RealtimeData. Stepname==EnumState. WaitTempDebug)
{
String sStepParam1=getParamStr (sTempIp);
If (sStepParam1. The Trim ()!="")
{
String [] STR=sStepParam1. Split (', ');

If (stdTpt==1000 & amp; & The I!=obj. BatName. Count - 1)
{
StdTpt=double. Parse (STR [0]).
DPc=double. Parse (STR [1]).
continue;
}
If (stdTpt==1000 & amp; & I==obj. BatName. Count - 1)
{
StdTpt=double. Parse (STR [0]).
DPc=double. Parse (STR [1]).
}
//else
//{
//stdTpt=double. Parse (STR [0]).
//dPc=double. Parse (STR [1]).
//}

If (double. Parse (STR [0]).=stdTpt)
{
Console. WriteLine (" the same temperature box below the temperature in the channel plan is different, please check the plan ");
Log. Write (" in the channel scheme under the same temperature box temperature is different, please check scheme ");
StdTpt=1000;
DPc=0;
break;
}
}
}

//set the thermostat
If (stdTpt!=1000 & amp; & I==obj. BatName. Count - 1)
{
Console. WriteLine (obj. ServerIp. ToString () + "thermostat temperature control" + stdTpt. ToString ());
TdBuffer. Instance. SetIncubatorTemp (RealDataQueue [sTempIp]. Addr, RealDataQueue [sTempIp] Chid, stdTpt);//set temperature
Thread.Sleep(1000);
TdBuffer. Instance. SetIncubatorTemp (RealDataQueue [sTempIp]. Addr, RealDataQueue [sTempIp] Chid, stdTpt);//set temperature
TdTestTask (obj, stdTpt, dPc);
TdBuffer. Instance. SetIncubatorTemp (RealDataQueue [sTempIp]. Addr, RealDataQueue [sTempIp] Chid, stdTpt);//set temperature
TdTestTask (obj, stdTpt, dPc);
TdBuffer. Instance. SetIncubatorTemp (RealDataQueue [sTempIp]. Addr, RealDataQueue [sTempIp] Chid, stdTpt);//set temperature
TdTestTask (obj, stdTpt, dPc);
TdBuffer. Instance. SetIncubatorTemp (RealDataQueue [sTempIp]. Addr, RealDataQueue [sTempIp] Chid, stdTpt);//set temperature
TdTestTask (obj, stdTpt, dPc);
TdBuffer. Instance. SetIncubatorTemp (RealDataQueue [sTempIp]. Addr, RealDataQueue [sTempIp] Chid, stdTpt);//set temperature
TdTestTask (obj, stdTpt, dPc);
TdBuffer. Instance. SetIncubatorTemp (RealDataQueue [sTempIp]. Addr, RealDataQueue [sTempIp] Chid, stdTpt);//set temperature
TdTestTask (obj, stdTpt, dPc);
TdBuffer. Instance. SetIncubatorTemp (RealDataQueue [sTempIp]. Addr, RealDataQueue [sTempIp] Chid, stdTpt);//set temperature
TdTestTask (obj, stdTpt, dPc);
TdBuffer. Instance. SetIncubatorTemp (RealDataQueue [sTempIp]. Addr, RealDataQueue [sTempIp] Chid, stdTpt);//set temperature
TdTestTask (obj, stdTpt, dPc);
TdBuffer. Instance. SetIncubatorTemp (RealDataQueue [sTempIp]. Addr, RealDataQueue [sTempIp] Chid, stdTpt);//set temperature
TdTestTask (obj, stdTpt, dPc);
TdBuffer. Instance. SetIncubatorTemp (RealDataQueue [sTempIp]. Addr, RealDataQueue [sTempIp] Chid, stdTpt);//set temperature
TdTestTask (obj, stdTpt, dPc);
}
# endregion
}
}
RefrechUiEvent. WaitOne (the DATA_FRESH_INTERVAL);
}
The catch (Exception ex)
{
The Debug. WriteLine (" Lift: {0} ", ex. StackTrace);
Log. A Write (string Format (" {0} - {1} ({2}) ", "TdControlTask", ex. The Message, the ex. StackTrace));
}
}
}
  • Related