Forcing a value
A force holds a tag at a value you choose. The logic can still write the tag, but the tag keeps your value until you remove the force. Use it to test a rung without waiting for a real sensor.
Force a tag
- Click Run. A tag can be forced only while the PLC runs, and the menu says Run to force otherwise.
- In the Tags table, right-click the tag and choose Force….
- Type the value. For a BOOL type 1 or 0. Press Enter, or click Force.
- A message confirms it, for example StopPB forced 1. The tag now shows an F.
You can also right-click an instruction on a rung and choose Force, which forces the tag that instruction uses. A BOOL, SINT, INT, DINT, LINT, REAL, STRING or CHAR tag can be forced. A structure shows Remove force when it is forced.
How a forced contact shows on the rung
A contact on a forced tag shows the held value with the word FORCED, for example 1 FORCED. The rung is solved with that value, whatever the logic or a Link writes to the tag. This is the seal-in rung that a force on StopPB acts on:
1. Press Start. StopPB is off, so its normally closed contact passes power and Motor turns on.
2. Release Start. Motor holds itself on through its own contact.
3. Press Stop. This is what a force of 1 on StopPB does with no button pressed: the contact opens and Motor turns off. Remove the force and the rung follows the real StopPB again.
| Step | StartPB | StopPB | Motor |
|---|---|---|---|
| 1. Press Start | 1 | 0 | 1 |
| 2. Release Start | 0 | 0 | 1 |
| 3. Press Stop | 0 | 1 | 0 |
The reason it works: a forced tag keeps its forced value whatever the logic writes, so the rung cannot tell a force from a pressed button.
Remove one force, or clear all
- To remove one force, right-click the tag and choose Force… again, then Remove force. On a rung, right-click the instruction and choose Remove force.
- To remove every force, click Clear forces above the Tags table, then confirm. The button shows only while at least one tag is forced.
Good to know
- A forced tag ignores the logic. If a result looks wrong, look for an F in the Tags table before you look at the rungs.
- Clear every force before you trust a result, and before you save a project you will give to someone else.
- Forces are for testing. They are not an input your program should depend on.