{-------------------------------------------------------------------------------
 STEP        : IP_SetValue.IPS
 PROJECT     :
 DESCRIPTION : Set a value
 RESULT      : 0 = success
 PROGRAMMER  : 2011-03-01 / gt /MCD
 UPDATE      :
-------------------------------------------------------------------------------}
parameter
  prWaitBefore : ( 1, real,   'Wait before',               '0..60000', '0' );  // Delay before measurement in ms
  psName       : ( 2, string, 'Value name',                ''              );  // Value name
  psValue      : ( 3, string, 'Value',                     ''              );  // Value
  prFactor     : ( 4, real,   'Factor (0=none)',           ''        , '0' );  // A factor to adjust the value
  prDB         : ( 5, real,   'DB (0=none, 1=dBV, 2=dBu)', ''        , '0' );  // Convert from DB (0=none, 1=dBV, 2=dBu)
  prAttributes : ( 6, string, 'Attributes',                ''              );  // Attributes
  prWaitAfter  : ( 7, real,   'Wait after',                '0..60000', '0' );  // Delay after measurement in ms

var
  vrActiveDuts : vector;
  vrIndex : real;

uses
  'LIB_TOOLMANAGER';

step

  DateTime.Delay(prWaitBefore, true);

  vrActiveDuts := ActiveDuts;
  for vrIndex := 1 to Len(vrActiveDuts) do begin

    TM_SetAttributes(psName, prAttributes);

    TM_SetValue(psName, psValue, prFactor, prDB);

    SetValueEx (vrActiveDuts[vrIndex], psValue);
    SetStepResultEx(vrActiveDuts[vrIndex],1);

  end;

  DateTime.Delay(prWaitAfter, true);

  DateTime.Delay(Math.Random * Val(RegForm.Get('RFE_STEPDELAY'),0), true);

end.


