Class SiemensMachineDataTable
- Namespace
- Hi.NcParsers.Dependencys.Siemens
- Assembly
- HiMech.dll
Siemens Sinumerik machine data table. Stores machine data (MD numbers) as system and per-axis parameters, under keys numbered after SINUMERIK machine data; the keys known not to be the machine data number of the value they hold are marked by IsStorageKeyOnly(int).
MD10000–MD19999: General machine data ($MN_).
MD20000–MD29999: Channel-specific machine data ($MC_).
MD30000–MD39999: Axis/spindle-specific machine data ($MA_).
Deliberately not ISessionResettable: machine data is control configuration a part program cannot mutate, so there is no session-scoped state to clear.
public class SiemensMachineDataTable : ControllerParameterTableBase, IHomeMcConfig, IMachineAxisConfig, IRapidFeedrateConfig, IStrokeLimitConfig, ISpindleControlConfig, IMCodeDeclarationConfig, IToolChangeTriggerConfig, IIndexingPositionConfig, IRotaryHalfTurnTieConfig, IRotaryAbsoluteWordConfig, INcDependency, IMakeXmlSource
- Inheritance
-
SiemensMachineDataTable
- Implements
- Inherited Members
- Extension Methods
Constructors
SiemensMachineDataTable()
Initializes a new instance with empty machine data tables.
public SiemensMachineDataTable()
SiemensMachineDataTable(XElement)
Initializes a new instance by deserializing from src.
public SiemensMachineDataTable(XElement src)
Parameters
srcXElementXML element produced by MakeXmlSource(string, string, bool).
Fields
MdAxisType
MD30300: Axis type per axis (0=linear, 1=rotary, 2=spindle).
public const int MdAxisType = 30300
Field Value
MdFixPointPos
MD30600: Fixed point position per axis — the G75 target
($MA_FIX_POINT_POS). Fixed point 1 only; the Siemens
per-axis array form (FP=2..4) is not modeled.
public const int MdFixPointPos = 30600
Field Value
MdIndexAxAssignPosTab
MD30500: Indexing table assignment per axis
($MA_INDEX_AX_ASSIGN_POS_TAB) — 0 = not an indexing axis,
1 = positions in IndexAxPosTab1, 2 = positions in
IndexAxPosTab2, 3 = equidistant index intervals
(MdIndexAxNumerator / MdIndexAxDenominator
/ MdIndexAxOffset). See IIndexingPositionConfig.
public const int MdIndexAxAssignPosTab = 30500
Field Value
MdIndexAxDenominator
MD30502: Equidistant indexing denominator per axis
($MA_INDEX_AX_DENOMINATOR) — on a modular rotary axis, the
number of indexing positions per revolution.
public const int MdIndexAxDenominator = 30502
Field Value
MdIndexAxNumerator
MD30501: Equidistant indexing numerator per axis
($MA_INDEX_AX_NUMERATOR). Position spacing =
numerator / denominator for non-modular axes; ignored on modular
rotary axes, whose spacing is the 360° modulo range /
MdIndexAxDenominator.
public const int MdIndexAxNumerator = 30501
Field Value
MdIndexAxOffset
MD30503: Absolute position of indexing position 1 per axis
($MA_INDEX_AX_OFFSET) for equidistant indexing.
public const int MdIndexAxOffset = 30503
Field Value
MdMaxAxisVelocity
MD32000: Max axis velocity per axis (mm/min or deg/min).
public const int MdMaxAxisVelocity = 32000
Field Value
MdMaxSpindleSpeed
MD35100: Maximum spindle speed (RPM).
public const int MdMaxSpindleSpeed = 35100
Field Value
MdMiscFunctionMask
MD30455: Miscellaneous axis function mask per axis
($MA_MISC_FUNCTION_MASK), a plain integer in the native
parameter view. Two bits are read, both 0 on an absent row as on the
control's factory setting. Bit 0 (value 1): 0 = an absolute word
outside 0°–359.999° on a modulo axis stops the control with an alarm,
1 = it is converted into the range (B-5 = B355). Bit 2 (value 4): 0 =
a modulo axis positions a plain G90 word by the displayed
difference (a target above the actual position turns positive, below it
negative), 1 = as DC (shortest path); an explicit AC() /
CAC() is the displayed difference whatever the bit says. See
IRotaryAbsoluteWordConfig and HalfTurnTie(string).
public const int MdMiscFunctionMask = 30455
Field Value
MdReferencePosition
Storage key MD34010 of the reference point position per axis: HiNC's own
key, not the SINUMERIK machine data number for that meaning (a SINUMERIK keeps the
reference point value at MD34100, $MA_REFP_SET_POS). See
IsStorageKeyOnly(int).
public const int MdReferencePosition = 34010
Field Value
MdRotIsModulo
MD30310: Modulo conversion per axis ($MA_ROT_IS_MODULO):
1 = a modulo axis, positioned within 0°–360° by the rules of
IRotaryAbsoluteWordConfig; 0 = not a modulo axis — an
absolute word is the position as written, as on a linear axis. An absent
row is the control's factory setting, 0: a SINUMERIK rotary axis is a
modulo axis only when its row says so (IsModularRotary(string)),
and the base table's travel rule is not consulted. The engine took every
rotary axis as modulo before 2026-10-18; the Siemens programs of the
corpus write their rotary axes with signed words (C-2.659,
B-176.623) that a factory modulo axis refuses (MD30455 bit 0 = 0)
and ran on their machines, so the factory value is assumed now. A
DC() word needs no modulo axis (FB2 R2 §13.3.3 p.863).
public const int MdRotIsModulo = 30310
Field Value
MdStrokeLimitNeg
Storage key MD36110 of the negative stroke limit per axis (mm or deg):
HiNC's own key, not the SINUMERIK machine data number for that meaning — on a
SINUMERIK, MD36110 ($MA_POS_LIMIT_PLUS) is the plus and MD36100
($MA_POS_LIMIT_MINUS) the minus software limit switch, the reverse of
these keys. See IsStorageKeyOnly(int).
public const int MdStrokeLimitNeg = 36110
Field Value
MdStrokeLimitPos
Storage key MD36100 of the positive stroke limit per axis (mm or deg):
HiNC's own key, not the SINUMERIK machine data number for that meaning — on a
SINUMERIK, MD36100 ($MA_POS_LIMIT_MINUS) is the minus and MD36110
($MA_POS_LIMIT_PLUS) the plus software limit switch, the reverse of these
keys. See IsStorageKeyOnly(int).
public const int MdStrokeLimitPos = 36100
Field Value
MdToolChangeMCode
MD22560: Tool change M function
($MC_TOOL_CHANGE_M_CODE, default 6). When the row is present,
the named M code carries IsToolChange in
the effective declaration view (overlaid at read time — see
EffectiveMCodeDeclarations); when absent, only
explicit MCodeDeclarations
entries trigger a change.
public const int MdToolChangeMCode = 22560
Field Value
MdToolChangeMode
MD22550: Tool change mode ($MC_TOOL_CHANGE_MODE) —
0 = the T word itself performs the change (turret/lathe),
1 = an M function performs it while T only preselects. When the row
is present it drives ToolWordTriggersChange; when
absent the brand-neutral flag stands alone.
public const int MdToolChangeMode = 22550
Field Value
OemAuxiliaryNote
Note text for the OEM auxiliary M-codes the default preset declares
note-only (M12/M13/M22/M23/M330/M331) — machine-specific codes
recurring in real Siemens programs whose PLC behavior varies per
machine and is not simulated. A note-only declaration keeps each
occurrence visible as known-but-unmodeled
(DeclaredMCode–UnmodeledEffects) instead of the unknown-code
Parsing–Unconsumed warning; a machine table overrides the
declaration with the actual effects when they are known.
public const string OemAuxiliaryNote = "machine-specific auxiliary function (OEM/PLC); the exact behavior depends on the machine"
Field Value
Properties
AxisMd30300
public Dictionary<string, int> AxisMd30300 { get; set; }
Property Value
AxisMd30500
MD30500: Indexing table assignment per axis. See MdIndexAxAssignPosTab.
public Dictionary<string, int> AxisMd30500 { get; set; }
Property Value
AxisMd30600
MD30600: Fixed point position per axis (fixed point 1 — the G75 target). See GetFixPointPosition(string).
public Dictionary<string, double> AxisMd30600 { get; set; }
Property Value
AxisMd32000
MD32000: Max axis velocity per axis (mm/min or deg/min). See IRapidFeedrateConfig.
public Dictionary<string, double> AxisMd32000 { get; set; }
Property Value
AxisMd34010
Reference point position per axis (mm or deg), under storage key MD34010 (MdReferencePosition) — not the SINUMERIK machine data number for that meaning, see IsStorageKeyOnly(int). See IHomeMcConfig.
public Dictionary<string, double> AxisMd34010 { get; set; }
Property Value
AxisTypeParamId
Parameter/MD/MP number for axis type (linear/rotary/spindle).
protected override int AxisTypeParamId { get; }
Property Value
Default3Axis
Default 3-axis Siemens milling machine.
public static SiemensMachineDataTable Default3Axis { get; }
Property Value
EffectiveMCodeDeclarations
Overlays the MD22560 tool-change M function onto the declared M-codes: the named code gains IsToolChange (merged into a clone of its explicit declaration when one exists, so a note or coolant half is kept and the stored instance is never mutated). The overlay exists only in this read-time view — XML, MCodeDeclarations, and clones stay derivation-free and re-derive from the MD row. With no MD22560 row (or one already declared as a tool change) the stored dictionary is returned as-is, allocation-free.
protected override IReadOnlyDictionary<string, MCodeEffects> EffectiveMCodeDeclarations { get; }
Property Value
IdAttributeName
XML attribute name for the parameter ID (“ParamId”, “MdId”, “MpId”).
protected override string IdAttributeName { get; }
Property Value
IndexAxPosTab1
Indexing position table 1 (MD10910 $MN_INDEX_AX_POS_TAB_1),
shared by every axis whose MdIndexAxAssignPosTab value
is 1. Entry order is position-number order: entry [0] is indexing
position 1. The used-length machine data (MD10900) is implied by
the list count. Values follow the Siemens constraints (strictly
ascending; within one revolution for modular rotary axes) — the
lookups do not validate them.
public List<double> IndexAxPosTab1 { get; set; }
Property Value
IndexAxPosTab2
Indexing position table 2 (MD10930 $MN_INDEX_AX_POS_TAB_2) —
see IndexAxPosTab1; used-length MD10920 implied by the
list count.
public List<double> IndexAxPosTab2 { get; set; }
Property Value
MaxSpindleSpeed_rpm
Maximum spindle speed in RPM. Delegates to Md35100.
public double MaxSpindleSpeed_rpm { get; set; }
Property Value
Md35100
MD35100: Maximum spindle speed (RPM). See MaxSpindleSpeed_rpm.
public double Md35100 { get; set; }
Property Value
ModuloSetting
The setting that makes the axis a modulo axis or not, as the messages name it (“MD30310”).
public string ModuloSetting { get; }
Property Value
OutOfRangeConversionSetting
The setting behind ConvertsOutOfRangeAbsoluteWord(string), as the messages name it and as the user enters it ("MD30455 bit 0 (1)").
public string OutOfRangeConversionSetting { get; }
Property Value
PlainWordPathSetting
The setting behind PlainWordPath(string), as the messages name it and as the user enters it — the bit and the integer it adds to the row ("MD30455 bit 2 (4)").
public string PlainWordPathSetting { get; }
Property Value
RapidRateParamId
Parameter/MD/MP number for rapid traverse rate per axis. Null if not defined for this controller brand.
protected override int? RapidRateParamId { get; }
Property Value
- int?
ReferencePositionParamId
Parameter/MD/MP number for reference position (G28 home).
protected override int ReferencePositionParamId { get; }
Property Value
StrokeLimitNegParamId
Parameter/MD/MP number for negative stroke limit per axis; IsStorageKeyOnly(int) marks it as a storage key rather than the controller's own number. Null if not defined for this controller brand.
protected override int? StrokeLimitNegParamId { get; }
Property Value
- int?
StrokeLimitPosParamId
Parameter/MD/MP number for positive stroke limit per axis; IsStorageKeyOnly(int) marks it as a storage key rather than the controller's own number. Null if not defined for this controller brand.
protected override int? StrokeLimitPosParamId { get; }
Property Value
- int?
ToolWordTriggersChange
The T-word trigger, bound to MD22550 ($MC_TOOL_CHANGE_MODE)
when that row is present: 0 = the T word performs the change, any
other value = an M function does. An absent row falls back to the
brand-neutral flag. The setter writes whichever storage is active,
so an MD-configured table keeps the machine data authoritative
(and visible in the native parameter view) while a table without
the row behaves exactly like the other brands.
public override bool ToolWordTriggersChange { get; set; }
Property Value
XName
XML element name used to register this dependency with XFactory.
public static string XName { get; }
Property Value
Methods
ConvertsOutOfRangeAbsoluteWord(string)
True when the control converts an absolute word outside the modulo range (0°–360°) into it and positions as if the converted value had been written; false when it stops with an alarm — the tail pass then still converts, and says so once per axis.
public bool ConvertsOutOfRangeAbsoluteWord(string axisName)
Parameters
axisNamestringAxis name (e.g., “C”).
Returns
Remarks
MD30455 bit 0: “Bit 0 = 0: Modulo rotary axis/spindle: Programmed positions must be within the modulo range. Otherwise, an alarm is output. Bit 0 = 1: If positions outside the modulo range are programmed, no alarm is output. The position is modulo-converted internally. Example: B-5 is equivalent to B355” (Machine data and parameters, Parameter Manual 03/2013, 6FC5397-7AP40-3BA1, MD30455, p.449).
DeepClone()
Returns an independent deep copy of this table: the three parameter dictionaries, M-code declarations, and T-word trigger (via CopyParamsTo(ControllerParameterTableBase)) plus this class's indexing position tables (IndexAxPosTab1/IndexAxPosTab2). Used by SiemensMachineDataTableProxy to clone its fixed machine-config seed into a host that has no table yet.
public SiemensMachineDataTable DeepClone()
Returns
DescribeAxisParam(int)
Per-axis double counterpart of DescribeSystemParam(int). Covers the role ids the base class consumes (reference position, rapid rate, stroke limits); brand subclasses may override for their own vocabulary or extra numbers.
public override string DescribeAxisParam(int paramId)
Parameters
paramIdintBrand-specific parameter/MD/MP number.
Returns
DescribeIntAxisParam(int)
Per-axis integer counterpart of DescribeSystemParam(int). Covers the axis-type id the base class consumes.
public override string DescribeIntAxisParam(int paramId)
Parameters
paramIdintBrand-specific parameter/MD/MP number.
Returns
DescribeSystemParam(int)
Short usage label for a well-known system parameter id, or null when the id has no modeled meaning (a raw pass-through row). Brand subclasses extend this with their own well-known numbers; the native parameter UI shows the label next to the raw id so an operator can tell the modeled parameters from free extras.
public override string DescribeSystemParam(int paramId)
Parameters
paramIdintBrand-specific parameter/MD/MP number.
Returns
ExplicitAbsoluteWordPath(string)
The controller's path to an explicitly absolute word — Siemens
AC() / CAC(), the Absolute
override — on the axis: the AC rule as written, which the setting
behind PlainWordPath(string) does not change.
public RotaryAbsoluteWordPath ExplicitAbsoluteWordPath(string axisName)
Parameters
axisNamestringAxis name (e.g., “C”).
Returns
Remarks
Always the displayed difference: the manual's bit 2 sentences
speak of the G90 word only (“with G90, modulo axis positioned as
standard using AC / DC”), while an AC() written out is the AC
rule itself ("When programming AC exclusively or with G90 …").
GetFixPointPosition(string)
Fixed-point-1 position (MD30600) for the axis, or null when the axis has no configured fixed point — the G75 consumer then falls back to the reference position (GetHomePosition(string)).
public double? GetFixPointPosition(string axisName)
Parameters
axisNamestring
Returns
GetIndexingPositionCount(string)
Number of programmable indexing positions: the table length for table-assigned axes, the per-cycle position count for cyclic equidistant axes, MaxValue for unbounded (non-cyclic equidistant) axes, and 0 when the axis is not a usable indexing axis.
public int GetIndexingPositionCount(string axisName)
Parameters
axisNamestringAxis name (e.g., “C”).
Returns
HalfTurnTie(string)
How a SINUMERIK modulo axis turns on a half-turn tie for a word other
than DC()/CDC() (those carry their own positive
preference, Function Manual Extended Functions 09/2011,
6FC5397-1BP40-2BA0, R2 §13.3.2 p.858): positive when
MdMiscFunctionMask bit 2 is set for the axis, which makes
a plain G90 word position as DC ("Bit 2 = 0: with G90,
modulo axis positioned as standard using AC; Bit 2 = 1: … using DC
(shortest path)", p.857); otherwise towards the programmed value, which
is what the displayed difference of PlainWordPath(string) gives
at a half turn too (a target above the actual position turns positive,
below it negative, p.857) — with bit 2 clear a plain word, and an
AC() or CAC() word whatever the bit, is decided by that
rule before the tie band is reached, so this answer is the same rule
stated for the band.
public RotaryHalfTurnTie HalfTurnTie(string axisName)
Parameters
axisNamestring
Returns
IsIndexingAxis(string)
True when the axis is configured as an indexing axis with a usable position table (a non-empty table, or a valid equidistant definition). An axis declared indexing but with an empty/invalid table reports false — the coded-position words then stay unrecognized (loud residue) instead of resolving against garbage.
public bool IsIndexingAxis(string axisName)
Parameters
axisNamestringAxis name (e.g., “C”).
Returns
IsIndexingCyclic(string)
True when position-number arithmetic wraps modulo GetIndexingPositionCount(string) — an indexing axis that is also a modular rotary axis (IsModularRotary(string)). Advancing past the last position continues at position 1.
public bool IsIndexingCyclic(string axisName)
Parameters
axisNamestringAxis name (e.g., “C”).
Returns
IsModularRotary(string)
Whether the rotary axis wraps 0°–360° (modular). Decides which axes
McAbcCyclicPathSyntax resolves cyclically —
the shortest path, or the controller's rule for an absolute word
(IRotaryAbsoluteWordConfig); a rotary axis that is not
modular keeps every programmed word as written — except a DC()
/ CDC() word, which still takes the shortest way (FB2 R2
§13.3.3 p.863) — and takes a value it carries without a word to the
nearest turn its stroke limits admit. Returns false for linear axes.
The default is every rotary axis; the brand tables
(IsModularRotary(string)) take a
rotary axis whose two stroke limits are set less than a turn apart out
of the set, and the Siemens table answers from MD30310 alone: a modulo
axis only when the row is 1, the control's factory value being 0.
public override bool IsModularRotary(string axisName)
Parameters
axisNamestring
Returns
Remarks
A rotary axis whose travel is under a turn is not modular: with both stroke limits set and finite (GetNegativeLimit(string), GetPositiveLimit(string)) and less than 360° apart, a word is the position as written — the controllers set such an axis not to roll over (FANUC No. 1008 ROAx = 0, SINUMERIK MD30310 = 0, a HEIDENHAIN axis that is not a modulo axis), and the shortest way round could run through the stop: a tilt axis at ±120° commanded from −100° to +100° turns +200°, not −160° to −260°. One limit, none, an infinite one, a pair at least a turn apart or within FullTurnMargin_deg of it (a rollover table's display range entered as its limits, 0° and 359.999°), a pair the wrong way round or an equal pair leaves the axis modular. A brand table may replace this with the machine data it reads: SiemensMachineDataTable answers from MD30310 alone — a modulo axis only when the row is 1, the control's factory value being 0 — and does not consult the travel.
IsPlainWordPathConfigured(string)
True when PlainWordPath(string) is read from a row the user set for the axis, false when it is the controller's factory setting assumed for an axis without the row — the case the tail pass reports once per axis when the assumed path is not the shortest way.
public bool IsPlainWordPathConfigured(string axisName)
Parameters
axisNamestringAxis name (e.g., “C”).
Returns
Remarks
True when the axis has an MD30455 row, whatever its value.
IsStorageKeyOnly(int)
Whether the modeled id paramId is only a storage key of this
table: the number the table keeps its value under is known not to be the
controller's own parameter number for that value, so a value read off a real
control goes into such a row by its meaning, and in the unit the row's caption
names, never by matching the number. False does not make an id the controller's
number: only the ids known to differ are marked. The base class marks the positive and the negative stroke-limit ids;
each brand table adds the other keys it knows to differ.
public override bool IsStorageKeyOnly(int paramId)
Parameters
paramIdintBrand-specific parameter/MD/MP number, as the row that DescribeSystemParam(int), DescribeAxisParam(int) or DescribeIntAxisParam(int) describes; a number the table does not model in a section is a free extra there, whatever this answers.
Returns
- bool
True for a storage key known not to be the controller's number; false for every other id.
Remarks
Beyond the stroke-limit pair, marks the reference-position key MD34010.
MakeXmlSource(string, string, bool)
Creates an XML representation of the object. This method may also generate additional resources such as related files.
public override XElement MakeXmlSource(string baseDirectory, string relFile, bool exhibitionOnly)
Parameters
baseDirectorystringThe base directory for resolving relative paths
relFilestringThe relative file path for the XML source
exhibitionOnlyboolif true, the extended file creation is suppressed.
Returns
- XElement
An XML element representing the object's state
Remarks
For the demand of easy moving source folder (especially project folder) without configuration file path corruption, the relative file path is applied.
The baseDirectory is typically the folder at the nearest configuration file folder.
Since the folder can be moving with the configuration file.
PlainWordPath(string)
The controller's path to a plain absolute word — one the modal
G90 makes absolute, with no coordinate function of its own —
on the axis.
public RotaryAbsoluteWordPath PlainWordPath(string axisName)
Parameters
axisNamestringAxis name (e.g., “C”).
Returns
Remarks
MD30455 bit 2 (MdMiscFunctionMask): 0, the
factory setting and an absent row, is the displayed difference — “When
programming AC exclusively or with G90, the traversing direction
depends on the rotary-axis actual position. If the target position is
greater than the actual position, the axis traverses in the positive
direction, otherwise it traverses in the negative direction.” (Function
Manual Extended Functions 09/2011, 6FC5397-1BP40-2BA0, R2 §13.3.2
p.857; example ④ there: AC(0) from 240° turns −240°); 1 is the
shortest path ("Bit 2 = 1: with G90, modulo axis positioned as standard
using DC (shortest path)", same page).
Reg(XFactory)
Registers this type's deserializer with the given XFactory
(or Default when factory is
null). Idempotent.
public static void Reg(XFactory factory = null)
Parameters
factoryXFactory
TryFindIndexingAnchor(string, double, out int, out bool)
Locates an axis position relative to the indexing table for
incremental (CIC) resolution: floorNumber
is the number of the nearest indexing position at or below
position (cyclically behind on cyclic axes; 0
when the position lies below the whole table on a non-cyclic axis),
and exactlyOnPosition reports a match within
PositionMatchTolerance. False when the axis is not a
usable indexing axis.
public bool TryFindIndexingAnchor(string axisName, double position, out int floorNumber, out bool exactlyOnPosition)
Parameters
axisNamestringAxis name (e.g., “C”).
positiondoubleCurrent axis coordinate (degrees or mm); rotary values may lie outside one revolution and are normalized by the implementation.
floorNumberintNumber of the nearest indexing position at or (cyclically) below the given position.
exactlyOnPositionboolTrue when the position sits on an indexing position within PositionMatchTolerance.
Returns
TryGetIndexingPosition(string, int, out double)
Resolves a 1-based indexing position number to its axis coordinate.
False when the axis is not a usable indexing axis or the number is
outside [1, count].
public bool TryGetIndexingPosition(string axisName, int positionNumber, out double position)
Parameters
axisNamestringAxis name (e.g., “C”).
positionNumberint1-based indexing position number.
positiondoubleResolved axis coordinate (degrees or mm).