You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

149 lines
4.3 KiB
C#

using CompressorXN_Model.Enums;
using CompressorXN_Model.ViewModel.Plc;
using CompressorXN_Model.ViewModel.Response;
using HslCommunication.Profinet.Omron;
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
namespace CompressorXN_Common
{
/// <summary>
/// 全局变量
/// </summary>
public static class GlobalVar
{
/// <summary>
/// 系统版本号
/// </summary>
public static string SystemVersion { get; set; }
/// <summary>
/// Ini文件路径
/// </summary>
public static string IniFilePath { get; } = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SystemConfig.ini");
public static CancellationTokenSource Home_cts;//用于控制HOME界面线程
/// <summary>
/// PLC点位--设备信息
/// </summary>
public static DeviceInfo deviceInfo = null;
public static AgreementMsgVM agreementMsgVM = new AgreementMsgVM();
/// <summary>
/// 使用中产品型号(机种码)
/// </summary>
public static int ProductTypeIndex;
/// <summary>
/// 实时转速
/// </summary>
public static int RealSpeed { get; set; } = 0;
#region 启动方式
public static event Action<string, string> StartTypeValueChanged;
private static string _startType=string.Empty;
/// <summary>
/// 产品型号名称
/// </summary>
public static string StartType
{
get { return _startType; }
set
{
string oldValue = _startType;
_startType = value;
if (oldValue != _startType && StartTypeValueChanged != null)
{
StartTypeValueChanged(oldValue, value);
}
}
}
#endregion
public static event Action<string, string> ValueChanged;
private static string _productTypeName;
/// <summary>
/// 产品型号名称
/// </summary>
public static string ProductTypeName
{
get { return _productTypeName; }
set
{
string oldValue = _productTypeName;
_productTypeName = value;
if (oldValue != _productTypeName && ValueChanged != null)
{
ValueChanged(oldValue, value);
}
}
}
#region TMS
public static StepEnum stepEnum;
public static int DevHandle = 0;
public static Byte WriteCANIndex = 0;
public static Byte ReadCANIndex = 0;
public static bool CAN_ReadMsgFlag = false;
public static bool CAN_SendMsgFlag = false;
public static bool LIN_SendMsgFlag = false;
public static bool LIN_GetMsgFlag = false;
#endregion
#region 曲线
public static List<DateTime> times = new List<DateTime>();
public static List<float> OutPress = new List<float>();//出口压力
public static List<float> InPress = new List<float>();//进口压力
public static List<float> JarPress = new List<float>();//罐压力
public static List<float> Voltage = new List<float>();//电压
public static List<float> Current = new List<float>();//电流
public static List<float> Noise = new List<float>();//噪音
public static List<float> X_Vibrate = new List<float>();//X轴震动
public static List<float> Y_Vibrate = new List<float>();//Y轴震动
public static List<float> Z_Vibrate = new List<float>();//Z轴震动
#endregion
#region PLC相关
/// <summary>
/// 读取PLC的频率
/// </summary>
public static int ReadPlcRate = 1000;
/// <summary>
/// PLC IP地址
/// </summary>
public static string PlcIpAddress { get; set; } = "127.0.0.1";
/// <summary>
/// PLC端口
/// </summary>
public static int PlcPort { get; set; } = 44818;
/// <summary>
/// PLC连接状态
/// </summary>
public static bool PlcConnectState { get; set; } = false;
/// <summary>
/// PLC链接对象
/// </summary>
public static OmronCipNet omronCipNet = null;
#endregion
}
}