/*@!Encoding:1252*/
includes
{
  
}

variables
{
  
}

export testfunction WaitForInitiating()
{
  Wait(7000);
  testStepPass();
}

export testfunction StartTaskOnTC()
{
  TCIL_StartTask(TC);
  Wait(2000); // Wait for 2 secconds
  testStepPass();
}

export testfunction DefineSetpointActivationRate()
{
  TCIL_ValueCommandPhysical(TC, Sprayer, 6/*DDI*/, 2/*elNum*/, 39000/* kg/ha */);
  Wait(2000); // Wait for 2 secconds
  testStepPass();
}

export testfunction TurnOnSprayer()
{
  VTIL_PressSoftKey(VT, 151/*keyId*/, 500/*duration*/);
  Wait(1000); // Wait for 1 seccond
  testStepPass();
}

export testfunction ActivateAdditionalSections()
{
  VTIL_PressSoftKey(VT, 153/*keyId*/, 500/*duration*/);
  Wait(1000); // Wait for 1 seccond
  VTIL_PressSoftKey(VT, 153/*keyId*/, 500/*duration*/);
  Wait(1000); // Wait for 1 seccond
  testStepPass();
}

export testfunction StartMoving()
{
  byte counter;

  $GBSD_TECU::GroundBasedMachineDirection = VtSig_GroundBasedMachineDirection::Forward;
  $GBSD_TECU::GroundBasedMachineSpeed = 1;

  // 6. Slow increase the speed
  for(counter = 0; counter < 4; counter++)
  {
    Wait(500); // Wait for 500 ms
    $GBSD_TECU::GroundBasedMachineSpeed += 2;
    Wait(500); // Wait for 500 ms
  }
  testStepPass();
}

export testfunction CheckReportedFlowRate()
{
  double curFlowRate;

  TCIL_GetValuePhysical(TC, Sprayer, 37/*DDI*/, 4/*elNum*/, curFlowRate);
  if(curFlowRate < 62 || curFlowRate > 65)
  {
    testStepFail("CheckReportedFlowRate", "Wrong reported Flow Rate (%f, has to be between 14 and 15)!",  curFlowRate);
    return;
  }
  testStepPass();
}

Wait(int timeToWait)
{
  testWaitForTimeout(timeToWait);
}

