Table of Contents

Class FanucSystemControlVariableLookup

Namespace
Hi.NcParsers.EvaluationSyntaxs.Fanuc
Assembly
HiMech.dll

Reads Fanuc-style system-control variables (#3000-#3999) back from Vars.SystemControl — the read side of FanucSystemControlVariableSyntax, which records every literal write there. Self-gates the id range so the evaluator's RuntimeVariableLookups chain can fall through to the next lookup for out-of-range keys.

Offline simulation has no clock: #3001 (millisecond timer) and #3002 (hour timer) stand still at the last value the program wrote, and read 0 when the program never wrote them — the timer-reset idiom #3001=0 … #501=[#3001/1000] therefore yields an elapsed time of zero instead of failing the assignment. Every other id in the range is vacant until written: its value lives on the real controller (date / time, override switches, tool-life data) and no offline default would be honest.

A clock that stands still must not drive control flow: the timed-wait idiom WHILE [#3001 LT 3000] DO 1 … END 1 (or its IF [..] GOTO spelling) would never see its condition change and would spin to the iteration limit, replaying the loop body thousands of times. On a block that carries a WHILE / GOTO phrase the two timers are therefore not served: the condition stays unevaluated, which the control-flow syntax already reports (FanucWhileDo--ConditionNotEvaluated / FanucGoto--ConditionNotEvaluated) before leaving the loop / falling through — the state the real machine is in once the wait is over.

Single-step lookup, same as VolatileVariableLookup: FanucSystemControlVariableSyntax dict-merges every block's Vars.SystemControl into the next block (across macro frames too), so the entry — if it exists — is on the current block or on the immediately previous one (the presets run the evaluator ahead of the writer on the same block).

Stateless and dependency-free — instances are interchangeable.

public class FanucSystemControlVariableLookup : IRuntimeVariableLookup, IMakeXmlSource
Inheritance
FanucSystemControlVariableLookup
Implements
Inherited Members
Extension Methods

Constructors

FanucSystemControlVariableLookup()

Default constructor.

public FanucSystemControlVariableLookup()

FanucSystemControlVariableLookup(XElement)

Loads from an XML element produced by MakeXmlSource(string, string, bool). Stateless — no fields to deserialise.

public FanucSystemControlVariableLookup(XElement src)

Parameters

src XElement

Fields

HourTimerId

Hour timer (#3002).

public const int HourTimerId = 3002

Field Value

int

MillisecondTimerId

Millisecond timer (#3001).

public const int MillisecondTimerId = 3001

Field Value

int

Properties

XName

XML element name for Generators registration.

public static string XName { get; }

Property Value

string

Methods

Get(string, LazyLinkedListNode<SyntaxPiece>, IReadOnlyList<INcDependency>)

Returns the value of the variable identified by key in the context of node and dependencies, or null if the key is outside this lookup's range or the value is vacant.

public double? Get(string key, LazyLinkedListNode<SyntaxPiece> node, IReadOnlyList<INcDependency> dependencies)

Parameters

key string
node LazyLinkedListNode<SyntaxPiece>
dependencies IReadOnlyList<INcDependency>

Returns

double?

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

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