Commit a58cf9f5 authored by 潘栩锋's avatar 潘栩锋 🚴

KSL完成

parent 8ac47926
...@@ -54,7 +54,26 @@ namespace FLY.KSL.UI.Client ...@@ -54,7 +54,26 @@ namespace FLY.KSL.UI.Client
public double Kp { get; set; } = 3; public double Kp { get; set; } = 3;
public int MaxHeat { get; set; } = 100; private double maxHeat = 100;
public double MaxHeat
{
get
{
return maxHeat;
}
set
{
if (value < 50)
{
value = 50;
}
if (value != maxHeat)
{
maxHeat = value;
}
}
}
public object MapperHeats { get; private set; } public object MapperHeats { get; private set; }
[PropertyChanged.DependsOn(nameof(Kp))] [PropertyChanged.DependsOn(nameof(Kp))]
......
...@@ -261,7 +261,7 @@ ...@@ -261,7 +261,7 @@
</lvc:CartesianChart.Series> </lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisX> <lvc:CartesianChart.AxisX>
<lvc:Axis Foreground="{StaticResource Brushes.AxisLabel}" <lvc:Axis Foreground="{StaticResource Brushes.AxisLabel}"
MinValue="0" MaxValue="{Binding XMax}" MinValue="{Binding XMin}" MaxValue="{Binding XMax}"
> >
<lvc:Axis.Separator> <lvc:Axis.Separator>
<lvc:Separator Stroke="{StaticResource Brushes.AxisSeparator}" Step ="1"/> <lvc:Separator Stroke="{StaticResource Brushes.AxisSeparator}" Step ="1"/>
...@@ -380,7 +380,7 @@ ...@@ -380,7 +380,7 @@
</lvc:CartesianChart.Series> </lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisX> <lvc:CartesianChart.AxisX>
<lvc:Axis Foreground="{StaticResource Brushes.AxisLabel}" <lvc:Axis Foreground="{StaticResource Brushes.AxisLabel}"
MinValue="0" MaxValue="{Binding XMax}" MinValue="{Binding XMin}" MaxValue="{Binding XMax}"
> >
<lvc:Axis.Separator> <lvc:Axis.Separator>
<lvc:Separator Stroke="{StaticResource Brushes.AxisSeparator}" Step ="1"/> <lvc:Separator Stroke="{StaticResource Brushes.AxisSeparator}" Step ="1"/>
......
...@@ -24,11 +24,13 @@ namespace FLY.KSL.UI.Client.UiModule ...@@ -24,11 +24,13 @@ namespace FLY.KSL.UI.Client.UiModule
#region 图表控制 #region 图表控制
public Func<double, string> YFormatter { get; private set; } public Func<double, string> YFormatter { get; private set; }
public int XMax { get; private set; } public double XMax { get; private set; }
public double YXax => (int)HSvAvg + MaxHeat / 2; public double XMin { get; private set; }
public double YMax => (int)HSvAvg + MaxHeat / 2;
public double YMin => (int)HSvAvg - MaxHeat / 2; public double YMin => (int)HSvAvg - MaxHeat / 2;
public double YXaxOffset => MaxHeat / 2; public double YMaxOffset => MaxHeat / 2;
public double YMinOffset => -MaxHeat / 2; public double YMinOffset => -MaxHeat / 2;
#endregion #endregion
...@@ -52,11 +54,27 @@ namespace FLY.KSL.UI.Client.UiModule ...@@ -52,11 +54,27 @@ namespace FLY.KSL.UI.Client.UiModule
public object MapperThickPercentsWithIsStable { get; private set; } public object MapperThickPercentsWithIsStable { get; private set; }
public object Mapper { get; private set; } public object Mapper { get; private set; }
public double HSvAvg { get; private set; } public double HSvAvg { get; set; }
public double HPvAvg { get; private set; } public double HPvAvg { get; set; }
public double PreHeatsAvg { get; private set; } public double PreHeatsAvg { get; set; }
public double Kp { get; private set; } = 3; public double Kp { get; private set; } = 3;
public double MaxHeat { get; private set; } = 100;
private double maxHeat = 100;
public double MaxHeat
{
get {
return maxHeat;
}
set {
if (value < 50) {
value = 50;
}
if (value != maxHeat) {
maxHeat = value;
}
}
}
/// <summary> /// <summary>
/// 当前选择加热通道 /// 当前选择加热通道
/// </summary> /// </summary>
...@@ -313,8 +331,8 @@ namespace FLY.KSL.UI.Client.UiModule ...@@ -313,8 +331,8 @@ namespace FLY.KSL.UI.Client.UiModule
} }
void UpdateAxisX() void UpdateAxisX()
{ {
XMax = mFeedback.ChannelCnt + 1; XMin = 0.5 - 0.5 * mFeedback.ChannelCnt / mFeedback.BoltCnt;
XMax = mFeedback.ChannelCnt + 0.5 + 0.5 * mFeedback.ChannelCnt / mFeedback.BoltCnt;
} }
......
...@@ -21,12 +21,12 @@ namespace FLY.KSL.UI.Client.UiModule ...@@ -21,12 +21,12 @@ namespace FLY.KSL.UI.Client.UiModule
#region 图表控制 #region 图表控制
public Func<double, string> YFormatter { get; private set; } public Func<double, string> YFormatter { get; private set; }
public int XMax { get; private set; } public double XMax { get; private set; }
public double XMin { get; private set; }
public double YXax => (int)(HSvAvg + MaxHeat / 2); public double YMax => (int)(HSvAvg + MaxHeat / 2);
public double YMin => (int)(HSvAvg - MaxHeat / 2); public double YMin => (int)(HSvAvg - MaxHeat / 2);
public double YXaxOffset => (int)(MaxHeat / 2); public double YMaxOffset => (int)(MaxHeat / 2);
public double YMinOffset => (int)(-MaxHeat / 2); public double YMinOffset => (int)(-MaxHeat / 2);
#endregion #endregion
...@@ -157,7 +157,8 @@ namespace FLY.KSL.UI.Client.UiModule ...@@ -157,7 +157,8 @@ namespace FLY.KSL.UI.Client.UiModule
Heats.AddRange(heats); Heats.AddRange(heats);
HeatOffsets.AddRange(heatoffsets); HeatOffsets.AddRange(heatoffsets);
Currs.AddRange(currs); Currs.AddRange(currs);
XMax = channelCnt + 1; XMin = 0.5 - 0.5 * channelCnt / boltCnt;
XMax = channelCnt+0.5 + 0.5 * channelCnt / boltCnt;
#endregion #endregion
......
...@@ -123,6 +123,7 @@ namespace FLY.KSL.IService ...@@ -123,6 +123,7 @@ namespace FLY.KSL.IService
/// </summary> /// </summary>
void ClearPreHeats(); void ClearPreHeats();
/// <summary> /// <summary>
/// 执行 HeatOffset = ThickPercent * Factor /// 执行 HeatOffset = ThickPercent * Factor
/// </summary> /// </summary>
......
...@@ -93,10 +93,7 @@ namespace FLY.KSL.Server ...@@ -93,10 +93,7 @@ namespace FLY.KSL.Server
/// 报警系统 /// 报警系统
/// </summary> /// </summary>
WarningSystem mWarning; WarningSystem mWarning;
/// <summary>
/// 加热记录文件夹
/// </summary>
string heats_dir = "feedbackheats";
FeedbackHeatsMarkJsonDb feedbackHeatsMarkJsonDb = new FeedbackHeatsMarkJsonDb(); FeedbackHeatsMarkJsonDb feedbackHeatsMarkJsonDb = new FeedbackHeatsMarkJsonDb();
public FeedbackHeat() public FeedbackHeat()
......
...@@ -43,6 +43,22 @@ namespace FLY.KSL.Server ...@@ -43,6 +43,22 @@ namespace FLY.KSL.Server
} }
public void Init() public void Init()
{ {
//--------------------------------------------------------------------------------
//添加任务
for (int i = 0; i < FosCnt; i++)
{
List<string> props = new List<string>
{
nameof(FurnaceOfSubdivide.TempPV),
nameof(FurnaceOfSubdivide.TempSV)
};
PLCos.SetPlan($"{nameof(Fos)}[{i}]", props, 0);
}
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
//last step PLC 更新计划服务初始化 //last step PLC 更新计划服务初始化
plcos.Init(); plcos.Init();
......
...@@ -228,9 +228,9 @@ namespace FLY.KSL.Server ...@@ -228,9 +228,9 @@ namespace FLY.KSL.Server
if (mHeatBuf.Stability != STABILITY.OK_CORREL) if (mHeatBuf.Stability != STABILITY.OK_CORREL)
return; return;
if (Heats.All(h => h == 0)) if (Heats.All(h => h == Heats[0]))
{ {
//加热全部为0 //加热全部一样
//复位状态 //复位状态
ResetAuto(); ResetAuto();
} }
...@@ -247,14 +247,12 @@ namespace FLY.KSL.Server ...@@ -247,14 +247,12 @@ namespace FLY.KSL.Server
if (mHeatBuf.Stability != STABILITY.OK_CORREL) if (mHeatBuf.Stability != STABILITY.OK_CORREL)
break; break;
if (Heats.All(h => h == 0)) if (Heats.All(h => h == Heats[0]))
{ {
//判断当前加热全部为, 且稳定性大于>0.7 //判断当前加热全部为一样, 且稳定性大于>0.7
//转为 加热棒数量
double[] thickPercents = OrgThickPercents; double[] thickPercents = OrgThickPercents;
//thickPercents = Common.MyMath.ZoomOut(thickPercents, BoltCnt / ChannelCnt);
double autoONoKp = Kp; double autoONoKp = Kp;
if (autoONoKp < 1) if (autoONoKp < 1)
...@@ -577,8 +575,10 @@ namespace FLY.KSL.Server ...@@ -577,8 +575,10 @@ namespace FLY.KSL.Server
/// </summary> /// </summary>
public void ClearPreHeats() public void ClearPreHeats()
{ {
int svAvg = (int)Heats.Average();
int[] heats = new int[ChannelCnt]; int[] heats = new int[ChannelCnt];
Array.Clear(heats, 0, ChannelCnt); for (int i = 0; i < heats.Count(); i++)
heats[i] = svAvg;
ModifyPreHeats(heats); ModifyPreHeats(heats);
} }
......
...@@ -26,18 +26,31 @@ namespace FLY.KSL.Server.Model ...@@ -26,18 +26,31 @@ namespace FLY.KSL.Server.Model
/// ///
/// </summary> /// </summary>
/// <param name="dbModel"></param> /// <param name="dbModel"></param>
public void Init(DbModel dbModel, bool isDbModelInitTrue) public void Init(DbModel dbModel)
{ {
this.dbModel = dbModel; this.dbModel = dbModel;
string cmd; string cmd;
if (!isDbModelInitTrue) {
//数据库新创建, 加入 INDEX //数据库新创建, 加入 INDEX
cmd = $"CREATE INDEX Time ON {this.dbModel.TbThickHeat.TableName} ({nameof(Db_ThickHeat.ID)},{nameof(Db_ThickHeat.Time)})"; cmd = $"CREATE INDEX {this.dbModel.TbThickHeat.TableName}_Time ON {this.dbModel.TbThickHeat.TableName} ({nameof(Db_ThickHeat.ID)},{nameof(Db_ThickHeat.Time)})";
try
{
this.dbModel.sqliteHelper.ExecuteNonQuery(cmd); this.dbModel.sqliteHelper.ExecuteNonQuery(cmd);
}
catch
{
//如果失败,证明里面已经有了
}
cmd = $"CREATE INDEX Time ON {this.dbModel.TbError.TableName} ({nameof(DB_Error.ID)},{nameof(DB_Error.Time)})"; cmd = $"CREATE INDEX {this.dbModel.TbError.TableName}_Time ON {this.dbModel.TbError.TableName} ({nameof(DB_Error.ID)},{nameof(DB_Error.Time)})";
try
{
this.dbModel.sqliteHelper.ExecuteNonQuery(cmd); this.dbModel.sqliteHelper.ExecuteNonQuery(cmd);
} }
catch
{
//如果失败,证明里面已经有了
}
ThickHeatBuffer = new BufferSQLite<Lc_ThickHeat, Db_ThickHeat>(); ThickHeatBuffer = new BufferSQLite<Lc_ThickHeat, Db_ThickHeat>();
ThickHeatBuffer.Init(dbModel.TbThickHeat, ThickHeatBuffer.Init(dbModel.TbThickHeat,
......
...@@ -47,6 +47,10 @@ namespace FLY.KSL.Server.Model ...@@ -47,6 +47,10 @@ namespace FLY.KSL.Server.Model
{ {
opt.MapFrom(s => Newtonsoft.Json.JsonConvert.SerializeObject(s.Heats)); opt.MapFrom(s => Newtonsoft.Json.JsonConvert.SerializeObject(s.Heats));
}) })
.ForMember(s => s.PVs, opt =>
{
opt.MapFrom(s => Newtonsoft.Json.JsonConvert.SerializeObject(s.PVs));
})
.ReverseMap() .ReverseMap()
.ForMember(s => s.RPeriod, opt => .ForMember(s => s.RPeriod, opt =>
{ {
...@@ -63,6 +67,10 @@ namespace FLY.KSL.Server.Model ...@@ -63,6 +67,10 @@ namespace FLY.KSL.Server.Model
.ForMember(s => s.Heats, opt => .ForMember(s => s.Heats, opt =>
{ {
opt.MapFrom(s => Newtonsoft.Json.JsonConvert.DeserializeObject<int[]>(s.Heats)); opt.MapFrom(s => Newtonsoft.Json.JsonConvert.DeserializeObject<int[]>(s.Heats));
})
.ForMember(s => s.PVs, opt =>
{
opt.MapFrom(s => Newtonsoft.Json.JsonConvert.DeserializeObject<int[]>(s.PVs));
}); });
......
...@@ -83,7 +83,7 @@ namespace FLY.KSL.Server ...@@ -83,7 +83,7 @@ namespace FLY.KSL.Server
bool dbRet = dbModel.Init(); bool dbRet = dbModel.Init();
historyDb = new HistoryDb(); historyDb = new HistoryDb();
historyDb.Init(dbModel, dbRet); historyDb.Init(dbModel);
historyDb.KeepDBSize(mSysParam.DBKeepMonth); historyDb.KeepDBSize(mSysParam.DBKeepMonth);
//--------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------
......
...@@ -145,6 +145,10 @@ ...@@ -145,6 +145,10 @@
<Project>{91a1aafe-a528-4c2e-a48a-9259e780255a}</Project> <Project>{91a1aafe-a528-4c2e-a48a-9259e780255a}</Project>
<Name>FLY.Thick.Base</Name> <Name>FLY.Thick.Base</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\FLY.KSL.UI.Client\FLY.KSL.UI.Client.csproj">
<Project>{4cbf61f9-381a-41fc-8919-60d395bfbba6}</Project>
<Name>FLY.KSL.UI.Client</Name>
</ProjectReference>
<ProjectReference Include="..\FLY.Thick.Blowing360.UI\FLY.Thick.Blowing360.UI.csproj"> <ProjectReference Include="..\FLY.Thick.Blowing360.UI\FLY.Thick.Blowing360.UI.csproj">
<Project>{9d4c9bd9-e482-45b3-89f0-45961705ba94}</Project> <Project>{9d4c9bd9-e482-45b3-89f0-45961705ba94}</Project>
<Name>FLY.Thick.Blowing360.UI</Name> <Name>FLY.Thick.Blowing360.UI</Name>
......
...@@ -283,12 +283,12 @@ namespace FLY.Thick.Blowing360.UI ...@@ -283,12 +283,12 @@ namespace FLY.Thick.Blowing360.UI
return false; return false;
} }
if (this.ChannelCnt < 20 || this.ChannelCnt > 160) if (this.ChannelCnt < 10 || this.ChannelCnt > 160)
{ {
message = "加热通道数"; message = "加热通道数";
return false; return false;
} }
if (this.BPC < 1 || this.BPC > 4) if (this.BPC < 1 || this.BPC > 10)
{ {
message = "分区数/加热通道数"; message = "分区数/加热通道数";
return false; return false;
......
...@@ -256,12 +256,12 @@ namespace FLY.Thick.Blowing360.Server ...@@ -256,12 +256,12 @@ namespace FLY.Thick.Blowing360.Server
void checkParamErr() void checkParamErr()
{ {
if (ChannelCnt < 20 || ChannelCnt > 160) if (ChannelCnt < 10 || ChannelCnt > 160)
{ {
ChannelCnt = 44; ChannelCnt = 44;
} }
if (BPC < 1 || BPC > 4) if (BPC < 1 || BPC > 10)
{ {
BPC = 2; BPC = 2;
} }
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<unity> <unity>
<container> <container>
<instance name="cn0" value="blowing" /> <instance name="cn0" value="blowing" />
<instance name="cn1" value="ksl" />
</container> </container>
</unity> </unity>
</configuration> </configuration>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection,Unity.Configuration" />
</configSections>
<unity>
<assembly name="FLY.KSL.UI.Client" />
<namespace name="FLY.KSL.UI.Client.UiModule" />
<alias alias="IUiModule2" type="MultiLayout.UiModule.IUiModule2, MultiLayout" />
<container>
<register type="IUiModule2" mapTo="UiModule2_MenuSetting" name="airRing_ms" />
<register type="IUiModule2" mapTo="UiModule2_DynAreaAirRing" name="airRing_da" />
<register type="IUiModule2" mapTo="UiModule2_GraphAirRing" name="airRing_g" />
</container>
</unity>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection,Unity.Configuration" />
</configSections>
<unity>
<assembly name="FLY.KSL" />
<namespace name="FLY.KSL.IService" />
<namespace name="FLY.KSL.Client" />
<assembly name="FLY.OBJComponents" />
<namespace name="FLY.OBJComponents.IService" />
<namespace name="FLY.OBJComponents.Client" />
<alias alias="WarningReasonWindow" type="FLY.Thick.Base.UI.WarningReasonWindow,FLY.Thick.Base.UI" />
<container>
<register type="IFeedbackHeatService" mapTo="FeedbackHeatServiceClient">
<lifetime type="singleton" />
<constructor>
<param name="serviceId" value="31000" />
<param name="connName" dependencyName="cn1" />
</constructor>
</register>
<register type="IHeatBufService" mapTo="HeatBufServiceClient">
<lifetime type="singleton" />
<constructor>
<param name="serviceId" value="31002" />
<param name="connName" dependencyName="cn1" />
</constructor>
</register>
<register type="IHeatCellService" mapTo="HeatCellServiceClient">
<lifetime type="singleton" />
<constructor>
<param name="serviceId" value="31003" />
<param name="connName" dependencyName="cn1" />
</constructor>
</register>
<register type="IBulkDbService" mapTo="BulkDbServiceClient">
<lifetime type="singleton" />
<constructor>
<param name="serviceId" value="31004" />
<param name="connName" dependencyName="cn1" />
</constructor>
</register>
<register type="IWarningService" mapTo="WarningServiceClient" name="airRingWarningService">
<lifetime type="singleton" />
<constructor>
<param name="serviceId" value="20000" />
<param name="connName" dependencyName="cn1" />
</constructor>
</register>
<register type="WarningReasonWindow" name="airRingWarningReasonWindow">
<lifetime type="singleton" />
<constructor>
<param name="warningService" dependencyName="airRingWarningService" />
<param name="size" value="100" />
</constructor>
</register>
</container>
</unity>
</configuration>
\ No newline at end of file
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
"Path": [ "Path": [
"gage0.service.config", "gage0.service.config",
"other.service.config", "other.service.config",
"blowing360.service.config" "blowing360.service.config",
"ksl.service.config"
], ],
"Children": [] "Children": []
}, },
...@@ -31,7 +32,8 @@ ...@@ -31,7 +32,8 @@
"Name": "uiModule.ui", "Name": "uiModule.ui",
"Path": [ "Path": [
"blowing.component.config", "blowing.component.config",
"blowing360.component.config" "blowing360.component.config",
"ksl.component.config"
], ],
"Children": [] "Children": []
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment