Class SimulationResult
java.lang.Object
neqsim.process.processmodel.SimulationResult
Structured result of a simulation build or execution.
Provides a standardized response format for web API integration including status, errors, warnings, and simulation results in JSON. Designed for external Python callers and web services.
Success Response:
{ "status": "success", "processSystemName": "json-process", "report": { ... },
"warnings": [] }
Error Response:
{ "status": "error", "errors": [ { "code": "MISSING_INLET", "message": "Inlet
reference 'HP Sep' not found", "unit": "Compressor-1", "remediation": "Ensure referenced unit is
defined before this unit" } ], "warnings": ["Property 'power' not found on Cooler-1"] } - Author:
- Even Solbraa @version 1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDetailed error information for a specific issue.static enumStatus of the simulation result. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List<SimulationResult.ErrorDetail> private final ProcessSystemprivate final Stringprivate final SimulationResult.Status -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateSimulationResult(SimulationResult.Status status, ProcessSystem processSystem, String reportJson, List<SimulationResult.ErrorDetail> errors, List<String> warnings) Private constructor — use static factory methods. -
Method Summary
Modifier and TypeMethodDescriptionstatic SimulationResultCreates a single-error failure result.static SimulationResultfailure(List<SimulationResult.ErrorDetail> errors, List<String> warnings) Creates a failure result with no process system.static SimulationResultfailure(ProcessSystem process, List<SimulationResult.ErrorDetail> errors, List<String> warnings) Creates a failure result with a partially built process system.Gets the list of errors.Gets the built ProcessSystem.Gets the simulation report JSON.Gets the result status.Gets the list of warnings.booleanReturns true if there are any warnings.booleanisError()Returns true if the simulation had errors.booleanReturns true if the simulation completed successfully.static SimulationResultsuccess(ProcessSystem process, String reportJson, List<String> warnings) Creates a success result.toJson()Converts this result to a structured JSON string suitable for web API responses.toString()
-
Field Details
-
status
-
processSystem
-
reportJson
-
errors
-
warnings
-
-
Constructor Details
-
SimulationResult
private SimulationResult(SimulationResult.Status status, ProcessSystem processSystem, String reportJson, List<SimulationResult.ErrorDetail> errors, List<String> warnings) Private constructor — use static factory methods.- Parameters:
status- the result statusprocessSystem- the built process system (nullable on error)reportJson- the simulation report JSON (nullable if not run)errors- list of errorswarnings- list of warnings
-
-
Method Details
-
success
public static SimulationResult success(ProcessSystem process, String reportJson, List<String> warnings) Creates a success result.- Parameters:
process- the built and optionally run process systemreportJson- the simulation report JSON (nullable if not run)warnings- list of non-fatal warnings- Returns:
- the success result
-
failure
public static SimulationResult failure(List<SimulationResult.ErrorDetail> errors, List<String> warnings) Creates a failure result with no process system.- Parameters:
errors- the list of errorswarnings- the list of warnings- Returns:
- the failure result
-
failure
public static SimulationResult failure(ProcessSystem process, List<SimulationResult.ErrorDetail> errors, List<String> warnings) Creates a failure result with a partially built process system.- Parameters:
process- the partially built process systemerrors- the list of errorswarnings- the list of warnings- Returns:
- the failure result
-
error
Creates a single-error failure result.- Parameters:
code- error codemessage- error messageremediation- how to fix- Returns:
- the failure result
-
isSuccess
public boolean isSuccess()Returns true if the simulation completed successfully.- Returns:
- true if status is SUCCESS
-
isError
public boolean isError()Returns true if the simulation had errors.- Returns:
- true if status is ERROR
-
getStatus
-
getProcessSystem
Gets the built ProcessSystem.- Returns:
- the process system, or null if build failed completely
-
getReportJson
Gets the simulation report JSON.- Returns:
- the report JSON string, or null if simulation was not run
-
getErrors
Gets the list of errors.- Returns:
- unmodifiable list of errors
-
getWarnings
-
hasWarnings
public boolean hasWarnings()Returns true if there are any warnings.- Returns:
- true if warnings exist
-
toJson
Converts this result to a structured JSON string suitable for web API responses.- Returns:
- JSON string
-
toString
-