Overview
On a SINUMERIK 840D pl controller (software version 6.x) fitted with a PCU50 and HMI Advanced, the request to display an additional "dummy" or "virtual" axis whose actual position is written from the PLC in real time is recurring. Typical drivers include showing an operator a torque-derived shaft angle, a die counter, a process-only position, or any PLC-calculated quantity as if it were a real machine axis. The challenge is that $AA_IM[Ax] (current axis actual value in the MCS) and $VA_IM[Ax] (encoder-independent actual value) are NC-internal computed variables. They cannot be overwritten directly from the PLC. This reference documents three field-proven approaches, the machine data involved, the PLC interface, the HMI Advanced configuration, and the verification checks for each method.
Scope: NCU 573.x / 574.x, SINUMERIK 840D pl SW 6.x, PCU50, HMI Advanced (not HMI-Embedded / SINUMERIK Operate). All machine data numbers below are standard 840D MDs; verify against the version-specific Siemens Industry Online Support documentation for your exact build.
Prerequisites
- SINUMERIK 840D pl controller (NCU 573.x or 574.x) running software version 6.x.
- PCU50 host with HMI Advanced operator interface and the relevant axis screen / "machine" area.
- PLC basic program toolbox installed on the S7-300 sub-rack; FB1/FB2/FB3/FB4/FB5/FB7 plus FC15/16/17/18/19/21 loaded.
- Axis slot available in the channel, either as a real but unused axis or as a configured simulated axis.
- Operator access rights to read/write machine data (
$MN_and$MA_ranges) and to display R-parameters / GUD via HMI. - Knowledge of the axis name convention (e.g.,
ZZas requested) and its index in the channel axis list.
Why $AA_IM and $VA_IM Are Read-Only
The variables $AA_IM[Ax] and $VA_IM[Ax] are produced by the position controller of the NC and not by a memory cell the PLC can address. $AA_IM reflects the actual position after the encoder/measuring-system path, while $VA_IM is the position without encoder contribution. The NC writes to them every IPO cycle (typically 4 ms); they are output-only from the PLC's point of view. Forcing a value into either variable is not supported on standard 840D pl builds. Three controlled alternatives are available.
Approach 1 - Simulated Axis with Continuous Positioning (FC15/FC18)
The most direct method is to add a real axis slot to the channel, declare it as simulated, and continuously command it to the value held in a PLC word. The axis then behaves like a normal axis for display purposes: $AA_IM[ZZ] tracks the commanded position and appears in the HMI machine area.
Required Machine Data
| MD Number | Name | Value | Effect |
|---|---|---|---|
| MD30130 $MA_CTRLOUT_TYPE[ZZ] | Output type of setpoint | 0 = analog / 1 = digital | Selects how the simulated setpoint is generated. For purely simulated operation, 0 or 1 is acceptable. |
| MD30240 $MA_ENC_TYPE[ZZ] | Encoder type | 0 = simulated | Marks the encoder as simulated; no physical encoder required. |
| MD30350 $MA_SIMU_AX_VDI_OUTPUT | Simulated axis VDI output | bit 0 = 1 | Allows the simulated axis to drive the VDI interface so the HMI treats it as a real axis. |
| MD30300 $MA_IS_ROT_AX[ZZ] | Rotary / linear axis | 0 or 1 | Pick per the unit you want shown. |
| MD32000 $MA_MAX_AX_VELO[ZZ] | Maximum axis velocity | e.g. 10000 mm/min | Set high enough so positioning commands finish inside one PLC cycle. |
| MD32010 $MA_JOG_VELO_RAPID[ZZ] | Rapid jog velocity | matches MD32000 | Used for FC18 motion profile. |
When the axis is declared simulated and the VDI output bit is enabled, the PLC can command it using the standard axis-positioning FBs and the HMI displays it as a regular axis. The trick is to keep the commanded position equal to the value you want displayed, on every PLC cycle.
Update Cycle
Approach 2 - R-Parameter / Free Variable Display (Recommended)
If the goal is only to show a number on the HMI, the simplest path is to write the value into an R-parameter (or a GUD) and bind a small visualization widget on the HMI to that variable. No axis slot is required, no simulated axis needs to be configured, and the PLC cycle writes the value directly with no NC positioning transaction involved.
Steps
- Define an R-parameter range:
R0..R99are reserved. UseR100..R199for operator-visible free variables, or define a GUD viaDEF NCK INT _ZZ_DUMMY_POS. - Configure the HMI Advanced to render the variable. In the HMI Advanced configuration directory, edit the
slamconfig.inior the relevant screen definition so the widget points to/Channel/Parameter/R[100]or to the GUD name. - From the PLC, write the value via the standard axis / variable FC interface (e.g., using the GUD write FB or by using
FB5+FB7for variable services). - Verify the value appears on the machine area and updates at the HMI refresh rate.
This approach is recommended for non-motion indicators because it does not consume a channel axis slot, does not require NC machine data changes, and survives NCK reset / cold start without re-initializing a simulated axis. The trade-off is that the display is a generic numeric field, not an axis row in the position list.
Approach 3 - Synchronized Action Force-Position
When an axis slot is available but the PLC does not want to issue a positioning command every cycle, a synchronized action in the NC can copy a free variable (GUD or R-parameter) into the axis actual value via POS[$AA_IM,Ax] = $AC_PARAM[n] semantics. However, on standard 840D pl SW 6.x, $AA_IM remains NC-internal and cannot be assigned to by synchronized actions either. A workable compromise:
- Configure the axis as simulated (Approach 1).
- In the NC program, write a synchronized action that continuously overrides the commanded position:
FA[Spindle/AX]=...; SUPA ...; $AA_OVR[ZZ]=100combined with a positioning block. - Update the target R-parameter from the PLC; let the NC synchronized action move the simulated axis toward it every IPO cycle.
This method smooths the HMI display but introduces IPO-cycle work and is rarely justified when the PLC can simply call FC18 every cycle.
PLC Implementation Reference
The standard 840D pl PLC basic program provides a small set of FBs/FCs relevant to axis positioning from the PLC. Use them as documented in the toolbox manual (always verify FB/FC numbers against your toolbox version; some vendors renumber):
| FC / FB | Name | Use for dummy axis | Typical cycle |
|---|---|---|---|
| FC15 | Position axis | Trigger absolute move | OB1 |
| FC16 | Position axis with new values | Override target during motion | OB1 |
| FC18 | Spindle positioning | Spin-axis style absolute positioning | OB1 |
| FB1 / FB2 / FB3 | Axis / spindle FCs (PLC-NCK interface) | Underlying services | OB1 / OB40 |
| FB5 / FB7 | Variable services (read/write GUD / R) | Approach 2 write path | OB1 |
ST Snippet - FC18 Every-Cycle Repositioning
// Pseudo-ST for a 840D pl PLC basic program block
VAR
AxisNo : INT := 7; // channel axis index for "ZZ"
TargetPos : REAL; // value to display, units of axis
AxisEnable : BOOL := TRUE;
PosTrigger : BOOL;
PosDone : BOOL;
PosError : WORD;
END_VAR
// Latch rising edge to retrigger FC18 each cycle the target changes
PosTrigger := AxisEnable AND (TargetPos <> LastTarget);
LastTarget := TargetPos;
IF PosTrigger THEN
// FC18 call signature varies by toolbox; example for one common build:
FC18(
Start := PosTrigger,
AxisNo := AxisNo,
Pos := TargetPos,
Mode := 0, // 0 = absolute positioning
Feed := 10000.0,
Invert := FALSE,
Done => PosDone,
Error => PosError
);
END_IF;
ST Snippet - Approach 2 GUD Write
// Write the dummy value directly into a GUD via FB7 variable services
VAR
VarName : STRING[32] := '_ZZ_DUMMY_POS';
VarValue : REAL;
WriteBusy : BOOL;
WriteDone : BOOL;
WriteError : WORD;
END_VAR
IF WriteTrigger AND NOT WriteBusy THEN
FB7(
REQ := TRUE,
NUM_VAR := 1,
ADD_VAR_1 := VarName,
VAL_1 := VarValue,
BUSY => WriteBusy,
DONE => WriteDone,
ERROR => WriteError
);
ELSE
FB7.REQ := FALSE;
END_IF;
HMI Advanced Configuration
HMI Advanced on PCU50 stores screen and widget configuration in INI files under C:\user\hmi\<config> (or the OEM equivalent). To surface the dummy axis / variable in the machine area:
Step 1 - Register the axis name
If you used Approach 1, ensure the axis name ZZ is present in the channel axis list. The HMI enumerates axis rows from $AC_AxisList; verify with the NC command SHOW AXIS on the operator panel.
Step 2 - Configure the display widget
For Approach 2, edit the relevant INI (for example mmc2.ini for an axis overview, or a custom user_view.ini):
[DummyAxis]
Visible = 1
Type = NumericDisplay
Variable = /Channel/Parameter/R[100]
FormatString = %9.3f
UnitText = mm
RefreshMs = 100
X = 12
Y = 8
Width = 10
Height = 1
Step 3 - Cycle and refresh
The HMI polls variables every 100 ms by default. For faster updates, lower RefreshMs in increments of 50 ms and verify the NCK load stays below the recommended limit (typically < 50% for SW 6.x, see Siemens performance manual).
Step 4 - Color / alarm binding
Optionally bind a color trigger so the field changes color when the value crosses a threshold:
ColorHigh = %var% > 100.0 ? Red : Green
ColorLow = %var% < -100.0 ? Red : Green
Verification and Commissioning
- On the HMI, navigate to the machine area; confirm the dummy axis row
ZZ(or the R / GUD widget) is visible. - From the PLC programmer, write a known test value (e.g., 123.456) into the source variable; observe the HMI updates within one refresh interval (typically 100-200 ms).
- Toggle the sign; confirm the display updates without axis alarms (700xxx range should remain clear).
- Cycle NCK power (warm restart); confirm the simulated axis re-initializes cleanly and the PLC cycle resumes driving the value.
- Force an NCK reset while the PLC continues writing; the display should snap back to the current target after re-init.
- Open the NC variable view in the HMI Diagnostics area and confirm
$AA_IM[ZZ](Approach 1) or the R-parameter / GUD (Approach 2) reflects the PLC value.
Troubleshooting Matrix
| Symptom | Likely Cause | Diagnostic | Remedy |
|---|---|---|---|
| Axis ZZ never appears in machine area | Axis not added to channel axis list | SHOW AXIS in operator panel | Add ZZ to MD20070 $MC_AXCONF_MACHAX_USED |
| Display reads 0 or last value | PLC not retriggering FC18 / not writing R-parameter | Monitor PLC PosTrigger and WriteBusy
|
Confirm OB1 logic, enable watch |
| HMI display lags by several seconds | RefreshMs set too high or polling overload | Check NCK load via SHOW DIAG
|
Lower RefreshMs, reduce other polls |
| Axis reports alarm 700xxx "simulated axis..." | MD30350 not set or MD30240 wrong | Read $MA_SIMU_AX_VDI_OUTPUT | Set MD30240 = 0 and MD30350 bit 0 = 1 |
| Position oscillates around target | Positioning FC called faster than motion finishes | Watch $AA_IM[ZZ] trace | Raise MD32000, reduce feed in FC18 call |
| Value visible on HMI but not on NC var view | Approach 2: widget bound to wrong path | Inspect INI Variable=
|
Use /Channel/Parameter/R[100] or correct GUD path |
| After NCK reset the value sticks | PLC not resuming writes | PLC watch on FC call | Use a first-cycle restart bit to re-init the simulated axis |
Field Notes and Constraints
- SW 6.x is a maintenance-branch release; behavior of FC18 and the variable services is stable but pin-compatible with earlier builds. Confirm toolbox version before applying.
- If your machine uses HMI-Embedded or SINUMERIK Operate (newer than HMI Advanced), the configuration paths differ entirely - this guide does not cover those targets.
- For very high update rates (>10 Hz visible refresh), prefer Approach 2 (R/GUD widget) over Approach 1 (axis positioning) to avoid unnecessary NC motion-traffic load.
- Always protect the dummy axis slot with MD36912 $MA_SAFE_FUNCTION_ENABLE if Safety Integrated is active on the controller; otherwise alarms may surface at safety startup.
- If the displayed value is also consumed by a closed-loop regulator downstream, Approach 1 is mandatory - Approach 2 only displays.
Frequently Asked Questions
Can I write directly to $AA_IM[ZZ] from the PLC?
No. On standard 840D pl SW 6.x, $AA_IM and $VA_IM are NC-computed outputs. They cannot be assigned by the PLC. Use one of the three approaches documented above (simulated axis with FC18, R/GUD display, or synchronized-action override).
Which approach gives the smoothest display update?
Approach 1 (simulated axis with continuous FC18 positioning) gives the most "axis-like" behavior and matches operator expectations. Approach 2 (R-parameter / GUD widget) is the lightest on NC load and avoids motion traffic entirely; refresh is limited by the HMI poll interval.
Do I need to change NCK machine data to add the ZZ axis name?
Yes for Approach 1: MD20070 $MC_AXCONF_MACHAX_USED must list ZZ, and MD20080 $MC_AXCONF_CHANAX_NAME_TAB must name it. Approach 2 needs no MD changes beyond declaring the GUD or R-parameter scope.
Why does my HMI show the dummy axis value lagging by seconds?
The HMI Advanced polls variables on a configurable interval, default 100 ms. Check RefreshMs in your INI file and confirm NCK load is below the recommended limit. High NCK load or excessive simultaneous polls slow refresh.
Is FC18 safe to call every PLC cycle for a simulated axis?
Yes, provided the axis is declared simulated (MD30240 = 0, MD30350 bit 0 = 1). The NC will accept and execute the positioning request at IPO rate. For SW 6.x, monitor that no 700xxx alarms accumulate; if they do, lower MD32000 or the FC18 feed parameter.