In the simplest of terms a PLC does something with the real world based upon what it measures about the real world and how it is programmed to respond. Its measurements and responses are determined by the devices attached to it.
A PLC cannot "know" anything about what the real world is (in a human context of knowledge). In its simplest form it is a replacement for electromechanical devices like relays and timers. These devices are created in firmware by the supplier, and programmed in software by the user.
The advantage that a PLC has over discrete devices are that the program can be changed relatively quickly, as opposed to the time and de-bugging effort involved in re-wiring a large control panel, and one may obtain an awful lot of relays and timers in a small volume. As PLC applications have increased, further "soft" equivalents for things like cam timers, arrays, shift registers and a whole range of other useful functions have been added to make the things more useful to the engineer who finds ever-increasing applications for them.
It would probably be possible to replace the computing power contained within the Apollo space vehicles with a standard PLC system nowadays, however programming the thing to land one on the Moon and return the contents safely to Earth would be rather involved...
__________________
"Did you get my e-mail?" - "The biggest problem in communication is the illusion that it has taken place" - George Bernard Shaw, 1856