Class StandardsRunner
java.lang.Object
neqsim.mcp.runners.StandardsRunner
Stateless standards calculation runner for MCP integration.
Supports gas quality standards (ISO 6976, AGA, GPA, EN) and oil quality standards (ASTM, BSW). Each standard returns its results (heating value, Wobbe index, density, distillation curve, etc.) in the standard JSON envelope format.
- Version:
- 1.0
- Author:
- Even Solbraa
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final com.google.gson.Gson -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivatePrivate constructor — all methods are static. -
Method Summary
Modifier and TypeMethodDescriptionprivate static SystemInterfacecreateFluid(String model, double tempK, double pBara) Creates a fluid system for the given EOS model.private static StandardInterfacecreateGasStandard(String name, SystemInterface fluid) Creates a gas quality standard instance by name.private static StandardInterfacecreateOilStandard(String name, SystemInterface fluid) Creates an oil quality standard instance by name.private static StringCreates a standard error JSON string.Returns the list of supported standard calculation types.private static doubleparsePressure(com.google.gson.JsonElement element) Parses pressure from JSON element.private static doubleparseTemperature(com.google.gson.JsonElement element) Parses temperature from JSON element.static StringRuns a standards calculation from a JSON input string.private static com.google.gson.JsonObjectrunAGA3(SystemInterface fluid, com.google.gson.JsonObject input) Runs AGA 3 orifice metering calculation.private static com.google.gson.JsonObjectrunASTM_D86(SystemInterface fluid, com.google.gson.JsonObject input) Runs ASTM D86 distillation curve calculation.private static com.google.gson.JsonObjectrunGenericGasStandard(SystemInterface fluid, String standardName) Runs a generic gas quality standard calculation.private static com.google.gson.JsonObjectrunGenericOilStandard(SystemInterface fluid, String standardName) Runs a generic oil quality standard calculation.private static com.google.gson.JsonObjectrunISO6976(SystemInterface fluid, com.google.gson.JsonObject input, boolean use2016) Runs ISO 6976 gas quality calculation.private static com.google.gson.JsonObjectrunStandard(SystemInterface fluid, String standard, com.google.gson.JsonObject input) Routes to the appropriate standard calculation.
-
Field Details
-
GSON
private static final com.google.gson.Gson GSON -
SUPPORTED_STANDARDS
-
-
Constructor Details
-
StandardsRunner
private StandardsRunner()Private constructor — all methods are static.
-
-
Method Details
-
getSupportedStandards
-
run
-
runStandard
private static com.google.gson.JsonObject runStandard(SystemInterface fluid, String standard, com.google.gson.JsonObject input) Routes to the appropriate standard calculation.- Parameters:
fluid- the initialized fluid systemstandard- the standard nameinput- the full JSON input for standard-specific parameters- Returns:
- JSON object with standard results
-
runISO6976
private static com.google.gson.JsonObject runISO6976(SystemInterface fluid, com.google.gson.JsonObject input, boolean use2016) Runs ISO 6976 gas quality calculation.- Parameters:
fluid- the initialized fluidinput- the JSON input with optional reference conditionsuse2016- whether to use the 2016 edition- Returns:
- JSON with calorific values, Wobbe index, density
-
runAGA3
private static com.google.gson.JsonObject runAGA3(SystemInterface fluid, com.google.gson.JsonObject input) Runs AGA 3 orifice metering calculation.- Parameters:
fluid- the initialized fluidinput- the JSON input with metering parameters- Returns:
- JSON with flow rate and metering results
-
runASTM_D86
private static com.google.gson.JsonObject runASTM_D86(SystemInterface fluid, com.google.gson.JsonObject input) Runs ASTM D86 distillation curve calculation.- Parameters:
fluid- the initialized fluidinput- the JSON input- Returns:
- JSON with distillation curve and temperatures
-
runGenericGasStandard
private static com.google.gson.JsonObject runGenericGasStandard(SystemInterface fluid, String standardName) Runs a generic gas quality standard calculation.- Parameters:
fluid- the initialized fluidstandardName- the standard name for factory lookup- Returns:
- JSON with standard results
-
runGenericOilStandard
private static com.google.gson.JsonObject runGenericOilStandard(SystemInterface fluid, String standardName) Runs a generic oil quality standard calculation.- Parameters:
fluid- the initialized fluidstandardName- the standard name suffix (e.g. D445, D2500, BSW)- Returns:
- JSON with standard results
-
createFluid
Creates a fluid system for the given EOS model.- Parameters:
model- EOS model nametempK- temperature in KelvinpBara- pressure in bara- Returns:
- the fluid system
-
parseTemperature
private static double parseTemperature(com.google.gson.JsonElement element) Parses temperature from JSON element.- Parameters:
element- the JSON element- Returns:
- temperature in Kelvin
-
parsePressure
private static double parsePressure(com.google.gson.JsonElement element) Parses pressure from JSON element.- Parameters:
element- the JSON element- Returns:
- pressure in bara
-
errorJson
-
createGasStandard
Creates a gas quality standard instance by name.- Parameters:
name- the standard name (e.g. "ISO6976", "AGA3")fluid- the fluid system- Returns:
- the standard instance, or null if not found
-
createOilStandard
Creates an oil quality standard instance by name.- Parameters:
name- the standard name (e.g. "ASTM_D86", "BSW")fluid- the fluid system- Returns:
- the standard instance, or null if not found
-