LGF_ActDeactDevice
implements a compact state machine to activate and monitor or deactivate decentral devices.
The module monitors as well the device connection and error state after activation.
It works for PN (S7-1200 / S7-1500) and DP (S7-1500) devices.
LGF_ActDeactDevice (FB) | ||||||||
---|---|---|---|---|---|---|---|---|
Bool | enable | valid | Bool | |||||
Bool | activate | busy | Bool | |||||
Bool | deactivate | error | Bool | |||||
HW_DEVICE | hwId | status | Word | |||||
LGF_typeActDeactDeviceParameter | parameter | activating | Bool | |||||
isActivated | Bool | |||||||
deactivating | Bool | |||||||
isDeactivated | Bool | |||||||
deviceStateOK | Bool | |||||||
diagnostics | LGF_typeDiagnostics | |||||||
Identifier | Data type | Default value | Description |
---|---|---|---|
enable | Bool | FALSE | TRUE: Enable functionality of FB |
activate | Bool | FALSE | Rising edge: Activate device given by `hwId` |
deactivate | Bool | FALSE | Rising edge: Deactivate device given by `hwId` |
hwId | HW_DEVICE | --- | Hardware ID of the device which should be activated / deactivated (`Device~PnIf~IODevice`) |
parameter | LGF_typeActDeactDeviceParameter | --- | Parameter dataset for the function `LGF_ActDeactDevice` |
Identifier | Data type | Description |
---|---|---|
valid | Bool | TRUE: Valid set of output values available at the FB |
busy | Bool | TRUE: FB is not finished and new output values can be expected |
error | Bool | TRUE: An error occurred during the execution of the FB |
status | Word | 16#0000 - 16#7FFF: Status of the FB, 16#8000 - 16#FFFF: Error identification |
activating | Bool | TRUE: Activation of device active |
isActivated | Bool | TRUE: Device activated |
deactivating | Bool | TRUE: Deactivating of device active |
isDeactivated | Bool | TRUE: Device deactivated |
deviceStateOK | Bool | TRUE: Device is activated and connected to IO-System FALSE: Device is faulty or not connected, depends on `isActivated` |
diagnostics | LGF_typeDiagnostics | Diagnostic structure to store and transfer diagnostic information from blocks trough the interface. |
Code / Value | Identifier / Description |
---|---|
16#7000 | STATUS_NO_CALL No job being currently processed |
16#7001 | STATUS_FIRST_CALL First call after incoming new job (rising edge 'enable') |
16#7002 | STATUS_SUBSEQUENT_CALL Subsequent call during active processing without further details |
16#8600 | ERR_UNDEFINED_STATE Error: Due to an undefined state in state machine |
16#8601 | ERR_LOG2GEO Error: Log2Geo, may the HW ID for the device is wrong, please see `diagnostics.subFunctionStatus` for more detailed information |
16#8601 | ERR_GEO2LOG Error: Geo2Log, may the HW ID for the device is wrong, please see `diagnostics.subFunctionStatus` for more detailed information |
16#8640 | ERR_DEVICE_DEACTIVATING Error: Deactivation (D_ACT_DP) of device, please see `diagnostics.subFunctionStatus` for more detailed information |
16#8641 | ERR_DEVICE_DEACTIVATING_TIME_OUT Error: Deactivation of device - watchdog time expired |
16#8650 | ERR_READ_ACTIVATION_STATE_WHILE_DEACTIVATED Error: Deactivation state (D_ACT_DP) of device is wrong, desired is `16#0000` or `16#0002`, please see `diagnostics.subFunctionStatus` for more detailed information |
16#8660 | ERR_DEVICE_ACTIVATING Error: Activation (D_ACT_DP) of device, please see `diagnostics.subFunctionStatus` for more detailed information |
16#8661 | ERR_DEVICE_ACTIVATING_TIME_OUT Error: Activation of device cause watchdog time expired. Can be a broken device connection |
16#8662 | ERR_READ_DEVICES_STATES_DURING_ACTIVATION Error: Read Device states (DeviceStates) during device activation, please see `diagnostics.subFunctionStatus` for more detailed information |
16#8670 | ERR_READ_DEVICES_STATES_WHILE_ACTIVE Error: Read Device states (DeviceStates) while device active, please see `diagnostics.subFunctionStatus` for more detailed information |
16#8671 | ERR_DEVICE_STATE_WHILE_ACTIVE Error: Device states present error and is unreachable, faulty Device or IO-System |
16#8672 | ERR_READ_ACTIVATION_STATE_WHILE_ACTIVE Error: Activation state (D_ACT_DP) of device is wrong, desired is `16#0000` or `16#0001`, please see `diagnostics.subFunctionStatus` for more detailed information |
16#8690 | ERR_DISABLING_DEACT_DEVICE Error: Deactivation (D_ACT_DP) of device throws an error while disabling, please see `diagnostics.subFunctionStatus` for more detailed information |
16#8691 | ERR_DISABLING_WATCHDOG Error: Watchdog timer expired while disabling |
This UDT belongs to the Module LGF_ActDeactDevice
and lists all possible parameter to configure its behavior.
Identifier | Data type | Default value | Description |
---|---|---|---|
timeOutActDeact | Time | T#2500ms | Time to monitor the commands `activate` and `deactivate` should be greater than the configured `configuration time` in the PLC hardware configuration section `Startup` |
timeOutStateMonitoring | Time | T#100ms | Time to monitor the device state while the device is activated After time has expired an error is present as long as the state is faulty. |
enableAndDeactivate | Bool | TRUE | TRUE: Disable / Deactivate device during startup / enabling (prior to `enableAndActive`) FALSE: Keep actual state or `enableAndActivate` |
enableAndActivate | Bool | FALSE | TRUE: Enable / Activate device during startup / enabling FALSE: Keep actual state or `enableAndDeactivate` |
disableAndDeactivate | Bool | TRUE | TRUE: Disable / Deactivate device during disabling of the module FALSE: Keep actual state |
Diagnostic structure to store and transfer diagnostic information from blocks trough the interface.
Identifier | Data type | Default value | Description |
---|---|---|---|
status | Word | 16#0000 | Status of the Block or error identification when error occurred |
subfunctionStatus | Word | 16#0000 | Status or return value of called FB's, FC's and system blocks |
stateNumber | DInt | 0 | State in the state machine of the block where the error occurred |
The module provides the procedure for activating and deactivating remote IO-Devices in the Profinet (PN, S7-1500 & S7-1200) and Profibus (DP, S7-1500) network.
The activation of the device (defined at hwId
) is initiated by a rising edge at activate
, after complete activation this is indicated at the output isActivated
and deviceStateOK
. After that the connection status is displayed at the deviceStateOK
output.
The connection is monitored and in case of a failure of this of more than the set monitoring time timeOutStateMonitoring
at the output and reported as an error. After successful recovery of the connection by the system, the configured time is also waited until the error is reset to ensure stability.
Deactivation of the device (defined at hwId
) is initiated by a rising edge at deactivate
, after complete activation this is indicated at the output isDeactivated
.
It is possible to define the states for switching on and off, as well as the monitoring times for activating and deactivating and the connection monitoring.
All errors are automatically reset as soon as the faulty state is eliminated.
The exception to this are errors that can only be corrected by an intervention in the software, such as an incorrect or non-existent hardware ID of a non-existent decentralized IO device.
timeOutActDeact
for monitoring the activation and deactivation sequence should always be set higher than the parameterized value in the Device configuration
/ Startup
/ Configuration time
.Version & Date | Change description | |
---|---|---|
01.00.00 | Simatic Systems Support | |
06.04.2023 | First released version |