Skip to content

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.

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.

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

  1. Menu Method: Select Tools > 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/

Mitsubishi McpX Interface Inspector

  • IP Address (string): IP address of the Mitsubishi PLC. Default: “192.168.3.39”
  • Port (int): MC Protocol communication port. Default: 5001 (standard port for MC Protocol 3E/4E frames)
  • Connection Timeout (int): Maximum connection establishment time in milliseconds. Default: 5000

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)

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

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

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 port 5001 (standard port for 3E frames)
    • Set communication data code to Binary (required for 3E frame format)
    • 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

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

The CSV import supports an optional InputOutput column that allows you to override the default signal direction for each device. This is useful when the standard device-type-based direction doesn’t match your application requirements.

Supported column headers: InputOutput, Input/Output, or IO (case-insensitive)

CSV Format with InputOutput column:

Device,Comment,Data Type,Initial Value,InputOutput
D0,Rx000,Word[Signed],0,Input
D1,Rx001,Word[Signed],0,Output
D2,Rx002,Word[Signed],0,
M0,System Flag,Bit,0,Output

Behavior:

  • Column present with value: The specified direction (“Input” or “Output”) overrides the default
  • Column present but empty: Uses the default direction based on device type
  • Column not present: Uses the default direction based on device type

Default directions by device type (from PLC perspective):

Device TypeDefault DirectionDescription
XInputPLC inputs (sensors) - Unity simulates sensors, sends to PLC
YOutputPLC outputs (actuators) - PLC sends commands to Unity
M, D, T, C, SOutputMost devices default to reading from PLC
SM, SDOutputSpecial devices are read-only from PLC

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.

  1. Add Interface to Scene:
    • Create an empty GameObject and name it “MitsubishiPLC”
    • Add the MitsubishiMcpXInterface component
    • Configure the connection settings (IP address and port)
  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 based on device type:
      • PLCInputBool - Send boolean values to PLC (for X devices - sensors)
      • PLCOutputBool - Read boolean values from PLC (for Y, M devices - actuators, flags)
      • PLCInputFloat - Send numeric values to PLC (for D devices used as setpoints)
      • PLCOutputFloat - Read numeric values from PLC (for D devices - status values)
  4. Configure Signal Properties:
    • Name: Set to the Mitsubishi device format (e.g., “X100”, “D200”, “M5”)
    • Comment: Add documentation describing the signal purpose
GameObject NameSignal NameSignal ComponentDirectionComment
ConveyorStartButtonX0PLCInputBoolInputSensor → PLC
MotorContactorY0PLCOutputBoolOutputPLC → Actuator
SystemReadyM100PLCOutputBoolOutputRead flag from PLC
SpeedSetpointD200PLCInputFloatInputSend setpoint to PLC
ActualSpeedD201PLCOutputFloatOutputRead value from PLC
DelayTimerT0PLCOutputBoolOutputTimer status from PLC
  • 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

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

  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
  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

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

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

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

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: X devices should be Input (Unity → PLC), Y devices should be Output (PLC → Unity)
  • Ensure device addresses match PLC program
  • Review batch optimization settings

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

The interface supports all standard Mitsubishi device types:

DeviceDescriptionData TypeAddress Range
XPhysical InputsBitX0-X7FF (hex)
YPhysical OutputsBitY0-Y7FF (hex)
MInternal RelaysBitM0-M8191
LLatch RelaysBitL0-L8191
FAnnunciatorBitF0-F2047
VEdge RelaysBitV0-V2047
BLink RelaysBitB0-B1FFF (hex)
DData RegistersWordD0-D12287
WLink RegistersWordW0-W1FFF (hex)
TTimer Contacts/CurrentBit/WordT0-T511
CCounter Contacts/CurrentBit/WordC0-C255
SState RelaysBitS0-S4095
SMSpecial RelaysBitSM0-SM2047
SDSpecial RegistersWordSD0-SD2047
RFile RegistersWordR0-R32767
ZRFile RegistersWordZR0-ZR65535

© 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.