GracoPd2kInt API

Functions (FC)

DecodeDateTime

Convert from Graco-formatted date and time data into Siemens DTL.

The Graco date format is encoded as four bytes. These bytes correspond to the following (in MSB order): - byte 1: last two digits in year (0-99). Starts at year 2000 (0) and max year is 2099 (99). - byte 2: month number, with January=1, February=2, etc. 0 is not a valid month number. - byte 3: day number (1=the 1st of the month). 0 is not a valid day number. - byte 4: day of week (1=Monday, … 7=Sunday). 0 is not a valid day of week number. The Graco time format is also encoded as four bytes: - byte 1: not used - byte 2: hour number (24 hour format). 0=midnight, 1=1AM, etc. - byte 3: minute number (0-59) - byte 4: seconds number (0-59)

dateSource (INPUT DWord)

Graco date format source

timeSource (INPUT DWord)

Graco time format source

dateTimeDest (OUTPUT DTL)

Datetime result

RETURN (Void)

DecodeEventCode

Convert an event/alarm code into a Siemens String. Event codes are always 4 ASCII characters in length.

source (INPUT DWord)

Event code source, packed into DWord

dest (OUTPUT STRING)

String result

RETURN (Void)

DecodeUserID

Convert a user ID into a Siemens String. User IDs are sent as 3 DWords each containing up to 4 ASCII characters. The max length of the entire user ID is 9 characters.

source1 (INPUT DWord)

User ID source, first four chars, packed as DWord

source2 (INPUT DWord)

User ID source, chars 5-8, packed as DWord

source3 (INPUT DWord)

User ID source, char 9, packed as DWord

dest (OUTPUT STRING)

String result

RETURN (Void)

EncodeUserID

Converts a Siemens String into an equivalent set of DWords for a user ID. The max length of a user ID is 9 characters, and this FC will only process the String up to that length.

source (INPUT STRING)

String source

dest1 (OUTPUT DWord)

Result, first four chars, packed as DWord

dest2 (OUTPUT DWord)

Result, chars 5-8, packed as DWord

dest3 (OUTPUT DWord)

Result, char 9, packed as DWord

RETURN (Void)

GetDataBySlotNum

Read data from the specified Profinet device number(defined in target parameter) and a slot number. This FC uses the GEO2LOG and RD_ADDR built-in functions internally to lookup the process data address. The status codes from those functions are forwarded through the return value of this function.

pnSlotNum (INPUT UInt)

Profinet slot number

target (INOUT TypeTarget)

target to operate on

data (OUTPUT DWord)

Current process data

RETURN (TypeFunctionCmdState)

SetDataBySlotNum

Writes data to a specified Profinet device number (defined in target parameter) and a slot number. This FC uses the GEO2LOG and RD_ADDR built-in functions internally to lookup the process data address. The status codes from those functions are forwarded through the return value of this function.

pnSlotNum (INPUT UInt)

Profinet slot number

data (INPUT DWord)

Data to write

target (INOUT TypeTarget)

target to operate on

RETURN (TypeFunctionCmdState)

StatusToUDT

Read status data from a PD2K Integrated device and collect it into a user-defined data type. This provides a more-convenient view of the available data compared to accessing it directly. If an error occurs while attempting to read the device data, the state codes from GetDataBySlotNum will be forwarded through the return value of this function.

target (INOUT TypeTarget)

Target to operate on

statusUDT (OUTPUT TypePd2kIntStatus)

Status data packed in a user-defined data type

RETURN (TypeFunctionCmdState)

Function Blocks (FB)

GunControl

An interface into the gun controls for the PD2K Integrated system. This allows you to control the gun mode, gun trigger(s), air solenoids, electrostatics, the dynamic preset values, and other gun-related functions. The control inputs come from a user-defined type - see TypeGunControls.

enable (INPUT Bool)

Enable command

applicatorType (INPUT USInt)

Applicator type (0=AirPro Auto, 1=G40 Auto, 2=AirProEFX, 3=Pro XPc Auto, 4=ProBell)

controls (INOUT TypeGunControls)

controls

target (INOUT TypeTarget)

target to operate on

state (OUTPUT TypeEnableCmdState)

Command state

State codes

  • 16#3000 - Command is valid, running

  • 16#8000 - Error, device number is invalid

  • 16#8001 - Internal error

  • 16#0000 - Command is disabled

PumpControl

An interface into the pump controls for the PD2K Integrated system. This allows you to control the pump system state (e.g. mixing, standby, recipe change), clear alarms, complete a job, and set the mix control setpoint. The control inputs come from a user-defined data type - see TypePumpControlInputs.

enable (INPUT Bool)

Enable command

controls (INOUT TypePumpControls)

Controls

target (INOUT TypeTarget)

Target to operate on

state (OUTPUT TypeEnableCmdState)

Command state

State codes

  • 16#3000 - Command is valid, running

  • 16#8000 - Error, device number is invalid

  • 16#8001 - Internal error

  • 16#0000 - Command is disabled

ReadAlarmInfo

Read an alarm record from the PD2K. See SendDCS for state codes.

indexNum (INPUT USInt)

Index number (0-199)

execute (INOUT Bool)

Execute command

target (INOUT TypeTarget)

Target to operate on

eventCode (OUTPUT STRING[4])

Event code

dateTime (OUTPUT DTL)

Event datetime

state (OUTPUT TypeExecuteCmdState)

Command state

ReadEventInfo

Read an event record from the PD2K. See SendDCS for state codes.

indexNum (INPUT USInt)

Index number (0-199)

execute (INOUT Bool)

Execute command

target (INOUT TypeTarget)

Target to operate on

eventCode (OUTPUT STRING[4])

Event code

dateTime (OUTPUT DTL)

Event datetime

state (OUTPUT TypeExecuteCmdState)

Command state

ReadFluidControlMode

Read the current fluid control mode (flow or pressure). See SendDCS for state codes.

execute (INOUT Bool)

Execute command

target (INOUT TypeTarget)

Target to operate on

fluidControlMode (OUTPUT Bool)

Fluid control mode (False=flow, True=pressure)

state (OUTPUT TypeExecuteCmdState)

Command state

ReadFlushSeq

Read parameters for a flush sequence. See SendDCS for state codes.

flushSeqNum (INPUT USInt)

Flush sequence number (1-5)

execute (INOUT Bool)

Execute command

target (INOUT TypeTarget)

Target to operate on

gunPurgeTime (OUTPUT UInt)

Gun purge time (s)

initialFlushVol (OUTPUT UInt)

Initial flush volume (cc)

finalFlushVol (OUTPUT UInt)

Final flush volume (cc)

numWashCycles (OUTPUT USInt)

Number of wash cycles

strokesPerWashCycle (OUTPUT USInt)

Number of strokes per wash cycle

state (OUTPUT TypeExecuteCmdState)

Command state

ReadGunContents

Read the recipe number currently loaded in a specified gun number. This will return 0 if the gun is filled with solvent, or 61 if the material is unknown. See SendDCS for state codes.

gunNum (INPUT USInt)

Gun number (1-3)

execute (INOUT Bool)

Execute command

target (INOUT TypeTarget)

Target to operate on

recipeNum (OUTPUT USInt)

Recipe number

state (OUTPUT TypeExecuteCmdState)

Command state

ReadJobInfo

Read a job record from the PD2K. See SendDCS for state codes.

indexNum (INPUT USInt)

Index number

execute (INOUT Bool)

Execute command

target (INOUT TypeTarget)

Target to operate on

dateTime (OUTPUT DTL)

Recorded datetime

jobNum (OUTPUT UInt)

Job number

recipeNum (OUTPUT USInt)

Recipe number

totalVol (OUTPUT UDInt)

Total volume of mixed material (cc)

userID (OUTPUT STRING[9])

User ID

state (OUTPUT TypeExecuteCmdState)

Command state

ReadMixFillSP

Read the current mix fill setpoint. See SendDCS for state codes.

execute (INOUT Bool)

Execute command

target (INOUT TypeTarget)

Target to operate on

mixFillSP (OUTPUT UInt)

Current mix fill setpoint (cc/min for flow mode, psi for pressure mode, 0 if disabled)

state (OUTPUT TypeExecuteCmdState)

Command state

ReadPreset

Read the parameters for a specified gun preset number. See SendDCS for state codes.

presetNum (INPUT USInt)

Preset number (0-98)

execute (INOUT Bool)

Execute command

target (INOUT TypeTarget)

Target to operate on

controlSP (OUTPUT UInt)

Fluid control setpoint (cc/min for flow mode, psi for pressure mode)

innerAirSP (OUTPUT USInt)

Inner/atomizing air setpoint (psi)

outerAirSP (OUTPUT USInt)

Outer/fan air setpoint (psi)

turbineSpeedSP (OUTPUT USInt)

Turbine speed (kRPM)

elecVoltageSP (OUTPUT USInt)

Electrostatic voltage setpoint (kV)

elecCurrentSP (OUTPUT USInt)

Electrostatic current setpoint (uA)

state (OUTPUT TypeExecuteCmdState)

Command state

ReadPumpMaterial

Read the material number currently loaded in a specified pump number. See SendDCS for state codes.

pumpNum (INPUT USInt)

Pump number (1-4)

execute (INOUT Bool)

Execute command

target (INOUT TypeTarget)

Target to operate on

materialNum (OUTPUT USInt)

Material number

state (OUTPUT TypeExecuteCmdState)

Command state

ReadRecipe

Read parameters for a given recipe number. See SendDCS for state codes.

recipeNum (INPUT USInt)

Recipe number (0-60)

execute (INOUT Bool)

Execute command

target (INOUT TypeTarget)

Target to operate on

matNumA (OUTPUT USInt)

Material number of component A

matNumB (OUTPUT USInt)

Material number of component B

flushSeqNumA (OUTPUT USInt)

Flush sequence number for component A

flushSeqNumB (OUTPUT USInt)

Flush sequence number for component B

mixRatioSP (OUTPUT UInt)

Mix ratio setpoint (A*100 : B)

potLifeTimeSP (OUTPUT UInt)

Potlife time setpoint (min)

state (OUTPUT TypeExecuteCmdState)

Command state

ReadRecipePotLifeTime

Read the remaining potlife for a given recipe number if it is currently loaded and mixed. This command will return the max UInt value (65535, or 16#FFFF) if there is no potlife time associated with the recipe or if the timer has not started. See SendDCS for state codes.

recipeNum (INPUT USInt)

Recipe number (1-60)

execute (INOUT Bool)

Execute command

target (INOUT TypeTarget)

Target to operate on

potLifeTimeRem (OUTPUT UInt)

Remaining potlife time (min)

state (OUTPUT TypeExecuteCmdState)

Command state

ReadUserID

Read the current User ID. See SendDCS for state codes.

execute (INOUT Bool)

Execute command

target (INOUT TypeTarget)

Target to operate on

userID (OUTPUT STRING[9])

User ID

state (OUTPUT TypeExecuteCmdState)

Command state

SendDCS

Send a dynamic command structure (DCS) to the PD2K. See the operation manual for more details regarding the DCS.

cmdID (INPUT USInt)

Command ID

arg1 (INPUT DWord)

Argument 1

arg2 (INPUT DWord)

Argument 2

arg3 (INPUT DWord)

Argument 3

arg4 (INPUT DWord)

Argument 4

arg5 (INPUT DWord)

Argument 5

arg6 (INPUT DWord)

Argument 6

arg7 (INPUT DWord)

Argument 7

execute (INOUT Bool)

Execute command

target (INOUT TypeTarget)

Target to operate on

ret1 (OUTPUT DWord)

Return 1

ret2 (OUTPUT DWord)

Return 2

ret3 (OUTPUT DWord)

Return 3

ret4 (OUTPUT DWord)

Return 4

ret5 (OUTPUT DWord)

Return 5

ret6 (OUTPUT DWord)

Return 6

ret7 (OUTPUT DWord)

Return 7

ret8 (OUTPUT DWord)

Return 8

state (OUTPUT TypeExecuteCmdState)

Command state

State codes

  • 16#2000 - Command completed

  • 16#4000 - Command was aborted

  • 16#8000 - Error, command ID must be non-zero

  • 16#8001 - Error, device number is invalid

  • 16#8002 - Internal error

  • 16#8003 - Error, timed out waiting for DCS registers to be available

  • 16#8004 - Error, DCS command failed

  • 16#8005 - Error, timed out waiting for acknowledge signal

WriteFluidControlMode

Write a value for the fluid control mode. See SendDCS for state codes.

fluidControlMode (INPUT Bool)

Fluid control mode (False=flow, True=pressure)

execute (INOUT Bool)

Execute command

target (INOUT TypeTarget)

Target to operate on

state (OUTPUT TypeExecuteCmdState)

Command state

WriteFlushSeq

Write the parameters for a given flush sequence number. See SendDCS for state codes.

flushSeqNum (INPUT USInt)

Flush sequence number (1-5)

gunPurgeTime (INPUT UInt)

Gun purge time (0-999 s)

initFlushVol (INPUT UInt)

Initial flush volume (0-9999 cc)

finalFlushVol (INPUT UInt)

Final flush volume (0-9999 cc)

numWashCycles (INPUT USInt)

Number of wash cycles (0-99)

strokesPerWashCycle (INPUT USInt)

Number of strokes per wash cycle (0-99)

execute (INOUT Bool)

Execute command

target (INOUT TypeTarget)

Target to operate on

state (OUTPUT TypeExecuteCmdState)

Command state

WriteMixFillSP

Write a value for the mix fill setpoint. See SendDCS for state codes.

mixFillSP (INPUT UInt)

Mix fill setpoint (1-1600 cc/min for flow mode, 1-1500 psi for pressure mode, 0 for disabled)

execute (INOUT Bool)

Execute command

target (INOUT TypeTarget)

Target to operate on

state (OUTPUT TypeExecuteCmdState)

Command state

WritePreset

Write the parameters for a given gun preset number. See SendDCS for state codes.

presetNum (INPUT USInt)

Preset number (0-98)

controlSP (INPUT UInt)

Fluid control setpoint (1-1600 cc/min for flow mode, 1-1500 psi for pressure mode)

innerAirSP (INPUT USInt)

Inner/atomizing air setpoint (7-99 psi)

outerAirSP (INPUT USInt)

Outer/fan air setpoint (7-99 psi)

turbineSpeedSP (INPUT USInt)

Turbine speed setpoint (10-60 kRPM)

elecVoltageSP (INPUT USInt)

Electrostatics voltage setpoint (0-100 kV)

elecCurrentSP (INPUT USInt)

Electrostatics current setpoint (0-150 uA)

execute (INOUT Bool)

Execute command

target (INOUT TypeTarget)

Target to operate on

state (OUTPUT TypeExecuteCmdState)

Command state

WriteRecipe

Write the parameters for a given recipe number. See SendDCS for state codes.

recipeNum (INPUT USInt)

Recipe number (0-21)

matNumA (INPUT USInt)

Material number for component A (0-30)

matNumB (INPUT USInt)

Material number for component B (0, 31-34)

flushSeqNumA (INPUT USInt)

Flush sequence number for component A (1-5)

flushSeqNumB (INPUT USInt)

Flush sequence number for component B (1-5)

mixRatioSP (INPUT UInt)

Mix ratio setpoint (0-5000, A*100 : B)

potLifeTimeSP (INPUT UInt)

Potlife time setpoint (0-999 min)

execute (INOUT Bool)

Execute command

target (INOUT TypeTarget)

Target to operate on

state (OUTPUT TypeExecuteCmdState)

Command state

WriteUserID

Write a value for the user ID. See SendDCS for state codes.

userID (INPUT STRING[9])

User ID

execute (INOUT Bool)

Execute command

target (INOUT TypeTarget)

Target to operate on

state (OUTPUT TypeExecuteCmdState)

Command state

UDTs

TypeDcsAckFlags

Acknowledge flags for DCS

nop (Bool)

No operation

busy (Bool)

Busy

ack (Bool)

Acknowledged successfully

nak (Bool)

Not acknowledged

err (Bool)

Error

TypeEnableCmdState

State for enable commands

aborted (Bool)

Command aborted

busy (Bool)

Command is busy

error (Bool)

Command error

valid (Bool)

Command is valid

code (Word)

state code

TypeExecuteCmdState

State for execute commands

aborted (Bool)

Command aborted

busy (Bool)

Command is busy

error (Bool)

Command error

done (Bool)

Command is done

code (Word)

State code

TypeFunctionCmdState

State for function commands

error (Bool)

Command error

done (Bool)

Command completed

code (Word)

State code

TypeGunControls

Gun control inputs. See GunControl.

sprayCmd (Bool)

Spray mode command

powerOffCmd (Bool)

Power off command

powerOnCmd (Bool)

Power on command

quickStopCmd (Bool)

Quick stop command

purgeCmd (Bool)

Purge mode command

idleCmd (Bool)

Idle mode command

innerAirOffCmd (Bool)

Inner air off command

innerAirOnCmd (Bool)

Inner air on command

outerAirOffCmd (Bool)

Outer air off command

outerAirOnCmd (Bool)

Outer air on command

gun1OffCmd (Bool)

Gun 1 off command

gun1OnCmd (Bool)

Gun 1 on command

gun2OffCmd (Bool)

Gun 2 off command

gun2OnCmd (Bool)

Gun 2 on command

gun3OffCmd (Bool)

Gun 3 off command

gun3OnCmd (Bool)

Gun 3 on command

openDumpValve (Bool)

Open dump valve command

closeDumpValve (Bool)

Close dump valve command

openCupWashValve (Bool)

Open cup wash valve command

closeCupWashValve (Bool)

Close cup wash valve command

aux3OffCmd (Bool)

Auxilliary solenoid 3 off command

aux3OnCmd (Bool)

Auxiliary solenoid 3 on command

electrostaticsOffCmd (Bool)

Electrostatics off command

electrostaticsOnCmd (Bool)

Electrostatics on command

gunPresetNum (USInt)

Gun preset number

dynInnerAirSP (USInt)

Dynamic preset inner air setpoint (psi)

dynOuterAirSP (USInt)

Dynamic preset outer air setpoint (psi)

dynTurbineSpeedSP (USInt)

Dynamic preset turbine speed setpoint (kRPM)

dynElecVoltageSP (USInt)

Dynamic preset electrostatics voltage setpoint (kV)

dynElecCurrentSP (USInt)

Dynamic preset electrostatics current setpoint (uA)

TypePd2kIntGunModeFlags

Gun mode flags

off (Bool)

Gun power off

offAlarm (Bool)

Gun power off, alarm is active

startup (Bool)

Gun startup

idle (Bool)

Gun in idle mode

spray (Bool)

Gun in spray mode

purge (Bool)

Gun in purge mode

TypePd2kIntPumpStatusFlags

Pump status flags

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

PD2K Integrated status data. See StatusToUDT.

inStandby (Bool)

System is in standby

gun1Trigger (Bool)

Gun 1 trigger status

gun2Trigger (Bool)

Gun 2 trigger status

gun3Trigger (Bool)

Gun 3 trigger status

safetyInterlock (Bool)

Safety interlock status

elecOn (Bool)

Electrostatics on status

innerAirOn (Bool)

Inner air on status

outerAirOn (Bool)

Outer air on status

gun1Solenoid (Bool)

Gun 1 solenoid on status

gun2Solenoid (Bool)

Gun 2 solenoid on status

gun3Solenoid (Bool)

Gun 3 solenoid on status

dumpValve (Bool)

Dump valve on status

cupWashValve (Bool)

Cup wash valve on status

aux3Solenoid (Bool)

Auxiliary solenoid 3 on status

systemMode (USInt)

System mode

systemModeFlags (TypePd2kIntSystemModeFlags)

System status flags

pump1Status (USInt)

Pump 1 status

pump1StatusFlags (TypePd2kIntPumpStatusFlags)

Pump 1 status flags

pump2Status (USInt)

Pump 2 status

pump2StatusFlags (TypePd2kIntPumpStatusFlags)

Pump 2 status flags

pump3Status (USInt)

Pump 3 status

pump3StatusFlags (TypePd2kIntPumpStatusFlags)

Pump 3 status flags

pump4Status (USInt)

Pump 4 status

pump4StatusFlags (TypePd2kIntPumpStatusFlags)

Pump 4 status flags

actualMixFlow (UInt)

Actual mix flow/pressure (cc/min in flow mode, psi in pressure mode)

actualMixRatio (UInt)

Actual mix ratio (A*100 : B)

actualPotLifeRemaining (UInt)

Actual pot life time remaining (sec)

activeRecipeNum (USInt)

Active recipe number

activeMatNumA (USInt)

Active material number for component A

activeMatNumB (USInt)

Active material number for component B

activeFlushSeqNumA (USInt)

Active flush sequence number for component A

activeFlushSeqNumB (USInt)

Active flush sequence number for component B

activeRatioSP (UInt)

Active mix ratio setpoint (A*100 : B)

activePotLifeSP (UInt)

Active pot life setpoint (min)

gunMode (USInt)

Current gun mode

gunModeFlags (TypePd2kIntGunModeFlags)

Current gun mode flags

gunActivePresetNum (USInt)

Active gun preset number

targetShapingAir1 (USInt)

Target shaping air 1 (psi)

targetShapingAir2 (USInt)

Target shaping air 2 (psi)

targetTurbineSpeed (USInt)

Target turbine speed (kRPM)

targetElecVoltage (USInt)

Target electrostatics voltage (kV)

actualShapingAir1 (USInt)

Actual shaping air 1 (psi)

actualShapingAir2 (USInt)

Actual shaping air 2 (psi)

actualTurbineSpeed (USInt)

Actual turbine speed (kRPM)

actualElecVoltage (USInt)

Actual electrostatics voltage (kV)

actualElecCurrent (USInt)

Actual electrostatics current (uA)

dcsAck (USInt)

DCS acknowledge

dcsAckFlags (TypeDcsAckFlags)

DCS acknowledge flags

dcsRet1 (DWord)

DCS return 1

dcsRet2 (DWord)

DCS return 2

dcsRet3 (DWord)

DCS return 3

dcsRet4 (DWord)

DCS return 4

dcsRet5 (DWord)

DCS return 5

dcsRet6 (DWord)

DCS return 6

dcsRet7 (DWord)

DCS return 7

dcsRet8 (DWord)

DCS return 8

TypePd2kIntSystemModeFlags

System mode flags

pumpOff (Bool)

System is off

colorChange (Bool)

Color change is active

colorChangePurgeA (Bool)

Color change is active, purging component A

colorChangePurgeB (Bool)

Color change is active, purging component B

colorChangeFilling (Bool)

Color change is active, filling

mixFill (Bool)

System in mix fill mode

mix (Bool)

System in mix mode

mixIdle (Bool)

System in mix idle mode

purgeA (Bool)

Purging component A

purgeB (Bool)

Purging component B

standbyMixReady (Bool)

Standby, mix ready

standbyFillReady (Bool)

Standby, ready for fill

standbyMixNotReady (Bool)

Standby, mix is not ready

standbyAlarm (Bool)

Standby, alarm is active

lineFillingFlushing (Bool)

Line is filling/flushing

TypePumpControls

Pump control inputs. See PumpControl.

powerOnCmd (Bool)

Power on command

powerOffCmd (Bool)

Power off command

quickStopCmd (Bool)

Quick stop command

recipeChangeCmd (Bool)

Recipe change command

clearAlarm (Bool)

Clear alarm command

completeJob (Bool)

Complete job command

ctrlMode (Bool)

Control mode (0=flow, 1=pressure)

mixCmd (Bool)

Mix mode command

mixFillCmd (Bool)

Mix fill mode command

recipePurgeCmd (Bool)

Recipe purge command

standbyCmd (Bool)

Standby mode command

mixCtrlSP (UInt)

Mix control SP (cc/min for flow mode, psi for pressure mode)

nextRecipeNum (UInt)

Next recipe number

TypeTarget

Defines a target Profinet device. See Using TypeTarget.

simulate (Bool)

Simulation mode select (1=on)

pnDeviceNum (UInt)

Profinet device number

simData (Array[1..64] of DWord)

Simulation data