Table of Contents

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.

MD10000–MD19999: General machine data. MD20000–MD29999: Axis-specific machine data. MD30000–MD39999: Axis-specific machine data (extended).

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, 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

src XElement

XML 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

int

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

int

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

int

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

int

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

int

MdIndexAxOffset

MD30503: Absolute position of indexing position 1 per axis ($MA_INDEX_AX_OFFSET) for equidistant indexing.

public const int MdIndexAxOffset = 30503

Field Value

int

MdMaxAxisVelocity

MD32000: Max axis velocity per axis (mm/min or deg/min).

public const int MdMaxAxisVelocity = 32000

Field Value

int

MdMaxSpindleSpeed

MD35100: Maximum spindle speed (RPM).

public const int MdMaxSpindleSpeed = 35100

Field Value

int

MdReferencePosition

MD34010: Reference point position per axis.

public const int MdReferencePosition = 34010

Field Value

int

MdStrokeLimitNeg

MD36110: Negative stroke limit per axis.

public const int MdStrokeLimitNeg = 36110

Field Value

int

MdStrokeLimitPos

MD36100: Positive stroke limit per axis.

public const int MdStrokeLimitPos = 36100

Field Value

int

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

int

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

int

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

string

Properties

AxisMd30300

MD30300: Axis type per axis. See AxisType. See AxisNames.

public Dictionary<string, int> AxisMd30300 { get; set; }

Property Value

Dictionary<string, int>

AxisMd30500

MD30500: Indexing table assignment per axis. See MdIndexAxAssignPosTab.

public Dictionary<string, int> AxisMd30500 { get; set; }

Property Value

Dictionary<string, int>

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

Dictionary<string, double>

AxisMd32000

MD32000: Max axis velocity per axis (mm/min or deg/min). See IRapidFeedrateConfig.

public Dictionary<string, double> AxisMd32000 { get; set; }

Property Value

Dictionary<string, double>

AxisMd34010

MD34010: Reference point position per axis. See IHomeMcConfig.

public Dictionary<string, double> AxisMd34010 { get; set; }

Property Value

Dictionary<string, double>

AxisTypeParamId

Parameter/MD/MP number for axis type (linear/rotary/spindle).

protected override int AxisTypeParamId { get; }

Property Value

int

Default3Axis

Default 3-axis Siemens milling machine.

public static SiemensMachineDataTable Default3Axis { get; }

Property Value

SiemensMachineDataTable

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

IReadOnlyDictionary<string, MCodeEffects>

IdAttributeName

XML attribute name for the parameter ID (“ParamId”, “MdId”, “MpId”).

protected override string IdAttributeName { get; }

Property Value

string

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

List<double>

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

List<double>

MaxSpindleSpeed_rpm

Maximum spindle speed in RPM. Delegates to Md35100.

public double MaxSpindleSpeed_rpm { get; set; }

Property Value

double

Md35100

MD35100: Maximum spindle speed (RPM). See MaxSpindleSpeed_rpm.

public double Md35100 { get; set; }

Property Value

double

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

int

StrokeLimitNegParamId

Parameter/MD/MP number for negative stroke limit per axis. 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. 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

bool

XName

XML element name used to register this dependency with XFactory.

public static string XName { get; }

Property Value

string

Methods

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

SiemensMachineDataTable

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

paramId int

Brand-specific parameter/MD/MP number.

Returns

string

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

paramId int

Brand-specific parameter/MD/MP number.

Returns

string

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

paramId int

Brand-specific parameter/MD/MP number.

Returns

string

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

axisName string

Returns

double?

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

axisName string

Axis name (e.g., “C”).

Returns

int

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

axisName string

Axis name (e.g., “C”).

Returns

bool

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

axisName string

Axis name (e.g., “C”).

Returns

bool

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

baseDirectory string

The base directory for resolving relative paths

relFile string

The relative file path for the XML source

exhibitionOnly bool

if 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.

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

factory XFactory

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

axisName string

Axis name (e.g., “C”).

position double

Current axis coordinate (degrees or mm); rotary values may lie outside one revolution and are normalized by the implementation.

floorNumber int

Number of the nearest indexing position at or (cyclically) below the given position.

exactlyOnPosition bool

True when the position sits on an indexing position within PositionMatchTolerance.

Returns

bool

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

axisName string

Axis name (e.g., “C”).

positionNumber int

1-based indexing position number.

position double

Resolved axis coordinate (degrees or mm).

Returns

bool