添加项目文件。

This commit is contained in:
2025-02-28 22:23:13 +08:00
parent d4ad2fe2de
commit 547a1b3bf6
416 changed files with 72830 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrpaonEMS.Core.Model
{
/// <summary>
/// 报警时间信息
/// </summary>
public class AlarmTimeInfo
{
/// <summary>
/// 开始报警
/// </summary>
public DateTime StartTime { set; get; }
private DateTime _EndTime;
/// <summary>
/// 结束报警
/// </summary>
public DateTime EndTime
{
get
{
return _EndTime;
}
set
{
_EndTime = value;
this.AlarmDur = (EndTime - StartTime).TotalMinutes;
}
}
private double _AlarmDur;
public double AlarmDur
{
get
{
return _AlarmDur;
}
set
{
_AlarmDur = value;
}
}
}
}

View File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrpaonEMS.Core.Model
{
public class BmsRtAlarmModel
{
/// <summary>
/// 报警状态
/// </summary>
public bool AlarmState { get; set; }
/// <summary>
/// Alarm等级
/// </summary>
public int AlarmLevel { get; set; }
/// <summary>
/// Alarm内容
/// </summary>
public string AlarmContent { get; set; }
/// <summary>
/// Alarm时间
/// </summary>
public DateTime AlarmTime { get; set; }
}
}

View File

@@ -0,0 +1,78 @@
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrpaonEMS.Core.Model
{
/// <summary>
/// 连接状态模型
/// 有些设备有时候会出现一次连接失败,但是下一次就会连接成功,那么不能判断为连接失败
/// </summary>
public class LinkStateModel : BindableBase
{
public LinkStateModel()
{
_LinkState = true;
}
private string _BmsLinkStateMsg = "失败";
/// <summary>
/// Bms通信状态Msg
/// </summary>
public string BmsLinkStateMsg
{
get { return _BmsLinkStateMsg; }
set { _BmsLinkStateMsg = value; RaisePropertyChanged(); }
}
private bool _LinkState;
/// <summary>
/// 通信连接状态
/// </summary>
public bool LinkState
{
get { return _LinkState; }
set
{
if (_LinkState != value)
{
if (value)//改变后连接成功
{
//连接成功了就把报错的设置为0
LinkErrCount = 0;
BmsLinkStateMsg = "正常";
_LinkState = value;
}
else//改变后连接失败
{
//
LinkErrCount = LinkErrCount + 1;
if (LinkErrCount >= 3)//连续达到三次算作报错
{
BmsLinkStateMsg = "失败";
//连接失败
_LinkState = false;
}
else
{
//小于三次的话则判定为没有问题
_LinkState = true;
}
}
}
}
}
/// <summary>
/// 通信连接失败次数
/// </summary>
public int LinkErrCount { get; set; }
}
}

View File

@@ -0,0 +1,81 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrpaonEMS.Core.Model
{
/// <summary>
/// 追踪指令值的模型
/// </summary>
public class TranceCmdValue
{
/// <summary>
/// 实例化函数
/// </summary>
/// <param name="changeThreshold"></param>
public TranceCmdValue(double changeThreshold)
{
ChangeThreshold = changeThreshold;
}
/// <summary>
/// 变化的阀值
/// </summary>
public double ChangeThreshold { get; set; }
/// <summary>
/// 事件
/// </summary>
public event EventHandler<double> CmdValueChanged;
private double _CmdValue;
/// <summary>
/// 指令值
/// 可实时赋值
/// </summary>
public double CmdValue
{
get { return _CmdValue; }
set
{
//发送0代表是待机此时不需要看变化了防止上一个值在0附近没有触发变化还是输出一个靠近0的值出去
if (value == 0 && value != _CmdValue)//value != _CmdValue 防止一直0值导致不停是Invoke事件
{
_CmdValue = value;
//超过变化的阀值,可以触发动作 BeginInvoke 换 Invoke 可能导致问题
CmdValueChanged.Invoke(this, 0);
return;
}
if (value != _CmdValue && GetChange(value, _CmdValue))
{
_CmdValue = value;
//超过变化的阀值,可以触发动作
CmdValueChanged.Invoke(this, value);
}
}
}
/// <summary>
/// 判断是否超过某个阀值数据
/// </summary>
/// <param name="newValue"></param>
/// <param name="oldValue"></param>
/// <returns></returns>
private bool GetChange(double newValue, double oldValue)
{
if (Math.Abs(newValue - oldValue) >= ChangeThreshold)
{
return true;
}
return false;
}
}
}