================================================================================
HIOKI 3193-10 POWER ANALYZER - GP-IB COMMAND REFERENCE
================================================================================
Source: HIOKI 3193-10 Instruction Manual, Chapter 12 (3193e_09.pdf)
Interface: IEEE-488.1/488.2 (1987) compliant GP-IB

================================================================================
COMMUNICATION BASICS
================================================================================

Command Syntax:
  - Colon-separated hierarchy: :VOLTage:RANGe
  - Long form: :VOLTage   Short form: :VOLT
  - Case insensitive (uppercase letters in names indicate short form)
  - Query: append "?" to command header
  - Multiple commands separated by semicolons ";"

Data Formats:
  - NR1: Integer (e.g., 123)
  - NR2: Fixed point (e.g., 123.45)
  - NR3: Floating point (e.g., +123.45E+00)

Response Terminators:
  - Default: LF with EOI
  - Optional: CR+LF (set via :TRANsmit:TERMinator)

Channel Numbering:
  - Single: 1, 2, 3, 4, 5, 6
  - Pairs: 12, 34, 45, 56
  - Triples: 123, 456

Display Item Codes:
  U=Voltage, I=Current, P=Active Power, S=Apparent Power,
  Q=Reactive Power, PF=Power Factor, DEG=Phase Angle,
  F=Frequency, IH=Integrated Current(Ah), WP=Integrated Power(Wh),
  LF=Load Factor, PK=Peak, PM=Motor Power, EXT=External, EFF=Efficiency

Special Error Values in :MEASure? Response:
  +6666.6E+99 = Display blank
  +7777.7E+99 = Scaling error
  +9999.9E+99 = Input over range

================================================================================
GP-IB BUS COMMANDS (IEEE-488.1)
================================================================================

GTL   Go To Local - Returns device to local mode
LLO   Local Lock Out - Disables LOCAL key on device
DCL   Device Clear - Initializes communication buffer (all devices)
SDC   Selected Device Clear - Initializes communication buffer (selected)
GET   Group Execute Trigger - Trigger sampling (same as *TRG, :HOLD)


================================================================================
SECTION 1: IEEE-488.2 STANDARD COMMANDS
================================================================================

*CLS
  Clear status byte register (STB) and all event status registers.

*ESE <NR1>
  Set the standard event status enable register (SESER).
  <NR1> = 0-255 (bitmask)

*ESE?
  Query the standard event status enable register.
  Response: <NR1>

*ESE0 <NR1>
  Set event status enable register 0. <NR1> = 0-255

*ESE0?
  Query event status enable register 0. Response: <NR1>

*ESE1 <NR1>
  Set event status enable register 1. <NR1> = 0-255

*ESE1?
  Query event status enable register 1. Response: <NR1>

*ESE2 <NR1>
  Set event status enable register 2. <NR1> = 0-255

*ESE2?
  Query event status enable register 2. Response: <NR1>

*ESE[ch] <NR1>
  Set event status enable register for channel.
  [ch] = 11-16 (voltage/current ch1-6), 21-26 (frequency ch1-6)
  <NR1> = 0-255

*ESE[ch]?
  Query event status enable register for channel.

*ESEF <NR1>
  Set event status enable register F (frequency). <NR1> = 0-255

*ESEF?
  Query event status enable register F. Response: <NR1>

*ESR?
  Query standard event status register (SESR). Clears on read.
  Response: <NR1>
  Bits: b7=PON, b6=URQ, b5=CME, b4=EXE, b3=DDE, b2=QYE, b1=RQC, b0=OPC

*ESR0?
  Query event status register 0. Clears on read.
  Bits: b7=SE(sampling event), b6=ST, b5=PE, b4=FE, b3=ST, b2=IE, b1=CE

*ESR1?
  Query event status register 1. Clears on read.
  Bits: b6-b1=O6-O1 (channel out of range), b0=OF (freq out of range)

*ESR2?
  Query event status register 2. Clears on read.

*ESR[ch]?
  Query event status register for channel. Clears on read.
  [ch] = 11-16, 21-26
  Bits: b5=OA, b4=OV, b2=HW, b1=HA, b0=HV

*ESRF?
  Query event status register F (frequency). Clears on read.
  Bits: b3=OC, b2=OB, b1=OA (freq channel out of range)

*IDN?
  Query device identification.
  Response: <manufacturer>,<model>,<serial>,<software version>
  Example: "HIOKI,3193,123456,01.00"

*OPC
  Operation complete. Sets OPC bit (b0) in SESR when all pending
  operations are completed.

*OPC?
  Query operation complete. Returns "1" when all pending operations done.

*OPT?
  Query device option provision.
  Response: 15 comma-separated fields describing installed units/options.

*RST
  Reset/initialize all settings to factory defaults.
  Note: Headers are set to OFF.

*SRE <NR1>
  Set the service request enable register (SRER). <NR1> = 0-255

*SRE?
  Query the service request enable register. Response: <NR1>

*STB?
  Query status byte register.
  Response: <NR1>
  Bits: b6=MSS, b5=ESB, b4=MAV, b2=ESB2, b1=ESB1, b0=ESB0

*TRG
  Trigger sampling once (same as GET bus command and :HOLD without data).

*TST?
  Execute self-test and return result.
  Response: <NR1> (0-31 bitmask, 0 = all OK)
  Bits: b0=ROM, b1=RAM, b2=Backup RAM, b3=Calibration data, b4=Clock

*WAI
  Wait until current sampling operation is fully completed before
  processing next command.


================================================================================
SECTION 2: DEVICE-SPECIFIC COMMANDS
================================================================================

--------------------------------------------------------------------------------
:AOUT - D/A Analog Output
--------------------------------------------------------------------------------

:AOUT <A,...(8 items)>
  Set D/A output items. Up to 8 display item codes.

:AOUT?
  Query D/A output items.

--------------------------------------------------------------------------------
:AVEraging - Signal Averaging
--------------------------------------------------------------------------------

:AVEraging:COEFficient <NR1>
  Set averaging coefficient. <NR1> = 8, 16, 32, 64

:AVEraging:COEFficient?
  Query averaging coefficient. Response: <NR1>

:AVEraging:MODE <mode>
  Set averaging mode. <mode> = TIM | LIN | EXP | OFF
  TIM = Time averaging, LIN = Linear averaging, EXP = Exponential averaging

:AVEraging:MODE?
  Query averaging mode. Response: <TIM/LIN/EXP/OFF>

:AVEraging?
  Query all averaging settings.

--------------------------------------------------------------------------------
:BACKlight - LCD Backlight
--------------------------------------------------------------------------------

:BACKlight <ON/OFF>
  Enable or disable LCD backlight.

:BACKlight?
  Query backlight state. Response: <ON/OFF>

:BACKlight:AUTO <NR1>
  Set auto backlight off time. <NR1> = 0-99 (minutes, 0=disabled)

:BACKlight:AUTO?
  Query auto backlight off time. Response: <NR1>

--------------------------------------------------------------------------------
:BEEPer - Beep Sound
--------------------------------------------------------------------------------

:BEEPer <ON/OFF>
  Enable or disable beep sound.

:BEEPer?
  Query beep state. Response: <ON/OFF>

--------------------------------------------------------------------------------
:CALCulate - Efficiency Calculation
--------------------------------------------------------------------------------

:CALCulate[n]:DENominator <A,...>
  Set efficiency denominator (input power items).
  [n] = 1, 2, or 3 (efficiency formula number)
  <A> = Display item codes (e.g., P1, P12, P123)

:CALCulate[n]:DENominator?
  Query efficiency denominator.

:CALCulate[n]:NUMerator <A,...>
  Set efficiency numerator (output power items).
  [n] = 1, 2, or 3

:CALCulate[n]:NUMerator?
  Query efficiency numerator.

:CALCulate[n]?
  Query full efficiency formula settings for formula [n].

  Efficiency = (NUMerator / DENominator) x 100%
  Example for MPPT testing:
    :CALC1:NUM P2        (output power on Ch2)
    :CALC1:DEN P1        (input power on Ch1)
    -> EFF1 = P2/P1 x 100%

--------------------------------------------------------------------------------
:CLOCK - System Clock
--------------------------------------------------------------------------------

:CLOCK <year,month,day,hour,min,sec>
  Set the system clock.

:CLOCK?
  Query the system clock.
  Response: <year,month,day,hour,min,sec>

--------------------------------------------------------------------------------
:COUPling - Input Coupling Mode
--------------------------------------------------------------------------------

:COUPling[ch] <mode>
  Set input coupling mode for channel.
  [ch] = 1-6
  <mode> = AC | DC | ACDC

:COUPling[ch]?
  Query input coupling mode. Response: <AC/DC/ACDC>

--------------------------------------------------------------------------------
:CURRent - Current Measurement Settings
--------------------------------------------------------------------------------

:CURRent[ch]:AUTO <ON/OFF>
  Enable or disable current auto ranging.
  [ch] = 1-6

:CURRent[ch]:AUTO?
  Query current auto ranging state. Response: [ch] <ON/OFF>

:CURRent[ch]:MEAN <ON/OFF>
  Set rectifier type (MEAN/RMS) of the current range.
  [ch] = 1-6
  ON = MEAN measurement, OFF = RMS measurement

:CURRent[ch]:MEAN?
  Query rectifier type of current range. Response: [ch] <ON/OFF>

:CURRent[ch]:RANGe <NR1>
  Set current range for the specified input unit.
  [ch] = 1-6
  <NR1> values depend on input unit type (clamp sensor model).

:CURRent[ch]:RANGe?
  Query current range. Response: [ch] <NR1>

:CURRent[ch]?
  Query all current settings for channel.

--------------------------------------------------------------------------------
:DATAout - Data Output (FDD/Printer)
--------------------------------------------------------------------------------

:DATAout:FD <ON/OFF>
  Enable or disable floppy disk data output.

:DATAout:FD?
  Query floppy disk output state. Response: <ON/OFF>

:DATAout:PRINter <ON/OFF>
  Enable or disable printer data output.

:DATAout:PRINter?
  Query printer output state. Response: <ON/OFF>

:DATAout:ITEM?
  Query all output items configured for FDD/printer.

:DATAout:ITEM:ALLClear
  Clear all output items.

:DATAout:ITEM:EFFiciency <NR1>
  Set efficiency output items. <NR1> = bitmask (b0=EFF1, b1=EFF2, b2=EFF3)

:DATAout:ITEM:EFFiciency?
  Query efficiency output items. Response: <NR1>

:DATAout:ITEM:EXTernalin <NR1>
  Set external input output items. <NR1> = bitmask (b0=EXTA, b1=EXTB, b2=PM)

:DATAout:ITEM:EXTernalin?
  Query external input output items. Response: <NR1>

:DATAout:ITEM:FREQuency <NR1>
  Set frequency output items. <NR1> = bitmask (b0=FA, b1=FB, b2=FC)

:DATAout:ITEM:FREQuency?
  Query frequency output items. Response: <NR1>

:DATAout:ITEM:INTEGrate <NR1,...(10 items)>
  Set integration output items (10 bitmask values, see manual p.148).

:DATAout:ITEM:INTEGrate?
  Query integration output items.

:DATAout:ITEM:LOADfactor <NR1,...(2 items)>
  Set load factor output items (2 bitmask values).

:DATAout:ITEM:LOADfactor?
  Query load factor output items.

:DATAout:ITEM:NORMal <NR1,...(8 items)>
  Set normal measurement output items (8 bitmask values for U,I,P,S,Q,PF,DEG,PK).

:DATAout:ITEM:NORMal?
  Query normal measurement output items.

:DATAout:ITEM:SUM <NR1,...(7 items)>
  Set SUM value output items (7 bitmask values).

:DATAout:ITEM:SUM?
  Query SUM value output items.

--------------------------------------------------------------------------------
:DEMAg - Degauss Current Sensor
--------------------------------------------------------------------------------

:DEMAg <A,...>
  Degauss (demagnetize) current sensors.
  <A> = I1, I2, I3, I4, I5, I6

--------------------------------------------------------------------------------
:DISPlay - Display Control
--------------------------------------------------------------------------------

:DISPlay?
  Query current screen display.
  Response: <DETAIL [1-6] / INTEGRATE [1-6] / MAGNIFY [1-6] /
            SELECT [4/8/16] / EXTERNALIN / EFFICIENCY>

:DISPlay:DETail[ch] <A,...>
  Set detail display items for channel. [ch] = 1-6

:DISPlay:DETail[ch]?
  Query detail display items. Response: [ch] <A,...>

:DISPlay:EFFiciency
  Switch to efficiency display screen.

:DISPlay:EXTernalin
  Switch to external input display screen.

:DISPlay:INTEGrate[ch]
  Switch to integration screen for channel. [ch] = 1-6

:DISPlay:MAGnify[ch] <A,...>
  Set magnified display items for channel. [ch] = 1-6

:DISPlay:MAGnify[ch]?
  Query magnified display items.

:DISPlay:SELect[No] <A,...>
  Set selection screen items.
  [No] = 4, 8, or 16 (number of items to display)
  <A> = display item codes (4, 8, or 16 items respectively)

:DISPlay:SELect[No]?
  Query selection screen items.

--------------------------------------------------------------------------------
:EXTernalin - External Signal Input (9603 Unit)
--------------------------------------------------------------------------------

:EXTernalin[ch]:RANGe <NR1>
  Set voltage range for 9603 external input. [ch] = A or B
  <NR1> = 1, 5, or 10 (Volts)

:EXTernalin[ch]:RANGe?
  Query voltage range. Response: [ch] <1/5/10>

:EXTernalin[ch]:SCALe <NR1>
  Set scaling value for 9603. [ch] = A or B
  <NR1> = 0.0001 to 99999

:EXTernalin[ch]:SCALe?
  Query scaling value. Response: [ch] <NR1>

:EXTernalin[ch]:UNIT <units>
  Set units for 9603 channel. [ch] = A or B
  <units> = V, Nm, mNm, kNm, kgfm, kgfcm, rpm

:EXTernalin[ch]:UNIT?
  Query units. Response: [ch] <units>

:EXTernalinB:PULSe <ON/OFF>
  Set channel B of 9603 to pulse input mode.
  Note: When ON, freq measurement source fc is set to channel B of 9603.

:EXTernalinB:PULSe?
  Query pulse input mode. Response: <ON/OFF>

:EXTernalin[ch]?
  Query all settings for 9603 channel.
  Response: [ch] <range>,<scale>,<units>,<ON/OFF>

--------------------------------------------------------------------------------
:FD - Floppy Disk
--------------------------------------------------------------------------------

:FD:MANual
  Save data to floppy disk manually.
  Note: :DATAout:FD must be ON. Items set by :DATAout:ITEM command.

--------------------------------------------------------------------------------
:FREQuency - Frequency Measurement
--------------------------------------------------------------------------------

:FREQuency[ch]:AUTO <ON/OFF>
  Set auto ranging for frequency measurement. [ch] = A, B, or C

:FREQuency[ch]:AUTO?
  Query auto ranging. Response: [ch] <ON/OFF>

:FREQuency[ch]:RANGe <NR1>
  Set frequency range. [ch] = A, B, or C
  <NR1> = 50, 500, 5E+3, 5E+4, 2E+6 (Hz)

:FREQuency[ch]:RANGe?
  Query frequency range. Response: [ch] <NR1>

:FREQuency[ch]:SOURce <A>
  Set frequency measurement source. [ch] = A, B, or C
  <A> = U1-U6, I1-I6
  Note: If external input ch B is pulse mode, freq ch C source is forced to EXTB.

:FREQuency[ch]:SOURce?
  Query frequency source. Response: [ch] <A>

:FREQuency[ch]?
  Query all frequency channel settings.
  Response: [ch] <ON/OFF>,<range>,<source>

--------------------------------------------------------------------------------
:HEADer - Response Headers
--------------------------------------------------------------------------------

:HEADer <ON/OFF>
  Enable or disable response message headers.
  Note: Headers are disabled (OFF) at power on, after reset by input, after *RST.

:HEADer?
  Query header state. Response: <ON/OFF>

--------------------------------------------------------------------------------
:HOLD - Display Hold / Trigger
--------------------------------------------------------------------------------

:HOLD <ON/OFF>
  Enable or disable display hold.
  When in hold mode and sent without data portion, triggers a single update
  (same as GET and *TRG).

:HOLD?
  Query hold state. Response: <ON/OFF>

--------------------------------------------------------------------------------
:INTEGrate - Integration Control
--------------------------------------------------------------------------------

:INTEGrate:RESEt
  Reset all integration values (all channels).
  Note: Error if any channel is currently integrating.

:INTEGrate:STARt [ch]
  Start integration. [ch] = 1-6 (specific channel) or omit for all channels.
  Note: Integration items set by :DISPlay:INTEGrate[ch].

:INTEGrate:STOP [ch]
  Stop integration. [ch] = 1-6 (specific channel) or omit for all channels.
  Note: If no channel specified, stops ALL channels even if started per-channel.

:INTEGrate?
  Query channels currently integrating.
  Response: channel numbers (e.g., "1,2,3") or "0" if none.

--------------------------------------------------------------------------------
:INTERval - Interval Time Control
--------------------------------------------------------------------------------

:INTERval:CONTrol <ON/OFF>
  Enable or disable interval time control.

:INTERval:CONTrol?
  Query interval control state. Response: <ON/OFF>

:INTERval:TIME <hour,min,sec>
  Set interval time.
  hour = 00-99, min = 00-59, sec = 00-50 (10-second steps)

:INTERval:TIME?
  Query interval time. Response: <hour,min,sec>

:INTERval?
  Query all interval settings. Response: <ON/OFF>,<hour,min,sec>

--------------------------------------------------------------------------------
:KEYLock - Front Panel Key Lock
--------------------------------------------------------------------------------

:KEYLock <ON/OFF>
  Enable or disable key lock (all front panel keys).
  Note: Released when switching from local to remote mode.

:KEYLock?
  Query key lock state. Response: <ON/OFF>

--------------------------------------------------------------------------------
:LANGuage - Display Language
--------------------------------------------------------------------------------

:LANGuage <ENGlish/JAPanese>
  Set display language.

:LANGuage?
  Query display language. Response: <ENGlish/JAPanese>

--------------------------------------------------------------------------------
:LPF - Low-Pass Filter
--------------------------------------------------------------------------------

:LPF[ch] <NR1>
  Set low-pass filter cutoff frequency.
  [ch] = 1-6
  <NR1> = 0 (off), 500, 5E+3 (5kHz), 3E+5 (300kHz)
  Note: Ignored if channel is in DC coupling mode.

:LPF[ch]?
  Query LPF setting. Response: [ch] <NR1>

--------------------------------------------------------------------------------
:MATH - Calculation Type
--------------------------------------------------------------------------------

:MATH <NR1>
  Set calculation type for apparent and reactive power.
  <NR1> = 1, 2, or 3
  Note: Applies to all channels simultaneously.

:MATH?
  Query calculation type. Response: <1/2/3>

--------------------------------------------------------------------------------
:MEASure - Measurement Data Query (CRITICAL COMMAND)
--------------------------------------------------------------------------------

:MEASure:ITEM <A>
  Set default items for :MEASure? query in default mode.
  <A> = Display item codes (e.g., U1,I1,P1,U2,I2,P2,EFF1)

:MEASure:ITEM?
  Query all default measurement items.

:MEASure:ITEM:ALLClear
  Clear all default measurement items.

:MEASure:ITEM:EFFiciency <NR1>
  Set efficiency items for :MEASure? default mode.
  <NR1> = 0-7 bitmask (b0=EFF1, b1=EFF2, b2=EFF3)

:MEASure:ITEM:EFFiciency?
  Query efficiency items. Response: <NR1>

:MEASure:ITEM:EXTernalin <NR1>
  Set external input items. <NR1> = 0-7 (b0=EXTA, b1=EXTB, b2=PM)

:MEASure:ITEM:EXTernalin?
  Query external input items. Response: <NR1>

:MEASure:ITEM:FREQuency <NR1>
  Set frequency items. <NR1> = 0-7 (b0=F1, b1=F2, b2=F3)

:MEASure:ITEM:FREQuency?
  Query frequency items. Response: <NR1>

:MEASure:ITEM:INTEGrate <NR1,...(10 items)>
  Set integration items (10 bitmask values).
  Bit mapping (per value):
    1: PIH1-PIH6 (positive integrated current)
    2: MIH1-MIH6 (negative integrated current)
    3: IH1-IH6 (total integrated current)
    4: PWP1-PWP6 (positive integrated power)
    5: MWP1-MWP6 (negative integrated power)
    6: WP1-WP6 (total integrated power)
    7: PWP12-PWP456 (positive sum integrated power)
    8: MWP12-MWP456 (negative sum integrated power)
    9: WP12-WP456 (total sum integrated power)
    10: TIME (elapsed integration time)

:MEASure:ITEM:INTEGrate?
  Query integration items.

:MEASure:ITEM:LOADfactor <NR1,...(2 items)>
  Set load factor items (2 bitmask values).
  Bit mapping:
    1: LF1-LF6 (per channel)
    2: LF12-LF456 (sum groups)

:MEASure:ITEM:LOADfactor?
  Query load factor items.

:MEASure:ITEM:NORMal <NR1,...(8 items)>
  Set per-channel measurement items (8 bitmask values).
  Bit mapping (each value, b0-b5 = ch1-ch6):
    1: U1-U6 (voltage)
    2: I1-I6 (current)
    3: P1-P6 (active power)
    4: S1-S6 (apparent power)
    5: Q1-Q6 (reactive power)
    6: PF1-PF6 (power factor)
    7: DEG1-DEG6 (phase angle)
    8: PK1-PK6 (peak value)

:MEASure:ITEM:NORMal?
  Query per-channel items.

:MEASure:ITEM:SUM <NR1,...(7 items)>
  Set SUM value items (7 bitmask values).
  Bit mapping (b0-b5 = ch pairs/triples: 12,34,56,123,456,45):
    1: U (voltage sums)
    2: I (current sums)
    3: P (power sums)
    4: S (apparent power sums)
    5: Q (reactive power sums)
    6: PF (power factor sums)
    7: DEG (phase angle sums)

:MEASure:ITEM:SUM?
  Query SUM value items.

:MEASure? [<A,...(up to 70 items)>]
  *** PRIMARY MEASUREMENT DATA QUERY ***

  Two modes:
    Default mode: :MEASure?   (no parameters - uses items set by :MEASure:ITEM)
    Specification mode: :MEASure? U1,I1,P1,U2,I2,P2,EFF1

  Available items for specification mode:
    Voltage:   U1-U6, U12, U34, U56, U45, U123, U456
    Current:   I1-I6, I12, I34, I56, I45, I123, I456
    Power:     P1-P6, P12, P34, P56, P45, P123, P456
    Apparent:  S1-S6, S12, S34, S56, S45, S123, S456
    Reactive:  Q1-Q6, Q12, Q34, Q56, Q45, Q123, Q456
    PF:        PF1-PF6, PF12, PF34, PF56, PF45, PF123, PF456
    Phase:     DEG1-DEG6, DEG12, DEG34, DEG56, DEG45, DEG123, DEG456
    Peak:      PK1-PK6
    Frequency: FA, FB, FC
    External:  EXTA, EXTB, PM
    Efficiency: EFF1, EFF2, EFF3
    Integrated Current: PIH1-PIH6, MIH1-MIH6, IH1-IH6
    Integrated Power:   PWP1-PWP6, MWP1-MWP6, WP1-WP6
                        PWP12-PWP456, MWP12-MWP456, WP12-WP456
                        PWP45, MWP45, WP45
    Load Factor: LF1-LF6, LF12, LF34, LF56, LF45, LF123, LF456
    Time:       TIME

  Response format (NR3): +123.456E+00
    Mantissa: 6 digits with decimal point
    Exponent: 2 digits
    Integration values: 8 digits mantissa

  With headers ON:  header1) <value1> (header2) <value2> ...
  With headers OFF: <value1> <value2> ...

  Up to 70 items can be queried at once.

--------------------------------------------------------------------------------
:MODE - Wiring Mode
--------------------------------------------------------------------------------

:MODE <mode>
  Set wiring mode.
  <mode> = 1P2W | 1P3W | 3P3W | 3V3A | 3P4W

  Valid configurations (by channel count):
    1) All 1P2W
    2) Ch1-2: 1P3W/3P3W, Ch3-6: 1P2W
    3) Ch1-3: 1P3W/3P3W, Ch4-6: 1P2W  (or Ch4-6: 1P3W/3P3W)
    4) Ch1-3: 1P3W/3P3W, Ch4-6: 1P3W/3P3W
    5) Ch1-3: 3V3A/3P4W, Ch4-6: 1P2W
    6) Ch1-3: 3V3A/3P4W, Ch4-6: 1P3W/3P3W
    7) Ch1-3: 3V3A/3P4W, Ch4-6: 3V3A/3P4W

:MODE?
  Query wiring mode. Response: <mode>

--------------------------------------------------------------------------------
:PEAKhold - Peak Value Hold
--------------------------------------------------------------------------------

:PEAKhold <ON/OFF>
  Enable or disable peak value hold function.
  Note: Cannot be used during time averaging.

:PEAKhold?
  Query peak hold state. Response: <ON/OFF>

--------------------------------------------------------------------------------
:PHF - Phase Polarity Discrimination Filter
--------------------------------------------------------------------------------

:PHF[ch] <ON/OFF>
  Enable or disable polarity detection stabilization filter.
  [ch] = 1-6
  Note: When :MATH is set to 1, this command is executed.

:PHF[ch]?
  Query PHF setting. Response: [ch] <ON/OFF>

--------------------------------------------------------------------------------
:PRINt - Printer Control
--------------------------------------------------------------------------------

:PRINt:FEED
  Feed paper.

:PRINt:HCOPy
  Output screen display to printer.

:PRINt:HELP
  Print unit settings in HELP mode.

:PRINt:MANual
  Execute manual printing (same as pressing PRINT key).
  Note: If :DATAout:PRINter is ON, execution error occurs.

--------------------------------------------------------------------------------
:RESPonse - Response Speed
--------------------------------------------------------------------------------

:RESPonse <speed>
  Set measurement response speed.
  <speed> = FAST | MID | SLOW
  Note: Applies to entire 3193 unit (all channels).

:RESPonse?
  Query response speed. Response: <FAST/MID/SLOW>

--------------------------------------------------------------------------------
:RTC - Real Time Count (Sampling Count)
--------------------------------------------------------------------------------

:RTC:COUNt <NR1>
  Set sampling count for event generation.
  <NR1> = 0-10000 (0 = disabled)
  Note: 3193 performs 8 samples/second. Setting to 8 = event every 1 second.
  When count reached, bit 7 of ESR0 is set.

:RTC:COUNt?
  Query sampling count. Response: <0-10000>

--------------------------------------------------------------------------------
:RS232c - RS-232C Settings (RS-232C interface only)
--------------------------------------------------------------------------------

:RS232c:ANSWer <ON/OFF>
  Set execution confirmation message (RS-232C only).
  Error: Execution error when using GP-IB interface.

:RS232c:ANSWer?
  Query confirmation message setting. Response: <ON/OFF>

:RS232c:ERRor?
  Query RS-232C communication error info. Response: <0-7>
  Bits: b0=Parity, b1=Framing, b2=Overrun

:RS232c:HANDshake <mode>
  Set RS-232C handshake. <mode> = X | HARD | OFF
  Error: Execution error when using GP-IB interface.

:RS232c:HANDshake?
  Query handshake setting.

:RS232c?
  Query all RS-232C settings.

--------------------------------------------------------------------------------
:SCALe - Scaling (PT/CT/SC Ratios)
--------------------------------------------------------------------------------

:SCALe[ch]:CONTrol <ON/OFF>,<ON/OFF>,<ON/OFF>
  Enable/disable PT, CT, SC ratio scaling.
  [ch] = 1-6 (use lowest channel in combination)
  Three ON/OFF values for: PT, CT, SC respectively.

:SCALe[ch]:CONTrol?
  Query scaling control. Response: [ch] <ON/OFF>,<ON/OFF>,<ON/OFF>

:SCALe[ch]:CT <NR2>
  Set CT (current transformer) ratio.
  [ch] = 1-6, <NR2> = 0.0001 to 10000
  Note: :SCALe:CONTrol CT must be ON for this to take effect.

:SCALe[ch]:CT?
  Query CT ratio. Response: [ch] <NR2>

:SCALe[ch]:PT <NR2>
  Set PT (potential transformer) ratio.
  [ch] = 1-6, <NR2> = 0.0001 to 10000

:SCALe[ch]:PT?
  Query PT ratio. Response: [ch] <NR2>

:SCALe[ch]:SC <NR2>
  Set SC (scaling) ratio.
  [ch] = 1-6, <NR2> = 0.0001 to 10000

:SCALe[ch]:SC?
  Query SC ratio. Response: [ch] <NR2>

:SCALe[ch]?
  Query all scaling settings for channel.
  Response: [ch] <ON/OFF>,<ON/OFF>,<ON/OFF>,<NR2>,<NR2>,<NR2>

--------------------------------------------------------------------------------
:STARt - Start All Timer Operations
--------------------------------------------------------------------------------

:STARt
  Start all timer settings at beginning of a cycle.
  Same as pressing START/STOP key.
  Starts: Synchronized control, Integration, Time averaging, FD/Printer output.
  Note: After executing, integration is always operative and settings are locked.
  To change range: execute :INTEGrate:RESEt after :STOP.

--------------------------------------------------------------------------------
:STOP - Stop All Timer Operations
--------------------------------------------------------------------------------

:STOP
  Stop all timer settings at beginning of a cycle.
  Same as pressing START/STOP key.
  Note: Follow with :INTEGrate:RESEt to prevent 10,000 hour limit error.

--------------------------------------------------------------------------------
:STIMe - Real Time Control (Scheduled Start/Stop)
--------------------------------------------------------------------------------

:STIMe:CONTrol <ON/OFF>
  Enable or disable real time control.
  Note: Ignored if timer control is ON. Use :STARt to start, :STOP to stop.

:STIMe:CONTrol?
  Query real time control state. Response: <ON/OFF>

:STIMe:STARTtime <year,month,day,hour,min>
  Set start time for real time control.
  year=00-99, month=1-12, day=1-31, hour=0-23, min=0-59

:STIMe:STARTtime?
  Query start time. Response: <year,month,day,hour,min>

:STIMe:STOPTime <year,month,day,hour,min>
  Set stop time for real time control.

:STIMe:STOPTime?
  Query stop time. Response: <year,month,day,hour,min>

:STIMe?
  Query all real time control settings.
  Response: <ON/OFF>,<start_year,month,day,hour,min>,<stop_year,month,day,hour,min>

--------------------------------------------------------------------------------
:TIMER - Timer Control
--------------------------------------------------------------------------------

:TIMER:CONTrol <ON/OFF>
  Enable or disable timer control.
  Note: Use :STARt to start, :STOP to stop. Max 10000 hours.

:TIMER:CONTrol?
  Query timer control state. Response: <ON/OFF>

:TIMER:TIME <hour,min>
  Set timer duration. hour=0-10000, min=0-59

:TIMER:TIME?
  Query timer duration. Response: <hour,min>

:TIMER?
  Query all timer settings. Response: <ON/OFF>,<hour,min>

--------------------------------------------------------------------------------
:TRANsmit - Response Message Format
--------------------------------------------------------------------------------

:TRANsmit:COLumn <NR1>
  Set numerical data format for :MEASure? response.
  <NR1> = 0 or 1
  0 = Leading zeros omitted from NR3 mantissa (e.g., +1.234E+02)
  1 = Fixed column width, leading zeros kept (e.g., +001.234E+02)

:TRANsmit:COLumn?
  Query numerical data format. Response: <0/1>

:TRANsmit:SEParator <NR1>
  Set message unit separator for response messages.
  <NR1> = 0 (semicolon ";") or 1 (comma ",")
  Note: When headers are ON, separator always appears as semicolon.

:TRANsmit:SEParator?
  Query separator setting. Response: <0/1>

:TRANsmit:TERMinator <NR1>
  Set data terminator for response messages.
  <NR1> = 0 (LF) or 1 (CR+LF)
  Note: EOI is always output alongside LF. Initialized to 1 (CR+LF) at power on.
  Not affected by *RST.

:TRANsmit:TERMinator?
  Query terminator setting. Response: <NR1>

--------------------------------------------------------------------------------
:VOLTage - Voltage Measurement Settings
--------------------------------------------------------------------------------

:VOLTage[ch]:AUTO <ON/OFF>
  Enable or disable voltage auto ranging.
  [ch] = 1-6

:VOLTage[ch]:AUTO?
  Query voltage auto ranging. Response: [ch] <ON/OFF>

:VOLTage[ch]:MEAN <ON/OFF>
  Set rectifier type (MEAN/RMS) of voltage range.
  [ch] = 1-6
  ON = MEAN measurement, OFF = RMS measurement

:VOLTage[ch]:MEAN?
  Query rectifier type. Response: [ch] <ON/OFF>

:VOLTage[ch]:RANGe <NR1>
  Set voltage range.
  [ch] = 1-6
  <NR1> depends on input unit:
    9600: 6, 15, 30, 60, 150, 300, 600, 1000
    9601: 60, 150, 300, 600, 1000
    9602: 6, 15, 30, 60, 150, 300, 600

:VOLTage[ch]:RANGe?
  Query voltage range. Response: [ch] <NR1>

:VOLTage[ch]?
  Query all voltage settings for channel.
  Response: [ch] <ON/OFF>,<ON/OFF>,<NR1>  (auto, mean, range)

--------------------------------------------------------------------------------
:WAVEpeak - Waveform Peak Measurement
--------------------------------------------------------------------------------

:WAVEpeak[ch] <U/I>
  Select whether waveform peak measurement applies to voltage or current.
  [ch] = 1-6
  <U/I> = U (voltage) or I (current)
  Note: With single input unit, only one of voltage/current can be selected.

:WAVEpeak[ch]?
  Query waveform peak setting. Response: [ch] <U/I>


================================================================================
SECTION 3: STATUS REGISTER BIT DEFINITIONS
================================================================================

Status Byte Register (STB) - Read with *STB?
  Bit 7: Unused
  Bit 6: SRQ/MSS (Service Request / Master Summary Status)
  Bit 5: ESB (Event Status Bit - SESR summary)
  Bit 4: MAV (Message Available in output queue)
  Bit 3: Unused
  Bit 2: ESB2 (Event Status Register 2 summary)
  Bit 1: ESB1 (Event Status Register 1 summary)
  Bit 0: ESB0 (Event Status Register 0 summary)

Standard Event Status Register (SESR) - Read with *ESR?
  Bit 7: PON (Power On)
  Bit 6: URQ (User Request)
  Bit 5: CME (Command Error)
  Bit 4: EXE (Execution Error)
  Bit 3: DDE (Device Dependent Error)
  Bit 2: QYE (Query Error)
  Bit 1: RQC (Request Control)
  Bit 0: OPC (Operation Complete)

Event Status Register 0 (ESR0) - Read with *ESR0?
  Bit 7: SE (Sampling Event - RTC count reached)
  Bit 6: ST (Start key pressed)
  Bit 5: PE (Printer error)
  Bit 4: FE (FDD error)
  Bit 3: ST (Stop - timer/integration stopped)
  Bit 2: IE (Integration error)
  Bit 1: CE (Clock error)
  Bit 0: Unused

Event Status Register 1 (ESR1) - Read with *ESR1?
  Bit 6: O6 (Channel 6 out of range)
  Bit 5: O5 (Channel 5 out of range)
  Bit 4: O4 (Channel 4 out of range)
  Bit 3: O3 (Channel 3 out of range)
  Bit 2: O2 (Channel 2 out of range)
  Bit 1: O1 (Channel 1 out of range)
  Bit 0: OF (Frequency out of range)

Event Status Register per Channel (ESR[ch]) - Read with *ESR[ch]?
  [ch] = 11-16 (input channels), 21-26 (frequency channels)
  Bit 5: OA (Over range - current)
  Bit 4: OV (Over range - voltage)
  Bit 2: HW (Watt integration overflow)
  Bit 1: HA (Amp-hour integration overflow)
  Bit 0: HV (Volt integration overflow)

Event Status Register F (ESRF) - Read with *ESRF?
  Bit 3: OC (Frequency channel C out of range)
  Bit 2: OB (Frequency channel B out of range)
  Bit 1: OA (Frequency channel A out of range)


================================================================================
SECTION 4: QUICK REFERENCE FOR SOLAR MPPT EFFICIENCY TESTING
================================================================================

Typical setup: 1P2W mode, Ch1 = Solar panel input, Ch2 = MPPT output

--- Initial Configuration ---
*RST                              Reset to defaults
:MODE 1P2W                        Set single-phase 2-wire mode
:HEADer OFF                      Disable response headers for easy parsing
:TRANsmit:SEParator 1            Use comma separator
:TRANsmit:COLumn 1               Fixed column width for consistent parsing

--- Set Voltage/Current Ranges ---
:VOLTage1:AUTO ON                 Auto-range voltage Ch1
:VOLTage2:AUTO ON                 Auto-range voltage Ch2
:CURRent1:AUTO ON                 Auto-range current Ch1
:CURRent2:AUTO ON                 Auto-range current Ch2

--- Configure Efficiency Calculation ---
:CALCulate1:NUMerator P2          Numerator = Output power (Ch2)
:CALCulate1:DENominator P1        Denominator = Input power (Ch1)
  -> EFF1 = (P2 / P1) x 100%

--- Set Up Measurement Query Items ---
:MEASure:ITEM:ALLClear            Clear all default items
:MEASure:ITEM:NORMal 3,3,3,0,0,0,0,0   U1,U2,I1,I2,P1,P2
:MEASure:ITEM:EFFiciency 1        Include EFF1

--- Read Measurements ---
:MEASure?                         Read all configured items (default mode)
  -or-
:MEASure? U1,I1,P1,U2,I2,P2,EFF1    Specific items (specification mode)

--- Single Trigger Mode ---
:HOLD ON                          Enable hold mode
*TRG                              Trigger single measurement
*WAI                              Wait for completion
:MEASure? U1,I1,P1,U2,I2,P2,EFF1    Read values

--- Continuous Polling ---
:RTC:COUNt 8                     Event every 1 second (8 samples/sec)
*ESE0 128                        Enable SE bit (sampling event) in ESE0
*SRE 1                           Enable ESB0 in SRE for service request
  -> Poll *STB? and read :MEASure? when ready

--- Integration (Energy Totals) ---
:INTEGrate:RESEt                  Reset integration counters
:INTEGrate:STARt                  Start integration on all channels
  ... (wait for test duration) ...
:INTEGrate:STOP                   Stop integration
:MEASure? WP1,WP2,IH1,IH2,TIME   Read integrated Wh, Ah, and elapsed time

--- Device Identification ---
*IDN?                             Verify instrument identity
*OPT?                             Check installed input units


================================================================================
END OF COMMAND REFERENCE
================================================================================
