using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Module.UpsEqm.ModBusTcp
{
///
/// UPS设备管理
///
public class UpsEqmManger
{
///
/// UPS通讯连接线程
///
public void UpsNetConnectThread()
{
Thread upsConnectThread = new Thread(UpsNetConnectFunc);
upsConnectThread.IsBackground = true;
upsConnectThread.Start();
}
///
/// UPS通讯连接
///
private void UpsNetConnectFunc()
{
CmnUpsBaseInfo.UPS01.F_EqmCode = "U001";
if (!CmnUpsBaseInfo.UPS01.F_NetConnected)
{
CmnUpsBaseInfo.UPS01.Connect();
}
}
///
/// UPS通讯重连线程
///
public void UpsNetReConnectThread()
{
Thread upsConnectThread = new Thread(UpsNetReConnectFunc);
upsConnectThread.IsBackground = true;
upsConnectThread.Start();
}
///
/// UPS通讯重新连接
///
private void UpsNetReConnectFunc()
{
CmnUpsBaseInfo.UPS01.DisConnect();
Thread.Sleep(5 * 1000);
CmnUpsBaseInfo.UPS01.Connect();
}
///
/// UPS状态值
///
///
public MUpsParamsVal GetUpsParamsVal()
{
return CmnUpsBaseInfo.UPS01.F_UpsParamsVal;
}
}
}