GracoPd2kInt API
#################

Add-On Instructions (AOIs)
**************************

.. _GunCtrl:

GunCtrl
=======
Provides several inputs for controlling the applicator (e.g. system mode, setpoints).

The enable input must be on for any other inputs to take effect. The boolean command inputs each function like execute inputs, meaning the command will automatically reset these once set to true.

The dynamic setpoint inputs modify dynamic preset 0 values while enabled.

**enable** (INPUT BOOL)
  Enable command
**applicatorType** (INPUT DINT)
  Applicator type (0=AirPro Auto, 1=AirPro EFX, 2=G40, 3=Pro Xpc Auto, 4=ProBell)
**powerOn** (INPUT BOOL)
  Power on
**powerOff** (INPUT BOOL)
  Power off
**quickStop** (INPUT BOOL)
  Quick stop
**toIdle** (INPUT BOOL)
  Goto idle
**toSpray** (INPUT BOOL)
  Goto spray
**toPurge** (INPUT BOOL)
  Goto purge
**innerAirOn** (INPUT BOOL)
  Inner air solenoid on
**innerAirOff** (INPUT BOOL)
  Inner air solenoid off
**outerAirOn** (INPUT BOOL)
  Outer air solenoid on
**outerAirOff** (INPUT BOOL)
  Outer air solenoid off
**gunOn1** (INPUT BOOL)
  Gun 1 on
**gunOff1** (INPUT BOOL)
  Gun 1 off
**gunOn2** (INPUT BOOL)
  Gun 2 on
**gunOff2** (INPUT BOOL)
  Gun 2 off
**gunOn3** (INPUT BOOL)
  Gun 3 on
**gunOff3** (INPUT BOOL)
  Gun 3 off
**openDumpValve** (INPUT BOOL)
  Open dump valve
**closeDumpValve** (INPUT BOOL)
  Close dump valve
**openCupWashValve** (INPUT BOOL)
  Open cup wash valve
**closeCupWashValve** (INPUT BOOL)
  Close cup wash valve
**aux3On** (INPUT BOOL)
  Auxiliary solenoid 3 on
**aux3Off** (INPUT BOOL)
  Auxiliary solenoid 3 off
**electrostaticsOn** (INPUT BOOL)
  Electrostatics on
**electrostaticsOff** (INPUT BOOL)
  Electrostatics off
**presetNum** (INPUT DINT)
  Preset number (0-98)
**dynInnerAirSP** (INPUT DINT)
  Dynamic preset inner air setpoint (7-99 psi)
**dynOuterAirSP** (INPUT DINT)
  Dynamic preset outer air setpoint (7-99 psi)
**dynTurbineSpeedSP** (INPUT DINT)
  Dynamic preset turbine speed setpoint (10-60 kRPM)
**dynVoltageSP** (INPUT DINT)
  Dynamic preset voltage setpoint (0-100 kV)
**dynCurrentSP** (INPUT DINT)
  Dynamic preset current setpoint (0-150 uA)

**busy** (OUTPUT BOOL)
  Command busy flag 
**valid** (OUTPUT BOOL)
  Command valid flag 
**aborted** (OUTPUT BOOL)
  Command aborted flag 
**error** (OUTPUT BOOL)
  Command error flag 
**state** (OUTPUT DINT)
  State code 

**moduleStatus** (INOUT DINT[39])
  Data from module to PLC 
**moduleCmds** (INOUT DINT[25])
  Data from PLC to module

State Codes
+++++++++++
* 16#0000 - Idle
* 16#3XXX - Valid

.. _PumpCtrl:

PumpCtrl
========
Provides several inputs for controlling the PD2K proportioner (e.g. system mode, setpoints).

The enable input must be on for any other inputs to take effect. The boolean command inputs each function like execute inputs, meaning the command will automatically reset these once set to true.

The current control mode setting (pressure or flow) determines which of the setpoint inputs are written to the PD2K system. This switches automatically when the control mode is changed.

**clearAlarm** (INPUT BOOL)
  Clear alarm 
**completeJob** (INPUT BOOL)
  Complete job 
**ctrlMode** (INPUT BOOL)
  Ctrl mode SP
  (0=flow, 1=pressure) 
**enable** (INPUT BOOL)
  Enable command 
**mix** (INPUT BOOL)
  Goto mix 
**mixFill** (INPUT BOOL)
  Goto mix fill 
**powerOff** (INPUT BOOL)
  Power off 
**powerOn** (INPUT BOOL)
  Power on 
**quickStop** (INPUT BOOL)
  Goto quick stop 
**recipePurge** (INPUT BOOL)
  Goto recipe purge 
**standby** (INPUT BOOL)
  Goto standby 
**flowCtrlSP** (INPUT DINT)
  Flow control setpoint
  (cc/min) 
**presCtrlSP** (INPUT DINT)
  Pressure control setpoint
  (psi) 

**busy** (OUTPUT BOOL)
  Command busy flag 
**valid** (OUTPUT BOOL)
  Command valid flag 
**aborted** (OUTPUT BOOL)
  Command aborted flag 
**error** (OUTPUT BOOL)
  Command error flag 
**state** (OUTPUT DINT)
  State code 

**moduleStatus** (INOUT DINT[39])
  Data from module to PLC 
**moduleCmds** (INOUT DINT[25])
  Data from PLC to module 

State Codes
+++++++++++
* 16#0000 - Idle
* 16#3XXX - Valid
* 16#9000 - Error, control mode could not be updated

.. _ReadAlarmInfo:

ReadAlarmInfo
=============
Reads data from an alarm record.

**indexNum** (INPUT DINT)
  the chronological alarm index number to look up, where 0 is the most recent, and 199 is the 200th most recent.
**execute** (INPUT BOOL)
  executes the command.

**code** (INOUT :ref:`STRING4`)
  the code for the alarm.
**dateTime** (INOUT :ref:`TypeDateTime`)
  The date and time the alarm occurred.
**moduleStatus** (INOUT DINT[39])
  The module input data.
**moduleCmds** (INOUT DINT[25])
  The module output data.

**busy** (OUTPUT BOOL)
  The busy command flag
**done** (OUTPUT BOOL)
  The done command flag
**aborted** (OUTPUT BOOL)
  The aborted command flag
**error** (OUTPUT BOOL)
  The error command flag
**state** (OUTPUT DINT)
  State data for the command

State Codes
+++++++++++
* 16#1xxx - Busy
* 16#2000 - Done
* 16#4000 - Aborted, command overwritten by another process
* 16#8000 - Error, invalid command ID
* 16#8001 - Error, timeout waiting for DCS registers to become available
* 16#8002 - Error, command unsuccessful
* 16#8003 - Error, timeout waiting for acknowledge from PD2K

.. _ReadEventInfo:

ReadEventInfo
=============
Reads data from an event record.

**indexNum** (INPUT DINT)
  the chronological event index number to look up, where 0 is the most recent, and 199 is the 200th most recent.
**execute** (INPUT BOOL)
  executes the command.

**code** (INOUT :ref:`STRING4`)
  the code for the event.
**dateTime** (INOUT :ref:`TypeDateTime`)
  The date and time the event occurred.
**moduleStatus** (INOUT DINT[39])
  The module input data.
**moduleCmds** (INOUT DINT[25])
  The module output data.

**busy** (OUTPUT BOOL)
  The busy command flag
**done** (OUTPUT BOOL)
  The done command flag
**aborted** (OUTPUT BOOL)
  The aborted command flag
**error** (OUTPUT BOOL)
  The error command flag
**state** (OUTPUT DINT)
  State data for the command

State Codes
+++++++++++
* 16#1xxx - Busy
* 16#2000 - Done
* 16#4000 - Aborted, command overwritten by another process
* 16#8000 - Error, invalid command ID
* 16#8001 - Error, timeout waiting for DCS registers to become available
* 16#8002 - Error, command unsuccessful
* 16#8003 - Error, timeout waiting for acknowledge from PD2K

.. _ReadFluidControlMode:

ReadFluidControlMode
====================
Returns the current fluid control mode for the system.

**execute** (INPUT BOOL)
  executes the command.

**moduleStatus** (INOUT DINT[39])
  The module input data.
**moduleCmds** (INOUT DINT[25])
  The module output data.

**mode** (OUTPUT BOOL)
  The current fluid control mode value (false=flow control, true=pressure control).
**busy** (OUTPUT BOOL)
  The busy command flag
**done** (OUTPUT BOOL)
  The done command flag
**aborted** (OUTPUT BOOL)
  The aborted command flag
**error** (OUTPUT BOOL)
  The error command flag
**state** (OUTPUT DINT)
  State data for the command

State Codes
+++++++++++
* 16#1xxx - Busy
* 16#2000 - Done
* 16#4000 - Aborted, command overwritten by another process
* 16#8000 - Error, invalid command ID
* 16#8001 - Error, timeout waiting for DCS registers to become available
* 16#8002 - Error, command unsuccessful
* 16#8003 - Error, timeout waiting for acknowledge from PD2K

.. _ReadFlushSeq:

ReadFlushSeq
============
Returns the current configuration values for a flush sequence number.

**flushSeqNum** (INPUT DINT)
  the flush sequence number to configure. The acceptable range is 1-5. If not in range, an error will be raised.
**execute** (INPUT BOOL)
  executes the command.

**moduleStatus** (INOUT DINT[39])
  The module input data.
**moduleCmds** (INOUT DINT[25])
  The module output data.

**gunPurgeTime** (OUTPUT DINT)
  the current gun purge time in seconds.
**initialFlushVol** (OUTPUT DINT)
  the current value for the initial flush volume setpoint in cc. 
**finalFlushVol** (OUTPUT DINT)
  the current value for the final flush volume setpoint in cc.
**numWashCycles** (OUTPUT DINT)
  the current number of wash cycles.
**strokesPerWashCycle** (OUTPUT DINT)
  the current number of strokes per wash cycle.
**busy** (OUTPUT BOOL)
  The busy command flag
**done** (OUTPUT BOOL)
  The done command flag
**aborted** (OUTPUT BOOL)
  The aborted command flag
**error** (OUTPUT BOOL)
  The error command flag
**state** (OUTPUT DINT)
  State data for the command

State Codes
+++++++++++
* 16#1xxx - Busy
* 16#2000 - Done
* 16#4000 - Aborted, command overwritten by another process
* 16#8000 - Error, invalid command ID
* 16#8001 - Error, timeout waiting for DCS registers to become available
* 16#8002 - Error, command unsuccessful
* 16#8003 - Error, timeout waiting for acknowledge from PD2K

.. _ReadGunContents:

ReadGunContents
===============
Returns the recipe number of mixed material that is currently loaded in the specified gun number.

**gunNum** (INPUT DINT)
  The gun number to look up. The acceptable range is 1-3. If not in range, an error will be raised.
**execute** (INPUT BOOL)
  executes the command.

**moduleStatus** (INOUT DINT[41])
  The module input data.
**moduleCmds** (INOUT DINT[22])
  The module output data.

**recipeNum** (OUTPUT DINT)
  The current recipe number. If the recipe is unknown (e.g. on startup), a value of 61 will be returned.
**busy** (OUTPUT BOOL)
  The busy command flag
**done** (OUTPUT BOOL)
  The done command flag
**aborted** (OUTPUT BOOL)
  The aborted command flag
**error** (OUTPUT BOOL)
  The error command flag
**state** (OUTPUT DINT)
  State data for the command

State Codes
+++++++++++
* 16#1xxx - Busy
* 16#2000 - Done
* 16#4000 - Aborted, command overwritten by another process
* 16#8000 - Error, invalid command ID
* 16#8001 - Error, timeout waiting for DCS registers to become available
* 16#8002 - Error, command unsuccessful
* 16#8003 - Error, timeout waiting for acknowledge from PD2K

.. _ReadJobInfo:

ReadJobInfo
===========
Reads data from a job record.

**indexNum** (INPUT DINT)
  the chronological job index number to look up, where 0 is the most recent, and 199 is the 200th most recent.
**execute** (INPUT BOOL)
  executes the command.

**userID** (INOUT :ref:`STRING9`)
  the user ID used for the job.
**dateTime** (INOUT :ref:`TypeDateTime`)
  the completion date and time of the job record.
**moduleStatus** (INOUT DINT[39])
  The module input data.
**moduleCmds** (INOUT DINT[25])
  The module output data.

**jobNum** (OUTPUT DINT)
  The actual job number of the record.
**recipeNum** (OUTPUT DINT)
  The recipe number used for the job.
**abVol** (OUTPUT DINT)
  The sum of materials (A+B) used for the job in cc.
**busy** (OUTPUT BOOL)
  The busy command flag
**done** (OUTPUT BOOL)
  The done command flag
**aborted** (OUTPUT BOOL)
  The aborted command flag
**error** (OUTPUT BOOL)
  The error command flag
**state** (OUTPUT DINT)
  State data for the command

State Codes
+++++++++++
* 16#1xxx - Busy
* 16#2000 - Done
* 16#4000 - Aborted, command overwritten by another process
* 16#8000 - Error, invalid command ID
* 16#8001 - Error, timeout waiting for DCS registers to become available
* 16#8002 - Error, command unsuccessful
* 16#8003 - Error, timeout waiting for acknowledge from PD2K

.. _ReadMixFillSP:

ReadMixFillSP
=============
Reads the alternate control setpoint used when filling the line with mixed material.

The mix fill setpoint units depend on the selected fluid control mode of the system. If the control mode is set to “flow,” the units are cc/min. If set to “pressure,” the units are PSI. 

**execute** (INPUT BOOL)
  executes the command.

**moduleStatus** (INOUT DINT[39])
  The module input data.
**moduleCmds** (INOUT DINT[25])
  The module output data.

**mixFillSP** (OUTPUT DINT)
  The returned setpoint value.
**busy** (OUTPUT BOOL)
  The busy command flag
**done** (OUTPUT BOOL)
  The done command flag
**aborted** (OUTPUT BOOL)
  The aborted command flag
**error** (OUTPUT BOOL)
  The error command flag
**state** (OUTPUT DINT)
  State data for the command

State Codes
+++++++++++
* 16#1xxx - Busy
* 16#2000 - Done
* 16#4000 - Aborted, command overwritten by another process
* 16#8000 - Error, invalid command ID
* 16#8001 - Error, timeout waiting for DCS registers to become available
* 16#8002 - Error, command unsuccessful
* 16#8003 - Error, timeout waiting for acknowledge from PD2K

.. _ReadPreset:

ReadPreset
==========
Returns the current configuration values for an applicator preset number.

**presetNum** (INPUT DINT)
  the recipe number to read (0-98)
**execute** (INPUT BOOL)
  Executes the command.

**moduleStatus** (INOUT DINT[39])
  The module input data.
**moduleCmds** (INOUT DINT[25])
  The module output data.

**ctrlSP** (OUTPUT DINT)
  Flow/pressure control setpoint
**airSP1** (OUTPUT DINT)
  Air setpoint 1 (psi)
**airSP2** (OUTPUT DINT)
  Air setpoint 2 (psi)
**turbineSpeed** (OUTPUT DINT)
  Turbine speed (kRPM)
**voltageSP** (OUTPUT REAL) 
  Electrostatic voltage setpoint (kV)
**currentSP** (OUTPUT DINT)
  Electrostatic current setpoint (uA)
**busy** (OUTPUT BOOL)
  The busy command flag
**done** (OUTPUT BOOL)
  The done command flag
**aborted** (OUTPUT BOOL)
  The aborted command flag
**error** (OUTPUT BOOL)
  The error command flag
**state** (OUTPUT DINT)
  State data for the command

State Codes
+++++++++++
* 16#1xxx - Busy
* 16#2000 - Done
* 16#4000 - Aborted, command overwritten by another process
* 16#8000 - Error, invalid command ID
* 16#8001 - Error, timeout waiting for DCS registers to become available
* 16#8002 - Error, command unsuccessful
* 16#8003 - Error, timeout waiting for acknowledge from PD2K

.. _ReadPumpMaterial:

ReadPumpMaterial
================
Returns the material number currently loaded in the specified pump number.

**pumpNum** (INPUT DINT)
  The pump number to look up. The acceptable range is 1-4. If not in range, an error will be raised.
**execute** (INPUT BOOL)
  executes the command.

**moduleStatus** (INOUT DINT[39])
  The module input data.
**moduleCmds** (INOUT DINT[25])
  The module output data.

**materialNum** (OUTPUT DINT)
  The current material number. If the material is unknown (e.g. on startup), a value of 61 will be returned.
**busy** (OUTPUT BOOL)
  The busy command flag
**done** (OUTPUT BOOL)
  The done command flag
**aborted** (OUTPUT BOOL)
  The aborted command flag
**error** (OUTPUT BOOL)
  The error command flag
**state** (OUTPUT DINT)
  State data for the command

State Codes
+++++++++++
* 16#1xxx - Busy
* 16#2000 - Done
* 16#4000 - Aborted, command overwritten by another process
* 16#8000 - Error, invalid command ID
* 16#8001 - Error, timeout waiting for DCS registers to become available
* 16#8002 - Error, command unsuccessful
* 16#8003 - Error, timeout waiting for acknowledge from PD2K

.. _ReadRecipe:

ReadRecipe
==========
Returns the current configuration values for a recipe number.

**recipeNum** (INPUT DINT)
  the recipe number to read. The acceptable range is 0-60.
**execute** (INPUT BOOL)
  Executes the command.

**moduleStatus** (INOUT DINT[39])
  The module input data.
**moduleCmds** (INOUT DINT[25])
  The module output data.

**materialA** (OUTPUT DINT)
  the current value for the first material number (paint component).
**materialB** (OUTPUT DINT)
  the current value for the second material number (catalyst component).
**flushSeqA** (OUTPUT DINT)
  the current flush sequence number associated with material A.
**flushSeqB** (OUTPUT DINT)
  the current flush sequence number associated with material B.
**mixRatioSP** (OUTPUT REAL) 
  the current mix ratio setpoint. The value corresponds to the ratio antecedent, i.e. the material A amount. For example, a value of 2.5 corresponds to a ratio of 2.5:1 (material A to material B).
**potLifeTimeSP** (OUTPUT DINT)
  the current pot life time setpoint in minutes.
**busy** (OUTPUT BOOL)
  The busy command flag
**done** (OUTPUT BOOL)
  The done command flag
**aborted** (OUTPUT BOOL)
  The aborted command flag
**error** (OUTPUT BOOL)
  The error command flag
**state** (OUTPUT DINT)
  State data for the command

State Codes
+++++++++++
* 16#1xxx - Busy
* 16#2000 - Done
* 16#4000 - Aborted, command overwritten by another process
* 16#8000 - Error, invalid command ID
* 16#8001 - Error, timeout waiting for DCS registers to become available
* 16#8002 - Error, command unsuccessful
* 16#8003 - Error, timeout waiting for acknowledge from PD2K

.. _ReadRecipePotLifeTime:

ReadRecipePotLifeTime
=====================
Returns the remaining pot life time for a selected recipe if it is currently loaded and mixed. 

This command is particularly useful if multiple guns are enabled.

**recipeNum** (INPUT DINT)
  The recipe number to look up. The acceptable range is 1-60. If not in range, an error will be raised.
**execute** (INPUT BOOL)
  executes the command.

**moduleStatus** (INOUT DINT[39])
  The module input data.
**moduleCmds** (INOUT DINT[25])
  The module output data.

**potLifeTime** (OUTPUT DINT)
  The remaining pot life time in seconds.
**busy** (OUTPUT BOOL)
  The busy command flag
**done** (OUTPUT BOOL)
  The done command flag
**aborted** (OUTPUT BOOL)
  The aborted command flag
**error** (OUTPUT BOOL)
  The error command flag
**state** (OUTPUT DINT)
  State data for the command

State Codes
+++++++++++
* 16#1xxx - Busy
* 16#2000 - Done
* 16#4000 - Aborted, command overwritten by another process
* 16#8000 - Error, invalid command ID
* 16#8001 - Error, timeout waiting for DCS registers to become available
* 16#8002 - Error, command unsuccessful
* 16#8003 - Error, timeout waiting for acknowledge from PD2K

.. _ReadUserID:

ReadUserID
==========
Returns the current user ID for the system.

The returned value is a string of up to 9 characters, not including a null terminator.

**execute** (INPUT BOOL)
  Executes the command
**mixUnitNum** (INPUT DINT)
  mix unit number (1-2)

**userID** (INOUT :ref:`STRING9`)
  The returned user ID
**moduleStatus** (INOUT DINT[39])
  The module input data
**moduleCmds** (INOUT DINT[25])
  The module output data

**busy** (OUTPUT BOOL)
  The busy command flag
**done** (OUTPUT BOOL)
  The done command flag
**aborted** (OUTPUT BOOL)
  The aborted command flag
**error** (OUTPUT BOOL)
  The error command flag
**state** (OUTPUT DINT)
  State data for the command

State Codes
+++++++++++
* 16#1xxx - Busy
* 16#2000 - Done
* 16#4000 - Aborted, command overwritten by another process
* 16#8000 - Error, invalid command ID
* 16#8001 - Error, timeout waiting for DCS registers to become available
* 16#8002 - Error, command unsuccessful
* 16#8003 - Error, timeout waiting for acknowledge from PD2K

.. _RecipeChange:

RecipeChange
============
Performs a recipe change operation.

**execute** (INPUT BOOL)
  executes the command.
**recipeNum** (INPUT DINT)
  The next recipe number to use.

**moduleStatus** (INOUT DINT[39])
  The module input data.
**moduleCmds** (INOUT DINT[25])
  The module output data.

**busy** (OUTPUT BOOL)
  The busy command flag
**done** (OUTPUT BOOL)
  The done command flag
**aborted** (OUTPUT BOOL)
  The aborted command flag
**error** (OUTPUT BOOL)
  The error command flag
**state** (OUTPUT DINT)
  State data for the command

State Codes
+++++++++++
* 16#1xxx - Busy
* 16#2000 - Done
* 16#4000 - Aborted, command overwritten by another process
* 16#8000 - Error, system must be powered on
* 16#8001 - Error, another recipe change is already in progress
* 16#8002 - Error, system alarm is active
* 16#8003 - Error, another operation is active
* 16#8004 - Error, alarm occurred
* 16#8005 - Error, unexpected system mode
* 16#8006 - Error, recipe change did not finish
* 16#8007 - Error, timeout waiting for system registers to become available

.. _SendDCS:

SendDCS
=======
Sends a dynamic command structure (DCS) message to the PD2K system.

For more information about DCS commands, see the system operation manual.

**execute** (INPUT BOOL)
  executes the command.
**cmdID** (INPUT DINT)
  the command number to send.
**arg0** (INPUT DINT)
  argument 0.
**arg1** (INPUT DINT)
  argument 1.
**arg2** (INPUT DINT)
  argument 2.
**arg3** (INPUT DINT)
  argument 3.
**arg4** (INPUT DINT)
  argument 4.
**arg5** (INPUT DINT)
  argument 5.
**arg6** (INPUT DINT)
  argument 6.

**moduleStatus** (INOUT DINT[39])
  The module input data.
**moduleCmds** (INOUT DINT[25])
  The module output data.

**return0** (OUTPUT DINT)
  Return value 0 from the PD2K.
**return1** (OUTPUT DINT)
  Return value 1 from the PD2K.
**return2** (OUTPUT DINT)
  Return value 2 from the PD2K.
**return3** (OUTPUT DINT)
  Return value 3 from the PD2K.
**return4** (OUTPUT DINT)
  Return value 4 from the PD2K.
**return5** (OUTPUT DINT)
  Return value 5 from the PD2K.
**return6** (OUTPUT DINT)
  Return value 6 from the PD2K.
**return7** (OUTPUT DINT)
  Return value 7 from the PD2K.
**busy** (OUTPUT BOOL)
  The busy command flag
**done** (OUTPUT BOOL)
  The done command flag
**aborted** (OUTPUT BOOL)
  The aborted command flag
**error** (OUTPUT BOOL)
  The error command flag
**state** (OUTPUT DINT)
  State data for the command

State Codes
+++++++++++
* 16#1xxx - Busy
* 16#2000 - Done
* 16#4000 - Aborted, command overwritten by another process
* 16#8000 - Error, invalid command ID
* 16#8001 - Error, timeout waiting for DCS registers to become available
* 16#8002 - Error, command unsuccessful
* 16#8003 - Error, timeout waiting for acknowledge from PD2K

.. _StatusToUDT:

StatusToUDT
===========
Reads a PD2K module array into a structured UDT.

**moduleStatus** (INOUT DINT[39])
  The module input data.
**statusUDT** (INOUT :ref:`TypePd2kIntStatus`)
  The structured data from the device.

.. _WriteFluidControlMode:

WriteFluidControlMode
=====================
Sets the fluid control mode for the system.

**mode** (INPUT BOOL)
  the fluid control mode to set (false=flow control, true=pressure control).
**execute** (INPUT BOOL)
  executes the command.

**moduleStatus** (INOUT DINT[39])
  The module input data.
**moduleCmds** (INOUT DINT[25])
  The module output data.

**busy** (OUTPUT BOOL)
  The busy command flag
**done** (OUTPUT BOOL)
  The done command flag
**aborted** (OUTPUT BOOL)
  The aborted command flag
**error** (OUTPUT BOOL)
  The error command flag
**state** (OUTPUT DINT)
  State data for the command

State Codes
+++++++++++
* 16#1xxx - Busy
* 16#2000 - Done
* 16#4000 - Aborted, command overwritten by another process
* 16#8000 - Error, invalid command ID
* 16#8001 - Error, timeout waiting for DCS registers to become available
* 16#8002 - Error, command unsuccessful
* 16#8003 - Error, timeout waiting for acknowledge from PD2K

.. _WriteFlushSeq:

WriteFlushSeq
=============
Configures the values for a flush sequence number.

**flushSeqNum** (INPUT DINT)
  the flush sequence number to configure. The acceptable range is 1-5. If not in range, an error will be raised.
**gunPurgeTime** (INPUT DINT)
  the gun purge time to set in seconds. The acceptable range is 0-999. If not in range, an error will be raised.
**initialFlushVol** (INPUT DINT)
  the initial flush volume setpoint in cc. The acceptable range is 0-9999. If not in range, an error will be raised.
**finalFlushVol** (INPUT DINT)
  the final flush volume setpoint in cc. The acceptable range is 0-9999. If not in range, an error will be raised.
**numWashCycles** (INPUT DINT)
  the number of wash cycles to set. The acceptable range is 0-99. If not in range, an error will be raised.
**strokesPerWashCycle** (INPUT DINT)
  the number of strokes per wash cycle to set. The acceptable range is 0-99. If not in range, an error will be raised.
**execute** (INPUT BOOL)
  executes the command.

**moduleStatus** (INOUT DINT[39])
  The module input data.
**moduleCmds** (INOUT DINT[25])
  The module output data.

**busy** (OUTPUT BOOL)
  The busy command flag
**done** (OUTPUT BOOL)
  The done command flag
**aborted** (OUTPUT BOOL)
  The aborted command flag
**error** (OUTPUT BOOL)
  The error command flag
**state** (OUTPUT DINT)
  State data for the command

State Codes
+++++++++++
* 16#1xxx - Busy
* 16#2000 - Done
* 16#4000 - Aborted, command overwritten by another process
* 16#8000 - Error, invalid command ID
* 16#8001 - Error, timeout waiting for DCS registers to become available
* 16#8002 - Error, command unsuccessful
* 16#8003 - Error, timeout waiting for acknowledge from PD2K

.. _WriteMixFillSP:

WriteMixFillSP
==============
Sets the alternate control setpoint used when filling the line with mixed material.

The mix fill setpoint units and valid range depend on the selected fluid control mode of the system. If the control mode is set to “flow,” the range is 1-1600 cc/min. If set to “pressure,” the range is 1-1500 PSI. If the value is set to 0, this set point will be ignored.

**mixFillSP** (INPUT DINT)
  the new setpoint value.
**execute** (INPUT BOOL)
  executes the command.

**moduleStatus** (INOUT DINT[39])
  The module input data.
**moduleCmds** (INOUT DINT[25])
  The module output data.

**busy** (OUTPUT BOOL)
  The busy command flag
**done** (OUTPUT BOOL)
  The done command flag
**aborted** (OUTPUT BOOL)
  The aborted command flag
**error** (OUTPUT BOOL)
  The error command flag
**state** (OUTPUT DINT)
  State data for the command

State Codes
+++++++++++
* 16#1xxx - Busy
* 16#2000 - Done
* 16#4000 - Aborted, command overwritten by another process
* 16#8000 - Error, invalid command ID
* 16#8001 - Error, timeout waiting for DCS registers to become available
* 16#8002 - Error, command unsuccessful
* 16#8003 - Error, timeout waiting for acknowledge from PD2K

.. _WritePreset:

WritePreset
==========
Configures the values for an applicator preset number.

**presetNum** (INPUT DINT)
  the recipe number to read (0-98)
**execute** (INPUT BOOL)
  Executes the command.
**ctrlSP** (INPUT DINT)
  Flow/pressure control setpoint
**airSP1** (INPUT DINT)
  Air setpoint 1 (psi)
**airSP2** (INPUT DINT)
  Air setpoint 2 (psi)
**turbineSpeed** (INPUT DINT)
  Turbine speed (kRPM)
**voltageSP** (INPUT REAL) 
  Electrostatic voltage setpoint (kV)
**currentSP** (INPUT DINT)
  Electrostatic current setpoint (uA)

**moduleStatus** (INOUT DINT[39])
  The module input data.
**moduleCmds** (INOUT DINT[25])
  The module output data.

**busy** (OUTPUT BOOL)
  The busy command flag
**done** (OUTPUT BOOL)
  The done command flag
**aborted** (OUTPUT BOOL)
  The aborted command flag
**error** (OUTPUT BOOL)
  The error command flag
**state** (OUTPUT DINT)
  State data for the command

State Codes
+++++++++++
* 16#1xxx - Busy
* 16#2000 - Done
* 16#4000 - Aborted, command overwritten by another process
* 16#8000 - Error, invalid command ID
* 16#8001 - Error, timeout waiting for DCS registers to become available
* 16#8002 - Error, command unsuccessful
* 16#8003 - Error, timeout waiting for acknowledge from PD2K

.. _WriteRecipe:

WriteRecipe
===========
Configures the values for a recipe number.

**execute** (INPUT BOOL)
  Executes the command.
**recipeNum** (INPUT DINT)
  the recipe number to configure. The acceptable range is 0-60.
**materialA** (INPUT DINT)
  the first material number to set (paint component). The acceptable range is 0-30.
**materialB** (INPUT DINT)
  the second material number to set (catalyst component). The acceptable range is 0,31-34.
**materialAFlushSeq** (INPUT DINT)
  the flush sequence number to use with material A. The acceptable range is 1-5.
**materialBFlushSeq** (INPUT DINT)
  the flush sequence number to use with material B. The acceptable range is 1-5. If not in range, an error will be raised.
**mixRatioSP** (INPUT REAL)
  the mix ratio setpoint to use. The value corresponds to the ratio antecedent, i.e. the material A amount. For example, a value of 2.5 corresponds to a ratio of 2.5:1 (material A to material B). For single component recipes, set the value to 0. The max precision is two decimal places; anything beyond that will be rounded. The acceptable range is 0-50.
**potLifeTimeSP** (INPUT DINT)
  the total pot life time to set in minutes. The acceptable range is 0-999 minutes.

**moduleStatus** (INOUT DINT[39])
  The module input data.
**moduleCmds** (INOUT DINT[25])
  The module output data.

**busy** (OUTPUT BOOL)
  The busy command flag
**done** (OUTPUT BOOL)
  The done command flag
**aborted** (OUTPUT BOOL)
  The aborted command flag
**error** (OUTPUT BOOL)
  The error command flag
**state** (OUTPUT DINT)
  State data for the command

State Codes
+++++++++++
* 16#1xxx - Busy
* 16#2000 - Done
* 16#4000 - Aborted, command overwritten by another process
* 16#8000 - Error, invalid command ID
* 16#8001 - Error, timeout waiting for DCS registers to become available
* 16#8002 - Error, command unsuccessful
* 16#8003 - Error, timeout waiting for acknowledge from PD2K

.. _WriteUserID:

WriteUserID
===========
Sets the current user ID for the system.

The user ID can be up to 9 characters in length. The value sent to the PD2K will include a null terminator for a total of 10 characters. Only ASCII characters are supported.

**execute** (INPUT BOOL)
  Executes the command

**userID** (INOUT :ref:`STRING9`)
  The new user ID
**moduleStatus** (INOUT DINT[39])
  The module input data
**moduleCmds** (INOUT DINT[25])
  The module output data.

**busy** (OUTPUT BOOL)
  The busy command flag
**done** (OUTPUT BOOL)
  The done command flag
**aborted** (OUTPUT BOOL)
  The aborted command flag
**error** (OUTPUT BOOL)
  The error command flag
**state** (OUTPUT DINT)
  State data for the command

State Codes
+++++++++++
* 16#1xxx - Busy
* 16#2000 - Done
* 16#4000 - Aborted, command overwritten by another process
* 16#8000 - Error, invalid command ID
* 16#8001 - Error, timeout waiting for DCS registers to become available
* 16#8002 - Error, command unsuccessful
* 16#8003 - Error, timeout waiting for acknowledge from PD2K

User-Defined Types (UDTs)
*************************

.. _TypePd2kIntGunModeFlags:

TypePd2kIntGunModeFlags
=======================
Status flags for the PD2K Integrated applicator.

**off** (BOOL)
  gun off
**offAlarm** (BOOL)
  gun off with alarm
**startup** (BOOL)
  startup
**idle** (BOOL)
  idle
**spray** (BOOL)
  spraying
**purge** (BOOL)
  purging

.. _TypePd2kPumpStatusFlags:

TypePd2kPumpStatusFlags
=======================
Status flags for a PD2K pump.

**off** (BOOL)
  pump is off.
**standby** (BOOL)
  pump is in standby.
**busy** (BOOL)
  pump is busy.
**flushing** (BOOL)
  pump is flushing.
**priming** (BOOL)
  pump is priming.

.. _TypePd2kIntStatus:

TypePd2kIntStatus
==================
Status data read from a PD2K Integrated system.

**standby** (BOOL)
  in standby
**gun1TriggerStatus** (BOOL)
  gun 1 trigger status (1 = on)
**gun2TriggerStatus** (BOOL)
  gun 2 trigger status(1 = on)
**gun3TriggerStatus** (BOOL)
  gun 3 trigger status(1 = on)
**safetyInterlockStatus** (BOOL)
  safety interlock status
**electrostaticTriggerStatus** (BOOL)
  electrostatic trigger status
**innerAirStatus** (BOOL)
  inner air / atomizing air solenoid status
**outerAirStatus** (BOOL)
  outer air / fan air solenoid status
**gun1SolenoidStatus** (BOOL)
  gun 1 solenoid status
**aux1SolenoidStatus** (BOOL)
  auxiliary signal 1 solenoid status (gun 2 or dump valve)
**aux2SolenoidStatus** (BOOL)
  auxiliary signal 2 solenoid status (gun 3 or cup wash valve)
**aux3SolenoidStatus** (BOOL)
  auxiliary signal 3 solenoid status
**systemMode** (DINT)
  system mode
**systemModeFlags**	(TypePd2kSystemModeFlags_)
  system mode flags
**pump1Status** (DINT)
  pump 1 status
**pump1StatusFlags** (`TypePd2kPumpStatusFlags`_)
  pump 1 status flags
**pump2Status** (DINT)
  pump 2 status
**pump2StatusFlags** (`TypePd2kPumpStatusFlags`_)
  pump 2 status flags
**pump3Status** (DINT)
  pump 3 status
**pump3StatusFlags** (`TypePd2kPumpStatusFlags`_)
  pump 3 status flags
**pump4Status** (DINT)
  pump 4 status
**pump4StatusFlags** (`TypePd2kPumpStatusFlags`_)
  pump 4 status flags
**actualMixFlow** (DINT)
  actual mix flow (cc/min)
**actualMixRatio** (DINT)
  actual mix ratio
**actualPotLifeRemaining** (DINT)
  actual pot life remaining
**activeRecipeNum**	(DINT)
  active recipe number
**activeMaterialA**	(DINT)
  active material A
**activeMaterialB**	(DINT)
  active material B
**activeFlushSeqA**	(DINT)
  active flush sequence A
**activeFlushSeqB**	(DINT)
  active flush sequence B
**activeRatioSP** (DINT)
  active ratio SP
**activePotLifeSP**	(DINT)
  active pot life SP
**gunMode** (DINT)
  gun mode
**gunModeFlags** (`TypePd2kIntGunModeFlags`_)
  gun mode flags
**gunActivePresetNum** (DINT)
  gun active preset number
**targetShapingAir1** (DINT)
  target shaping air 1 (psi)
**targetShapingAir2** (DINT)
  target shaping air 2 (psi)
**targetSpeed** (DINT)
  target turbine speed (kRPM)
**targetVoltage** (DINT)
  target electrostatic voltage (kV)
**actualShapingAir1** (DINT)
  actual shaping air 1 (psi)
**actualShapingAir2** (DINT)
  actual shaping air 2 (psi)
**actualSpeed** (DINT)
  actual turbine speed (kRPM)
**actualVoltage** (DINT)
  actual electrostatic voltage (kV)
**actualCurrent** (DINT)
 actual electrostatic current (uA)
**dcsAck** (DINT)
  DCS acknowledge
**dcsReturn0** (DINT)
  DCS return 0
**dcsReturn1** (DINT)
  DCS return 1
**dcsReturn2** (DINT)
  DCS return 2
**dcsReturn3** (DINT)
  DCS return 3
**dcsReturn4** (DINT)
  DCS return 4
**dcsReturn5** (DINT)
  DCS return 5
**dcsReturn6** (DINT)
  DCS return 6
**dcsReturn7** (DINT)
  DCS return 7

.. _TypePd2kSystemModeFlags:

TypePd2kSystemModeFlags
=======================
Flags for the PD2K system mode.

**pumpOff** (BOOL)
  pump off
**colorChange** (BOOL)
  color change enabled
**colorChangePurgeA** (BOOL)
  color change purging component A
**colorChangePurgeB** (BOOL)
  color change purging component B
**colorChangeFilling** (BOOL)
  color change filling
**colorChangeMixFill** (BOOL)
  color change mix fill
**colorChangeMix** (BOOL)
  color change mixing
**colorChangeMixIdle** (BOOL)
  color change mix idle
**purgeA** (BOOL)
  purging component A
**purgeB** (BOOL)
  purging component B
**standbyMixReady** (BOOL)
  standby mix ready
**standbyFillReady** (BOOL)
  standby fill ready
**standbyMixNotReady** (BOOL)
  standby mix not ready
**standbyAlarm** (BOOL)
  standby alarm
**lineFillingFlushing** (BOOL)
  line is filling or flushing