Class ParametricStudyRunner
java.lang.Object
neqsim.mcp.runners.ParametricStudyRunner
Parametric study runner for sensitivity analysis and optimization sweeps.
Enables license-free batch exploration of a process design space. A typical cooperative UniSim–NeqSim workflow:
- Engineer builds the base case in UniSim (industry-accepted model)
- Convert to NeqSim JSON via
unisim_reader.py - Run a parametric study with this runner (hundreds of cases, no license)
- Identify optimal operating point
- Write the optimal case back to UniSim via
unisim_writer.py
Input JSON Format:
{ "baseProcess": { ... standard process JSON ... }, "sweeps": [ { "address":
"Feed.temperature", "unit": "C", "values": [10.0, 20.0, 30.0, 40.0, 50.0] }, { "address":
"Feed.pressure", "unit": "bara", "from": 30.0, "to": 80.0, "steps": 6 } ], "outputs": [
{"address": "HP Sep.gasOutStream.flowRate", "unit": "MSm3/day"}, {"address": "Compressor.power",
"unit": "kW"} ], "mode": "full_factorial" } - Author:
- Even Solbraa @version 1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final com.google.gson.Gsonprivate static final intMaximum total cases to prevent resource exhaustion. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static com.google.gson.JsonObjectbuildOutputSummary(List<ParametricStudyRunner.OutputDef> outputs, com.google.gson.JsonArray caseResults) Builds summary statistics for each output variable across all converged cases.private static Stringprivate static voidgenerateFactorialRecursive(List<ParametricStudyRunner.SweepDef> sweeps, int depth, Map<String, Double> current, List<Map<String, Double>> cases) Generates all combinations for full-factorial design.Generates one-at-a-time cases: vary one parameter while keeping others at midpoint.static StringRuns a parametric study by sweeping input variables and recording outputs.private static com.google.gson.JsonObjectrunCase(com.google.gson.JsonObject baseProcess, List<ParametricStudyRunner.SweepDef> sweeps, Map<String, Double> inputValues, List<ParametricStudyRunner.OutputDef> outputs, int caseIndex) Runs a single parametric case.
-
Field Details
-
GSON
private static final com.google.gson.Gson GSON -
MAX_TOTAL_CASES
private static final int MAX_TOTAL_CASESMaximum total cases to prevent resource exhaustion.- See Also:
-
-
Constructor Details
-
ParametricStudyRunner
private ParametricStudyRunner()
-
-
Method Details
-
run
Runs a parametric study by sweeping input variables and recording outputs.Supports two modes:
full_factorial— all combinations of sweep values (N1 × N2 × ...)one_at_a_time— vary one parameter while keeping others at base (default)
- Parameters:
json- the parametric study specification- Returns:
- JSON with all case results and summary statistics
-
runCase
private static com.google.gson.JsonObject runCase(com.google.gson.JsonObject baseProcess, List<ParametricStudyRunner.SweepDef> sweeps, Map<String, Double> inputValues, List<ParametricStudyRunner.OutputDef> outputs, int caseIndex) Runs a single parametric case.- Parameters:
baseProcess- the base process JSON definitionsweeps- the sweep parameter definitionsinputValues- the input values for this caseoutputs- the output definitions to collectcaseIndex- the index of this case- Returns:
- a JsonObject containing the case results
-
generateFullFactorialCases
-
generateFactorialRecursive
-
generateOneAtATimeCases
private static List<Map<String,Double>> generateOneAtATimeCases(List<ParametricStudyRunner.SweepDef> sweeps) Generates one-at-a-time cases: vary one parameter while keeping others at midpoint.- Parameters:
sweeps- the sweep definitions for each parameter- Returns:
- list of parameter cases, each mapping address to value
-
buildOutputSummary
private static com.google.gson.JsonObject buildOutputSummary(List<ParametricStudyRunner.OutputDef> outputs, com.google.gson.JsonArray caseResults) Builds summary statistics for each output variable across all converged cases.- Parameters:
outputs- the output variable definitionscaseResults- the JSON array of individual case results- Returns:
- JSON object containing min, max, mean, and std for each output
-
errorJson
-