S7-1200 Robot Simulation: Configuring Offline Control

David Krause3 min read
S7-1200SiemensTutorial / How-to
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

This S7-1200 concept uses a PLC state machine to command three simulated robot joints and exchange status with Siemens Process Simulate. Treat the supplied logic as a starting point: its interface, stop behavior, timer handling, and virtual I/O mapping require correction before validation.

System Configuration and Interface Decisions

The stated control system contains an S7-1200 CPU 1215C DC/DC/DC, 16 digital inputs, 16 digital outputs, a CM 1241 communication module, a 24 V DC supply, Process Simulate, and a workstation. The evidence does not define the communication protocol, CM 1241 configuration, addresses, joint-position units, or signal ownership.

Item Stated role Required engineering decision
16 digital inputs Receive simulation feedback Define each virtual input and its PLC address.
16 digital outputs Control virtual robot joints Define how discrete signals represent or trigger joint motion.
CM 1241 Exchange simulation data Select and document the supported protocol and data framing.
Joint positions Three REAL setpoints Define units, limits, scaling, and transfer method.

A REAL joint position cannot be mapped directly to one digital output without an explicit conversion or command scheme. Either transfer numeric setpoints through the communication channel or redefine the digital outputs as discrete motion commands. Do not proceed until the PLC and simulator use the same data model.

State-Machine Behavior

The proposed function block starts in state 0. A start command advances to state 1 only when Stop and Emergency are false. State 1 writes joint setpoints 45.0, 30.0, and 0.0; after a 2-second timer it advances to state 2. State 2 writes 90.0, 45.0, and 30.0; after another 2-second timer it returns to state 0. The evidence does not define position units or prove that the simulated robot reaches either setpoint before the state changes.

State 0: Wait for Start AND NOT Stop AND NOT Emergency
State 1: Command [45.0, 30.0, 0.0]; wait 2 s; select State 2
State 2: Command [90.0, 45.0, 30.0]; wait 2 s; select State 0
Emergency: Select State 0 and command [0.0, 0.0, 0.0]

The 2-second value is a time delay, not motion-complete feedback. For deterministic sequencing, define whether advancement depends on elapsed time, simulator confirmation, or both.

Logic Corrections Before Commissioning

  1. Correct the function-block interface. The main call passes Sim_Running and Sim_Error, but the shown FB_RobotControl declaration does not contain those parameters.
  2. Implement Stop behavior for active states. In the supplied logic, Stop prevents a transition out of state 0 but does not stop states 1 or 2.
  3. Define timer reset behavior explicitly. Verify that the TON instance resets before it is reused and does not retain a completed state across sequence transitions.
  4. Define safe outputs for state 0 and for simulation errors. The supplied code assigns zero positions only when Emergency is true; normal return to state 0 does not explicitly rewrite the joint outputs.
  5. Separate simulated emergency handling from machine safety. The demonstrated BOOL reset is control logic only; the evidence does not establish a safety-rated function.

Mapping, Test, and Verification

Map every virtual I/O point, numeric setpoint, command, and feedback status between the PLC and Process Simulate. Confirm that both programs use matching interfaces and versions, then observe motion in the simulator's 3D view and record the trajectory data.

  1. Test state 0 with Start false and confirm that no sequence begins.
  2. Apply Start with Stop and Emergency false; confirm the first three setpoints and the transition after 2 seconds.
  3. Confirm the second setpoint group and return to state 0 after the next 2 seconds.
  4. Apply Stop during states 1 and 2 after correcting the logic; verify the defined stopped state and outputs.
  5. Apply Emergency from every state; confirm state 0 and three zero commands, then inspect timer reset and restart behavior.
  6. Force a mapping or communication mismatch and verify that Sim_Error is transferred and handled according to the completed interface design.

FAQ

Why does the S7-1200 robot simulation ignore Stop?

The shown logic checks Stop only while leaving state 0. Add explicit Stop handling in active states 1 and 2, then verify the resulting state and joint commands.

Can REAL joint positions use the 16 digital outputs directly?

No direct conversion is defined. Specify a numeric communication mapping for the REAL values or define discrete output commands that Process Simulate can interpret.

Why does FB_RobotControl reject the simulation status parameters?

The main call supplies Sim_Running and Sim_Error, but the displayed function-block interface does not declare them. Add the required interface parameters with defined directions or remove them from the call.

Back to blog