Table of Contents

Class DwellWordConfig

Namespace
Hi.NcParsers.Dependencys.Generic
Assembly
HiMech.dll

How this control reads a decimal point in a dwell word written in milliseconds — the P of G04 and the bottom-dwell P of G82 / G89. A whole number is the least input increment on every ISO control (P1000 dwells 1 s, the dwell command and the cycles alike); a decimal point is where they part. Syntec reads the cycle P as seconds (Mill Machine Program Manual §2.64: "P: dwelling time(sec)", G82 … P2. dwells 2 s; §2.70 G87–G89: “with decimal points, unit: second”) and its G04 P as whole milliseconds (§2.9: "dwell time (in milliseconds, decimal point not permitted)", G04 P2.5 delays 2 ms — the 2012–2015 editions printed 2 s on that line, corrected by the 2020 revision that is still current). Fanuc refuses it: B-64304EN/02 §5.6 DWELL marks P “(decimal point not permitted)” and its alarm list defines PS0007 ILLEGAL USE OF DECIMAL POINT as “a decimal point (.) was specified at an address where no decimal point may be specified” — the manual states no G04 example, so the alarm is the two statements read together. Mazak refuses it too (H740PB0030E §8-1: “For address P, the decimal point is not available. Setting a decimal point will cause an alarm”, G04 P 12.345 ; Alarm; p.14-38: the cycle P's “relationship between time and designated value is same as for G04”), and neither that manual nor the MATRIX alarm list H740HA0030E numbers the alarm. One DecimalPointDwellRule per word: G04DecimalPointP for the dwell command, CycleDecimalPointP for the cycles.

Read where the word is turned into a number: by the capture (MillisecondsParamPrefixes, which sees the source text) and, for a P spoken on a modal-repeat block of a cycle, by CannedCycleSyntaxUtil.MergeModalCycleSection through the evaluator's source-text mirror. Under Alarm the word is reported (ReportRefused(NcDiagnosticProgress, ISentenceCarrier, DwellWordConfig, string, string, string), Dwell--DecimalPointRefused) and dropped, and the block does not dwell: a G04 arrives at DwellSyntax as a bare flag, a cycle still drills, and a repeat block that spoke the word dwells nothing, as do the repeats after it until a new P — reported, not moved, as the arc gate treats a block a control refuses. A runner whose dependency list carries no instance reads both words as DefaultRule. The brand presets carry an explicit instance so the rule is visible and editable in the controller XML:

<DwellWordConfig>
  <G04DecimalPointP>Alarm</G04DecimalPointP>
  <CycleDecimalPointP>Alarm</CycleDecimalPointP>
  <Alarm>PS0007 ILLEGAL USE OF DECIMAL POINT</Alarm>
</DwellWordConfig>
public class DwellWordConfig : INcDependency, IMakeXmlSource
Inheritance
DwellWordConfig
Implements
Inherited Members
Extension Methods

Constructors

DwellWordConfig()

Initializes a new instance reading both words as DefaultRule, naming no alarm.

public DwellWordConfig()

DwellWordConfig(XElement)

Loads the rules and the alarm name from XML produced by MakeXmlSource(string, string, bool); an absent or unreadable element keeps the default.

public DwellWordConfig(XElement src)

Parameters

src XElement

Root element named XName.

Fields

DefaultRule

The rule a runner with no instance on its dependency list follows for both words: the decimal point makes the word seconds.

public const DecimalPointDwellRule DefaultRule = Seconds

Field Value

DecimalPointDwellRule

RefusedDiagnosticId

Diagnostic id of a dwell word refused under Alarm.

public const string RefusedDiagnosticId = "Dwell--DecimalPointRefused"

Field Value

string

Properties

Alarm

The alarm the control raises, as the refusal message names it after the word “alarm”: PS0007 ILLEGAL USE OF DECIMAL POINT on Fanuc; on Mazak, where the manuals do not number it, the manual section that states it. null reads “not named in the controller preset”.

public string Alarm { get; set; }

Property Value

string

CycleDecimalPointP

Rule for the bottom-dwell P of the canned cycles (G82, G89), on the cycle block and on a modal-repeat block that speaks its own P.

public DecimalPointDwellRule CycleDecimalPointP { get; set; }

Property Value

DecimalPointDwellRule

Fanuc

Fanuc: both words refused, alarm PS0007 (B-64304EN/02 §5.6 DWELL and appendix H).

public static DwellWordConfig Fanuc { get; }

Property Value

DwellWordConfig

G04DecimalPointP

Rule for the P of G04 (DwellCodes).

public DecimalPointDwellRule G04DecimalPointP { get; set; }

Property Value

DecimalPointDwellRule

Mazak

Mazak: both words refused (H740PB0030E §8-1, p.14-38); no Mazak manual numbers the alarm.

public static DwellWordConfig Mazak { get; }

Property Value

DwellWordConfig

Syntec

Syntec: G04 P whole milliseconds, the cycle P seconds (Mill Machine Program Manual §2.9, §2.64, §2.70).

public static DwellWordConfig Syntec { get; }

Property Value

DwellWordConfig

XName

XML element name used to register this dependency with XFactory.

public static string XName { get; }

Property Value

string

Methods

DecimalPointToMilliseconds(DecimalPointDwellRule, double)

The milliseconds a decimal-point word written as value stands for under rule: the value times 1000 (seconds), its whole part (milliseconds), or null when the rule refuses the word.

public static double? DecimalPointToMilliseconds(DecimalPointDwellRule rule, double value)

Parameters

rule DecimalPointDwellRule
value double

Returns

double?

Find(IEnumerable<INcDependency>)

The first instance on ncDependencyList, or null.

public static DwellWordConfig Find(IEnumerable<INcDependency> ncDependencyList)

Parameters

ncDependencyList IEnumerable<INcDependency>

Returns

DwellWordConfig

ForBrand(string)

The instance the named brand preset carries, or null for a brand with no milliseconds dwell word (Siemens, Heidenhain) or no brand at all.

public static DwellWordConfig ForBrand(string brand)

Parameters

brand string

A CncBrandDependency brand token.

Returns

DwellWordConfig

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

ReportRefused(NcDiagnosticProgress, ISentenceCarrier, DwellWordConfig, string, string, string)

Reports a refused word — the one emit site of RefusedDiagnosticId, so every brand's refusal carries the same template with the control's alarm in a hole.

public static void ReportRefused(NcDiagnosticProgress diag, ISentenceCarrier sentenceCarrier, DwellWordConfig config, string code, string word, string written)

Parameters

diag NcDiagnosticProgress

Sink; may be null.

sentenceCarrier ISentenceCarrier

The block the word is on.

config DwellWordConfig

The rule's config, whose Alarm the message names; may be null.

code string

The command the word belongs to (G04, G82).

word string

The word's address (P).

written string

The value as written (2.).

RuleFor(string)

The rule for the word of code: a dwell code (DwellCodes) reads G04DecimalPointP, any other code — a canned cycle — CycleDecimalPointP.

public DecimalPointDwellRule RuleFor(string code)

Parameters

code string

Returns

DecimalPointDwellRule