@mokouliszt/mel-device 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.ja.md +216 -0
- package/README.md +216 -0
- package/dist/index.cjs +686 -0
- package/dist/index.d.ts +105 -0
- package/dist/index.js +14 -0
- package/docs/manual-evidence.md +136 -0
- package/package.json +57 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 mokouliszt
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.ja.md
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# @mokouliszt/mel-device
|
|
2
|
+
|
|
3
|
+
[English](README.md)
|
|
4
|
+
|
|
5
|
+
三菱電機 MELSEC / MXコントローラ および MELFAロボットコントローラのデバイス表記を、シリーズとCPU/コントローラ型名を含めて検証する、依存ライブラリなしのnpmパッケージです。
|
|
6
|
+
|
|
7
|
+
対応シリーズは iQ-R、iQ-F、MX-R、MX-F、CR800-R/D/Qです。ES Modules と CommonJS の両方から利用できます。
|
|
8
|
+
|
|
9
|
+
## インストール
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @mokouliszt/mel-device
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 基本的な使い方
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
import { isValidDevice, analyzeDevice } from "@mokouliszt/mel-device";
|
|
19
|
+
|
|
20
|
+
isValidDevice("X0", {
|
|
21
|
+
series: "iQ-R",
|
|
22
|
+
model: "R00"
|
|
23
|
+
}); // true(R00CPU に正規化)
|
|
24
|
+
|
|
25
|
+
isValidDevice("D0.A", {
|
|
26
|
+
series: "iQ-F",
|
|
27
|
+
model: "FX5S"
|
|
28
|
+
}); // true
|
|
29
|
+
|
|
30
|
+
analyzeDevice("D12288", {
|
|
31
|
+
series: "iQ-R",
|
|
32
|
+
model: "R00",
|
|
33
|
+
mode: "default"
|
|
34
|
+
});
|
|
35
|
+
// {
|
|
36
|
+
// valid: false,
|
|
37
|
+
// code: "REQUIRES_CONFIGURATION",
|
|
38
|
+
// suggestedMode: "maximum",
|
|
39
|
+
// ...
|
|
40
|
+
// }
|
|
41
|
+
|
|
42
|
+
isValidDevice("U3E0\\G524287", {
|
|
43
|
+
series: "CR800-R"
|
|
44
|
+
}); // true(modelはseriesから推論)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
`analyzeDevice` は、単なる `true` / `false` ではなく、正規化後の型名、解釈したデバイス、失敗理由、参照マニュアルとページ、実機設定への依存有無を返します。入力欄のバリデーションにはこちらを推奨します。
|
|
48
|
+
|
|
49
|
+
`model`を省略できるのは、`series`に`CR800-R`、`CR800-D`、`CR800-Q`のいずれかを直接指定した場合だけです。その他のシリーズでは従来どおり型名を指定してください。
|
|
50
|
+
|
|
51
|
+
## 判定モード
|
|
52
|
+
|
|
53
|
+
PLCのM/D等はCPUパラメータで点数を変更できるため、型名だけで実機上の有効範囲を断定できない場合があります。本パッケージは、この違いをモードで明示します。
|
|
54
|
+
|
|
55
|
+
| `mode` | 用途 | 動作 |
|
|
56
|
+
| --- | --- | --- |
|
|
57
|
+
| `default` | 安全側の通常判定(既定) | マニュアル記載のデフォルト点数で判定。iQ-Fは添付マニュアルにデフォルト点数表がないため、機種別「使用範囲」で判定し `configurationDependent: true` を返します。 |
|
|
58
|
+
| `maximum` | 設計・設定画面 | マニュアル記載の変更可能上限で判定。メモリ、ラベル使用量、拡張SRAM等で実際の上限が下がる場合があります。 |
|
|
59
|
+
| `configured` | 実機プロジェクトの厳密判定 | `configuredPoints` に渡した実際の点数で判定。可変デバイスの点数が未指定なら `MISSING_CONFIGURATION`。 |
|
|
60
|
+
| `syntax` | エディタ入力途中・構文チェック | 型名が対応するデバイス文法のみを確認し、点数範囲を無視。 |
|
|
61
|
+
|
|
62
|
+
CR800-R/D/Qのデバイス範囲はマニュアル上固定されているため、`default`、`maximum`、`configured`はいずれも同じ固定範囲を使用します。
|
|
63
|
+
|
|
64
|
+
```js
|
|
65
|
+
isValidDevice("D99", {
|
|
66
|
+
series: "MX-F",
|
|
67
|
+
model: "MXF100",
|
|
68
|
+
mode: "configured",
|
|
69
|
+
configuredPoints: { D: 100 }
|
|
70
|
+
}); // true
|
|
71
|
+
|
|
72
|
+
isValidDevice("D100", {
|
|
73
|
+
series: "MX-F",
|
|
74
|
+
model: "MXF100",
|
|
75
|
+
mode: "configured",
|
|
76
|
+
configuredPoints: { D: 100 }
|
|
77
|
+
}); // false(100点はD0〜D99)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## 入力モード
|
|
81
|
+
|
|
82
|
+
`inputMode: "exact"` が既定です。大文字、半角、マニュアルどおりの `\` を要求します。
|
|
83
|
+
|
|
84
|
+
UIで人が入力する場合は `friendly` が便利です。前後空白、小文字、全角英数字、`¥` / `¥` を正規化します。
|
|
85
|
+
|
|
86
|
+
```js
|
|
87
|
+
analyzeDevice(" u1¥g0 ", {
|
|
88
|
+
series: "iQ-F",
|
|
89
|
+
model: "FX5U",
|
|
90
|
+
inputMode: "friendly"
|
|
91
|
+
}).normalized; // "U1\\G0"
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## 対応する主な表記
|
|
95
|
+
|
|
96
|
+
- 直接デバイス: `X0`, `DX0`, `DY0`, `M0`, `D0`, `W0`, `SM400`
|
|
97
|
+
- ワードデバイスのビット指定: `D0.A`
|
|
98
|
+
- タイマ/カウンタの接点・コイル・現在値: `TS0`, `TC0`, `TN0`, `LCS0` など
|
|
99
|
+
- ユニットアクセス: `U1\G0`
|
|
100
|
+
- CPUバッファメモリアクセス: `U3E0\G0`
|
|
101
|
+
- リンクダイレクト: `J1\X0`, `J1\W0`
|
|
102
|
+
- 桁指定: `K4M100`
|
|
103
|
+
- 間接指定: `@D10`, `@D10.8`
|
|
104
|
+
- インデックス修飾: `D10Z2.0`, `D10.8Z2`, `D0LZ0`
|
|
105
|
+
- ローカルデバイス: `#M0`(対応シリーズ/デバイスのみ)
|
|
106
|
+
|
|
107
|
+
## MELFA CR800
|
|
108
|
+
|
|
109
|
+
推奨表記は、親シリーズとコントローラ種別を分ける方法です。
|
|
110
|
+
|
|
111
|
+
```js
|
|
112
|
+
analyzeDevice("U3E1\\HG100", {
|
|
113
|
+
series: "CR800",
|
|
114
|
+
model: "CR800-D",
|
|
115
|
+
operation: "write"
|
|
116
|
+
});
|
|
117
|
+
// valid: true(デバイス表記としては有効)
|
|
118
|
+
// access: "read-only"
|
|
119
|
+
// operationAllowed: false(この領域は常時有効のシーケンサリンク入力)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
`series: "CR800-R"`、`"CR800-D"`、`"CR800-Q"`の省略形も使用でき、この場合は`model`を省略できます。モデルには`R`、`D`、`Q`も指定できます。
|
|
123
|
+
|
|
124
|
+
| モデル | 対応デバイスと固定範囲 |
|
|
125
|
+
| --- | --- |
|
|
126
|
+
| CR800-R | `X0-XFFF`, `Y0-YFFF`, `M0-M18431`, `D0-D5119`, `SM0-SM4095`, `SD0-SD4095`, `U3E0-U3E3\G0-G524287`, `U3E0-U3E3\HG0-HG12287` |
|
|
127
|
+
| CR800-D | `X0-X1FFF`, `Y0-Y1FFF`, `D0-D5119`, `SM0-SM4095`, `SD0-SD4095`, `U3E0/U3E1\HG0-HG2047` |
|
|
128
|
+
| CR800-Q | `X0-XFFF`, `Y0-YFFF`, `M0-M18431`, `D0-D5119`, `SM0-SM2047`, `SD0-SD2047`, `U3E0-U3E3\G10000-G24335` |
|
|
129
|
+
|
|
130
|
+
### 読書き属性の判定
|
|
131
|
+
|
|
132
|
+
取扱説明書の表6-14~6-16では、固定範囲内でも機能の割付中は読出し専用となり、書込みが無視される領域があります。`isValidDevice`は「デバイス表記と固定範囲」を判定し、`analyzeDevice`はそれとは別に次を返します。
|
|
133
|
+
|
|
134
|
+
- `access`: `read-write` / `read-only` / `configuration-dependent`
|
|
135
|
+
- `operationAllowed`: `operation: "read" | "write"`に対する`true` / `false`。構成不明時は`null`
|
|
136
|
+
- `activeAllocations`, `possibleAllocations`, `warnings`: 判定根拠となった割付
|
|
137
|
+
|
|
138
|
+
実機設定が分かる場合は`cr800Features`を渡せます。省略した項目は「不明」として安全側に`configuration-dependent`を返します。
|
|
139
|
+
|
|
140
|
+
```js
|
|
141
|
+
analyzeDevice("U3E1\\HG600", {
|
|
142
|
+
series: "CR800-D",
|
|
143
|
+
operation: "write",
|
|
144
|
+
cr800Features: { iqmem: false }
|
|
145
|
+
}).operationAllowed; // true(拡張機能無効時は自由に読書き可能)
|
|
146
|
+
|
|
147
|
+
analyzeDevice("U3E1\\HG600", {
|
|
148
|
+
series: "CR800-D",
|
|
149
|
+
operation: "write",
|
|
150
|
+
cr800Features: { iqmem: true }
|
|
151
|
+
}).operationAllowed; // false
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
指定可能な設定は次のとおりです。
|
|
155
|
+
|
|
156
|
+
| `cr800Features` | 対象 | 意味 |
|
|
157
|
+
| --- | --- | --- |
|
|
158
|
+
| `qxyread` | R/Q | シーケンサ入出力ユニット直接制御 |
|
|
159
|
+
| `iqmem` | R/D/Q | CPUバッファ/共有メモリ拡張 |
|
|
160
|
+
| `ddevvl` | R/D/Q | `"disabled"`, `"program-external"`, `"status"`, `"mixed"` |
|
|
161
|
+
| `parallelIoUnit`, `parallelIoInterface`, `gotLink` | D | パラレルI/O、GOTリンク |
|
|
162
|
+
| `profibus`, `ccLink`, `ccLinkIef` | D | 各ネットワーク機能 |
|
|
163
|
+
|
|
164
|
+
常時有効の例として、CR800-Dの`U3E1\HG0-HG511`、CR800-Rの`U3E1-U3E3\HG0-HG511`、CR800-Qの`U3E1-U3E3\G10000-G10511`は外部機器から読出し専用です。ハンド入力`X384-X38B`も読出し専用です。一方、機能が無効または未割付の領域は、マニュアル注記どおり自由に読書きできます。
|
|
165
|
+
|
|
166
|
+
CR800-Qの表6-16にある`U3En\G512-G1023`は、表6-13の固定範囲`G10000-G24335`および5.2.1/6.2.2の対応表と矛盾します。本パッケージは誤った有効判定を避けるため、この表記を`MANUAL_RANGE_CONFLICT`として無効にし、`G10512-G11023`側のIQMEM読書き属性も断定せず`configuration-dependent`とします。
|
|
167
|
+
|
|
168
|
+
表6-11~6-13に記載されていないビット指定、桁指定、間接指定、インデックス修飾、ローカル指定は、CR800では保守的に無効と判定します。
|
|
169
|
+
|
|
170
|
+
定数(`K100`, `HFF`, 実数・文字列)は「デバイス」ではないため判定対象外です。ラベル、構造体メンバ、SLMPのバイナリデバイスコードも対象外です。
|
|
171
|
+
|
|
172
|
+
## API
|
|
173
|
+
|
|
174
|
+
### `isValidDevice(value, options): boolean`
|
|
175
|
+
|
|
176
|
+
簡潔な真偽値判定です。
|
|
177
|
+
|
|
178
|
+
### `analyzeDevice(value, options): DeviceAnalysis`
|
|
179
|
+
|
|
180
|
+
詳細判定です。主要な返却値は `valid`, `code`, `message`, `normalized`, `parsed`, `configurationDependent`, `source` です。
|
|
181
|
+
|
|
182
|
+
### `assertValidDevice(value, options): DeviceAnalysis`
|
|
183
|
+
|
|
184
|
+
無効時に `MelDeviceError` を投げます。
|
|
185
|
+
|
|
186
|
+
### `parseDevice(value, options): ParsedDevice | null`
|
|
187
|
+
|
|
188
|
+
構文を分解します。シリーズ/機種の範囲判定は行いません。
|
|
189
|
+
|
|
190
|
+
### `normalizeDevice(value): string | null`
|
|
191
|
+
|
|
192
|
+
人間向け表記を正規化します。
|
|
193
|
+
|
|
194
|
+
### `normalizeModel(series, model): string | null`
|
|
195
|
+
|
|
196
|
+
`R00` → `R00CPU`、iQ-Fの具体的な型名 → `FX5U` のように、検証用の型名へ正規化します。
|
|
197
|
+
|
|
198
|
+
### `getSupportedModels(series): string[]`
|
|
199
|
+
|
|
200
|
+
マニュアルの対象機種一覧を返します。
|
|
201
|
+
|
|
202
|
+
## 対象機種
|
|
203
|
+
|
|
204
|
+
- iQ-R: R00CPU、R01CPU、R02CPU、R04/R08/R16/R32/R120 CPUおよびENCPU
|
|
205
|
+
- iQ-F: FX5S、FX5UJ、FX5U、FX5UC(具体的なI/O型名もファミリへ正規化)
|
|
206
|
+
- MX-R: MXR300-16/-32/-64、MXR500-128/-256
|
|
207
|
+
- MX-F: MXF100系のマニュアル対象10機種(`MXF100` をファミリ別名として受付)
|
|
208
|
+
- MELFA CR800: CR800-R、CR800-D、CR800-Q
|
|
209
|
+
|
|
210
|
+
## 資料
|
|
211
|
+
|
|
212
|
+
判定表は、同梱の [manual-evidence.md](docs/manual-evidence.md) にマニュアル番号・版・ページ単位で整理しています。
|
|
213
|
+
|
|
214
|
+
## ライセンス
|
|
215
|
+
|
|
216
|
+
MIT
|
package/README.md
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# @mokouliszt/mel-device
|
|
2
|
+
|
|
3
|
+
[日本語](README.ja.md)
|
|
4
|
+
|
|
5
|
+
A dependency-free npm package for validating Mitsubishi Electric MELSEC/MX controller and MELFA robot controller device notation against a specified series and CPU/controller model.
|
|
6
|
+
|
|
7
|
+
Supported series are iQ-R, iQ-F, MX-R, MX-F, and CR800-R/D/Q. The package supports both ES Modules and CommonJS.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @mokouliszt/mel-device
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Basic usage
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
import { isValidDevice, analyzeDevice } from "@mokouliszt/mel-device";
|
|
19
|
+
|
|
20
|
+
isValidDevice("X0", {
|
|
21
|
+
series: "iQ-R",
|
|
22
|
+
model: "R00"
|
|
23
|
+
}); // true (normalized to R00CPU)
|
|
24
|
+
|
|
25
|
+
isValidDevice("D0.A", {
|
|
26
|
+
series: "iQ-F",
|
|
27
|
+
model: "FX5S"
|
|
28
|
+
}); // true
|
|
29
|
+
|
|
30
|
+
analyzeDevice("D12288", {
|
|
31
|
+
series: "iQ-R",
|
|
32
|
+
model: "R00",
|
|
33
|
+
mode: "default"
|
|
34
|
+
});
|
|
35
|
+
// {
|
|
36
|
+
// valid: false,
|
|
37
|
+
// code: "REQUIRES_CONFIGURATION",
|
|
38
|
+
// suggestedMode: "maximum",
|
|
39
|
+
// ...
|
|
40
|
+
// }
|
|
41
|
+
|
|
42
|
+
isValidDevice("U3E0\\G524287", {
|
|
43
|
+
series: "CR800-R"
|
|
44
|
+
}); // true (model inferred from series)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Instead of returning only `true` or `false`, `analyzeDevice` reports the normalized model, parsed device, reason for failure, referenced manual and page, and whether the result depends on the actual hardware configuration. It is the recommended API for validating user input.
|
|
48
|
+
|
|
49
|
+
The `model` option may be omitted only when `series` is set directly to `CR800-R`, `CR800-D`, or `CR800-Q`. A model must still be specified for all other series.
|
|
50
|
+
|
|
51
|
+
## Validation modes
|
|
52
|
+
|
|
53
|
+
The number of available points for PLC devices such as M and D can be changed in the CPU parameters, so the valid range on actual hardware cannot always be determined from the model alone. This package makes that distinction explicit through validation modes.
|
|
54
|
+
|
|
55
|
+
| `mode` | Use case | Behavior |
|
|
56
|
+
| --- | --- | --- |
|
|
57
|
+
| `default` | Conservative general-purpose validation (default) | Validates against the default point counts stated in the manuals. Because the referenced iQ-F manuals do not include a default point-count table, iQ-F devices are checked against the model-specific usage range and return `configurationDependent: true`. |
|
|
58
|
+
| `maximum` | Design and configuration screens | Validates against the maximum configurable limits stated in the manuals. Actual limits may be lower depending on memory, label usage, expansion SRAM, and other factors. |
|
|
59
|
+
| `configured` | Exact validation for an actual project | Validates against the actual point counts supplied in `configuredPoints`. Returns `MISSING_CONFIGURATION` if the point count for a configurable device is omitted. |
|
|
60
|
+
| `syntax` | In-progress editor input and syntax checking | Checks only whether the model supports the device syntax and ignores point-count ranges. |
|
|
61
|
+
|
|
62
|
+
The device ranges for CR800-R/D/Q are fixed in the manuals, so `default`, `maximum`, and `configured` all use the same fixed ranges.
|
|
63
|
+
|
|
64
|
+
```js
|
|
65
|
+
isValidDevice("D99", {
|
|
66
|
+
series: "MX-F",
|
|
67
|
+
model: "MXF100",
|
|
68
|
+
mode: "configured",
|
|
69
|
+
configuredPoints: { D: 100 }
|
|
70
|
+
}); // true
|
|
71
|
+
|
|
72
|
+
isValidDevice("D100", {
|
|
73
|
+
series: "MX-F",
|
|
74
|
+
model: "MXF100",
|
|
75
|
+
mode: "configured",
|
|
76
|
+
configuredPoints: { D: 100 }
|
|
77
|
+
}); // false (100 points cover D0 through D99)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Input modes
|
|
81
|
+
|
|
82
|
+
`inputMode: "exact"` is the default. It requires uppercase, half-width characters, and the `\` separator used in the manuals.
|
|
83
|
+
|
|
84
|
+
For user-entered UI input, `friendly` is convenient. It normalizes leading and trailing whitespace, lowercase characters, full-width alphanumeric characters, and `¥` / `¥`.
|
|
85
|
+
|
|
86
|
+
```js
|
|
87
|
+
analyzeDevice(" u1¥g0 ", {
|
|
88
|
+
series: "iQ-F",
|
|
89
|
+
model: "FX5U",
|
|
90
|
+
inputMode: "friendly"
|
|
91
|
+
}).normalized; // "U1\\G0"
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Main supported notation
|
|
95
|
+
|
|
96
|
+
- Direct devices: `X0`, `DX0`, `DY0`, `M0`, `D0`, `W0`, `SM400`
|
|
97
|
+
- Bit specification for word devices: `D0.A`
|
|
98
|
+
- Timer/counter contacts, coils, and current values: `TS0`, `TC0`, `TN0`, `LCS0`, etc.
|
|
99
|
+
- Module access: `U1\G0`
|
|
100
|
+
- CPU buffer memory access: `U3E0\G0`
|
|
101
|
+
- Link direct devices: `J1\X0`, `J1\W0`
|
|
102
|
+
- Digit specification: `K4M100`
|
|
103
|
+
- Indirect specification: `@D10`, `@D10.8`
|
|
104
|
+
- Index modification: `D10Z2.0`, `D10.8Z2`, `D0LZ0`
|
|
105
|
+
- Local devices: `#M0` (supported series/devices only)
|
|
106
|
+
|
|
107
|
+
## MELFA CR800
|
|
108
|
+
|
|
109
|
+
The recommended notation separates the parent series from the controller type.
|
|
110
|
+
|
|
111
|
+
```js
|
|
112
|
+
analyzeDevice("U3E1\\HG100", {
|
|
113
|
+
series: "CR800",
|
|
114
|
+
model: "CR800-D",
|
|
115
|
+
operation: "write"
|
|
116
|
+
});
|
|
117
|
+
// valid: true (valid as device notation)
|
|
118
|
+
// access: "read-only"
|
|
119
|
+
// operationAllowed: false (this area is an always-enabled sequencer link input)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
The shorthand series values `"CR800-R"`, `"CR800-D"`, and `"CR800-Q"` are also accepted; `model` may be omitted in that form. The model may also be specified as `R`, `D`, or `Q`.
|
|
123
|
+
|
|
124
|
+
| Model | Supported devices and fixed ranges |
|
|
125
|
+
| --- | --- |
|
|
126
|
+
| CR800-R | `X0-XFFF`, `Y0-YFFF`, `M0-M18431`, `D0-D5119`, `SM0-SM4095`, `SD0-SD4095`, `U3E0-U3E3\G0-G524287`, `U3E0-U3E3\HG0-HG12287` |
|
|
127
|
+
| CR800-D | `X0-X1FFF`, `Y0-Y1FFF`, `D0-D5119`, `SM0-SM4095`, `SD0-SD4095`, `U3E0/U3E1\HG0-HG2047` |
|
|
128
|
+
| CR800-Q | `X0-XFFF`, `Y0-YFFF`, `M0-M18431`, `D0-D5119`, `SM0-SM2047`, `SD0-SD2047`, `U3E0-U3E3\G10000-G24335` |
|
|
129
|
+
|
|
130
|
+
### Read/write attribute validation
|
|
131
|
+
|
|
132
|
+
Tables 6-14 through 6-16 of the instruction manual identify areas that become read-only while particular functions are assigned, even when the addresses remain within the fixed device ranges. Writes to these areas are ignored. `isValidDevice` validates the device notation and fixed range, while `analyzeDevice` separately returns the following fields:
|
|
133
|
+
|
|
134
|
+
- `access`: `read-write` / `read-only` / `configuration-dependent`
|
|
135
|
+
- `operationAllowed`: `true` or `false` for `operation: "read" | "write"`; `null` when the configuration is unknown
|
|
136
|
+
- `activeAllocations`, `possibleAllocations`, `warnings`: allocations used as the basis for the result
|
|
137
|
+
|
|
138
|
+
If the actual hardware configuration is known, pass it through `cr800Features`. Omitted properties are treated as unknown and conservatively return `configuration-dependent`.
|
|
139
|
+
|
|
140
|
+
```js
|
|
141
|
+
analyzeDevice("U3E1\\HG600", {
|
|
142
|
+
series: "CR800-D",
|
|
143
|
+
operation: "write",
|
|
144
|
+
cr800Features: { iqmem: false }
|
|
145
|
+
}).operationAllowed; // true (freely readable/writable when the expansion is disabled)
|
|
146
|
+
|
|
147
|
+
analyzeDevice("U3E1\\HG600", {
|
|
148
|
+
series: "CR800-D",
|
|
149
|
+
operation: "write",
|
|
150
|
+
cr800Features: { iqmem: true }
|
|
151
|
+
}).operationAllowed; // false
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
The following settings are supported:
|
|
155
|
+
|
|
156
|
+
| `cr800Features` | Applies to | Meaning |
|
|
157
|
+
| --- | --- | --- |
|
|
158
|
+
| `qxyread` | R/Q | Direct control of sequencer I/O units |
|
|
159
|
+
| `iqmem` | R/D/Q | CPU buffer/shared-memory expansion |
|
|
160
|
+
| `ddevvl` | R/D/Q | `"disabled"`, `"program-external"`, `"status"`, `"mixed"` |
|
|
161
|
+
| `parallelIoUnit`, `parallelIoInterface`, `gotLink` | D | Parallel I/O and GOT link |
|
|
162
|
+
| `profibus`, `ccLink`, `ccLinkIef` | D | Network functions |
|
|
163
|
+
|
|
164
|
+
Examples of always-enabled areas include `U3E1\HG0-HG511` on CR800-D, `U3E1-U3E3\HG0-HG511` on CR800-R, and `U3E1-U3E3\G10000-G10511` on CR800-Q. These areas are read-only from external devices. Hand inputs `X384-X38B` are also read-only. In contrast, areas for disabled or unassigned functions may be freely read and written as described in the manual notes.
|
|
165
|
+
|
|
166
|
+
The `U3En\G512-G1023` range in Table 6-16 for CR800-Q conflicts with the fixed `G10000-G24335` range in Table 6-13 and with the correspondence tables in Sections 5.2.1 and 6.2.2. To avoid false-positive validation, this package treats that notation as invalid with `MANUAL_RANGE_CONFLICT`. It also does not make a definitive claim about the IQMEM read/write attributes of the `G10512-G11023` range, instead reporting them as `configuration-dependent`.
|
|
167
|
+
|
|
168
|
+
Bit specifications, digit specifications, indirect specifications, index modifications, and local specifications that are not listed in Tables 6-11 through 6-13 are conservatively treated as invalid for CR800.
|
|
169
|
+
|
|
170
|
+
Constants (`K100`, `HFF`, real numbers, and strings) are outside the validation scope because they are not devices. Labels, structure members, and SLMP binary device codes are also outside the scope.
|
|
171
|
+
|
|
172
|
+
## API
|
|
173
|
+
|
|
174
|
+
### `isValidDevice(value, options): boolean`
|
|
175
|
+
|
|
176
|
+
Returns a simple Boolean validation result.
|
|
177
|
+
|
|
178
|
+
### `analyzeDevice(value, options): DeviceAnalysis`
|
|
179
|
+
|
|
180
|
+
Returns a detailed validation result. The main fields are `valid`, `code`, `message`, `normalized`, `parsed`, `configurationDependent`, and `source`.
|
|
181
|
+
|
|
182
|
+
### `assertValidDevice(value, options): DeviceAnalysis`
|
|
183
|
+
|
|
184
|
+
Throws `MelDeviceError` when the device is invalid.
|
|
185
|
+
|
|
186
|
+
### `parseDevice(value, options): ParsedDevice | null`
|
|
187
|
+
|
|
188
|
+
Parses the notation into its components. It does not validate ranges for a series or model.
|
|
189
|
+
|
|
190
|
+
### `normalizeDevice(value): string | null`
|
|
191
|
+
|
|
192
|
+
Normalizes human-entered notation.
|
|
193
|
+
|
|
194
|
+
### `normalizeModel(series, model): string | null`
|
|
195
|
+
|
|
196
|
+
Normalizes a model name for validation, such as `R00` → `R00CPU` or a specific iQ-F model name → `FX5U`.
|
|
197
|
+
|
|
198
|
+
### `getSupportedModels(series): string[]`
|
|
199
|
+
|
|
200
|
+
Returns the list of models covered by the manuals.
|
|
201
|
+
|
|
202
|
+
## Supported models
|
|
203
|
+
|
|
204
|
+
- iQ-R: R00CPU, R01CPU, R02CPU, R04/R08/R16/R32/R120 CPUs, and ENCPUs
|
|
205
|
+
- iQ-F: FX5S, FX5UJ, FX5U, and FX5UC (specific I/O model names are normalized to their families)
|
|
206
|
+
- MX-R: MXR300-16/-32/-64 and MXR500-128/-256
|
|
207
|
+
- MX-F: the 10 models covered by the MXF100-series manual (`MXF100` is accepted as a family alias)
|
|
208
|
+
- MELFA CR800: CR800-R, CR800-D, and CR800-Q
|
|
209
|
+
|
|
210
|
+
## References
|
|
211
|
+
|
|
212
|
+
The validation tables and their supporting manual numbers, editions, and page references are documented in the bundled [manual-evidence.md](docs/manual-evidence.md).
|
|
213
|
+
|
|
214
|
+
## License
|
|
215
|
+
|
|
216
|
+
MIT
|