 2007 Fluke Corporation, All rights reserved               MET/CAL Procedure
=============================================================================
INSTRUMENT:            Sub Initialize /DCPWR
INSTRUMENT:            Sub Reset /DCPWR
INSTRUMENT:            Sub Output Off /DCPWR
INSTRUMENT:            Sub Apply /DCPWR
DATE:                  2007-07-27 12:57:29
AUTHOR:                Fluke
REVISION:              $Revision: 24551 $
ADJUSTMENT THRESHOLD:  70%
NUMBER OF TESTS:       5
NUMBER OF LINES:       280
CONFIGURATION:         DC Power Supply
=============================================================================
#
#  Procedure Author:
#        DAC
#
#  Compatibility:
#        MET/CAL 7.2 or later
#
#  Subprocedures:
#        None
#
#  Required Files:
#        $Data_file: user_config_instr.ini $
#
#  This procedure is intended for use with MET/CAL calibration software;
#  the terms and conditions set forth in your MET/CAL license apply to this
#  procedure.
#
#  Due to Fluke's policy of continuously updating our products, this procedure
#  may contain minor differences in methods used and/or specifications to
#  those found in the manual or other documentation. While every effort has
#  been made to ensure that this procedure is accurate, Fluke cannot be held
#  responsible for the consequences of error or omissions found within this
#  procedure.
#
#  The copyright in this procedure is owned by Fluke Corporation.
#
#  Parameters       Values
#  ---------------  ---------------------------------------------------------
#  @DCPWR_Chan      <NR1> (1, 2, or 3 supported)
#  @DCPWR_Volt      <NR3>[][<prefix>]V
#  @DCPWR_Curr      <NR3>[][<prefix>]A
#  @DCPWR_VoltLmt   <NR3>[][<prefix>]V
#  @DCPWR_CurrLmt   <NR3>[][<prefix>]A
#
#  Terminals        @DCPWR_OutputHi,  @DCPWR_OutputLo
#                   @DCPWR_SenseHi,   @DCPWR_SenseLo
#                   @DCPWR_Output1Hi, @DCPWR_Output1Lo
#                   @DCPWR_Sense1Hi,  @DCPWR_Sense1Lo
#                   @DCPWR_Output2Hi, @DCPWR_Output2Lo
#                   @DCPWR_Sense2Hi,  @DCPWR_Sense2Lo
#                   @DCPWR_Output3Hi, @DCPWR_Output3Lo
#                   @DCPWR_Sense3Hi,  @DCPWR_Sense3Lo
#
#  Example Usage:
#
#    Initialize DC Power Supply parameters
#
#      CALL         Sub Initialize /DCPWR
#
#    Reset
#
#      CALL         Sub Reset /DCPWR
#
#    Output Off
#
#      CALL         Sub Output Off /DCPWR
#
#    Apply
#
#      DISP         Connect [V @DCPWR_DevName] to UUT as follows:
#      DISP         [32] [V @DCPWR_OutputHi] to INPUT HI
#      DISP         [32] [V @DCPWR_OutputLo] to INPUT LO
#      MATH         @DCPWR_Chan = 1; @DCPWR_Volt = "100 mV"
#      CALL         Sub Apply /DCPWR
#
 STEP    FSC    RANGE NOMINAL        TOLERANCE     MOD1        MOD2  3  4 CON

  1.001  JMPL         INITIALIZE                   PSUBI("Initialize")
  1.002  JMPL         RESET                        PSUBI("Reset")
  1.003  JMPL         OUTPUT_OFF                   PSUBI("Output Off")
  1.004  JMPL         APPLY                        PSUBI("Apply")
  1.005  DISP         Subprocedure not found!
  1.006  END

  1.007  EVAL   Increment test number

# =============================== Initialize =================================

  2.001  LABEL        INITIALIZE
# Get and store device name.
  2.002  MATH         @DCPWR_DevName = INSTR("DCPWR")

# Get and store programming section name.
  2.003  MATH         Parameter = "ProgSecName"
  2.004  MATH         @DCPWR_ProgSecName = RINFE(@DCPWR_DevName, Parameter)

# Get and store FSC.
  2.005  MATH         @DCPWR_FSC = RINFE(@DCPWR_ProgSecName, "FSC")

# Get and store terminal names.
  2.006  MATH         @DCPWR_Output1Hi = RINF(@DCPWR_ProgSecName, "Output1Hi")
  2.007  MATH         @DCPWR_Output1Lo = RINF(@DCPWR_ProgSecName, "Output1Lo")
  2.008  MATH         @DCPWR_Output2Hi = RINF(@DCPWR_ProgSecName, "Output2Hi")
  2.009  MATH         @DCPWR_Output2Lo = RINF(@DCPWR_ProgSecName, "Output2Lo")
  2.010  MATH         @DCPWR_Output3Hi = RINF(@DCPWR_ProgSecName, "Output3Hi")
  2.011  MATH         @DCPWR_Output3Lo = RINF(@DCPWR_ProgSecName, "Output3Lo")
  2.012  MATH         @DCPWR_Sense1Hi  = RINF(@DCPWR_ProgSecName, "Sense1Hi")
  2.013  MATH         @DCPWR_Sense1Lo  = RINF(@DCPWR_ProgSecName, "Sense1Lo")
  2.014  MATH         @DCPWR_Sense2Hi  = RINF(@DCPWR_ProgSecName, "Sense2Hi")
  2.015  MATH         @DCPWR_Sense2Lo  = RINF(@DCPWR_ProgSecName, "Sense2Lo")
  2.016  MATH         @DCPWR_Sense3Hi  = RINF(@DCPWR_ProgSecName, "Sense3Hi")
  2.017  MATH         @DCPWR_Sense3Lo  = RINF(@DCPWR_ProgSecName, "Sense3Lo")

# If no channel 1 terminals are specified, get the single channel terminals.
# Otherwise set the single channel terminals to channel 1.
  2.018  IF           EMPTY(@DCPWR_Output1Hi)
  2.019  MATH         @DCPWR_OutputHi = RINFE(@DCPWR_ProgSecName, "OutputHi")
  2.020  MATH         @DCPWR_OutputLo = RINFE(@DCPWR_ProgSecName, "OutputLo")
  2.021  MATH         @DCPWR_SenseHi  = RINF(@DCPWR_ProgSecName,  "SenseHi")
  2.022  MATH         @DCPWR_SenseLo  = RINF(@DCPWR_ProgSecName,  "SenseLo")
  2.023  MATH         @DCPWR_Output1Hi = @DCPWR_OutputHi
  2.024  MATH         @DCPWR_Output1Lo = @DCPWR_OutputLo
  2.025  MATH         @DCPWR_Sense1Hi  = @DCPWR_SenseHi
  2.026  MATH         @DCPWR_Sense1Lo  = @DCPWR_SenseLo
  2.027  ELSE
  2.028  MATH         @DCPWR_OutputHi = @DCPWR_Output1Hi
  2.029  MATH         @DCPWR_OutputLo = @DCPWR_Output1Lo
  2.030  MATH         @DCPWR_SenseHi  = @DCPWR_Sense1Hi
  2.031  MATH         @DCPWR_SenseLo  = @DCPWR_Sense1Lo
  2.032  ENDIF

# Initialize parameters to the empty string (unset).
  2.033  MATH         @DCPWR_Volt    = ""
  2.034  MATH         @DCPWR_Curr    = ""
  2.035  MATH         @DCPWR_VoltLmt = ""
  2.036  MATH         @DCPWR_CurrLmt = ""
  2.037  MATH         @DCPWR_Chan    = ""

# Get programming string for RESET FSC.
  2.038  MATH         ResetCmd = RINF(@DCPWR_ProgSecName, "ResetFSC")

# If ResetFSC is defined, establish the RESET FSC.
  2.039  IF           NOT(EMPTY(ResetCmd))

  2.040  IF           ZCMPI(ResetCmd, "[SDC]")
  2.041  RESET        [@DCPWR][SDC]
  2.042  ELSE
  2.043  RESET        [@DCPWR][V ResetCmd]
  2.044  ENDIF

  2.045  ENDIF

  2.046  END

  2.047  EVAL   Increment test number

# ================================= Reset ====================================

  3.001  LABEL        RESET
  3.002  MATH         @DCPWR_Cmd = RINFE(@DCPWR_ProgSecName, "Reset")
  3.003  CALL         Sub Send Command /DCPWR
  3.004  END

  3.005  EVAL   Increment test number

# =============================== Output_Off =================================

  4.001  LABEL        OUTPUT_OFF

# See if there is a channel specific command.
  4.002  IF           NOT(EMPTY(@DCPWR_Chan))

  4.003  IF           ZCMP(@DCPWR_Chan, "1")
  4.004  MATH         LookupStr = "Output1Off"
  4.005  ELSEIF       ZCMP(@DCPWR_Chan, "2")
  4.006  MATH         LookupStr = "Output2Off"
  4.007  ELSEIF       ZCMP(@DCPWR_Chan, "3")
  4.008  MATH         LookupStr = "Output3Off"
  4.009  ENDIF

  4.010  MATH         @DCPWR_Cmd = RINF(@DCPWR_ProgSecName, LookupStr)
  4.011  ENDIF

# If not, see if there is a general command.
  4.012  IF           EMPTY(@DCPWR_Cmd)
  4.013  MATH         @DCPWR_Cmd = RINF(@DCPWR_ProgSecName, "OutputOff")

  4.014  IF           NOT(EMPTY(@DCPWR_Cmd))
  4.015  CALL         Sub Send Command /DCPWR
  4.016  ENDIF

  4.017  ENDIF

  4.018  END

  4.019  EVAL   Increment test number

# ================================== Apply ===================================

  5.001  LABEL        APPLY

# -----  Channel

  5.002  IF           NOT(EMPTY(@DCPWR_Chan))
  5.003  MATH         Chan = "Chan" & @DCPWR_Chan
  5.004  MATH         @DCPWR_Cmd = RINFE(@DCPWR_ProgSecName, Chan)
  5.005  CALL         Sub Send Command /DCPWR
  5.006  ENDIF

# -----  Voltage

  5.007  IF           NOT(EMPTY(@DCPWR_Volt))
  5.008  MATH         VoltCmd = RINFE(@DCPWR_ProgSecName, "Volt")
  5.009  MATH         Volt = BASE(@DCPWR_Volt)
  5.010  MATH         @DCPWR_Cmd = REPL("<val>", Volt, VoltCmd)
  5.011  CALL         Sub Send Command /DCPWR
  5.012  ENDIF

# -----  Current

  5.013  IF           NOT(EMPTY(@DCPWR_Curr))
  5.014  MATH         CurrCmd = RINFE(@DCPWR_ProgSecName, "Curr")
  5.015  MATH         Curr = BASE(@DCPWR_Curr)
  5.016  MATH         @DCPWR_Cmd = REPL("<val>", Curr, CurrCmd)
  5.017  CALL         Sub Send Command /DCPWR
  5.018  ENDIF

# -----  Voltage Limit

  5.019  IF           NOT(EMPTY(@DCPWR_VoltLmt))
  5.020  MATH         VoltLmtCmd = RINFE(@DCPWR_ProgSecName, "VoltLmt")
  5.021  MATH         VoltLmt = BASE(@DCPWR_VoltLmt)
  5.022  MATH         @DCPWR_Cmd = REPL("<val>", VoltLmt, VoltLmtCmd)
  5.023  CALL         Sub Send Command /DCPWR
  5.024  ENDIF

# -----  Current Limit

  5.025  IF           NOT(EMPTY(@DCPWR_CurrLmt))
  5.026  MATH         CurrLmtCmd = RINFE(@DCPWR_ProgSecName, "CurrLmt")
  5.027  MATH         CurrLmt = BASE(@DCPWR_CurrLmt)
  5.028  MATH         @DCPWR_Cmd = REPL("<val>", CurrLmt, CurrLmtCmd)
  5.029  CALL         Sub Send Command /DCPWR
  5.030  ENDIF

# -----  Output On

# See if there is a channel specific command.
  5.031  IF           NOT(EMPTY(@DCPWR_Chan))

  5.032  IF           ZCMP(@DCPWR_Chan, "1")
  5.033  MATH         LookupStr = "Output1On"
  5.034  ELSEIF       ZCMP(@DCPWR_Chan, "2")
  5.035  MATH         LookupStr = "Output2On"
  5.036  ELSEIF       ZCMP(@DCPWR_Chan, "3")
  5.037  MATH         LookupStr = "Output3On"
  5.038  ENDIF

  5.039  MATH         @DCPWR_Cmd = RINF(@DCPWR_ProgSecName, LookupStr)
  5.040  ENDIF

# If not, see if there is a general command.
  5.041  IF           EMPTY(@DCPWR_Cmd)
  5.042  MATH         @DCPWR_Cmd = RINF(@DCPWR_ProgSecName, "OutputOn")

  5.043  IF           NOT(EMPTY(@DCPWR_Cmd))
  5.044  CALL         Sub Send Command /DCPWR
  5.045  ENDIF

  5.046  ENDIF

  5.047  END
