SIMOTION D435 Virtual Axis Encoder Simulation for Flying Saw
A flying saw follows a moving material web using the web's measured position and velocity as the master setpoint. When the controller is on the bench — no line, no material, no measuring wheel — the master encoder is missing, and every Technology Object (TO) downstream of the master (FollowingAxis, Cam, Cam_track, SynchronousOperation) reports "no master" and the entire motion program sits idle. The fix is to substitute a SIMOTION Virtual Axis (VA) for the real encoder. This reference shows how to configure a D435-2DP/PN controller in SCOUT V4.3 so a VA behaves as a deterministic master for the saw during commissioning, and how to verify the result.
1. Prerequisites
| Item | Specification |
|---|---|
| Controller | SIMOTION D435-2DP/PN (MLFB 6AU1435-2AD00-0AA0) — CompactFlash 6AU1400-2PA00-0AA0 or higher, firmware V4.3.x or V4.4.x |
| Engineering tool | SIMOTION SCOUT V4.3 (or SCOUT TIA V4.3 / V5.x with the matching SIMOTION firmware) |
| Drive | SINAMICS S120 with CU320-2 DP/PN (or V90 PN, S210) on PROFINET IRT or PROFIBUS DP — drive firmware V4.4 SP3 minimum for SIMOTION V4.3 SP1 |
| License | SIMOTION runtime license covering "Cam" or "Cam_ext" if a cam profile is used in the test |
| Project | Existing SCOUT project with the D435 inserted, drive commissioned, axes already created (SawAxis = real, FollowingAxis = real) |
| Programming language | MCC (Motion Control Chart) or ST (Structured Text) for the test program |
Reference the SIMOTION D4xx Manual and the SIMOTION Technology Objects Programming Manual for axis / cam TO parameter ranges cited below.
2. Why a Virtual Axis Works as Encoder Substitute
A SIMOTION Virtual Axis is a software-only TO of type TO_Axis with typeOfAxis = VIRTUAL. Internally it maintains the same position, velocity, and acceleration state variables as a real axis. It accepts the same system-function calls (_enableAxis, _disableAxis, _move, _setPosition, _stop), publishes a master interface (axisData.actualPosition, axisData.actualVelocity, axisData.positionControl), and can be bound as the master of a Following Axis, a Cam, or a Cam_track TO. To the downstream TOs the VA is indistinguishable from a real encoder-driven axis — they read the same interface, the same scaling (LU/inc), and the same motion status bits.
The three engineering options for substituting the master encoder are summarised in the table below.
| Option | Master source | Tests TO logic | Tests encoder interface | Tests drive wiring | Complexity |
|---|---|---|---|---|---|
| A — Virtual Axis (recommended) | Software-generated position/velocity | Yes | No | No | Low |
| B — Real slave axis (e.g., an idler motor) | Real incremental or absolute encoder on a slave drive | Yes | Yes (on that axis only) | Yes (on that axis only) | Medium |
| C — External quadrature generator (D/A, FGPA, or HBM-style simulator) | TTL/HTL A/B/Z signals into the encoder input module | Yes | Yes | Yes | High |
For a first-pass logic test of the cut length, line speed, cam profile, and saw return kinematics, Option A is the only one that runs without additional hardware.
3. Architecture Overview
The bench-test architecture is identical to the production topology with the measuring-wheel encoder replaced by a virtual axis that you drive from an MCC or ST program. The following SVG shows the data flow.
Every master-consuming TO is bound to the VA. When the test is complete and the real encoder is wired to the controller, only the _setMaster call is changed to point at the new master axis or the encoder TO — the cam, the saw, the HMI scope, and the cut-length math remain unchanged.
4. Configuring the Virtual Axis in SCOUT V4.3
- In the project navigator, right-click Axes > Insert Axis.
- Select
TO_Axis, name itVirtualLineAxis(or follow your project naming convention). - Open the axis configuration dialog and set the parameters as listed below.
| Tab | Parameter | Value | Notes |
|---|---|---|---|
| Basic | Name | VirtualLineAxis |
Used by the ST program and HMI tags |
| Basic | Type of axis | VIRTUAL |
Selects software-only mode — no drive reference |
| Mechanical | Modulo | OFF for cut-length testing, ON for continuous line simulation | Enable modulo if you simulate an infinite web |
| Units | Position unit | mm |
Match the real line encoder scaling |
| Units | Increments per LU | 1 | VA defaults; do not change |
| Limits | Max velocity | Line speed × 1.25 (with margin) | Matches the planned production web speed |
| Limits | Max acceleration | Application-specific (e.g., 500 mm/s²) | High values mask position-control issues — keep realistic |
| Limits | Position tolerance | 0.1 mm | Used by following axis monitoring |
| Homing | Home position | 0.0 mm | VA always powers up at 0 — use _setPosition to offset |
| Simulation | SimulateAxis = TRUE | Required only if you want to bypass drive enable checks during very early tests | Disable before final FAT |
Compile the project (Ctrl+F7) and download to the D435 before running the next steps.
SimulateAxis = TRUE suppresses drive-side alarms such as F07901, F08501 and the SIMOTION-side DriveFault propagation. Use it only for the very first connect test; disable it before the cam is exercised, or the cut-length math will mask real drive faults.5. Driving the Virtual Axis with ST
The MCC chart below is a minimal cut-length test driver. It issues a constant velocity _move command to the VA, ramps it to the test line speed, and waits for the HMI to start a saw cycle.
// MCC chart: CutLengthTest_Startup
// Purpose: drive VirtualLineAxis at the planned production line speed.
IF <Startup.SequenceActive> = FALSE THEN
Startup.SequenceActive := TRUE;
// 1. Enable virtual axis (no drive telegram required)
_enableAxis(
axis := VirtualLineAxis,
enableMode := ALL_AXIS_TASKS,
commandId := _getCommandId());
WAITFORCONDITION VirtualLineAxis.MotionStateData.MotionState = MOTION_STATE_STANDSTILL;
// 2. Reset position to simulate material seam at 0 mm
_setPosition(
axis := VirtualLineAxis,
position := 0.0,
mode := POSITION_MODE_DIRECT,
commandId := _getCommandId());
// 3. Start constant-velocity motion at V_line_mm_s
_move(
axis := VirtualLineAxis,
velocity := 1500.0, // mm/s -- match production V_line
acceleration := 200.0, // mm/s^2
deceleration := 200.0,
direction := POSITIVE,
commandId := _getCommandId());
Startup.SequenceActive := FALSE;
END_IF;
For ST-only projects the equivalent block is shown below. Note the use of axis.actualVelocity for HMI display — the VA's actual velocity is computed from the position increment, so it tracks the commanded velocity with sub-inc precision.
// ST: drive the virtual line axis at test line speed
IF bStartLine = TRUE AND bLineRunning = FALSE THEN
bLineRunning := TRUE;
_enableAxis(axis := VirtualLineAxis, enableMode := ALL_AXIS_TASKS, commandId := _getCommandId());
WAITFORCONDITION VirtualLineAxis.MotionStateData.MotionState = 4; // STANDSTILL
_setPosition(axis := VirtualLineAxis, position := 0.0, mode := 1, commandId := _getCommandId());
_move(axis := VirtualLineAxis,
velocity := rVline_mm_s,
acceleration := rAccel_mm_s2,
deceleration := rAccel_mm_s2,
direction := 1,
commandId := _getCommandId());
END_IF;
Constants rVline_mm_s, rAccel_mm_s2 are HMI-visible VAR_GLOBAL so the operator can step the line speed through the planned operating range without re-compiling.
6. Calculating Cut Length and Line Speed in the Test
The saw cycle is a deterministic sequence of position windows on the master. The cut length is enforced through the cam profile; the line speed is enforced by the VA's velocity. To verify both at once, log four scope channels and compare:
| Channel | Source | Expected behaviour |
|---|---|---|
| Master position | VirtualLineAxis.actualPosition |
Linear ramp at slope = rVline_mm_s |
| Master velocity | VirtualLineAxis.actualVelocity |
Step to rVline_mm_s within 1 servo cycle, no overshoot |
| Slave position (saw) | SawAxis.actualPosition |
Synchronous with master during cut window, decoupled during return |
| Following error | SawAxis.followingError |
Remains within position_tolerance for the full cut |
The cut length is set on the cam. With master = VA, slave = SawAxis, the cam should map one master revolution (or one full material pitch) to the cut cycle: accelerate, sync, dwell, cut, return. Because the master is software, the dwell is reproducible to the servo cycle — usually 1 ms on D435, 0.5 ms on D455, 2 ms on D425. See the SIMOTION TO Programming Manual for servo cycle mapping rules.
7. Gearing and _setMaster Programming
The _setMaster system function binds a FollowingAxis (or Cam) to its master. In the bench test we point it at the VA. The example below shows the swap between VA (test) and the real encoder axis (production):
// ST: bind following axis to chosen master at runtime
FUNCTION BindMasterToSaw : VOID
VAR_INPUT
bUseVirtualMaster : BOOL;
END_VAR
VAR_TEMP
stMaster : StructRetTypeMaster;
END_VAR
IF bUseVirtualMaster THEN
stMaster := VirtualLineAxis; // virtual axis TO handle
ELSE
stMaster := RealLineEncoderAxis; // encoder TO handle (production)
END_IF;
// re-bind the cam's master reference
_setMaster(
slave := SawAxisCam,
master := stMaster,
masterFactor := 1.0, // 1:1 gearing between line and saw
commandId := _getCommandId());
// re-bind the following axis' master reference
_setMaster(
slave := SawFollowingAxis,
master := stMaster,
masterFactor := 1.0,
commandId := _getCommandId());
END_FUNCTION
Binding the VA to a FollowingAxis TO is a normal _setMaster call; the FollowingAxis does not know — and does not need to know — that the master is virtual. The same call sequence is used in production to point the cam at the real encoder TO, so the swap is a single boolean toggle in the HMI.
_setMaster may not be issued while the slave is in synchronous motion. Stop the slave (_stop), wait for MotionState = STANDSTILL, then call _setMaster, then re-enable synchronous operation with _enableSynchronousMotion. Skipping the standstill check yields error 33006 "Command cannot be executed in current axis state."8. Alternative 1 — Real Slave Axis as Master Encoder
If the engineer has a second, real drive available (for example an idler servo with an incremental encoder on the back of the motor), it can be used as the master in lieu of the VA. The wiring is:
- Bind the idler drive to a real axis TO (
typeOfAxis = SERVO) on PROFINET IRT, telegram 105. - Run that axis at the test line speed with
_move. - Read its actual position/velocity into the FollowingAxis with
_setMaster.
This option tests the encoder interface on the idler axis but does not test the production encoder's wiring to the line. It is the standard "motor-to-encoder" check used in factory acceptance tests. The drawback is that the idler must be physically spun up, which is inconvenient on a bench with no mechanical mount.
9. Alternative 2 — External Quadrature Signal Generator
To test the production encoder input module and the SMC/SMCI/encoder cable run, generate a TTL or HTL quadrature stream externally and feed it into the encoder port. A typical signal chain uses:
- An FPGA, a microcontroller (Arduino, STM32), or a dedicated signal generator producing TTL A/B/Z with index.
- A line driver (e.g., 26LS31) if the controller's encoder input is differential RS-422.
- For HTL 24 V encoders, a level shifter and an HTL-rated input card (e.g., SIMOTION SME12x).
The output of the generator must be electrically and timing-accurate to within ±0.5 % of the planned line speed, because the SIMOTION encoder input latches the position on the index and counts edges on A/B. A 1 kHz quadrature stream with 4× decoding yields 4000 LU/s per kHz. For a 1.5 m/s line on a 50 mm measuring wheel, the encoder runs at ~9.55 rev/s × PPR; if PPR = 4096, the controller must see ~39 100 edges/s, or ~9.78 kHz after 4× decoding — within the bandwidth of any modern controller's encoder input.
10. Reference: HBM Incremental Encoder Simulation
For an overview of the function-block patterns used to simulate a digital incremental rotary encoder with two tracks and an index pulse — applicable to HBM test rigs but transferrable to any hardware-in-the-loop setup — see the HBM incremental-encoder simulation reference. The article covers the FSM that toggles A and B with 90° phase shift, the index pulse generation at the zero crossing, and the dead-time compensation needed for short pulses at high PPR.
11. Verification Procedure
Run the bench test in this sequence to validate the VA-driven flying saw before integrating the real encoder.
- Compile clean. SCOUT build with zero warnings. Warnings on VA configuration typically indicate scaling or modulo conflicts that will surface only at run time.
-
Connect and check online. Confirm the D435 is online, the VA TO is loaded, and
VirtualLineAxis.MotionStateData.MotionStatereportsSTANDSTILL. -
Run at low speed first. Start the VA at 50 mm/s, verify the FollowingAxis follows with zero following error. If the following error is non-zero, the cam scaling or the
masterFactoris wrong. - Step line speed. Ramp from 50 mm/s to the planned production line speed in 100 mm/s steps. Log the four scope channels from §6 at each step.
- Trigger a saw cycle. From the HMI, issue a single saw cut. Verify the saw accelerates, synchronises within the configured sync window, dwells at the cut length, returns, and resets.
- Cut-length sweep. Run 50 cuts at the minimum, midpoint, and maximum planned cut length. Compare the actual cut length from the trace against the HMI setpoint — deviation must be inside the position tolerance of the saw axis.
-
Master swap dry-run. With the saw stopped, toggle
bUseVirtualMasterfrom TRUE to FALSE. The_setMastercall should re-bind the cam to the real encoder TO with no alarm. Re-toggle to TRUE; the cam should re-bind to the VA cleanly. -
Fault injection. Issue a master alarm (e.g.,
_commandErrorAcknowledgewith a synthetic error) and verify the saw entersFAULT_STOPand the HMI alarm banner appears.
12. Troubleshooting Matrix
| Symptom | Likely cause | Fix |
|---|---|---|
VA reports DRIVE_FAULT on enable |
SimulateAxis = FALSE and no drive assigned |
Set SimulateAxis = TRUE for the bench test, or accept the warning and proceed — VAs do not require a drive |
_setMaster returns error 33006 |
Slave axis is in synchronous motion when the master is rebound | Stop the slave, wait for STANDSTILL, then call _setMaster
|
| FollowingAxis follows with constant offset | Master/slave scaling mismatch | Match IncrementsPerLU on both axes; check masterFactor
|
| Cam does not engage | Cam TO not bound to VA at runtime | Open the cam in SCOUT, set master = VirtualLineAxis, recompile and download |
| VA accelerates but FollowingAxis does not move |
enableMode omitted the synchronous task |
Call _enableAxis(..., enableMode := ALL_AXIS_TASKS)
|
Position step on _setPosition
|
Mode = DIRECT does not interpolate | Use POSITION_MODE_ABSOLUTE for smooth rehome; reserve DIRECT for zeroing on standstill |
| Saw oscillates around sync point | Cam profile too aggressive for saw dynamics | Soften the cam ramp segments; check the Kp of the saw axis position controller |
| Cut length drifts with line speed | Cam defined in time, not in master distance | Recreate the cam in the "distance on master" domain |
| ServoTrace shows no VA position | VA not enabled when trace starts | Enable the VA, then start the trace recording |
VA stops with STOP_BY_LIMIT
|
Software position limit reached during long test | Enable Modulo or raise the software limit beyond the test range |
13. Field-Proven Caveats
-
SCOUT V4.3 is end of life. Siemens announced the SIMOTION V4.3 end of marketing in 2018; V4.4 is the active line. New features such as TO Axis object extensions, the
Cam_extlicence, and the SIMOTION Task Profiler require V4.4 SP1 or V5.x. If the test is run on V4.3, document the firmware version on the bench test report. - Servo cycle jitter on VA. A virtual axis is updated on the IPO or IPO_2 task clock, not the position-control cycle. For high-speed flying saws (line > 5 m/s, cut < 50 mm), set the IPO2 cycle to the position-control cycle to avoid 0.5–1 ms jitter that will show up as a wobble in the cut.
-
Cam profile export. A cam tuned against a VA is only as accurate as the VA's position step. If the cam was generated from a 0.001 mm LU grid and the VA updates at 1 ms × 1.5 m/s = 1.5 mm/step, the cam will quantise. Re-import the cam in
poly5with a finer grid (e.g., 0.0001 mm) for a clean trace. -
HMI lag. When the operator changes
rVline_mm_slive, the VA must re-plan the velocity with the same acceleration profile as a real axis. A_movecall on a moving axis is accepted; an axis-specificVelocityOverrideis the cleaner method. -
Real-encoder swap side effects. When the real encoder TO has a different
IncrementsPerLUorGearFactorthan the VA, the cam master/slave relationship changes. Always assert the scaling in the swap HMI screen before re-enabling synchronous motion.
14. Frequently Asked Questions
Can a SIMOTION virtual axis be used as the master of a Following Axis and a Cam at the same time?
Yes. The VA publishes the same master interface as a real axis, so multiple slaves can be bound to it via _setMaster. The binding is a one-to-many relationship; one VA can master several FollowingAxes and several Cams simultaneously without contention.
Does the virtual axis need a drive assigned in SCOUT?
No. Set typeOfAxis = VIRTUAL and leave the drive assignment empty. The axis runs purely in software. If SimulateAxis = FALSE, SCOUT may warn at compile time; the warning is benign for a VA and the project still downloads and runs.
How is the virtual axis updated, and at what cycle?
The VA is updated on the IPO task clock of the TO. For a D435 with a 1 ms position-control cycle and a 2 ms IPO, set the IPO2 equal to the position-control cycle (1 ms) to match the dynamic response of a real drive. See the SIMOTION Programming Manual for cycle time configuration.
What error code appears if I rebind the master while the slave is moving?
SIMOTION returns error 33006 "Command cannot be executed in current axis state." Stop the slave first with _stop, wait for MotionState = STANDSTILL, then call _setMaster and re-enable synchronous motion with _enableSynchronousMotion.
Can I run the virtual-encoder test with no drive and no motor wired at all?
Yes. The VA does not require a drive or motor, the cam does not require a drive, and only the SawAxis (the real slave) requires its drive to be commissioned and on PROFINET IRT. With the drive powered off, the SawAxis will not enable, but the VA, the cam, and the HMI scope are fully exercisable for logic validation.
What is the simplest way to swap from the virtual master to the real encoder in production?
Wire the real encoder to the encoder input, create a second TO (real line encoder axis) in the project, and use a boolean in the HMI to choose which master handle is passed to _setMaster. The cam, the saw, and the cut-length math do not change; only the _setMaster argument does.