Table of Contents

Class CodedPositionUtil

Namespace
Hi.NcParsers.LogicSyntaxs
Assembly
HiMech.dll

Shared coded-position resolution for the write-stage consumers (McAbcSyntax for rotary words, IncrementalResolveSyntax for linear words): turns a per-word PositioningOverride entry of the coded family (CodedAbsolute / CodedIncremental / CodedShortest / CodedPositiveOnly / CodedNegativeOnly — stamped by SiemensAcIcSyntax for CAC()/CIC()/CDC()/CACP()/CACN()) plus the evaluated position number into an axis coordinate via IIndexingPositionConfig, and names the plain override value the caller rewrites the entry to — so the McAbcCyclicPathSyntax tail-pass and every other downstream reader only ever see the established non-coded vocabulary.

Failure semantics mirror the Siemens alarms as far as a simulator can: an invalid position number (alarm 17510) or a missing table reports an error diagnostic and resolves to "hold" — the caller writes the anchor so the axis does not move. CIC(0) also resolves to hold, by specification ("the indexing axis is not traversed") and silently. A CIC from between two indexing positions advances to the n-th next position in the programmed direction. On a cyclic indexing axis the incremental sign becomes a directional (PositiveOnly / NegativeOnly) approach; increments spanning more than one revolution reach the correct position but collapse the extra full turns (the tail-pass windows cover one revolution).

public static class CodedPositionUtil
Inheritance
CodedPositionUtil
Inherited Members

Fields

ConfigMissingDiagId

Diagnostic id for a coded-position word whose axis no longer resolves an indexing table at the write stage (the unwrap stage only stamps coded overrides for configured indexing axes, so this indicates the dependency list changed between stages). The axis holds its position.

public const string ConfigMissingDiagId = "CodedPosition--ConfigMissing"

Field Value

string

NumberInvalidDiagId

Diagnostic id for a coded position number the indexing table cannot resolve: not an integer, outside the table, or (via CIC) advanced past the end of a non-cyclic table. The Siemens control raises alarm 17510 and stops; the simulation reports this error and holds the axis.

public const string NumberInvalidDiagId = "CodedPosition--NumberInvalid"

Field Value

string

Methods

IsCodedOverride(string)

True when overrideValue is one of the five coded-position PositioningOverride values.

public static bool IsCodedOverride(string overrideValue)

Parameters

overrideValue string

Returns

bool

TryResolveCodedTarget(IIndexingPositionConfig, string, string, double, double, ISentenceCarrier, NcDiagnosticProgress, out double, out string)

Resolves a coded-position word to its target axis coordinate. Returns true with the target position; false means “hold” — the caller writes anchorPosition instead (no motion on this axis), with any error already reported. resolvedOverride is always set to the plain override value the caller stamps over the coded entry (Absolute on every hold).

public static bool TryResolveCodedTarget(IIndexingPositionConfig indexingConfig, string axis, string codedOverride, double parsedValue, double anchorPosition, ISentenceCarrier sentenceCarrier, NcDiagnosticProgress diag, out double targetPosition, out string resolvedOverride)

Parameters

indexingConfig IIndexingPositionConfig

Indexing table, or null when the dependency list carries none.

axis string

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

codedOverride string

The coded PositioningOverride entry value.

parsedValue double

Evaluated word value — the position number (or count, for CodedIncremental).

anchorPosition double

Current axis position, used as the CIC anchor and as the hold target.

sentenceCarrier ISentenceCarrier

Block to anchor diagnostics to.

diag NcDiagnosticProgress

Diagnostic sink; may be null.

targetPosition double

Resolved target axis coordinate.

resolvedOverride string

Plain override value to stamp over the coded entry.

Returns

bool