Features

Compilation Feedback

Real-time compilation errors and warnings

Compilation Feedback

PLC Studio AI provides real-time compilation feedback, showing you errors and warnings as soon as changes are applied.

How It Works

When you accept code changes:

  1. The bridge sends the updated code to CODESYS
  2. CODESYS compiles the project
  3. Compilation results are sent back to PLC Studio AI
  4. Errors and warnings appear in the interface

This happens automatically—you don't need to manually trigger compilation.

Understanding Compilation Results

Success

When compilation succeeds, you'll see:

  • A green checkmark indicator
  • "Compilation successful" message
  • Any warnings (if present)

Errors

When compilation fails, you'll see:

  • A red error indicator
  • List of errors with line numbers
  • Error descriptions from CODESYS

Warnings

Warnings don't prevent compilation but indicate potential issues:

  • Yellow warning indicator
  • List of warnings with locations
  • Suggestions for resolution

Error Display

Errors appear in the Problems panel:

Errors (2)
├─ FB_Motor.st:15 - Identifier 'bStrat' not defined
└─ FB_Motor.st:23 - Type mismatch: Cannot convert REAL to INT

Warnings (1)
└─ FB_Pump.st:8 - Variable 'rTemp' is declared but never used

Click on any error to jump to that location in the code.

Common Error Types

Syntax Errors

Error: Unexpected token 'THEN' at line 12

Cause: Missing or incorrect syntax Fix: Check for missing semicolons, keywords, or parentheses

Undefined Identifiers

Error: Identifier 'bStartMotor' not defined

Cause: Variable or function not declared Fix: Declare the variable or check spelling

Type Mismatches

Error: Type mismatch: Cannot assign REAL to INT

Cause: Incompatible data types Fix: Use explicit conversion (REAL_TO_INT) or change variable type

Missing Declarations

Error: Variable 'counter' must be declared

Cause: Using a variable without declaring it Fix: Add the variable to the appropriate VAR section

AI-Assisted Error Fixing

When you encounter errors, you can ask the AI for help:

"Fix the compilation error on line 15"
"Why am I getting a type mismatch error?"
"The compiler says 'bStart' is undefined, but I declared it"

The AI can:

  • Explain what the error means
  • Suggest fixes
  • Apply corrections automatically

Error Prevention

Enable Real-Time Checking

PLC Studio AI can catch some errors before compilation:

  • Syntax highlighting shows issues
  • Type checking warns about mismatches
  • Missing declarations are flagged

Use Autocomplete

The AI-powered autocomplete suggests:

  • Valid variable names
  • Correct function signatures
  • Appropriate data types

Follow Best Practices

  • Declare variables before use
  • Use consistent naming conventions
  • Keep functions focused and small

Compilation Settings

You can configure compilation behavior in Settings:

SettingDescription
Auto-compileCompile automatically after accepting changes
Show warningsDisplay warning messages
Strict modeTreat warnings as errors

Troubleshooting

Compilation Not Running

If compilation doesn't run:

  • Check that the bridge is connected
  • Verify CODESYS is open with your project
  • Try reconnecting the bridge

Errors Not Clearing

If errors persist after fixing:

  • Save all files in CODESYS
  • Trigger a manual compile in CODESYS
  • Restart the bridge

Inconsistent Results

If PLC Studio AI shows different errors than CODESYS:

  • Sync may be out of date—refresh the connection
  • Check for unsaved changes in CODESYS

Next Steps

On this page