/*@!Encoding:936*/
includes
{
  
}

variables
{
  long table = 0;
  
  /**************VH1160**************/
  char DevName[10] = "4";            //设备名称
  long pHandle[10];
  long devHandle;
  
  enum vLines{R_30=0, R_15=1, R_31=2};
  
  /***********************************/
  long CanH;
  long CanL;
  long passThru;
  const long FoundDevNameLen = 25;
  char FoundDev[FoundDevNameLen];
  double setV;
  long current;
  double mVal;
  
  char actualDev[128];
  char devType[128];
  long ret, tmp[1];
  
  float t_FaultRemove;
}

void OpenVHPower()
{
  ret = VHDevSearchOpen(tmp, devType, actualDev, elcount(actualDev));
  writeLineEx(0, 1, "Open == %d", ret);
  if(ret == 0)
  {
    devHandle = tmp[0];
  }
  VHDevSetSafeState(devHandle);
  writeDbgLevel(5, "------连接VH1160--------");
}

void DUTPowerOff()
{
  VHDevClose(devHandle);
  VHDevSetRelay(devHandle, 1, 0);
  KL30(0);
  KL15(0);
  GND(0);
  testWaitForTimeout(1000);
}

void DUTPowerOn()
{
  OpenVHPower();
  KL30(1);
  KL15(1);
  GND(1);
  testWaitForTimeout(1000);
}

void KL30(byte state)
{
  VHDevSetRelay(devHandle, R_30, state);
}

void KL15(byte state)
{
  VHDevSetRelay(devHandle, R_15, state);
}

void GND(byte state)
{
  VHDevSetRelay(devHandle, R_31, state);
}

void SetOutputVoltValue(double voltage)
{
  VHDevSetVoltageVBatt(devHandle, voltage);
}