DrvModbusTcp (FB)
FUNCTION_BLOCK DrvModbusTcp EXTENDS AbbLConCA
Function block DrvModbusTcp controls the Modbus TCP communication to ACS/DCS drive and is used for the basic control of drives with ABB Drives Profile or ABB Drives Enhanced profile
- ABB Drives Classic Profile
Reading status information from Drives: The Function block continuously reads data from the drive starting at Modbus register 400004. So at least the StatusWord(SW), ActualValue 1(Speed Reference), Actual Value 2 are continuously read from the drive and written to the inout variable DriveData. These values are stored in DriveData.wStatusWord, DriveData.iActValue1 and DriveData.iActValue2
Writing control word and reference value to drives: The Function Block checks if there are changes of the ControlWord(CW), Reference Value 1(Speed Reference) or Reference Value 2 on the inout variable DriveData. If there is a change a write job is requested to send these 3 values to the ACS drive starting at Modbus register 400001.
- ABB Drives Enhanced profile
Reading status information from Drives: The Function Block continuously reads data from the drive starting at Modbus register 400051. So at least the StatusWord(SW), ActualValue 1(Speed Reference), Actual Value 2 are continuously read from the drive and written to the inout variable DriveData. These values are stored in DriveData.wStatusWord, DriveData.iActValue1 and DriveData.iActValue2
Writing control word and reference value to drives: The Function block checks if there are changes of the ControlWord(CW), Reference Value 1(Speed Reference) or Reference Value 2 on the inout variable DriveData. If there is a change a write job is requested to send these 3 values to the ACS drive starting at Modbus register 400001.
Note
Please refer the respective drives / fieldbus module manual for parameter settings and more details on the drive configuration.
If a Modbus TCP job tries to access a register in the drive which has no valid mapping information, job is aborted with an error.
The requests to process other read or write Modbus jobs is transferred via the structure DriveData at the inout variable DriveData which can be connected to several other read/write function blocks e.g. DrvModbusRead, DrvModbusWrite or DrvModbusReadWrite23 of this drive.
- Diagnosis
The output ErrorID, which reflects an actual error number is only valid for one cycle if Done is FALSE and Error is set to TRUE. To catch this error number an external function must be programmed. However there are internal diagnosis variables available, which are not shown at any output, but can be accessed from the Function block instance or Visualization VisuDrvModbusTcp.
The additional diagnosis variables are:
uiWriteErrCnt: Number of errors in write jobs since Enable = TRUE.
wLastWriteErno: Holds the error number of the last executed write job.
uiReadErrCnt: Number of errors in read jobs since Enable = TRUE.
wLastReadErno: Holds the error number of the last executed read job.
uiReadWriteErrCnt: Number of errors in read/Write (FCT-23) write jobs since Enable = TRUE.
wLastReadWriteErno: Holds the error number of the last executed read/Write (FCT-23) job.
Note
If the user changes drive profile while drive is online with PLC, Function block output’s may give wrong indication
- InOut:
Scope
Name
Type
Initial
Comment
Inherited from
Input
EnableBOOLFALSE
A rising edge (Enable = TRUE) starts the operation, the output Busy goes to TRUE. All other inputs are read and considered continuously. A falling edge (Enable = FALSE) aborts the operation. During Aborting the Busy is still TRUE. Afterward all outputs are reset.
AbbLConCA
Output
BusyBOOLFALSE
Operation is running (while output Error is FALSE)
AbbLConCA
ErrorBOOLFALSE
Operation is stopped with error (while output Busy is FALSE). This output is TRUE for at least one cycle or until Enable is set to FALSE. The output ErrorID gives more details about the error.
AbbLConCA
Input
EthBYTE1
2: Eth port number of the assigned onboard port/coupler. Ex: (1= onboard ETH1, 2= onboard ETH2). Valid range: 1 to 62 depending on PLC type, Ethernet coupler used in configuration.
IPAdrServerSTRING(15)‘0.0.0.0’
3: IP-Address of drive as string e.g. ‘192.168.005.003’. Value must be greater than zero.
EnhancedProfileBOOLFALSE
- 4: To select either ABB Drives Classic profile or ABB Drives Enhanced profile. FALSE = ABB Drives Classic Profile, TRUE = ABB Drives Enhanced Profile. Profile should not be switched when PLC is online with the Drive.
Drive profile has to be properly configured in drives parameters, any mismatch with drive parameter configuration may lead to incorrect block behavior.
NvarReadBYTE0
5: Number of parameters to read from Reg 400004. Max 12. Depending of configured parameters in Group FBA DATA IN in drive. Valid range: 0..12
NvarWriteBYTE0
6: Number of parameters to write to Reg 400054. Max 12. Depending of configured parameters in Group FBA DATA OUT in drive. Valid range: 0..12
WriteValuesARRAY [1..12] OF INT
[12(0)]
7: Array of values to write to Reg 400054..400065 of drive configured parameters in Group FBA DATA OUT in drive
EnableWriteBOOLTRUE
8: Specific to High Availability(HA) functionality. Enables automatic write of CW, Ref1 and Ref2 after changes, can be used to block writing for HA application
SteadyWriteBOOLFALSE
9: Specific to High Availability(HA) functionality. Steady writing of values, If FALSE then the write job is only started after changes of the values CW, Ref1, Ref2, WriteValues[1..12]
Inout
DriveData11: Drive reference variable to connect to all function blocks of this drive
Output
ErrorID3: Error codes
ModMastErrorActBOOLFALSE
4: Active error in ModMast. Operation is running with error. This output is TRUE for at least one cycle or until input Enable is set to FALSE. The output ModMastErrorIDLast gives more details about the last error
ModMastErrorIDLastWORD0
5: Error code of last active error in ModMast. For error code description, refer to error codes in Modbus TCP library, “AC500_ModbusTcp.ERROR_ID”
WarnActBOOLFALSE
6: Operation is running with warning. This output is TRUE for at least one cycle or until input Enable is set to FALSE. The output WarnIDLast gives more details about the warning
WarnIDLast7: Warning code of last active warning
JobDoneBOOLFALSE
8: Modbus job done
JobBusyBOOLFALSE
9: Modbus job busy
OnlineBOOLFALSE
10: Connection established without error, all read jobs are done without errors and all Modbus Jobs are finished
ReadValuesARRAY [1..12] OF INT
[12(0)]
11: Array of values read from Reg 400004..400015 from drive parameters mapped in Group FBA DATA IN in drive
Methods:
A_StartAction
B_CyclicAction
C_CleaningAction
D_AbortAction
E_ResetAction
Structure: