What I do
- •Enforce Worker Isolation: Ensure DWSIM binaries are ONLY referenced in
Enerflow.Worker. The API and Domain must remain pure. - •DWSIM Safety Checks: Verify that
DWSIM.GlobalSettings.Settings.AutomationMode = trueis set before any simulation logic. - •Unit Consistency: Enforce that all
StreamStatevalues (T, P, Flow) are handled in SI Units (Kelvin, Pascal, kg/s) within the Domain and Mapper layers. - •Sequential IDs: Ensure all entities and jobs use
NewIdviaIdGenerator.NextGuid()for identifiers to maintain database performance. - •Error Handling: Ensure the Worker wraps
Solve()calls in try-catch blocks and writes aFailureResultJSON instead of crashing silently. - •DTO Usage: Verify that data is passed between API and Worker via
Enerflow.DomainDTOs, not DWSIM objects. - •Block Non-Production Shortcuts: If a DWSIM constraint or architectural blocker is hit, DO NOT implement a "hacky" fix. Stop and request User guidance. User feedback is required for all architectural hurdles.
When to use me
- •Architectural Review: When creating new projects or adding dependencies.
- •Worker Implementation: When writing code in
Enerflow.Worker. - •API Design: When designing endpoints that trigger simulations.
Key Constraints
- •
Split Architecture:
- •
Enerflow.API: Orchestrator (DB, Queue, HTTP). NO DWSIM DLLs. - •
Enerflow.Worker: Executor (DWSIM DLLs). Transient or Hosted Service. - •
Enerflow.Domain: Shared Kernel (POCOs, Enums).
- •
- •
DWSIM Integration:
- •Always check
flowsheet.Solvedandflowsheet.ErrorMessage. - •Never assume a
Calculate()call succeeded without verification.
- •Always check
- •
Data Flow:
- •API -> Redis (JSON) -> Worker -> DWSIM -> Worker -> Redis/DB (JSON) -> API.