Mitsubishi MELSEC Treiber
Überblick
MC-Protokoll-Kommunikation (3E / 1E) für PLC-Serien von Mitsubishi Electric (Q / L / iQ-R / iQ-F / FX).
| Punkt | Wert |
|---|---|
opc_type | MELSEC |
| Implementierungsklasse | plantpulse.driver.protocol.melsec.Melsec_34_Driver |
| Bibliothek | iot-communication (plantpulse.plc.protocol.melsec) |
| read | ✅ (Batch-Modus) |
| write | ✅ (Boolean/Integer/Long/Float/Double/String + BIN[n] Wort-Bit-RMW) |
| Sicherheit | keine (direkte TCP-Verbindung, Firmennetz vorausgesetzt) |
OPC-Registrierungsformular
| Feld | Bedeutung | Beispiel |
|---|---|---|
opc_agent_ip | PLC-IP | 192.168.0.60 |
opc_agent_port | MC-Port | 5000 (Q/L Standard 1500) |
timecycle | Abfrageintervall (ms) | 1000 |
options.controller-type | Serie (Q_L, QnA, IQ_R, A — iQ-F/FX verwenden Q_L) | Q_L |
options.read-mode | single (einzelner read je Tag, default) / grouped (Gruppen-Batch-read — minimiert Umläufe) | single |
options.batch-gap-words | im Modus grouped zulässiger Gap für das Zusammenfassen von Wortblöcken | 16 (default) |
options.string-charset | Kodierung für String-Tags (Unterstützung koreanischer Zeichen) | MS949 (default) |
options.enable-iqr-extended | direkter read auf iQ-R-Erweiterungsgeräte (LCN/LZ/LF/LSTN/LCC/LSC) | false (default) |
Ist controller-type nicht angegeben, wird Q_L verwendet (Serie Q / L).
Format von Tag plc_address
Notation nach iot-communication. Kombination aus Gerätecode + Index (dezimal).
| Notation | Bedeutung |
|---|---|
D100 | Data Register 100 (16 Bit) |
D100.W | 16-Bit-Wort (explizit) |
D100.D | 32-Bit-Doppelwort (D100~D101) |
D100.F | 32-Bit-Float (D100~D101) |
M100 | Internal Relay 100 (1 Bit) |
X100 | Input X100 (1 Bit) |
Y100 | Output Y100 (1 Bit) |
B0 | Link Relay |
W100 | Link Register |
R100 | File Register |
D Data Register, M Coil, X/Y I/O, R File Reg, W Link Reg.
Zuordnung data_type / format
data_type | format | Breite / Interpretation |
|---|---|---|
| Boolean / Bool | (empty) | 1 Bit (M, X, Y usw.) |
| Short / Int / Integer | (empty) | 16 Bit signed (W) |
| UInt16 | UI / UWORD | 16 Bit unsigned |
| Int32 / DWord | DW | 32 Bit signed (2 Wörter) |
| UInt32 | UDW | 32 Bit unsigned |
| Float / REAL | REAL | 32 Bit IEEE 754 |
| Double / LREAL | LREAL | 64 Bit IEEE 754 |
| String | STR[N] | N Wörter → 2N Byte ASCII |
Der Batch-Modus (IS_BATCH_MODE=true) ist standardmäßig aktiv. Alle Tags einer PLC werden in einer einzigen read-Anforderung
zusammengefasst verarbeitet (REQUEST_LIMIT=1).
Häufige Fehler + Abhilfe
| Meldung / Symptom | Ursache | Abhilfe |
|---|---|---|
| Connection refused | MC-Protokoll deaktiviert, Port blockiert | in GX Works MELSOFT 접속 / TCP / 포트 5000 aktivieren |
Wrong device code | Gerätecode nicht unterstützt | Übereinstimmung von controller-type prüfen (Unterschiede der Gerätecodes zwischen Q und iQ-R) |
| 32-Bit-Werte inkonsistent | byte order | D100.D (signed) / D100.UD (unsigned) explizit angeben |
| alle Tags 0 | Mismatch von Netzwerk-/Stationsnummer | network, station in den Optionen angeben (derzeit Standard 0) |
curl-Registrierungsbeispiel
curl -X POST http://<edge-host>/api/v1/opc \
-H "Content-Type: application/json" \
-d '{
"opc_id": "OPC_MELSEC_LINE1",
"opc_type": "MELSEC",
"opc_name": "Line1 Q-Series",
"opc_agent_ip": "192.168.0.60",
"opc_agent_port": "5000",
"site_id": "SITE_00001",
"auto_collect": true,
"timecycle": 1000,
"options": { "controller-type": "Q_L" },
"tag_list": [
{
"tag_id": "OPC_MELSEC_LINE1_TAG_00001",
"tag_name": "Counter",
"plc_address": "D100",
"data_type": "Integer"
},
{
"tag_id": "OPC_MELSEC_LINE1_TAG_00002",
"tag_name": "Pressure",
"plc_address": "D200",
"data_type": "Float",
"format": "REAL"
},
{
"tag_id": "OPC_MELSEC_LINE1_TAG_00003",
"tag_name": "PumpRun",
"plc_address": "M100",
"data_type": "Boolean"
}
]
}'
Beispielsammlung (nach Datentyp)
Mitsubishi-Gerätecodes: D (Data), M (Internal Relay), X (Input), Y (Output), B (Link Relay), W (Link Register), R (File Register), T (Timer), C (Counter).
Bit / Boolean
data_type | format | Beispiel plc_address | Bedeutung |
|---|---|---|---|
Boolean | (empty) | M100 | Internal Relay 100 |
Boolean | (empty) | X100 | Input-Bit X100 |
Boolean | (empty) | Y100 | Output-Bit Y100 |
Boolean | (empty) | B0 | Link Relay 0 |
16-Bit-Ganzzahl
data_type | format | Beispiel plc_address | Bedeutung |
|---|---|---|---|
Integer | (empty) | D100 | Data Register (signed 16) |
Integer | (empty) | D100.W | explizites 16-Bit-Wort |
Integer | UI | D100 | unsigned 16 |
Integer | (empty) | W100 | Link Register |
Integer | (empty) | R100 | File Register |
32-Bit-Ganzzahl
data_type | format | Beispiel plc_address | Bedeutung |
|---|---|---|---|
Integer | DW | D100 | signed 32 (Kombination D100~D101) |
Integer | (empty) | D100.D | 32 Bit signed in Bibliotheksnotation |
Integer | UDW | D100 | unsigned 32 |
Integer | (empty) | D100.UD | unsigned 32 in Bibliotheksnotation |
Gleitkommazahlen
data_type | format | Beispiel plc_address | Bedeutung |
|---|---|---|---|
Float | REAL | D200 | IEEE 754 32 Bit (D200~D201) |
Float | (empty) | D200.F | Bibliotheksnotation |
Double | LREAL | D300 | IEEE 754 64 Bit |
Zeichenketten
data_type | format | Beispiel plc_address | Bedeutung |
|---|---|---|---|
String | STR[5] | D400 | 5 Wörter = 10 Byte ASCII |
String | STR[16] | D500 | 16 Wörter = 32 Byte |
Einsatz von Formula
| Zweck | data_type | fomula | Hinweis |
|---|---|---|---|
| Ganzzahl-Rohwert → skalierter Gleitkommawert | Float | ${VALUE}*0.01 | 12345 → 123,45 |
| Zählerakkumulation (Summe anderer Tags) | Integer | ${VALUE}+${TAG_PREV} | Addition des vorherigen Summenwerts |
| Einheitenumrechnung (g → kg) | Float | ${VALUE}/1000 |
Umfassendes curl-Beispiel
curl -X POST http://<edge-host>/api/v1/opc \
-H "Content-Type: application/json" \
-d '{
"opc_id": "OPC_MELSEC_FULL",
"opc_type": "MELSEC",
"opc_name": "MELSEC iQ-R Full",
"opc_agent_ip": "192.168.0.60",
"opc_agent_port": "5000",
"site_id": "SITE_00001",
"auto_collect": true,
"timecycle": 1000,
"options": { "controller-type": "IQ_R" },
"tag_list": [
{"tag_id":"OPC_MELSEC_FULL_T01", "tag_name":"InternalBit", "plc_address":"M100", "data_type":"Boolean"},
{"tag_id":"OPC_MELSEC_FULL_T02", "tag_name":"InputBit", "plc_address":"X100", "data_type":"Boolean"},
{"tag_id":"OPC_MELSEC_FULL_T03", "tag_name":"DataWord", "plc_address":"D100", "data_type":"Integer"},
{"tag_id":"OPC_MELSEC_FULL_T04", "tag_name":"DataDWord", "plc_address":"D102", "data_type":"Integer", "format":"DW"},
{"tag_id":"OPC_MELSEC_FULL_T05", "tag_name":"Pressure", "plc_address":"D200", "data_type":"Float", "format":"REAL"},
{"tag_id":"OPC_MELSEC_FULL_T06", "tag_name":"Power", "plc_address":"D300", "data_type":"Double", "format":"LREAL"},
{"tag_id":"OPC_MELSEC_FULL_T07", "tag_name":"Batch", "plc_address":"D500", "data_type":"String", "format":"STR[16]"},
{"tag_id":"OPC_MELSEC_FULL_T08", "tag_name":"PressKpa", "plc_address":"D200", "data_type":"Float", "format":"REAL", "fomula":"${VALUE}*0.001"}
]
}'