You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
1.7 KiB
71 lines
1.7 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Module.UpsEqm.ModBusTcp
|
|
{
|
|
/// <summary>
|
|
/// UPS设备管理
|
|
/// </summary>
|
|
public class UpsEqmManger
|
|
{
|
|
/// <summary>
|
|
/// UPS通讯连接线程
|
|
/// </summary>
|
|
public void UpsNetConnectThread()
|
|
{
|
|
Thread upsConnectThread = new Thread(UpsNetConnectFunc);
|
|
upsConnectThread.IsBackground = true;
|
|
upsConnectThread.Start();
|
|
}
|
|
|
|
/// <summary>
|
|
/// UPS通讯连接
|
|
/// </summary>
|
|
private void UpsNetConnectFunc()
|
|
{
|
|
CmnUpsBaseInfo.UPS01.F_EqmCode = "U001";
|
|
|
|
if (!CmnUpsBaseInfo.UPS01.F_NetConnected)
|
|
{
|
|
CmnUpsBaseInfo.UPS01.Connect();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// UPS通讯重连线程
|
|
/// </summary>
|
|
public void UpsNetReConnectThread()
|
|
{
|
|
Thread upsConnectThread = new Thread(UpsNetReConnectFunc);
|
|
upsConnectThread.IsBackground = true;
|
|
upsConnectThread.Start();
|
|
}
|
|
|
|
/// <summary>
|
|
/// UPS通讯重新连接
|
|
/// </summary>
|
|
private void UpsNetReConnectFunc()
|
|
{
|
|
CmnUpsBaseInfo.UPS01.DisConnect();
|
|
Thread.Sleep(5 * 1000);
|
|
CmnUpsBaseInfo.UPS01.Connect();
|
|
}
|
|
|
|
/// <summary>
|
|
/// UPS状态值
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public MUpsParamsVal GetUpsParamsVal()
|
|
{
|
|
return CmnUpsBaseInfo.UPS01.F_UpsParamsVal;
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|