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

KSL完成

parent 8ac47926
......@@ -54,7 +54,26 @@ namespace FLY.KSL.UI.Client
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; }
[PropertyChanged.DependsOn(nameof(Kp))]
......
......@@ -261,7 +261,7 @@
</lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisX>
<lvc:Axis Foreground="{StaticResource Brushes.AxisLabel}"
MinValue="0" MaxValue="{Binding XMax}"
MinValue="{Binding XMin}" MaxValue="{Binding XMax}"
>
<lvc:Axis.Separator>
<lvc:Separator Stroke="{StaticResource Brushes.AxisSeparator}" Step ="1"/>
......@@ -380,7 +380,7 @@
</lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisX>
<lvc:Axis Foreground="{StaticResource Brushes.AxisLabel}"
MinValue="0" MaxValue="{Binding XMax}"
MinValue="{Binding XMin}" MaxValue="{Binding XMax}"
>
<lvc:Axis.Separator>
<lvc:Separator Stroke="{StaticResource Brushes.AxisSeparator}" Step ="1"/>
......
......@@ -24,11 +24,13 @@ namespace FLY.KSL.UI.Client.UiModule
#region 图表控制
public Func<double, string> YFormatter { get; private set; }
public int XMax { get; private set; }
public double YXax => (int)HSvAvg + MaxHeat / 2;
public double XMax { get; private set; }
public double XMin { get; private set; }
public double YMax => (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;
#endregion
......@@ -52,11 +54,27 @@ namespace FLY.KSL.UI.Client.UiModule
public object MapperThickPercentsWithIsStable { get; private set; }
public object Mapper { get; private set; }
public double HSvAvg { get; private set; }
public double HPvAvg { get; private set; }
public double PreHeatsAvg { get; private set; }
public double HSvAvg { get; set; }
public double HPvAvg { get; set; }
public double PreHeatsAvg { get; set; }
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>
......@@ -313,8 +331,8 @@ namespace FLY.KSL.UI.Client.UiModule
}
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
#region 图表控制
public Func<double, string> YFormatter { get; private set; }
public int XMax { get; private set; }
public double YXax => (int)(HSvAvg + MaxHeat / 2);
public double XMax { get; private set; }
public double XMin { get; private set; }
public double YMax => (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);
#endregion
......@@ -157,7 +157,8 @@ namespace FLY.KSL.UI.Client.UiModule
Heats.AddRange(heats);
HeatOffsets.AddRange(heatoffsets);
Currs.AddRange(currs);
XMax = channelCnt + 1;
XMin = 0.5 - 0.5 * channelCnt / boltCnt;
XMax = channelCnt+0.5 + 0.5 * channelCnt / boltCnt;
#endregion
......
......@@ -123,6 +123,7 @@ namespace FLY.KSL.IService
/// </summary>
void ClearPreHeats();
/// <summary>
/// 执行 HeatOffset = ThickPercent * Factor
/// </summary>
......
......@@ -93,10 +93,7 @@ namespace FLY.KSL.Server
/// 报警系统
/// </summary>
WarningSystem mWarning;
/// <summary>
/// 加热记录文件夹
/// </summary>
string heats_dir = "feedbackheats";
FeedbackHeatsMarkJsonDb feedbackHeatsMarkJsonDb = new FeedbackHeatsMarkJsonDb();
public FeedbackHeat()
......
......@@ -43,6 +43,22 @@ namespace FLY.KSL.Server
}
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 更新计划服务初始化
plcos.Init();
......
......@@ -228,9 +228,9 @@ namespace FLY.KSL.Server
if (mHeatBuf.Stability != STABILITY.OK_CORREL)
return;
if (Heats.All(h => h == 0))
if (Heats.All(h => h == Heats[0]))
{
//加热全部为0
//加热全部一样
//复位状态
ResetAuto();
}
......@@ -247,13 +247,11 @@ namespace FLY.KSL.Server
if (mHeatBuf.Stability != STABILITY.OK_CORREL)
break;
if (Heats.All(h => h == 0))
if (Heats.All(h => h == Heats[0]))
{
//判断当前加热全部为, 且稳定性大于>0.7
//判断当前加热全部为一样, 且稳定性大于>0.7
//转为 加热棒数量
double[] thickPercents = OrgThickPercents;
//thickPercents = Common.MyMath.ZoomOut(thickPercents, BoltCnt / ChannelCnt);
double autoONoKp = Kp;
......@@ -577,8 +575,10 @@ namespace FLY.KSL.Server
/// </summary>
public void ClearPreHeats()
{
int svAvg = (int)Heats.Average();
int[] heats = new int[ChannelCnt];
Array.Clear(heats, 0, ChannelCnt);
for (int i = 0; i < heats.Count(); i++)
heats[i] = svAvg;
ModifyPreHeats(heats);
}
......
......@@ -26,18 +26,31 @@ namespace FLY.KSL.Server.Model
///
/// </summary>
/// <param name="dbModel"></param>
public void Init(DbModel dbModel, bool isDbModelInitTrue)
public void Init(DbModel dbModel)
{
this.dbModel = dbModel;
string cmd;
if (!isDbModelInitTrue) {
//数据库新创建, 加入 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);
}
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);
}
catch
{
//如果失败,证明里面已经有了
}
ThickHeatBuffer = new BufferSQLite<Lc_ThickHeat, Db_ThickHeat>();
ThickHeatBuffer.Init(dbModel.TbThickHeat,
......
......@@ -47,6 +47,10 @@ namespace FLY.KSL.Server.Model
{
opt.MapFrom(s => Newtonsoft.Json.JsonConvert.SerializeObject(s.Heats));
})
.ForMember(s => s.PVs, opt =>
{
opt.MapFrom(s => Newtonsoft.Json.JsonConvert.SerializeObject(s.PVs));
})
.ReverseMap()
.ForMember(s => s.RPeriod, opt =>
{
......@@ -63,6 +67,10 @@ namespace FLY.KSL.Server.Model
.ForMember(s => s.Heats, opt =>
{
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
bool dbRet = dbModel.Init();
historyDb = new HistoryDb();
historyDb.Init(dbModel, dbRet);
historyDb.Init(dbModel);
historyDb.KeepDBSize(mSysParam.DBKeepMonth);
//---------------------------------------------------------------------------------------------------------------
......
......@@ -145,6 +145,10 @@
<Project>{91a1aafe-a528-4c2e-a48a-9259e780255a}</Project>
<Name>FLY.Thick.Base</Name>
</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">
<Project>{9d4c9bd9-e482-45b3-89f0-45961705ba94}</Project>
<Name>FLY.Thick.Blowing360.UI</Name>
......
......@@ -283,12 +283,12 @@ namespace FLY.Thick.Blowing360.UI
return false;
}
if (this.ChannelCnt < 20 || this.ChannelCnt > 160)
if (this.ChannelCnt < 10 || this.ChannelCnt > 160)
{
message = "加热通道数";
return false;
}
if (this.BPC < 1 || this.BPC > 4)
if (this.BPC < 1 || this.BPC > 10)
{
message = "分区数/加热通道数";
return false;
......
......@@ -256,12 +256,12 @@ namespace FLY.Thick.Blowing360.Server
void checkParamErr()
{
if (ChannelCnt < 20 || ChannelCnt > 160)
if (ChannelCnt < 10 || ChannelCnt > 160)
{
ChannelCnt = 44;
}
if (BPC < 1 || BPC > 4)
if (BPC < 1 || BPC > 10)
{
BPC = 2;
}
......
......@@ -6,6 +6,7 @@
<unity>
<container>
<instance name="cn0" value="blowing" />
<instance name="cn1" value="ksl" />
</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.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 @@
"Path": [
"gage0.service.config",
"other.service.config",
"blowing360.service.config"
"blowing360.service.config",
"ksl.service.config"
],
"Children": []
},
......@@ -31,7 +32,8 @@
"Name": "uiModule.ui",
"Path": [
"blowing.component.config",
"blowing360.component.config"
"blowing360.component.config",
"ksl.component.config"
],
"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