{-------------------------------------------------------------------------------
 STEP        : IP_GetValue.IPS
 PROJECT     :
 DESCRIPTION : Get 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
  prFactor     : ( 3, real,   'Factor (0=none)',           ''        , '0' );  // A factor to adjust the value
  prDB         : ( 4, real,   'DB (0=none, 1=dBV, 2=dBu)', ''        , '0' );  // Convert to DB (0=none, 1=dBV, 2=dBu)
  prAttributes : ( 5, string, 'Attributes',                ''              );  // Attributes
  prWaitAfter  : ( 6, 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);
    
    repeat
      SetValueEx (vrActiveDuts[vrIndex], TM_GetValue(psName, prFactor, prDB));
      if not stepcontinue then begin
        DateTime.Delay(10, true);
      end;
    until stepcontinue;
    
    DateTime.Delay(prWaitAfter, true);
    DateTime.Delay(Math.Random * Val(RegForm.Get('RFE_STEPDELAY'),0), true);

  end;

end.


