Be careful when forcing variables. First, forcing variables may lead to unwanted behavior of your program. Second, you need to be aware that different PLC types behave differently.
Input variables X are forced before the scan (after reading from the input)
Output variables Y are forced after the scan (before writing to the output)
Internal flags R are forced between the scans
From the firmware side, all values (X, Y, R, C, T, L) are forced at the steps marked with (1), (2) and (3).
Processing of input variables (X)
Regardless of the state of the input from the input device, a forced TRUE/FALSE will take precedence in phase B at the contacts specified for forcing. At this time, the area assigned to input X in the operation memory will be rewritten. Please note that the input LED will not blink.
Contacts not specified for forcing will be TRUE/FALSE according to the state of the input from the input device.
Processing of output variables (Y)
Regardless of the operation results, a forced TRUE/FALSE will take precedence in phase A at the contacts specified for forcing. At this time, the area assigned to output Y in the operation memory will be rewritten. External output will take place according to the input/output update timing in the diagram above.
Contacts not specified for forcing will be TRUE/FALSE according to their operation result.
Processing of timers (T) and counters (C)
Regardless of the timer/counter input condition, a forced TRUE/FALSE will take precedence at a contact specified for forcing. At this time, the area assigned to the contact of the timer (T) or counter (C) in the operation memory will be rewritten. During forcing, no timing and counting will be performed.
Contacts not specified for forcing will be TRUE/FALSE according to their operation result.
For FP0R, FP0, FP0H, FPS (Sigma), FP-X, FPXH, FP7:
Forced internal flags R and outputs Y are rewritten according to the operation results.
For FP2 and FP2SH:
Depending on the instruction used, the PLC behavior is different: