jiangjy 4 weeks ago
parent
commit
ea8e764d79
1 changed files with 30 additions and 30 deletions
  1. 30 30
      Furnace/FurnaceRT/Devices/IoHeater.cs

+ 30 - 30
Furnace/FurnaceRT/Devices/IoHeater.cs

@@ -227,7 +227,7 @@ namespace FurnaceRT.Devices
                 {
                     if (_isFloatAioType)
                     {
-                        if (ControlMode == 0)
+                        if(ControlMode == 0)
                         {
                             if (Math.Abs(_aoCascadeControlModeSetPoint.FloatValue - value) > 0.0001)
                                 _aoCascadeControlModeSetPoint.FloatValue = value;
@@ -388,9 +388,9 @@ namespace FurnaceRT.Devices
                 DeviceSchematicId = DeviceID,
                 DisplayName = Display,
                 Module = Module,
-
+               
                 Scale = SC.GetValue<double>($"{_scRoot}.{Name}.Range"),
-                OverTempScale = SC.GetValue<double>($"{_scRoot}.{Name}.OverTempRange"),
+                OverTempScale= SC.GetValue<double>($"{_scRoot}.{Name}.OverTempRange"),
                 //Scale = 1200,
                 Unit = "°C",
                 //SetPoint = TempSetPoint,
@@ -473,8 +473,8 @@ namespace FurnaceRT.Devices
             var setLastPoint = SC.GetConfigItem($"PM1.Heater.{this.Name}.SetLastPoint");
             if (setLastPoint != null)
             {
+                _tempSetpoint = (float)setLastPoint.DoubleValue;
                 DeviceData.SetPoint = _tempSetpoint;
-                SetManualParameters(new object[] { (float)setLastPoint.DoubleValue });
             }
             SetCorrectParameters(SC.GetStringValue("PM1.TempCorrection"));
 
@@ -483,7 +483,7 @@ namespace FurnaceRT.Devices
 
         public override void Monitor()
         {
-            if (!string.IsNullOrEmpty(_writeLog))
+            if(!string.IsNullOrEmpty(_writeLog))
             {
                 LOG.Write(_writeLog);
                 _writeLog = "";
@@ -501,9 +501,9 @@ namespace FurnaceRT.Devices
 
                     if (_tempSetpoint == 0)
                     {
-                        if (ControlMode == 0)
+                        if(ControlMode == 0)
                         {
-                            if (_aoCascadeControlModeSetPoint != null && _aoCascadeControlModeSetPoint.FloatValue > 0)
+                            if(_aoCascadeControlModeSetPoint != null && _aoCascadeControlModeSetPoint.FloatValue > 0)
                             {
                                 _tempSetpoint = _aoCascadeControlModeSetPoint.FloatValue;
                             }
@@ -519,8 +519,8 @@ namespace FurnaceRT.Devices
                     SetPIDParameters(SC.GetStringValue("PM1.Heater.PID"));
                 }
             }
-
-            if (DeviceData != null)
+            
+            if(DeviceData != null)
             {
                 DeviceData.CascadePID_P = _aoCascadePID_P == null ? 0 : _aoCascadePID_P.FloatValue;
                 DeviceData.CascadePID_I = _aoCascadePID_I == null ? 0 : _aoCascadePID_I.FloatValue;
@@ -552,12 +552,12 @@ namespace FurnaceRT.Devices
                     DeviceData.ProfilePreheatTime = _preheatTime - _profileTimer.ElapsedMilliseconds / 1000 > 0 ? _preheatTime - _profileTimer.ElapsedMilliseconds / 1000 : 0;
                 }
 
-                if (_profileStableTimer != null && _profileStableTimer.IsRunning)
+                if(_profileStableTimer != null && _profileStableTimer.IsRunning)
                 {
                     DeviceData.ProfileCheckTime = _checkTime - _profileStableTimer.ElapsedMilliseconds / 1000 > 0 ? _checkTime - _profileStableTimer.ElapsedMilliseconds / 1000 : 0;
                 }
             }
-
+           
             MonitorTolerance();
 
             Ramping();
@@ -623,11 +623,11 @@ namespace FurnaceRT.Devices
         {
             var reason = "";
             DeviceData.ControlModeSetpoint = mode;
-            switch (mode.ToLower())
+            switch(mode.ToLower())
             {
                 case "heater":
                 case "heater control":
-                    if (_doSelect.Value)
+                    if(_doSelect.Value)
                         _doSelect.SetValue(false, out reason);
                     if (!_doCascadeMode.Value)
                         _doCascadeMode.SetValue(true, out reason);
@@ -647,13 +647,13 @@ namespace FurnaceRT.Devices
                         _doCascadeMode.SetValue(true, out reason);
                     break;
                 default:
-                    if (mode.ToLower().StartsWith("profile"))
+                    if(mode.ToLower().StartsWith("profile"))
                     {
-                        var arry = mode.Replace(")", "").Split('(');
-                        if (arry != null && arry.Length > 1)
+                        var arry = mode.Replace(")","").Split('(');
+                        if(arry != null && arry.Length > 1)
                         {
                             var profileArray = arry[1].Split(',');
-                            if (profileArray != null && profileArray.Length > 2)
+                            if(profileArray != null && profileArray.Length > 2)
                             {
                                 var profileFileName = profileArray[0];
                                 int.TryParse(profileArray[1], out int profileTableIndex);
@@ -740,7 +740,7 @@ namespace FurnaceRT.Devices
                 //var actualSet = temperature - profileCorrect < 0 ? 0 : temperature - profileCorrect;
                 var actualSet = temperature + _profileTCCalib;//加上flat zone的值  
                 float _rampTime = 0;
-                if (DPR && BWR)
+                if(DPR && BWR)
                 {
                     DownRate = 0;
                     UpRate = 0;
@@ -762,7 +762,7 @@ namespace FurnaceRT.Devices
                         DownRate = ramp;//单位是°C/min
                         UpRate = ramp;//单位是°C/min
                     }
-                }
+                }               
 
                 DeviceData.SetPoint = temperature;
                 DeviceData.RampSetPoint = _rampTime;
@@ -866,7 +866,7 @@ namespace FurnaceRT.Devices
         {
             return _doEnableIn.SetValue(isEnable, out _);
         }
-
+        
         public bool ResetWarningChecker()
         {
             _toleranceCheckerWarning.Reset(_warningJudgmentTime);
@@ -1017,7 +1017,7 @@ namespace FurnaceRT.Devices
             var fileName = string.Join("\\", para.ToArray());
             if (!string.IsNullOrEmpty(recipeCorrectFileName))
                 fileName = recipeCorrectFileName;
-
+            
             CurrentCorrectFileName = fileName;
             CurrentCorrectIndex = index;
             var content = ParameterFileManager.Instance.LoadParameter("Parameter\\TempCorrection", fileName, false);
@@ -1039,7 +1039,7 @@ namespace FurnaceRT.Devices
             }
 
             Dictionary<int, CorrectTableParameter> dic = new Dictionary<int, CorrectTableParameter>();
-            for (int i = 0; i < nodeSteps.Count; i++)
+            for(int i= 0;i < nodeSteps.Count;i++)
             {
                 var step = nodeSteps[i];
                 XmlElement stepNode = step as XmlElement;
@@ -1149,17 +1149,17 @@ namespace FurnaceRT.Devices
                 dic.Add(tableIndex, correctTableParameter);
             }
 
-            if (dic.ContainsKey(index))
+            if(dic.ContainsKey(index))
             {
                 var item = dic[index];
                 var heaterIndex = GetHeaterIndex() - 1;//U的index是0
-                if (item.CorrectParameterLst.Count > heaterIndex)
+                if(item.CorrectParameterLst.Count > heaterIndex)
                 {
                     _profileTemp = item.CorrectParameterLst[heaterIndex].ProfileTemp;
                     _profileCorrect = item.CorrectParameterLst[heaterIndex].ProfileCorrect;
                     _profileTCCalib = item.CorrectParameterLst[heaterIndex].ProfileTCCalib;
                     _cascadeTCCorrect = item.CorrectParameterLst[heaterIndex].CascadeTCCorrect;
-
+                  
 
                 }
                 else
@@ -1181,7 +1181,7 @@ namespace FurnaceRT.Devices
             }
             var temperature = DeviceData.SetPoint;
             var actualSet = temperature + _profileTCCalib;
-            if (temperature > 0)
+            if(temperature > 0)
                 TempSetPoint = (float)actualSet;
             DeviceData.CorrectTable = name;
             if (SC.GetStringValue("PM1.TempCorrection") != name)
@@ -1506,9 +1506,9 @@ namespace FurnaceRT.Devices
                         if (!_profileStableTimer.IsRunning)
                             _profileStableTimer.Restart();
 
-                        if (Math.Abs(TempFeedback - TempSetPoint) > _checkLimit)
+                        if(Math.Abs(TempFeedback - TempSetPoint)  > _checkLimit)
                             _profileStableTimer.Restart();
-
+             
                         _profileAlarmLimitTrig.CLK = Math.Abs(TempFeedback - TempSetPoint) > _alarmLimit && _alarmLimit > 0;
                         if (_profileAlarmLimitTrig.Q)
                             EV.PostWarningLog(ModuleName.PM1.ToString(), $"{Name} profile success setpoint={TempSetPoint} feedback={TempFeedback}, difference={Math.Abs(TempFeedback - TempSetPoint)} is more than alarm limit={_alarmLimit}");
@@ -1517,7 +1517,7 @@ namespace FurnaceRT.Devices
                         if (_profileStableTimer.ElapsedMilliseconds > _checkTime * 1000)
                         {
                             IsProfileSuccess = true;
-                            if (_profileSuccessTrig.Q)
+                            if(_profileSuccessTrig.Q)
                                 LOG.Write($"{Name} profile success setpoint={TempSetPoint} feedback={TempFeedback}");
                             return true;
                         }
@@ -1599,7 +1599,7 @@ namespace FurnaceRT.Devices
             public float TableUseRangeMax { get; set; }
             public int ProfileConditionTableNo { get; set; }
             public int TempPIDTableNo { get; set; }
-            public List<CorrectParameter> CorrectParameterLst { get; set; }
+            public List<CorrectParameter> CorrectParameterLst{ get; set; }
         }
         struct ProfileParameter
         {