Class HeidenhainQParameterTable
- Namespace
- Hi.NcParsers.Dependencys.Heidenhain
- Assembly
- HiMech.dll
Heidenhain Q-parameter table for the ranges that persist on a real TNC:
free parameters Q0-Q99 (survive power cycles) and the permanent
QR0-QR499 range (nonvolatile, backed up with the machine). Like
the Siemens sibling SiemensRParameterTable, this
table is not session-reset and is serialised into the project file.
The other Q ranges deliberately live elsewhere: Q100-Q199 are
controller-written system parameters — Get(string) returns
null for them (read fail-soft, no fabricated values) and the
reading syntax refuses writes; Q200+ are volatile cycle/user
parameters carried block-to-block in Vars.Volatile (JSON
dataflow, cleared at program end) — Get(string) also returns
null so the evaluator's chain falls through to
HeidenhainVolatileQLookup.
Reads flow through Get(string) (registered
automatically because the table sits on the runner's effective
NcDependencyList); writes flow through
HeidenhainQParameterReadingSyntax,
which consumes literal Parsing.Assignments.Qn entries after
VariableEvaluatorSyntax has normalized
expression RHS to literals.
Vacant is represented by null: either the dictionary has no entry
for the key, or the entry maps to null — both read identically. A
vacant read failing loud (Variable--Vacant via the evaluator) surfaces
missing setup data instead of silently machining with 0.
public class HeidenhainQParameterTable : INcDependency, IMakeXmlSource, IVariableLookup
- Inheritance
-
HeidenhainQParameterTable
- Implements
- Inherited Members
- Extension Methods
Constructors
HeidenhainQParameterTable()
Empty table.
public HeidenhainQParameterTable()
HeidenhainQParameterTable(XElement)
Loads from XML produced by MakeXmlSource(string, string, bool).
public HeidenhainQParameterTable(XElement src)
Parameters
srcXElement
Fields
PersistentMax
Inclusive upper bound of the persistent free range (Q99).
public const int PersistentMax = 99
Field Value
PersistentMin
Inclusive lower bound of the persistent free range (Q0).
public const int PersistentMin = 0
Field Value
QRMax
Inclusive upper bound of the permanent QR range (QR499).
public const int QRMax = 499
Field Value
QRMin
Inclusive lower bound of the permanent QR range (QR0).
public const int QRMin = 0
Field Value
SystemMax
Inclusive upper bound of the read-only system range (Q199).
public const int SystemMax = 199
Field Value
SystemMin
Inclusive lower bound of the read-only system range (Q100).
public const int SystemMin = 100
Field Value
Properties
QRVariables
Backing store of the permanent QR range. Key = QR number (e.g. 5 for
QR5); same vacant semantics as Variables. Keys are
constrained to QRMin..QRMax.
public Dictionary<int, double?> QRVariables { get; set; }
Property Value
- Dictionary<int, double?>
Variables
Backing store of the free persistent range. Key = Q number (e.g. 1 for
Q1). Value null = vacant; a missing key is also vacant.
Keys are constrained to PersistentMin..PersistentMax;
out-of-range writes are silently ignored.
public Dictionary<int, double?> Variables { get; set; }
Property Value
- Dictionary<int, double?>
XName
XML element name.
public static string XName { get; }
Property Value
Methods
Get(string)
Returns the value of the variable identified by key
(e.g. "#124"), or null if vacant or unknown to this lookup.
public double? Get(string key)
Parameters
keystring
Returns
Remarks
Routes Qn keys in the persistent free range and QRn keys
(canonical uppercase from
HeidenhainExpressionParser;
lowercase from raw captures also resolves) to their stores. All other
keys — including the system range Q100-Q199 (read fail-soft by
design), the volatile range Q200+ (lives in
Vars.Volatile) and QL/QS — return null so
the evaluator's lookup chain falls through.
GetQRVariable(int)
Reads a permanent QR parameter (QR0-QR499). Returns null
for vacant.
public double? GetQRVariable(int id)
Parameters
Returns
GetVariable(int)
Reads a free Q parameter (Q0-Q99). Returns null for
vacant (either the entry is absent or stored as null).
public double? GetVariable(int id)
Parameters
idintParameter number in PersistentMin..PersistentMax.
Returns
MakeXmlSource(string, string, bool)
Creates an XML representation of the object. This method may also generate additional resources such as related files.
public 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.
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
SetQRVariable(int, double?)
public void SetQRVariable(int id, double? value)
Parameters
SetVariable(int, double?)
Writes a free Q parameter. Pass null to set vacant. Ignores ids
outside PersistentMin..PersistentMax.
public void SetVariable(int id, double? value)