Table of Contents

Class ControllerParameterTableBase

Namespace
Hi.NcParsers.Dependencys
Assembly
HiMech.dll

Base class for brand-specific controller parameter tables. Provides shared data structures, XML IO, and IHomeMcConfig

  • IMachineAxisConfig implementations. Subclasses define brand-specific parameter numbers, XML attribute names, and derived convenience properties.
public abstract class ControllerParameterTableBase : IHomeMcConfig, IMachineAxisConfig, IRapidFeedrateConfig, IStrokeLimitConfig, ISpindleControlConfig, IMCodeDeclarationConfig, IToolChangeTriggerConfig, INcDependency, IMakeXmlSource
Inheritance
ControllerParameterTableBase
Implements
Derived
Inherited Members
Extension Methods

Fields

DefaultLinearRapidRate_mmdmin

Rapid traverse rate GetLinearAxisRapidRate_mmdmin(string) answers for a linear axis without a rapid-rate row of its own (mm/min).

public const double DefaultLinearRapidRate_mmdmin = 20000

Field Value

double

DefaultRotaryRapidRate_degdmin

Rapid traverse rate GetRotaryAxisRapidRate_degdmin(string) answers for a rotary axis without a rapid-rate row of its own (deg/min); also the value ConfigureByMachiningChain(IMachiningChain) seeds such an axis with, and the default of ConfigureRotaryAxis(string, double, double).

public const double DefaultRotaryRapidRate_degdmin = 36000

Field Value

double

FullTurnMargin_deg

How far short of 360° a pair of limits may be and still count as a full turn in HasTravelUnderOneTurn(string): a rotary table's limits entered as its display range, 0° and 359.999° (or −180° and 180°), are a rollover axis, while a tilt axis travels a few hundred degrees at most.

public const double FullTurnMargin_deg = 1

Field Value

double

Properties

AxisNames

Gets the configured axis names in order.

public IEnumerable<string> AxisNames { get; }

Property Value

IEnumerable<string>

AxisParams

Per-axis float parameters. Outer key = parameter number, inner key = axis name.

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

Property Value

Dictionary<int, Dictionary<string, double>>

AxisTypeParamId

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

protected abstract int AxisTypeParamId { get; }

Property Value

int

EffectiveMCodeDeclarations

The declaration view the consumers resolve against (IMCodeDeclarationConfig and TryGetMCodeEffects(string, out MCodeEffects)/TryResolveDirection(string, out SpindleDirection)). Defaults to MCodeDeclarations verbatim; a brand subclass overrides it to overlay declarations mandated by its own machine data (e.g. the Siemens MD22560 tool-change M function) without writing them into the stored dictionary — the stored declarations, XML, and clones stay derivation-free and the overlay re-derives on every read.

protected virtual IReadOnlyDictionary<string, MCodeEffects> EffectiveMCodeDeclarations { get; }

Property Value

IReadOnlyDictionary<string, MCodeEffects>

IdAttributeName

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

protected abstract string IdAttributeName { get; }

Property Value

string

IntAxisParams

Per-axis integer parameters. Outer key = parameter number, inner key = axis name.

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

Property Value

Dictionary<int, Dictionary<string, int>>

MCodeDeclarations

Declared machine M-codes and their effects — the single storage behind both IMCodeDeclarationConfig and the narrower ISpindleControlConfig face, so one code is never half-recognized by two separate maps. Key = M-code as parsed (e.g., “M13”), case-insensitive. Serialized as <MCode> elements (spindle-direction-only entries keep the legacy <SpindleMCode> element for older readers).

public Dictionary<string, MCodeEffects> MCodeDeclarations { get; set; }

Property Value

Dictionary<string, MCodeEffects>

RapidRateParamId

Parameter/MD/MP number for rapid traverse rate per axis. Null if not defined for this controller brand.

protected virtual int? RapidRateParamId { get; }

Property Value

int?

ReferencePositionParamId

Parameter/MD/MP number for reference position (G28 home).

protected abstract int ReferencePositionParamId { get; }

Property Value

int

SpindleDirectionCodes

Spindle-direction view over MCodeDeclarations: every declared code that carries a SpindleDirection. See ISpindleControlConfig.

public IReadOnlyDictionary<string, SpindleDirection> SpindleDirectionCodes { get; }

Property Value

IReadOnlyDictionary<string, SpindleDirection>

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 virtual 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 virtual int? StrokeLimitPosParamId { get; }

Property Value

int?

SystemParams

System-wide parameters. Key = parameter number.

public Dictionary<int, double> SystemParams { get; set; }

Property Value

Dictionary<int, double>

ToolWordTriggersChange

When true, a T word performs the tool change by itself (turret/lathe semantics — Siemens MD22550 $MC_TOOL_CHANGE_MODE = 0). Default false: T only pre-selects; the trigger M-code changes the tool. See IToolChangeTriggerConfig. Virtual so a brand subclass can defer to its own machine data when that carries the same semantics (the Siemens table consults MD22550 when present).

public virtual bool ToolWordTriggersChange { get; set; }

Property Value

bool

Methods

AxisParam(int)

Returns the per-axis float bucket for paramId, creating it if absent. See AxisParams.

public Dictionary<string, double> AxisParam(int paramId)

Parameters

paramId int

Brand-specific parameter/MD/MP number.

Returns

Dictionary<string, double>

ConfigureRotaryAxis(string, double, double)

Configures a rotary axis with home position and rapid rate. Sets axis type to Rotary, home position via SetHomePosition(string, double), and per-axis rapid rate (if RapidRateParamId is defined for this brand). Writes all three as given, over any value the table holds; the chain walk of ConfigureByMachiningChain(IMachiningChain) does not call it, since that walk seeds only the rows a table lacks. Use RemoveAxis(string) to remove the axis entirely.

public void ConfigureRotaryAxis(string axisName, double homePosition_deg = 0, double rapidRate_degdmin = 36000)

Parameters

axisName string

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

homePosition_deg double

Home position in degrees (default 0).

rapidRate_degdmin double

Rapid traverse rate in deg/min (default DefaultRotaryRapidRate_degdmin).

ConfigureSpindleDirectionCode(string, SpindleDirection)

Adds or updates a custom spindle direction M-code.

public void ConfigureSpindleDirectionCode(string mCode, SpindleDirection direction)

Parameters

mCode string
direction SpindleDirection

CopyParamsTo(ControllerParameterTableBase)

Deep-copies this table's SystemParams, AxisParams, IntAxisParams, MCodeDeclarations, and ToolWordTriggersChange into target, replacing the target's dictionaries with independent copies (outer and inner buckets; declaration entries cloned). Subclasses expose a typed DeepClone that constructs the concrete table and calls this. Used by the parameter-table proxies to clone their fixed machine-config seed into a host that has no table yet.

protected void CopyParamsTo(ControllerParameterTableBase target)

Parameters

target ControllerParameterTableBase

The table to overwrite with deep copies of this table's parameters.

DeclareMCode(string, MCodeEffects)

Adds or replaces the declaration for an M-code. The effects are copied on store, so the caller may reuse or further mutate its instance without coupling declarations to each other.

public void DeclareMCode(string mCode, MCodeEffects effects)

Parameters

mCode string
effects MCodeEffects

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 virtual 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 virtual 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 virtual string DescribeSystemParam(int paramId)

Parameters

paramId int

Brand-specific parameter/MD/MP number.

Returns

string

GetHomePosition(string)

Gets the home position for a specific axis. Returns null if the axis has no home position configured.

public double? GetHomePosition(string axisName)

Parameters

axisName string

Returns

double?

GetLinearAxisRapidRate_mmdmin(string)

Gets rapid traverse feedrate for a linear axis in mm/min. Returns a default value if the axis is not configured.

public double GetLinearAxisRapidRate_mmdmin(string axisName)

Parameters

axisName string

Returns

double

GetNegativeLimit(string)

Gets the negative stroke limit for a specific axis. Unit is mm for linear axes, deg for rotary axes. Returns null if not configured (no limit).

public double? GetNegativeLimit(string axisName)

Parameters

axisName string

Returns

double?

GetPositiveLimit(string)

Gets the positive stroke limit for a specific axis. Unit is mm for linear axes, deg for rotary axes. Returns null if not configured (no limit).

public double? GetPositiveLimit(string axisName)

Parameters

axisName string

Returns

double?

GetRotaryAxisRapidRate_degdmin(string)

Gets rapid traverse feedrate for a rotary axis in deg/min. Returns a default value if the axis is not configured.

public double GetRotaryAxisRapidRate_degdmin(string axisName)

Parameters

axisName string

Returns

double

HasRapidRate(string)

Whether the table holds a rapid-rate row of its own for axisName. GetLinearAxisRapidRate_mmdmin(string) and GetRotaryAxisRapidRate_degdmin(string) answer the default for an axis without one, so this is how a stored value is told from the default. False for every axis of a brand whose table has no rapid-rate parameter (RapidRateParamId null), where the setters store nothing.

public bool HasRapidRate(string axisName)

Parameters

axisName string

Axis name (e.g., “X”, “B”).

Returns

bool

HasTravelUnderOneTurn(string)

True when both stroke limits of the axis are set and finite, the positive one above the negative one by more than nothing and by less than a turn (360° − FullTurnMargin_deg) — a limited-travel axis (see IsModularRotary(string)).

protected bool HasTravelUnderOneTurn(string axisName)

Parameters

axisName string

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

Returns

bool

IntAxisParam(int)

Returns the per-axis integer bucket for paramId, creating it if absent. See IntAxisParams.

public Dictionary<string, int> IntAxisParam(int paramId)

Parameters

paramId int

Brand-specific parameter/MD/MP number.

Returns

Dictionary<string, int>

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 virtual bool IsModularRotary(string axisName)

Parameters

axisName string

Returns

bool

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.

IsRotaryAxis(string)

Returns true if the axis is rotary or spindle, false if linear.

public bool IsRotaryAxis(string axisName)

Parameters

axisName string

Returns

bool

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 virtual bool IsStorageKeyOnly(int paramId)

Parameters

paramId int

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

MakeXmlSource(string, string, bool)

Creates an XML representation of the object. This method may also generate additional resources such as related files.

public abstract 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.

ReadXml(XElement)

Populates SystemParams, AxisParams, and IntAxisParams from src using the brand-specific IdAttributeName.

protected void ReadXml(XElement src)

Parameters

src XElement

XML element produced by WriteXml(string).

RemoveAxis(string)

Removes an axis from the configuration.

public void RemoveAxis(string axisName)

Parameters

axisName string

RemoveMCodeDeclaration(string)

Removes the declaration for an M-code.

public void RemoveMCodeDeclaration(string mCode)

Parameters

mCode string

RemoveSpindleDirectionCode(string)

Removes a custom spindle direction M-code.

public void RemoveSpindleDirectionCode(string mCode)

Parameters

mCode string

SetAxis(string, AxisType)

Adds or updates an axis with the specified type.

public void SetAxis(string axisName, AxisType type)

Parameters

axisName string
type AxisType

SetHomePosition(string, double)

Sets the home position for a specific axis.

public void SetHomePosition(string axisName, double value)

Parameters

axisName string
value double

SetLinearAxisRapidRate_mmdmin(string, double)

Sets rapid traverse feedrate for a linear axis in mm/min.

public void SetLinearAxisRapidRate_mmdmin(string axisName, double value)

Parameters

axisName string
value double

SetNegativeLimit(string, double)

Sets the negative stroke limit for a specific axis. Unit is mm for linear axes, deg for rotary axes.

public void SetNegativeLimit(string axisName, double value)

Parameters

axisName string
value double

SetPositiveLimit(string, double)

Sets the positive stroke limit for a specific axis. Unit is mm for linear axes, deg for rotary axes.

public void SetPositiveLimit(string axisName, double value)

Parameters

axisName string
value double

SetRotaryAxisRapidRate_degdmin(string, double)

Sets rapid traverse feedrate for a rotary axis in deg/min.

public void SetRotaryAxisRapidRate_degdmin(string axisName, double value)

Parameters

axisName string
value double

TryGetMCodeEffects(string, out MCodeEffects)

Resolves a parsed flag to its declared effects. Returns false for undeclared codes — ISO defaults are the consumers' concern, not this config's. The returned instance is the live declaration: treat it as read-only and reconfigure through DeclareMCode(string, MCodeEffects) instead of mutating it.

public bool TryGetMCodeEffects(string mCode, out MCodeEffects effects)

Parameters

mCode string
effects MCodeEffects

Returns

bool

TryResolveDirection(string, out SpindleDirection)

Resolves a parsed flag to a spindle direction. Returns true only for configured custom codes whose declaration carries no other effect — the caller consumes the whole flag for this one meaning, so a composite declaration (e.g. spindle + coolant) must instead be expanded by MCodeExpansionSyntax to keep its other halves alive. ISO M03/M04/M05 defaults are the caller's fallback, not this config's concern.

public bool TryResolveDirection(string mCode, out SpindleDirection direction)

Parameters

mCode string
direction SpindleDirection

Returns

bool

WriteXml(string)

Serializes SystemParams, AxisParams, and IntAxisParams into a new XElement. Inverse of ReadXml(XElement).

protected XElement WriteXml(string xName)

Parameters

xName string

Element name for the produced XML element.

Returns

XElement