Class AutomationRunner
java.lang.Object
neqsim.mcp.runners.AutomationRunner
Stateless automation and lifecycle runner for MCP integration.
Provides string-addressable variable access via ProcessAutomation and lifecycle state
management via ProcessSystemState. Designed for agentic workflows where LLMs need to
discover, read, and write simulation variables without navigating Java class hierarchies.
- Version:
- 1.0
- Author:
- Even Solbraa
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivatePrivate constructor — all methods are static. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcompareStates(String stateJson1, String stateJson2) Compares two process states and returns the differences.static StringDiagnoses a failed automation operation and returns suggestions for fixing it.private static StringBuilds a standard error JSON response.static StringgetLearningReport(String processJson) Returns the learning report from operation history, summarizing success rates, error patterns, learned corrections, and recommendations.static StringgetVariable(String processJson, String address, String unit) Runs a process from JSON and reads a specific variable value with self-healing.static StringRuns a process from JSON and returns the list of equipment unit names.static StringlistVariables(String processJson, String unitName) Runs a process from JSON and returns all variables for a specific equipment unit with self-healing.static StringRuns a process from JSON and saves its state as a lifecycle snapshot.static StringsetVariableAndRun(String processJson, String address, double value, String unit) Runs a process from JSON, modifies a variable with self-healing, re-runs, and returns the updated results.
-
Field Details
-
GSON
private static final com.google.gson.Gson GSON
-
-
Constructor Details
-
AutomationRunner
private AutomationRunner()Private constructor — all methods are static.
-
-
Method Details
-
listUnits
Runs a process from JSON and returns the list of equipment unit names.Builds and runs the process, then queries
ProcessAutomation.getUnitList()to discover all addressable equipment.- Parameters:
processJson- the JSON process definition- Returns:
- JSON string with list of unit names and their types
-
listVariables
Runs a process from JSON and returns all variables for a specific equipment unit with self-healing. If the unit name is incorrect, attempts fuzzy matching and returns suggestions.- Parameters:
processJson- the JSON process definitionunitName- the equipment unit name to query variables for- Returns:
- JSON string with list of variables including address, type, unit, and description
-
getVariable
Runs a process from JSON and reads a specific variable value with self-healing. If the address is incorrect, attempts fuzzy matching and auto-correction, returning suggestions in the response.- Parameters:
processJson- the JSON process definitionaddress- the dot-notation variable address (e.g., "HP Sep.gasOutStream.temperature")unit- the desired unit of measurement (e.g., "C", "bara", "kg/hr")- Returns:
- JSON string with the variable value, auto-correction info, or diagnostic suggestions
-
setVariableAndRun
public static String setVariableAndRun(String processJson, String address, double value, String unit) Runs a process from JSON, modifies a variable with self-healing, re-runs, and returns the updated results. If the address is incorrect, attempts fuzzy matching and auto-correction. Also validates values against physical bounds before setting.- Parameters:
processJson- the JSON process definitionaddress- the dot-notation variable address to modifyvalue- the new value to setunit- the unit of the value- Returns:
- JSON string with the updated simulation results or diagnostic info
-
saveState
Runs a process from JSON and saves its state as a lifecycle snapshot.- Parameters:
processJson- the JSON process definitionstateName- name for the snapshotstateVersion- version string for the snapshot- Returns:
- JSON string with the serialized process state
-
compareStates
-
diagnose
Diagnoses a failed automation operation and returns suggestions for fixing it. This is the entry point agents should call when an automation operation returns an error to get actionable remediation hints.- Parameters:
processJson- the JSON process definitionfailedAddress- the address that failed (e.g., "HP separator.gasOut.temp")operation- the operation that failed ("get", "set", or "list")- Returns:
- JSON string with diagnostic information including suggestions and auto-corrections
-
getLearningReport
Returns the learning report from operation history, summarizing success rates, error patterns, learned corrections, and recommendations.- Parameters:
processJson- the JSON process definition (used to initialize the automation)- Returns:
- JSON string with learning statistics and recommendations
-
errorJson
-