using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SIASUN.Autopilot.Device.BeckHoff
{
    public static class BeckhoffDrive
    {
        /// <summary>
        /// value值为正 执行油门踏板
        /// value值为负 执行刹车踏板
        /// </summary>
        /// <param name="value">输入需要的加速度</param>
        public static void Accelerator(float value)
        {
            // 输入value, 输出 要发送的值
            float mlvalue = value;

            if (value > 0) //加速
                OpcFactory.Instance.opcHelper.SetOpcSend("AccPsngCtrReq", mlvalue.ToString());
            else if (value < 0) //制动
                OpcFactory.Instance.opcHelper.SetOpcSend("BrkPsngCtrReq", mlvalue.ToString());

        }

        /// <summary>
        /// 转盘转动角度值
        /// </summary>
        /// <param name="value"></param>
        public static void SteerAngCt(float value)
        {
            //输入value, 输出 要发送的值
            float mlvalue = value;
            OpcFactory.Instance.opcHelper.SetOpcSend("StrAngCtrReq", mlvalue.ToString());
        }

        /// <summary>
        /// 电机控制器上电
        /// </summary>
        public static void AccCtrPowOn()
        {
            OpcFactory.Instance.opcHelper.SetOpcSend("AccCtrPowReq", "1");
        }

        /// <summary>
        /// 电机使能
        /// </summary>
        public static void AccCtrEngOn()
        {
            OpcFactory.Instance.opcHelper.SetOpcSend("AccMotEnReq", "1");
        }

        /// <summary>
        /// 清空学习表
        /// </summary>
        public static void AccCtrCleOn()
        {
            OpcFactory.Instance.opcHelper.SetOpcSend("ClrAccTbl", "1");
        }

        /// <summary>
        /// 控制请求
        /// </summary>
        public static void AccCtrReq()
        {
            //位置
            OpcFactory.Instance.opcHelper.SetOpcSend("AccPsngCtrReq", "1");

            //速度
            OpcFactory.Instance.opcHelper.SetOpcSend("AccSpdCtrReq", "1");

            //
        }
    }
}
