diff --git a/FrameworkLocal/RTCore/DeviceData/IoPsuData.cs b/FrameworkLocal/RTCore/DeviceData/IoPsuData.cs index 111271e..3c73ad0 100644 --- a/FrameworkLocal/RTCore/DeviceData/IoPsuData.cs +++ b/FrameworkLocal/RTCore/DeviceData/IoPsuData.cs @@ -74,6 +74,18 @@ namespace Aitex.Core.Common.DeviceData.IoDevice [DataMember] public float ConstantSetPoint { get; set; } + /// + /// 设置或返回输出限幅上限值。 + /// + [DataMember] + public float OutputLimitHigh { get; set; } + + /// + /// 设置或返回输出限幅下限值。 + /// + [DataMember] + public float OutputLimitLow { get; set; } + /// /// 设置或返回PSU总开关状态。 /// diff --git a/Modules/SicPM/Config/DeviceModelPM.xml b/Modules/SicPM/Config/DeviceModelPM.xml index f73d608..579c69f 100644 --- a/Modules/SicPM/Config/DeviceModelPM.xml +++ b/Modules/SicPM/Config/DeviceModelPM.xml @@ -59,6 +59,8 @@ aiOutputVoltage="AI_PSU2Voltage" aiOutputArms="AI_PSU2Arms" aiOutputPower="AI_PSU2Power" aiSimVoltage="AI_PSU2SimVoltage" aiSimArms="AI_PSU2SimArms" doStatus="DO_PSU2Enable" doReset="DO_PSU2Reset" aoConstant="AO_PSU2Constant" + aoOutputLimitHigh="AO_PSU2OutputLimitHigh" + aoOutputLimitLow="AO_PSU2OutputLimitLow" diStatus="DI_MiddleHeaterEnable_FB" diAlarm="DI_PSU2Alarm" AlarmText="Alarm67 PSU2 Alarm[DI-321]" diCommunicationError ="DI_PSU2dpCommunicationError" commAlarmText="" doHeatEnable="DO_PSUEnable" diHeatEnable="DI_PSUEnable_FB" doRelatedEnable="DO_MiddleHeaterEnable" /> diff --git a/Modules/SicPM/Config/_ioDefinePM.xml b/Modules/SicPM/Config/_ioDefinePM.xml index 6c50575..d4d45ed 100644 --- a/Modules/SicPM/Config/_ioDefinePM.xml +++ b/Modules/SicPM/Config/_ioDefinePM.xml @@ -743,8 +743,8 @@ - - + + diff --git a/Modules/SicPM/Devices/IoPSU.cs b/Modules/SicPM/Devices/IoPSU.cs index 5867d51..2d9ae51 100644 --- a/Modules/SicPM/Devices/IoPSU.cs +++ b/Modules/SicPM/Devices/IoPSU.cs @@ -29,6 +29,8 @@ namespace SicPM.Devices //private AOAccessor _aoEnable = null; //private AOAccessor _aoReset = null; private readonly AOAccessor _aoConstant; + private readonly AOAccessor _aoOutputLimitHigh; + private readonly AOAccessor _aoOutputLimitLow; private readonly DIAccessor _diStatus; private readonly DIAccessor _diAlarm; @@ -66,7 +68,10 @@ namespace SicPM.Devices _aiOutputPower = ParseAiNode("aiOutputPower", node, ioModule); _aiSimVoltage = ParseAiNode("aiSimVoltage", node, ioModule); _aiSimArms = ParseAiNode("aiSimArms", node, ioModule); + _aoConstant = ParseAoNode("aoConstant", node, ioModule); + _aoOutputLimitHigh = ParseAoNode("aoOutputLimitHigh", node, ioModule); + _aoOutputLimitLow = ParseAoNode("aoOutputLimitLow", node, ioModule); _doReset = ParseDoNode("doReset", node, ioModule); _doStatus = ParseDoNode("doStatus", node, ioModule); @@ -143,6 +148,8 @@ namespace SicPM.Devices _deviceData.Resistance = Resistance; _deviceData.IsResistanceOutOfRange = IsResistanceOutOfRange; _deviceData.IsResistanceTooHigh = IsResistanceTooHigh; + _deviceData.OutputLimitHigh = _aoOutputLimitHigh?.FloatValue ?? 0; + _deviceData.OutputLimitLow = _aoOutputLimitLow?.FloatValue ?? 0; return JsonConvert.SerializeObject(_deviceData); } } @@ -185,6 +192,7 @@ namespace SicPM.Devices SetPSUEnable(isTrue, out _); return true; }); + OP.Subscribe($"{Module}.{Name}.SetPSUReset", (function, args) => { var isTrue = Convert.ToBoolean(args[0]); @@ -192,9 +200,43 @@ namespace SicPM.Devices return true; }); + OP.Subscribe($"{Module}.{Name}.SetOutputLimitHigh", (function, args) => + { + if (args.Length == 1 && args[0] is double value) + { + SetOutputLimitHigh(value); + return true; + } + + EV.PostWarningLog(Module, $"SetOutputLimitHigh fail, args error"); + return false; + }); + + OP.Subscribe($"{Module}.{Name}.SetOutputLimitLow", (function, args) => + { + if (args.Length == 1 && args[0] is double value) + { + SetOutputLimitLow(value); + return true; + } + + EV.PostWarningLog(Module, $"SetOutputLimitLow fail, args error"); + return false; + }); + return true; } + public void SetOutputLimitHigh(double value) + { + SC.SetItemValue($"PM.{Module}.Heater.PSU2OutputLimitHigh", value); + } + + public void SetOutputLimitLow(double value) + { + SC.SetItemValue($"PM.{Module}.Heater.PSU2OutputLimitLow", value); + } + public bool SetPSUEnable(bool setValue, out string reason) { if (!_doStatus.Check(setValue, out reason)) @@ -277,16 +319,10 @@ namespace SicPM.Devices { try { + MonitorPsu2OutputLimit(); MonitorEnableTimer(); MonitorAlarm(); - if (_timResetPulse.IsTimeout()) - { - _timResetPulse.Stop(); - if (_doReset.Value) - _doReset.Value = false; - - ResetResistanceMonitorResult(); - } + MonitorDoResetDone(); } catch (Exception ex) { @@ -306,6 +342,19 @@ namespace SicPM.Devices ResetResistanceMonitorResult(); } + + private void MonitorDoResetDone() + { + if (_timResetPulse.IsTimeout()) + { + _timResetPulse.Stop(); + if (_doReset.Value) + _doReset.Value = false; + + ResetResistanceMonitorResult(); + } + } + /// /// 复位加热器电阻监测结果。 /// @@ -358,20 +407,57 @@ namespace SicPM.Devices } } } + + private readonly R_TRIG _trigBelow1600 = new(); + private readonly R_TRIG _trigAbove1600 = new(); + + private void MonitorPsu2OutputLimit() + { + if (Name == "PSU2") + { + var limitHigh = (float)SC.GetValue($"PM.{Module}.Heater.PSU2OutputLimitHigh"); + if(limitHigh > 100) + limitHigh = 100; + + _trigAbove1600.CLK = AETemp >= 1600; + if (_trigAbove1600.Q) + EV.PostInfoLog(Module, $"Temp above 1600℃, limit PSU2 Output level to {limitHigh}%"); + + _trigBelow1600.CLK = AETemp < 1600; + if (_trigAbove1600.Q) + EV.PostInfoLog(Module, $"Temp below 1600℃, limit PSU2 Output level to 100%"); + + if (AETemp >= 1600) + { + if (Math.Abs(_aoOutputLimitHigh.FloatValue - limitHigh) > 1E-6) + _aoOutputLimitHigh.FloatValue = limitHigh; + } + else + { + _aoOutputLimitHigh.FloatValue = 100; + } + + + var limitLow = (float)SC.GetValue($"PM.{Module}.Heater.PSU2OutputLimitLow"); + if (Math.Abs(_aoOutputLimitLow.FloatValue - limitLow) > 1E-6) + _aoOutputLimitLow.FloatValue = limitLow; + + + } + } + public double AETemp { get { - var temp = new object(); + object temp = null; if (SC.GetConfigItem("AETemp.EnableDevice").BoolValue) - { temp = DATA.Poll($"{Module}.AETemp.Middle"); - } - if (SC.GetConfigItem("AKunTemp.EnableDevice").BoolValue) + /*if (SC.GetConfigItem("AKunTemp.EnableDevice").BoolValue) { temp = DATA.Poll($"{Module}.AKunTemp.Middle"); - } + }*/ return temp == null ? 0 : (double)temp; } diff --git a/SicRT/Config/System.sccfg b/SicRT/Config/System.sccfg index fa000ba..4814426 100644 --- a/SicRT/Config/System.sccfg +++ b/SicRT/Config/System.sccfg @@ -193,6 +193,9 @@ + + + diff --git a/SicRT/Properties/AssemblyInfo.cs b/SicRT/Properties/AssemblyInfo.cs index 05fd0cc..4f745e1 100644 --- a/SicRT/Properties/AssemblyInfo.cs +++ b/SicRT/Properties/AssemblyInfo.cs @@ -52,6 +52,6 @@ using System.Windows; // 方法是按如下所示使用“*”: : // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.5.6.14")] +[assembly: AssemblyVersion("1.6.0.15")] //[assembly: AssemblyFileVersion("1.5.3.11")] diff --git a/SicRT/ReleaseNotes.txt b/SicRT/ReleaseNotes.txt index 299bdd2..10cd6c8 100644 --- a/SicRT/ReleaseNotes.txt +++ b/SicRT/ReleaseNotes.txt @@ -10,6 +10,10 @@ --------------------------------------------------------------------------------- +Sic02 2023-08-02 Version 1.6.0.15 +1. PSU2增加控制量输出上下限设定 + + Sic02 2023-08-02 Version 1.5.6.14 1. PM Operation视图中的Heater电阻值保留3位小数 diff --git a/SicSimulator/Config/_ioDefinePM.xml b/SicSimulator/Config/_ioDefinePM.xml index d4cdc67..1a157f2 100644 --- a/SicSimulator/Config/_ioDefinePM.xml +++ b/SicSimulator/Config/_ioDefinePM.xml @@ -741,8 +741,8 @@ - - + + diff --git a/SicUI/Models/PMs/PMHeaterView.xaml b/SicUI/Models/PMs/PMHeaterView.xaml index f20080a..806e9d8 100644 --- a/SicUI/Models/PMs/PMHeaterView.xaml +++ b/SicUI/Models/PMs/PMHeaterView.xaml @@ -1194,7 +1194,7 @@ Visibility="{Binding TipsVisble}" /> - + @@ -1207,23 +1207,12 @@ - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SicUI/Models/PMs/PMHeaterViewModel.cs b/SicUI/Models/PMs/PMHeaterViewModel.cs index b66236d..6a7a95f 100644 --- a/SicUI/Models/PMs/PMHeaterViewModel.cs +++ b/SicUI/Models/PMs/PMHeaterViewModel.cs @@ -1,4 +1,6 @@ using Aitex.Core.Common.DeviceData; +using Aitex.Core.Common.DeviceData.IoDevice; +using Aitex.Core.RT.Event; using Aitex.Core.Util; using Caliburn.Micro; using MECF.Framework.Common.DataCenter; @@ -6,6 +8,7 @@ using MECF.Framework.Common.OperationCenter; using MECF.Framework.UI.Client.CenterViews.Editors.Recipe; using MECF.Framework.UI.Client.CenterViews.Editors.Sequence; using MECF.Framework.UI.Client.ClientBase; +using OpenSEMI.ClientBase; using RecipeEditorLib.DGExtension.CustomColumn; using RecipeEditorLib.RecipeModel.Params; using System; @@ -17,6 +20,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Media; +using Newtonsoft.Json; namespace SicUI.Models.PMs { @@ -1097,6 +1101,81 @@ namespace SicUI.Models.PMs #endregion + #region PSU2 Output Limit High/Low + + [Subscription("PSU2.DeviceData")] + public string Psu2DataJson { get; set; } + + public IoPsuData Psu2Data => + string.IsNullOrEmpty(Psu2DataJson) + ? null + : JsonConvert.DeserializeObject(Psu2DataJson); + + public double PSU2OutputLimitHighSetting + { + get + { + var sc = QueryDataClient.Instance.Service.GetConfig($"PM.{SystemName}.Heater.PSU2OutputLimitHigh"); + if (sc is double dValue) + { + return dValue; + } + + return 0; + } + } + + public double PSU2OutputLimitLowSetting + { + get + { + var sc = QueryDataClient.Instance.Service.GetConfig($"PM.{SystemName}.Heater.PSU2OutputLimitLow"); + if (sc is double dValue) + { + return dValue; + } + + return 0; + } + } + + public void SetOutputLimitHigh(string psu, string limit) + { + if (!double.TryParse(limit, out var dLimit)) + { + DialogBox.ShowError("The limit value is not a number."); + return; + } + + try + { + InvokeClient.Instance.Service.DoOperation($"{SystemName}.{psu}.SetOutputLimitHigh", dLimit); + } + catch (Exception ex) + { + EV.PostWarningLog("PM1", "SetOutputLimitHigh exception:" + ex.Message); + } + } + + public void SetOutputLimitLow(string psu, string limit) + { + if (!double.TryParse(limit, out var dLimit)) + { + DialogBox.ShowError("The limit value is not a number."); + return; + } + + try + { + InvokeClient.Instance.Service.DoOperation($"{SystemName}.{psu}.SetOutputLimitLow", dLimit); + } + catch (Exception ex) + { + EV.PostWarningLog("PM1", "SetOutputLimitLow exception:" + ex.Message); + } + } + + #endregion #endregion diff --git a/SicUI/Properties/AssemblyInfo.cs b/SicUI/Properties/AssemblyInfo.cs index bdb1c14..71f8000 100644 --- a/SicUI/Properties/AssemblyInfo.cs +++ b/SicUI/Properties/AssemblyInfo.cs @@ -54,5 +54,5 @@ using System.Windows; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.5.6.14")] +[assembly: AssemblyVersion("1.6.0.15")] //[assembly: AssemblyFileVersion("1.5.3.11")]