public bool carReched() { bool flag = false; int index = GetIdex.getDicInputIndex("car01_RCHD"); ComTCPLib.GetInputAsBOOL(1, index, out flag); return(flag); }
public void getNowInfo(int handle) { int index = GetIdex.getDicInputIndex("car01_ACT_SPD"); ComTCPLib.GetInputAsREAL32(handle, index, out now_spd); index = GetIdex.getDicInputIndex("car01_AXIS"); ComTCPLib.GetInputAsREAL32(handle, index, out now_pos); }
public void setCarInfo(float add, float dec, float spd, int handle) { int index = 0; index = GetIdex.getDicOutputIndex("car01_S_ACC"); ComTCPLib.SetOutputAsREAL32(handle, index, add); index = GetIdex.getDicOutputIndex("car01_S_DEC"); ComTCPLib.SetOutputAsREAL32(handle, index, dec); index = GetIdex.getDicOutputIndex("car01_S_SPD"); ComTCPLib.SetOutputAsREAL32(handle, index, spd); }
//--------------------------------------------------- #region 基本数据处理 //type 1 uint,2 float,3 flag //设置数据 public void updateValue(string name, string value, int type, int handle) { double time, timeStep; ComTCPLib.UpdateData(handle, out time, out timeStep); int index = GetIdex.getDicOutputIndex(name); if (type == 1) { ComTCPLib.SetOutputAsUINT(handle, index, uint.Parse(value)); } else if (type == 2) { ComTCPLib.SetOutputAsREAL32(handle, index, float.Parse(value)); } }