FunctionBlocks Additional MC_ExchangeConfigurationFB - ThorstenBrach/SRCI GitHub Wiki

MC_ExchangeConfigurationFB

📝 Description:

Reads and writes specific configuration parameters on RC that are required for the RI to work.

Caution

This command is used internally by the RobotTask functionblock and should not be used directly within the application. The RobotTask functionblock automatically provides the extracted data in the UserData.

⚙️ FB Variables:

VAR_INPUT
Parameter Data Type Default Value Description Required

InternalLogger

IMessageLogger

-

For internal usage only

-

ExternalLogger

IMessageLogger

-

For internal usage only

-

LogLevel

LogLevelEnum

-

For internal usage only

-

Name

STRING(20)

-

User defined command name

O

ExecMode

ExecutionMode

SEQUENCE_PRIMARY

Execution mode of the command

M

Priority

PriorityLevel

PriorityLevel.NORMAL

Priority of the command

M

Enable

BOOL

-

Enable / Disable the command at rising / falling edge

M

ParCmd

[ExchangeConfigurationParCmd]

-

Command specific parameter

M

VAR_IN_OUT
Parameter Data Type Default Value Description Required

AxesGroup

AxesGroup

-

Robot group assigned to the function

M

VAR_OUTPUT
Parameter Data Type Default Value Description Required

CommandData

RobotLibraryCommandDataFB

-

For internal usage only

-

ResponseData

RobotLibraryResponseDataFB

-

For internal usage only

-

Error

BOOL

-

Error occurred during execution. See ErrorID for details

M

ErrorID

WORD

-

Error ID as raw value for error diagnosis

M

ErrorIDEnum

RobotLibraryErrorIdEnum

-

Error ID as enumeration for error diagnosis

M

ErrorAddTxt

STRING(MAX_ADD_TEXT_LENGTH)

-

Additional error text information

M

WarningID

WORD

-

Warning ID as raw value for identifying warnings

M

WarningIDEnum

RobotLibraryWarningIdEnum

-

Warning ID as enumeration for identifying warning

M

InfoID

WORD

-

Info ID for as raw value for identifying additional information

M

InfoIDEnum

RobotLibraryInfoIdEnum

-

Info ID for as enumeration for identifying additional information

M

Enabled

BOOL

-

Command enabled successfully

M

Busy

BOOL

-

Function block is being processed

M

CommmandBuffered

BOOL

-

Command was transferred to the robot-controller and confirmed

M

ParameterAccepted

BOOL

-

Receiving of input parameter values has been acknowledged by RC

M

OutCmd

[ExchangeConfigurationParCmd]

-

Command specific outputs

M

⚙️ FB_Structures:

ExchangeConfigurationParCmd
Parameter Data Type Default Value Description Required

LogLevel

LogLevel

-

Defines up to which level of severity messages will be logged in the RC’s server log

M

WaitAtBlendingZone

BOOL

-

Defines blending behavior for single move commands. One of the optional modes must be supported.
• 0 (default): Move to end position – Robot moves exactly to the target position regardless of the selected "BlendingMode"
• 1: Wait at blending parameter – Robot stops its movement when the specified blending parameter is reached

M

AllowSecSeqWhileSubprogram

BOOL

-

Allow a sequence switch from primary to secondary while a subprogram called via CallSubprogram is in progress

M

AllowDynamicBlending

BOOL

-

Allows blending when CallSubprogram is called in sequence and removed afterwards.
• 0 (default): Dynamic blending is prevented
• 1: Dynamic blending is allowed

M

DelayTime

UINT

-

Waiting time of RC between receiving first move command (when queue is empty) and starting movement

M

WaitForNrOfCmd

UINT

-

Number of points required to calculate the blending

M

LifeSignTimeOut

UINT

50

Maximum allowed time between LifeSign updates before communication error
• <10 ms: Invalid
• 50 ms: default

M

SyncDelay

UINT

0

Delay time between detecting configuration inconsistency and executing SyncReaction
Always positive
Default: 0 ms

M

SyncReaction

SyncReaction

-

Reaction in case of synchronization data inconsistency

M

DataInSync

DataInSync

-

Datas which are synchronized

M

DataEnableSync

DataEnableSync

-

Enable datas to synchronize

M

ExchangeConfigurationOutCmd
Parameter Data Type Default Value Description Required

LengthACR

UINT

-

Metric of how many CMDs the RC can receive and manage at the same time

M

HighestToolIndex

USINT

-

Highest index of available tools on the RC

M

HighestFrameIndex

USINT

-

Highest index of available frames on the RC

M

HighestLoadIndex

USINT

-

Highest index of available loads on the RC

M

HighestWorkAreaIndex

USINT

-

Highest index of available work areas on the RC

M

DataInSync

DataInSync

-

Datas which are synchronized

M

ChangeIndexTool

USINT

-

Index of tool changed on RC

M

ChangeIndexFrame

USINT

-

Index of frame changed on RC

M

ChangeIndexLoad

USINT

-

Index of load changed on RC

M

ChangeIndexWorkArea

USINT

-

Index of work area changed on RC

M

RAWorkingHours

UDINT

-

Working hours of a connected RA

M

BrakeTestRequired

BOOL

-

Signals that a brake test is required within monitoring time

M

StepModeExactStopActive

BOOL

-

StepMode is active and set to ExactStop

M

StepModeBlendingActive

BOOL

-

StepMode is active and set to Blending

M

PathAccuracyMode

BOOL

-

PathAccuracyMode is active

M

AvoidSingularity

BOOL

-

AvoidSingularity is active

M

CollisionDetectionEnabled

BOOL

-

CollisionDetection is active

M

AcceleratingSupported

BOOL

-

RC supports cyclic dynamics status bit: Accelerating

M

DecceleratingSupported

BOOL

-

RC supports cyclic dynamics status bit: Decelerating

M

ConstantVelocitySupported

BOOL

-

RC supports cyclic dynamics status bit: ConstantVelocity

M

RCWorkingHours

UDINT

-

Total system hours of connected RA
• 0: Invalid
• >1: Total system hours
Must not be modifiable by user

M

⏳ Timing Diagram:

Work in progress – more content coming soon.

📋 Examples:

Declaration
VAR_GLOBAL
  /// Robot assignment of function
  AxesGroup             : AxesGroup;
  /// Robot Task
  RobotTask             : MC_RobotTaskFB;
  /// Exchange Configuration
  ExchangeConfiguration : MC_ExchangeConfigurationFB;
END_VAR
Call
// Call functionblock
ExchangeConfiguration
(
  Name           := 'SRCI_Robot',
  ExecutionMode  := ExecutionMode.PARALLEL,
  Priority       := PriorityLevel.NORMAL,
  AxesGroup      := AxesGroup
);
Usage
VAR_INPUT
  /// Request exchange configuration
  EnableRequest : BOOL;
END_VAR

VAR_OUTPUT
  /// Error ID
  ErrorID       : DINT;
  /// Error addition text
  ErrorAddTxt   : STRING;
  /// Configuration
  Configuration : ExchangeConfigurationOutCmd;
END_VAR

VAR
  /// internal step counter
 _stepCmd    : DINT;
  /// internal timer for command
 _timerCmd   : TON;
  /// internal timeout for command
 _timeoutCmd : TIME := T#5S;
END_VAR
CASE _stepCmd OF

  0: // Enable or disable exchange of configuration ?
     IF (( EnableRequest                 ) XOR
         ( ExchangeConfiguration.Enabled ))
     THEN
       // set timeout
       SetTimeout(PT := _timeoutCmd, rTimer := _timerCmd);
       // inc step counter
      _stepCmd := _stepCmd + 1;
     END_IF

  1: // Start Execution
     IF (( NOT ExchangeConfiguration.Busy  ) AND
         ( NOT ExchangeConfiguration.Error ))
     THEN
       // enable/disable exchange configuration
       ExchangeConfiguration.Enable := EnableRequest;
       // set timeout
       SetTimeout(PT := _timeoutCmd, rTimer := _timerCmd);
       // inc step counter
      _stepCmd := _stepCmd + 1;
     ELSE
       // timeout exceeded ?
       IF (CheckTimeout(_timerCmd) = RobotLibraryConstants.OK)
       THEN
         ErrorID     := RobotLibraryErrorIdEnum.ERR_TIMEOUT_CMD;
         ErrorAddTxt := CONCAT('_stepCmd = ' , DINT_TO_STRING(_stepCmd));
       END_IF

       // Error occurred ?
       IF (ExchangeConfiguration.Error)
       THEN
         ErrorID     := ExchangeConfiguration.ErrorID;
         ErrorAddTxt := CONCAT('_stepCmd = ' , DINT_TO_STRING(_stepCmd));
       END_IF
     END_IF


  2: // Wait Execution done ?
     IF (( NOT ExchangeConfiguration.Busy                    ) AND
         (     ExchangeConfiguration.Enabled = EnableRequest ))
     THEN
       // copy results
       Configuration := ExchangeConfiguration.OutCmd;
       // set timeout
       SetTimeout(PT := _timeoutCmd, rTimer := _timerCmd);
       // set step counter
      _stepCmd := 0;
     ELSE
       // timeout exceeded ?
       IF (CheckTimeout(_timerCmd) = RobotLibraryConstants.OK)
       THEN
         ErrorID     := RobotLibraryErrorIdEnum.ERR_TIMEOUT_CMD;
         ErrorAddTxt := CONCAT('_stepCmd = ' , DINT_TO_STRING(_stepCmd));
       END_IF

       // Error occurred ?
       IF (ExchangeConfiguration.Error)
       THEN
         ErrorID     := ExchangeConfiguration.ErrorID;
         ErrorAddTxt := CONCAT('_stepCmd = ' , DINT_TO_STRING(_stepCmd));
       END_IF
     END_IF

ELSE
  // invalid step
  ErrorID     := RobotLibraryErrorIdEnum.ERR_INVALID_STEP;
  ErrorAddTxt := CONCAT('_stepCmd = ' , DINT_TO_STRING(_stepCmd));
END_CASE

💡 Additional Information:

Work in progress – more content coming soon.

⚠️ **GitHub.com Fallback** ⚠️