Class EngineeringValidator

java.lang.Object
neqsim.mcp.runners.EngineeringValidator

public final class EngineeringValidator extends Object
Engineering validation layer that checks simulation results against industry design rules, physical constraints, and best-practice ranges.

Validation is applied post-simulation to flag issues like compressor efficiency out of range, separator residence time too low, approach temperatures below minimum, hydrate risk, etc. Each check has a severity (ERROR, WARNING, INFO) and a remediation hint.

Version:
1.0
Author:
Even Solbraa
  • Field Details

    • GSON

      private static final com.google.gson.Gson GSON
  • Constructor Details

    • EngineeringValidator

      private EngineeringValidator()
      Private constructor — all methods are static.
  • Method Details

    • validate

      public static String validate(String resultsJson, String context)
      Validates simulation results JSON against engineering rules.
      Parameters:
      resultsJson - JSON from any runner (process, pipeline, flash, etc.)
      context - optional context string ("process", "flash", "pipeline", "compressor", etc.)
      Returns:
      JSON with validation findings
    • validateEquipment

      public static String validateEquipment(String equipmentJson, String equipmentType)
      Validates a specific equipment type with targeted rules.
      Parameters:
      equipmentJson - JSON describing the equipment
      equipmentType - the equipment type (compressor, separator, heatExchanger, etc.)
      Returns:
      JSON with validation findings
    • checkTemperatureRanges

      private static void checkTemperatureRanges(com.google.gson.JsonObject results, List<EngineeringValidator.ValidationFinding> findings)
      Checks temperatures against physical and practical limits.
      Parameters:
      results - the results JSON
      findings - the findings list to append to
    • checkPressureRanges

      private static void checkPressureRanges(com.google.gson.JsonObject results, List<EngineeringValidator.ValidationFinding> findings)
      Checks pressures against physical and practical limits.
      Parameters:
      results - the results JSON
      findings - the findings list to append to
    • checkCompressorRules

      private static void checkCompressorRules(com.google.gson.JsonObject results, List<EngineeringValidator.ValidationFinding> findings)
      Checks compressor-specific parameters.
      Parameters:
      results - the results JSON
      findings - the findings list
    • checkCompressorDesign

      private static void checkCompressorDesign(com.google.gson.JsonObject eq, List<EngineeringValidator.ValidationFinding> findings)
      Detailed compressor design validation.
      Parameters:
      eq - equipment JSON
      findings - findings list
    • checkSeparatorRules

      private static void checkSeparatorRules(com.google.gson.JsonObject results, List<EngineeringValidator.ValidationFinding> findings)
      Checks separator-specific parameters.
      Parameters:
      results - the results JSON
      findings - the findings list
    • checkSeparatorDesign

      private static void checkSeparatorDesign(com.google.gson.JsonObject eq, List<EngineeringValidator.ValidationFinding> findings)
      Detailed separator design validation.
      Parameters:
      eq - equipment JSON
      findings - findings list
    • checkHeatExchangerRules

      private static void checkHeatExchangerRules(com.google.gson.JsonObject results, List<EngineeringValidator.ValidationFinding> findings)
      Checks heat exchanger rules.
      Parameters:
      results - the results JSON
      findings - the findings list
    • checkHeatExchangerDesign

      private static void checkHeatExchangerDesign(com.google.gson.JsonObject eq, List<EngineeringValidator.ValidationFinding> findings)
      Detailed HX design validation.
      Parameters:
      eq - equipment JSON
      findings - findings list
    • checkPipelineRules

      private static void checkPipelineRules(com.google.gson.JsonObject results, List<EngineeringValidator.ValidationFinding> findings)
      Checks pipeline-specific parameters.
      Parameters:
      results - the results JSON
      findings - the findings list
    • checkPipelineDesign

      private static void checkPipelineDesign(com.google.gson.JsonObject eq, List<EngineeringValidator.ValidationFinding> findings)
      Detailed pipeline design validation.
      Parameters:
      eq - equipment JSON
      findings - findings list
    • checkValveDesign

      private static void checkValveDesign(com.google.gson.JsonObject eq, List<EngineeringValidator.ValidationFinding> findings)
      Valve design validation.
      Parameters:
      eq - equipment JSON
      findings - findings list
    • checkPhaseRules

      private static void checkPhaseRules(com.google.gson.JsonObject results, List<EngineeringValidator.ValidationFinding> findings)
      Checks phase-related issues.
      Parameters:
      results - the results JSON
      findings - the findings list
    • checkMassBalance

      private static void checkMassBalance(com.google.gson.JsonObject results, List<EngineeringValidator.ValidationFinding> findings)
      Checks mass balance closure.
      Parameters:
      results - the results JSON
      findings - the findings list
    • checkEnergyBalance

      private static void checkEnergyBalance(com.google.gson.JsonObject results, List<EngineeringValidator.ValidationFinding> findings)
      Checks energy balance closure.
      Parameters:
      results - the results JSON
      findings - the findings list
    • checkConvergence

      private static void checkConvergence(com.google.gson.JsonObject results, List<EngineeringValidator.ValidationFinding> findings)
      Checks convergence status.
      Parameters:
      results - the results JSON
      findings - the findings list
    • findNumericValue

      private static Double findNumericValue(com.google.gson.JsonObject obj, String fieldName)
      Recursively searches a JSON object for a numeric field by key name.
      Parameters:
      obj - the JSON object
      fieldName - the field name to search for
      Returns:
      the numeric value, or null if not found
    • checkNumericField

      private static void checkNumericField(com.google.gson.JsonObject results, String fieldName, double min, double max, String unit, List<EngineeringValidator.ValidationFinding> findings, String errorMessage, String remediation)
      Checks a numeric field against min/max bounds.
      Parameters:
      results - the results JSON
      fieldName - the field name
      min - the minimum value
      max - the maximum value
      unit - the unit string
      findings - the findings list
      errorMessage - the error message
      remediation - the remediation hint
    • buildReport

      private static String buildReport(List<EngineeringValidator.ValidationFinding> findings, String context)
      Builds the validation report JSON.
      Parameters:
      findings - the list of findings
      context - the validation context
      Returns:
      JSON report string