Class SimulationResult

java.lang.Object
neqsim.process.processmodel.SimulationResult

public class SimulationResult extends Object
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
  • Field Details

  • 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 status
      processSystem - the built process system (nullable on error)
      reportJson - the simulation report JSON (nullable if not run)
      errors - list of errors
      warnings - 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 system
      reportJson - 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 errors
      warnings - 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 system
      errors - the list of errors
      warnings - the list of warnings
      Returns:
      the failure result
    • error

      public static SimulationResult error(String code, String message, String remediation)
      Creates a single-error failure result.
      Parameters:
      code - error code
      message - error message
      remediation - 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

      public SimulationResult.Status getStatus()
      Gets the result status.
      Returns:
      the status
    • getProcessSystem

      public ProcessSystem getProcessSystem()
      Gets the built ProcessSystem.
      Returns:
      the process system, or null if build failed completely
    • getReportJson

      public String getReportJson()
      Gets the simulation report JSON.
      Returns:
      the report JSON string, or null if simulation was not run
    • getErrors

      public List<SimulationResult.ErrorDetail> getErrors()
      Gets the list of errors.
      Returns:
      unmodifiable list of errors
    • getWarnings

      public List<String> getWarnings()
      Gets the list of warnings.
      Returns:
      unmodifiable list of warnings
    • hasWarnings

      public boolean hasWarnings()
      Returns true if there are any warnings.
      Returns:
      true if warnings exist
    • toJson

      public String toJson()
      Converts this result to a structured JSON string suitable for web API responses.
      Returns:
      JSON string
    • toString

      public String toString()
      Overrides:
      toString in class Object