Skip to content

feat(game): add native NeqSim Plant Operator challenge - #129

Merged
EvenSol merged 4 commits into
mainfrom
feat/neqsim-plant-operator
Aug 30, 2026
Merged

EvenSol merged 4 commits into
mainfrom
feat/neqsim-plant-operator

Conversation

@EvenSol

@EvenSol EvenSol commented Aug 30, 2026

Copy link
Copy Markdown
Owner

Summary

  • add NeqSim Plant Operator as an available NeqSim Studio workflow
  • implement the first playable scenario, The 10% Throughput Challenge
  • use native ProcessBuilder / NeqSimProcessModel thermodynamics, equipment calculations, solver constraints, and conservation evidence
  • retain session attempts and best score, reject stale results after control changes, export reproducible JSON, and hand the exact solved model to Process Chat
  • keep build, solve, and evidence extraction inside one shared 180-second deadline

Engineering contract

The synthetic SRK gas-compression train is:

feed -> inlet scrubber -> compressor 1 -> intercooler -> interstage scrubber -> compressor 2 -> export cooler

The player controls feed flow, both discharge pressures, intercooling, and export cooling. A win requires all published checks to pass: throughput, export pressure/temperature, compressor discharge temperature, total power, specific energy, cooling duty, mass balance, energy balance, and all other native NeqSim constraints. The score cannot override a failed engineering check.

Validation

Tested with NeqSim Python package 3.18.0 and Streamlit 1.62.0.

  • .venv/bin/python -m unittest tests.test_plant_operator_game tests.test_plant_operator_page tests.test_studio_navigation tests.test_studio_shell — 19 passed
  • .venv/bin/python -m unittest tests.test_process_execution tests.test_process_chat_studio_handoff tests.test_runtime_imports — 33 passed
  • python -m py_compile process_chat/plant_operator_game.py pages/36_NeqSim_Plant_Operator.py studio/navigation.py — passed
  • git diff --check — passed
  • isolated Streamlit AppTest initial render — no exceptions
  • UI-driven native attempt — no exceptions; challenge completed

Representative native winning attempt:

Evidence Solved value
Feed throughput 110,000 kg/hr
Export pressure 130.00 bara
Export temperature 40.00 °C
Maximum compressor discharge temperature 76.52 °C
Compression power 4,402.75 kW
Specific compression energy 40.025 kWh/tonne
Cooling duty 6,277.37 kW
Mass-balance error 0.0%
Energy-balance error 1.21e-14%
Game score 771/1000
Win checks all passed

Documentation impact

Updated the README and added docs/neqsim_plant_operator_game.md with units, assumptions, win conditions, scoring, reproducibility, interoperability, and limitations.

Current limitations

This first increment is a steady-state synthetic training case. Dynamic controllers, trips, hydrate-margin calculation, economics/emissions, and persistent leaderboards remain future separately validated challenges. Results support education and engineering screening; they are not design certification.

@EvenSol
EvenSol requested a lite review from Copilot August 30, 2026 13:33
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-08-30T13:36:49.316677Z 0d81991 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

It introduces runtime-affecting issues around JVM option handling and input validation that should be corrected before merge.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds a new Streamlit-based NeqSim Plant Operator workflow to NeqSim Studio, introducing a native NeqSim “game” scenario where users tune operating controls, run a bounded native solve, and receive transparent engineering checks plus a score.

Changes:

  • Registers the new plant_operator Studio destination and adds navigation/page-level regression tests.
  • Introduces process_chat.plant_operator_game implementing the challenge spec, bounded execution, evidence collection, scoring, and guidance.
  • Adds a new Streamlit page (36_NeqSim_Plant_Operator) plus README/docs describing the scenario contract and reproducibility.
File summaries
File Description
tests/test_studio_navigation.py Adds navigation coverage for the new Studio destination key.
tests/test_plant_operator_page.py Adds regression tests for page discoverability, accessibility markers, and non-solving initial render.
tests/test_plant_operator_game.py Adds unit tests for spec generation, control validation, and scoring/check behavior.
studio/navigation.py Registers the plant_operator workflow destination.
README.md Documents the new Plant Operator workflow and links to detailed docs.
process_chat/plant_operator_game.py Implements the native challenge spec, bounded run orchestration, evidence extraction, and scoring.
process_chat/init.py Updates module index docstring to include plant_operator_game.
pages/36_NeqSim_Plant_Operator.py Adds the Streamlit UI for running and reviewing Plant Operator attempts, exporting JSON, and handing off to Process Chat.
docs/neqsim_plant_operator_game.md Adds scenario contract, win conditions, scoring rules, and reproducibility details.
Review details
  • Files reviewed: 9/9 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread pages/36_NeqSim_Plant_Operator.py Resolved
Comment thread process_chat/plant_operator_game.py Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0d81991b77

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread process_chat/plant_operator_game.py Resolved
@EvenSol
EvenSol merged commit c14358c into main Aug 30, 2026
2 of 3 checks passed
@EvenSol
EvenSol requested a lite review from Copilot August 30, 2026 13:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Two validated runtime-contract issues remain (JAVA_TOOL_OPTIONS clobbering and timeout_ms validation raising unintended exception types) that can break execution in real deployments.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

process_chat/plant_operator_game.py:520

  • timeout_ms validation calls int(timeout_ms) inside the condition; non-int-convertible values (e.g., None or 'abc') will raise a raw TypeError/ValueError instead of the intended ValueError contract. Convert once under try/except and validate the converted value.
    if isinstance(timeout_ms, bool) or int(timeout_ms) <= 0:
        raise ValueError("Challenge timeout must be a positive integer.")
    timeout_ms = int(timeout_ms)
  • Files reviewed: 10/10 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment on lines +19 to +20
if "add-opens" not in os.environ.get("JAVA_TOOL_OPTIONS", ""):
os.environ["JAVA_TOOL_OPTIONS"] = _JVM_OPENS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants