refactor: Remove connection indicators from hydraulic pipe UI
This commit is contained in:
parent
f07e7895f6
commit
fd57091d73
|
@ -1,13 +1,41 @@
|
|||
# CtrEditor MCP Server - LLM Usage Guide
|
||||
# CtrEditor Enhanced MCP Server - LLM Usage Guide
|
||||
|
||||
## 🤖 Quick Start for Language Models
|
||||
|
||||
This guide provides step-by-step instructions for LLMs to interact with CtrEditor simulations programmatically. The MCP server allows complete control over simulation objects, execution, and monitoring.
|
||||
This guide provides step-by-step instructions for LLMs to interact with CtrEditor simulations programmatically. The enhanced MCP server provides complete control over simulation objects, execution, monitoring, process management, build tools, and intelligent debug console access.
|
||||
|
||||
## 🚀 Basic Workflow
|
||||
## 🚀 Enhanced Workflow
|
||||
|
||||
### 1. Initial Assessment
|
||||
Start by getting the current state of the simulation:
|
||||
### 1. Process Management (NEW)
|
||||
Control CtrEditor application lifecycle:
|
||||
|
||||
```
|
||||
🚀 start_ctreditor - Launch CtrEditor instance
|
||||
🔍 get_ctreditor_status - Check process status
|
||||
🛑 stop_ctreditor - Terminate CtrEditor
|
||||
```
|
||||
|
||||
### 2. Build Management (NEW)
|
||||
Intelligent compilation with error filtering:
|
||||
|
||||
```
|
||||
🔨 build_project - Compile with smart error filtering
|
||||
🧹 clean_project - Clean build artifacts
|
||||
```
|
||||
|
||||
### 3. Debug Console Access (NEW)
|
||||
Real-time debug monitoring with intelligent filtering:
|
||||
|
||||
```
|
||||
🎧 start_debug_listener - Connect to debug output
|
||||
🔍 search_debug_log - Regex/grep search in console
|
||||
📊 get_debug_stats - Debug buffer statistics
|
||||
🧹 clear_debug_buffer - Clear debug history
|
||||
🛑 stop_debug_listener - Disconnect debug monitoring
|
||||
```
|
||||
|
||||
### 4. Simulation Assessment
|
||||
Get the current state of the simulation:
|
||||
|
||||
```
|
||||
🔍 list_objects - See what's currently in the simulation
|
||||
|
@ -15,7 +43,7 @@ Start by getting the current state of the simulation:
|
|||
🔌 get_plc_status - Check PLC connection state
|
||||
```
|
||||
|
||||
### 2. Object Analysis
|
||||
### 5. Object Analysis
|
||||
For each object found, examine its properties to understand:
|
||||
- **Position**: `Left`, `Top` coordinates in meters
|
||||
- **Dimensions**: `Ancho` (width), `Alto` (height) in meters
|
||||
|
@ -23,12 +51,57 @@ For each object found, examine its properties to understand:
|
|||
- **Connection States**: Which components are connected
|
||||
- **Simulation Parameters**: Physics and hydraulic settings
|
||||
|
||||
### 3. Simulation Control
|
||||
### 6. Simulation Control
|
||||
Control the simulation lifecycle:
|
||||
- `start_simulation` - Begin physics calculations
|
||||
- `stop_simulation` - Halt simulation
|
||||
- Monitor changes with repeated `list_objects` calls
|
||||
|
||||
## 🔧 Enhanced Development Workflow (NEW)
|
||||
|
||||
### Full Development Cycle Automation
|
||||
The enhanced MCP server enables complete development automation:
|
||||
|
||||
1. **🚀 Launch Environment**
|
||||
```
|
||||
start_ctreditor - Launch fresh CtrEditor instance
|
||||
get_ctreditor_status - Verify process started
|
||||
```
|
||||
|
||||
2. **🔨 Build and Test**
|
||||
```
|
||||
build_project - Compile with intelligent error filtering
|
||||
# Only compilation errors/warnings returned, not full build log
|
||||
clean_project - Clean artifacts if needed
|
||||
```
|
||||
|
||||
3. **🐛 Debug Monitoring**
|
||||
```
|
||||
start_debug_listener - Connect to CtrEditor debug console
|
||||
# Real-time monitoring of debug output with buffering
|
||||
```
|
||||
|
||||
4. **🔍 Intelligent Debug Search**
|
||||
```
|
||||
search_debug_log(pattern="ERROR|EXCEPTION", max_lines=20)
|
||||
search_debug_log(pattern="simulation.*started", case_sensitive=false)
|
||||
search_debug_log(pattern="pump.*flow", last_n_lines=500)
|
||||
```
|
||||
|
||||
5. **📊 System Monitoring**
|
||||
```
|
||||
get_debug_stats - Buffer status and recent activity
|
||||
get_simulation_status - Runtime state
|
||||
list_objects - Current simulation objects
|
||||
```
|
||||
|
||||
6. **🧹 Cleanup**
|
||||
```
|
||||
stop_simulation - Stop if running
|
||||
stop_ctreditor - Terminate process
|
||||
clear_debug_buffer - Clean debug history
|
||||
```
|
||||
|
||||
## 📊 Object Property Deep Dive
|
||||
|
||||
### Hydraulic Components
|
||||
|
@ -114,9 +187,115 @@ update_object({
|
|||
- Use appropriate units (meters, Pascal, m³/s, etc.)
|
||||
- Verify changes by calling `list_objects` again
|
||||
|
||||
## 🎯 Common Debugging Workflows
|
||||
## 🎯 Enhanced Usage Examples (NEW)
|
||||
|
||||
### 1. Pre-Simulation Analysis
|
||||
### Process Management Example
|
||||
```json
|
||||
// Check if CtrEditor is running
|
||||
{"tool": "get_ctreditor_status", "parameters": {}}
|
||||
|
||||
// Start CtrEditor if needed
|
||||
{"tool": "start_ctreditor", "parameters": {}}
|
||||
|
||||
// Stop CtrEditor when done
|
||||
{"tool": "stop_ctreditor", "parameters": {}}
|
||||
```
|
||||
|
||||
### Build Management Example
|
||||
```json
|
||||
// Clean before building
|
||||
{"tool": "clean_project", "parameters": {}}
|
||||
|
||||
// Build and get only errors/warnings
|
||||
{"tool": "build_project", "parameters": {}}
|
||||
```
|
||||
|
||||
### Debug Console Example
|
||||
```json
|
||||
// Start monitoring
|
||||
{"tool": "start_debug_listener", "parameters": {}}
|
||||
|
||||
// Search for errors
|
||||
{"tool": "search_debug_log", "parameters": {
|
||||
"pattern": "error|exception",
|
||||
"max_lines": 20
|
||||
}}
|
||||
|
||||
// Check buffer stats
|
||||
{"tool": "get_debug_stats", "parameters": {}}
|
||||
|
||||
// Stop monitoring
|
||||
{"tool": "stop_debug_listener", "parameters": {}}
|
||||
```
|
||||
|
||||
### Combined Development Workflow
|
||||
```json
|
||||
// 1. Ensure clean environment
|
||||
{"tool": "get_ctreditor_status", "parameters": {}}
|
||||
{"tool": "stop_ctreditor", "parameters": {}}
|
||||
{"tool": "clean_project", "parameters": {}}
|
||||
|
||||
// 2. Build and check for errors
|
||||
{"tool": "build_project", "parameters": {}}
|
||||
|
||||
// 3. Start CtrEditor with monitoring
|
||||
{"tool": "start_debug_listener", "parameters": {}}
|
||||
{"tool": "start_ctreditor", "parameters": {}}
|
||||
|
||||
// 4. Monitor for issues
|
||||
{"tool": "search_debug_log", "parameters": {
|
||||
"pattern": "error|exception|fail",
|
||||
"max_lines": 10
|
||||
}}
|
||||
|
||||
// 5. Test simulation
|
||||
{"tool": "get_simulation_status", "parameters": {}}
|
||||
{"tool": "start_simulation", "parameters": {}}
|
||||
|
||||
// 6. Search for simulation issues
|
||||
{"tool": "search_debug_log", "parameters": {
|
||||
"pattern": "simulation|physics",
|
||||
"max_lines": 15
|
||||
}}
|
||||
```
|
||||
|
||||
## 🔧 Enhanced Debugging Workflows (NEW)
|
||||
|
||||
### 1. Build Error Investigation
|
||||
```
|
||||
1. build_project - Get compilation errors only (filtered)
|
||||
2. search_debug_log(pattern="error|warning", max_lines=50) - Find related debug info
|
||||
3. start_ctreditor - Launch for testing
|
||||
4. get_debug_stats - Monitor for new issues
|
||||
```
|
||||
|
||||
### 2. Runtime Issue Investigation
|
||||
```
|
||||
1. start_debug_listener - Begin monitoring
|
||||
2. start_simulation - Trigger the issue
|
||||
3. search_debug_log(pattern="exception|error", last_n_lines=200) - Find problems
|
||||
4. search_debug_log(pattern="stack trace", max_lines=10) - Get stack traces
|
||||
5. stop_simulation - Stop for analysis
|
||||
```
|
||||
|
||||
### 3. Performance Analysis
|
||||
```
|
||||
1. clear_debug_buffer - Start with clean slate
|
||||
2. start_simulation - Begin performance test
|
||||
3. search_debug_log(pattern="fps|performance|slow", max_lines=20) - Find performance issues
|
||||
4. search_debug_log(pattern="memory|allocation", max_lines=15) - Check memory usage
|
||||
5. get_debug_stats - Overall statistics
|
||||
```
|
||||
|
||||
### 4. Component Behavior Analysis
|
||||
```
|
||||
1. search_debug_log(pattern="pump|flow|pressure", max_lines=30) - Hydraulic behavior
|
||||
2. search_debug_log(pattern="simulation.*object", max_lines=25) - Object interactions
|
||||
3. take_screenshot() - Visual verification
|
||||
4. list_objects - Current property values
|
||||
```
|
||||
|
||||
### 5. Pre-Simulation Analysis
|
||||
```
|
||||
1. list_objects - Document initial state
|
||||
2. take_screenshot() - Visual documentation
|
||||
|
@ -124,7 +303,7 @@ update_object({
|
|||
4. Verify proper component setup
|
||||
```
|
||||
|
||||
### 2. Simulation Monitoring
|
||||
### 6. Simulation Monitoring
|
||||
```
|
||||
1. start_simulation - Begin simulation
|
||||
2. get_simulation_status - Confirm running
|
||||
|
@ -133,7 +312,7 @@ update_object({
|
|||
5. stop_simulation - End when needed
|
||||
```
|
||||
|
||||
### 3. Performance Investigation
|
||||
### 7. Performance Investigation
|
||||
```
|
||||
1. list_objects - Get baseline measurements
|
||||
2. start_simulation - Run simulation
|
||||
|
@ -142,7 +321,7 @@ update_object({
|
|||
5. take_screenshot() - Document final state
|
||||
```
|
||||
|
||||
### 4. Component Analysis
|
||||
### 8. Component Analysis
|
||||
```
|
||||
1. take_screenshot(component_area) - High-res component view
|
||||
2. list_objects - Get detailed properties
|
||||
|
@ -168,7 +347,29 @@ update_object({
|
|||
- **IsRunning**: Operational state
|
||||
- **PumpDirection**: Flow direction control
|
||||
|
||||
## 🚨 Troubleshooting Guide
|
||||
## 🚨 Enhanced Troubleshooting Guide (NEW)
|
||||
|
||||
### Process Management Issues
|
||||
If CtrEditor won't start or crashes:
|
||||
1. `get_ctreditor_status` - Check current process state
|
||||
2. `stop_ctreditor` - Ensure clean termination
|
||||
3. `build_project` - Check for compilation issues
|
||||
4. `start_ctreditor` - Launch fresh instance
|
||||
5. `start_debug_listener` - Monitor for startup issues
|
||||
|
||||
### Build Problems
|
||||
If compilation fails:
|
||||
1. `clean_project` - Clean build artifacts
|
||||
2. `build_project` - Get filtered error list (not full log)
|
||||
3. Focus on CS#### errors (compilation) vs MSB#### (build system)
|
||||
4. Check for file locks or permission issues
|
||||
|
||||
### Debug Console Issues
|
||||
If debug monitoring fails:
|
||||
1. `stop_debug_listener` - Clean disconnect
|
||||
2. `get_debug_stats` - Check connection status
|
||||
3. Verify CtrEditor has debug console enabled on port 5007
|
||||
4. `start_debug_listener` - Reconnect with fresh connection
|
||||
|
||||
### Connection Issues
|
||||
If MCP commands fail:
|
||||
|
@ -191,7 +392,27 @@ If properties seem wrong:
|
|||
3. Check if simulation is running vs stopped
|
||||
4. Verify meter-based coordinates
|
||||
|
||||
## 💡 Best Practices
|
||||
## 💡 Enhanced Best Practices (NEW)
|
||||
|
||||
### Token Efficiency
|
||||
- Use `build_project` instead of running full `dotnet build` - returns only errors
|
||||
- Use `search_debug_log` with specific patterns instead of requesting full console
|
||||
- Set `max_lines` parameter to limit returned results
|
||||
- Use `last_n_lines` to focus on recent activity
|
||||
|
||||
### Development Workflow
|
||||
- Always use `get_ctreditor_status` before attempting to start CtrEditor
|
||||
- Use `clean_project` if builds seem inconsistent
|
||||
- Monitor debug output with `start_debug_listener` during development
|
||||
- Use regex patterns for precise debug searches: `error|exception|fail`
|
||||
|
||||
### Debug Search Patterns
|
||||
Effective patterns for common issues:
|
||||
- **Errors**: `error|exception|fail|crash`
|
||||
- **Performance**: `fps|slow|performance|memory`
|
||||
- **Simulation**: `simulation.*start|simulation.*stop|physics`
|
||||
- **Hydraulics**: `pump|flow|pressure|tank|pipe`
|
||||
- **Objects**: `object.*create|object.*delete|object.*update`
|
||||
|
||||
### Efficient Monitoring
|
||||
- Use `get_simulation_status` for quick status checks
|
||||
|
|
|
@ -44,22 +44,6 @@
|
|||
Foreground="White"/>
|
||||
</Viewbox>
|
||||
|
||||
<!-- Indicador de conexión entrada -->
|
||||
<Ellipse x:Name="ConnectionIn"
|
||||
Fill="Green"
|
||||
Width="8"
|
||||
Height="8"
|
||||
Canvas.Left="-4"
|
||||
Canvas.Top="{Binding Alto, Converter={StaticResource MeterToPixelConverter}, ConverterParameter=0.5}"/>
|
||||
|
||||
<!-- Indicador de conexión salida -->
|
||||
<Ellipse x:Name="ConnectionOut"
|
||||
Fill="Red"
|
||||
Width="8"
|
||||
Height="8"
|
||||
Canvas.Right="-4"
|
||||
Canvas.Top="{Binding Alto, Converter={StaticResource MeterToPixelConverter}, ConverterParameter=0.5}"/>
|
||||
|
||||
<!-- Indicador de flujo -->
|
||||
<Border x:Name="FlowIndicator"
|
||||
Background="Yellow"
|
||||
|
|
Loading…
Reference in New Issue