Mitsubishi McpX (Pro)

The Mitsubishi McpX interface provides high-performance communication with Mitsubishi PLCs using the MC Protocol 3E/4E frames through the McpX library.

Overview

The Mitsubishi McpX interface enables real-time bidirectional data exchange between Unity simulations and Mitsubishi Q, L, R, iQ-R, and iQ-F series PLCs. This Professional-only interface utilizes the MC Protocol (MELSEC Communication Protocol) with 3E/4E frame formats for robust industrial communication. A key feature is its intelligent batch read optimization that automatically groups signals into efficient read operations, reducing network traffic and improving throughput by up to 30x compared to individual signal reads.

The interface supports all major Mitsubishi device types including physical inputs/outputs (X/Y), internal relays (M), data registers (D), timers (T), counters (C), state relays (S), and special devices (SM/SD). Communication runs in a background thread using the FastInterface architecture, ensuring smooth Unity performance while maintaining reliable PLC connectivity.

This interface requires realvirtual Professional and uses the McpX library (https://github.com/YudaiKitamura/McpX) for MC Protocol implementation.

Installation

The Mitsubishi McpX interface is included in realvirtual Professional and can be added to your scene through:

  1. Menu Method: Select realvirtual > Add Interface > Mitsubishi McpX (Pro)

  2. Manual Method: Add the MitsubishiMcpXInterface script to an empty GameObject

The interface files are located at: Assets/realvirtual/Interfaces/Mitsubishi/

Properties

Mitsubishi McpX Interface Inspector

Connection Settings

  • IP Address (string): IP address of the Mitsubishi PLC. Default: "192.168.3.39"

  • Port (int): MC Protocol communication port. Default: 5001 for 3E/4E frames, alternative: 1025 for 1E frames

  • Frame Format (enum): MC Protocol frame format selection. Frame3E for Q/L/R series, Frame4E for iQ-R/iQ-F series

  • Use TCP (boolean): Transport protocol selection. TCP for reliable communication, UDP for faster transfer. Default: true

  • Network Number (int): Network routing number for multi-network systems. Default: 0 (local network)

  • Station Number (int): Target station identification. Default: 255 (broadcast)

  • Connection Timeout (int): Maximum connection establishment time in milliseconds. Default: 5000

Batch Optimization

Dramatically improves communication efficiency by grouping multiple signal reads into single network operations, providing up to 30x performance improvement.

  • Optimize Batch Reads (boolean): Enables automatic signal grouping for efficient reading. Default: true

  • Max Gap Size (int): Maximum address gap between signals in the same batch. Default: 5

  • Min Batch Size (int): Minimum signals required to justify batch reading. Default: 3

  • Max Batch Size Bits (int): Maximum batch size for bit devices (X, Y, M, etc.). Default: 960 (MC Protocol limit)

  • Max Batch Size Words (int): Maximum batch size for word devices (D, W, R, etc.). Default: 120 (MC Protocol limit)

GX Works3 Import

Provides seamless integration with GX Works3 device comment exports for rapid signal configuration.

  • GX Works3 CSV File (string): Path to device comment CSV export file. Use Select CSV File button to browse

  • Use Standard GX Format (boolean): Uses standard GX Works3 CSV format (Device,Comment,Data Type,Initial Value). Default: true

  • Create Device Hierarchy (boolean): Organizes imported signals by device type (Physical Inputs (X), Physical Outputs (Y), etc.). Default: true

  • Import Comments (boolean): Uses device comments as signal names for meaningful identification. Default: true

  • Max Import Devices (int): Safety limit for imported devices to prevent memory issues. Default: 1000

  • Validate Device Addresses (boolean): Checks device addresses for validity before import. Default: true

Device Type Filtering

Controls which device types are imported from CSV files.

  • Import Physical Inputs (boolean): Import X devices (sensors, buttons, switches). Default: true

  • Import Physical Outputs (boolean): Import Y devices (actuators, lights, valves). Default: true

  • Import Internal Relays (boolean): Import M devices (internal memory bits). Default: true

  • Import Data Registers (boolean): Import D devices (16-bit data storage). Default: true

  • Import Timers (boolean): Import T devices (timer current values and contacts). Default: true

  • Import Counters (boolean): Import C devices (counter current values and contacts). Default: true

  • Import State Relays (boolean): Import S devices (state/step relays). Default: true

  • Import Special Devices (boolean): Import SM/SD devices (system special relays and registers). Default: false

PLC Configuration

Enabling MC Protocol

Configure your Mitsubishi PLC to accept MC Protocol connections:

  1. GX Works3 Configuration:

    • Open your project in GX Works3

    • Navigate to Project > Parameter > Ethernet Configuration

    • Enable MC Protocol on the desired port (typically 5001)

    • Set communication data code (Binary or ASCII)

    • Configure allowed operations (Read/Write)

  2. Network Settings:

    • Ensure PLC and Unity PC are on the same network

    • Configure IP address and subnet mask appropriately

    • Test connectivity with ping command

  3. Security Settings:

    • MC Protocol typically doesn't require authentication

    • Ensure firewall allows communication on configured port

    • Some PLCs may require enabling external communication

Device Comment Export

To export device comments from GX Works3 for import:

  1. Export Process:

    • Open your GX Works3 project

    • Navigate to Project > Export > Device Comment

    • Select CSV format

    • Choose devices to export

    • Save with meaningful filename

  2. CSV Format:

    Device,Comment,Data Type,Initial Value
    X0,Start Button,Bit,0
    Y0,Motor Output,Bit,0
    D100,Speed Setpoint,Word[Signed],0
    M100,System Ready,Bit,0

Manual Signal Creation

For precise control over signal configuration, you can manually create individual PLC signals. The interface automatically parses device type and address from the signal name.

Basic Setup Process

  1. Add Interface to Scene:

    • Create an empty GameObject and name it "MitsubishiPLC"

    • Add the MitsubishiMcpXInterface component

    • Configure the connection settings (IP address, port, frame format)

  2. Create Signal GameObject:

    • Right-click the interface GameObject in the hierarchy

    • Select Create Empty to add a child GameObject

    • Name it descriptively (e.g., "ConveyorStartButton", "MotorSpeedSetpoint", "SystemReady")

  3. Add Signal Component:

    • Select the signal GameObject

    • Add the appropriate PLC signal component:

      • PLCInputBool - Send boolean values to PLC (for bit devices like X, Y, M)

      • PLCOutputBool - Read boolean values from PLC (for bit devices like X, Y, M)

      • PLCInputFloat - Send numeric values to PLC (for word devices like D)

      • PLCOutputFloat - Read numeric values from PLC (for word devices like D)

  4. Configure Signal Properties:

    • Name: Set to the Mitsubishi device format (e.g., "X100", "D200", "M5")

    • Comment: Add documentation describing the signal purpose

Device Parsing: The interface automatically extracts the device type and address from the Signal Name property (not the GameObject name). For example:

  • Signal Name "X100" → DeviceType: "X", Address: "100"

  • Signal Name "D200" → DeviceType: "D", Address: "200"

  • Signal Name "M5" → DeviceType: "M", Address: "5"

Signal Configuration Examples

GameObject Name
Signal Name
Device Type
Address
Comment

ConveyorStartButton

X0

X

0

Start button sensor

MotorContactor

Y0

Y

0

Motor contactor

SystemReady

M100

M

100

System ready flag

SpeedSetpoint

D200

D

200

Speed setpoint

DelayTimer

T0

T

0

Delay timer finished

PartCounter

C5

C

5

Part count value

Configuration Summary

  • GameObject Name: Descriptive name for easy identification in Unity hierarchy

  • Signal Name: Mitsubishi device format (X100, D200, etc.) - used for PLC communication

  • Comment: Additional documentation about the signal's purpose and usage

CSV Import

The CSV import feature allows rapid signal creation from GX Works3 device comment exports, dramatically reducing setup time for large systems.

Preparing CSV File in GX Works3

  1. Export Device Comments:

    • Open your GX Works3 project

    • Navigate to Project > Export > Device Comment

    • Select CSV format from the export options

    • Choose the device ranges to export

    • Save to a location accessible from Unity

  2. Verify CSV Format: The exported CSV should follow this structure:

    Device,Comment,Data Type,Initial Value
    X0,Start Button,Bit,0
    X1,Stop Button,Bit,0
    Y0,Motor Contactor,Bit,0
    Y1,Status Light,Bit,0
    D100,Speed Setpoint,Word[Signed],1500
    D101,Temperature Reading,Word[Signed],0
    M0,System Ready,Bit,0
    M1,Auto Mode Active,Bit,0

Import Process in Unity

  1. Select CSV File:

    • In the Mitsubishi McpX Interface Inspector

    • Click the Select CSV File button

    • Navigate to your exported CSV file

    • Click Open to load the file path

  2. Configure Import Settings:

    • Use Standard GX Format: Keep enabled for GX Works3 exports

    • Create Device Hierarchy: Enable to organize signals by device type

    • Import Comments: Enable to use device comments as signal names

    • Max Import Devices: Set safety limit (default 1000)

    • Validate Device Addresses: Keep enabled to catch errors

  3. Filter Device Types: Enable only the device types you need:

    • Physical Inputs (X): Sensors, buttons, switches

    • Physical Outputs (Y): Actuators, lights, valves

    • Internal Relays (M): Logic flags and status bits

    • Data Registers (D): Numeric values and parameters

    • Timers (T): Timer current values and contacts

    • Counters (C): Counter values and contacts

    • State Relays (S): Step sequence control

    • Special Devices (SM/SD): Usually disabled

  4. Execute Import:

    • Click the Import from CSV button

    • Monitor the Unity Console for import progress and any warnings

    • Review created signals in the hierarchy

Post-Import Organization

After successful import, you'll have:

  • Organized hierarchy: Signals grouped by device type (if enabled)

  • Named signals: Using device comments for meaningful names

  • Configured addresses: All device types and addresses set correctly

  • Ready-to-use signals: Immediately available for connection to simulation components

Import Validation and Troubleshooting

Common CSV Issues:

  • Encoding problems: Ensure CSV is saved as UTF-8

  • Format mismatches: Verify column order matches GX Works3 standard

  • Invalid addresses: Check for typos in device addresses

  • Large imports: Consider splitting very large files into smaller segments

Post-Import Verification:

  • Check Unity Console for any import warnings or errors

  • Verify signal names match your expectations

  • Test connectivity with a few sample signals before connecting all components

  • Review batch optimization settings for optimal performance with your signal layout

Troubleshooting

Connection Issues

Cannot connect to PLC:

  1. Verify PLC IP address is correct

  2. Check MC Protocol is enabled on PLC

  3. Test with ping command: ping 192.168.3.39

  4. Verify firewall settings allow port 5001

  5. Check network cable and switches

Connection timeouts:

  • Increase Connection Timeout value

  • Reduce batch sizes if using optimization

  • Check network latency

  • Verify PLC scan time isn't too long

Import Issues

CSV import fails:

  • Verify CSV format matches GX Works3 standard

  • Check file encoding (UTF-8 recommended)

  • Ensure device addresses are valid

  • Review console log for specific errors

Signals not updating:

  • Verify PLC is in RUN mode

  • Check signal direction (Input vs Output)

  • Ensure device addresses match PLC program

  • Review batch optimization settings

Performance Issues

Slow update rates:

  • Enable batch optimization

  • Adjust Max Gap Size for better grouping

  • Increase Min Batch Size to reduce operations

  • Check network bandwidth and latency

Unity freezes during communication:

  • Interface runs in background thread

  • Check for exceptions in console

  • Verify reasonable number of signals (<5000)

  • Consider splitting into multiple interfaces

Supported Device Types

The interface supports all standard Mitsubishi device types:

Device
Description
Data Type
Address Range

X

Physical Inputs

Bit

X0-X7FF (hex)

Y

Physical Outputs

Bit

Y0-Y7FF (hex)

M

Internal Relays

Bit

M0-M8191

L

Latch Relays

Bit

L0-L8191

F

Annunciator

Bit

F0-F2047

V

Edge Relays

Bit

V0-V2047

B

Link Relays

Bit

B0-B1FFF (hex)

D

Data Registers

Word

D0-D12287

W

Link Registers

Word

W0-W1FFF (hex)

T

Timer Contacts/Current

Bit/Word

T0-T511

C

Counter Contacts/Current

Bit/Word

C0-C255

S

State Relays

Bit

S0-S4095

SM

Special Relays

Bit

SM0-SM2047

SD

Special Registers

Word

SD0-SD2047

R

File Registers

Word

R0-R32767

ZR

File Registers

Word

ZR0-ZR65535

See Also

External Resources

© 2025 realvirtual GmbH https://realvirtual.io - All rights reserved. No part of this publication may be reproduced, distributed, or transmitted in any form or by any means, including printing, saving, photocopying, recording, or other electronic or mechanical methods, without the prior written permission of the publisher.

Last updated