fix: resolve CLI solver state dimension mismatch

Removed mathematical singularity in HeatExchanger models (q_hot - q_cold = 0 was redundant) causing them to incorrectly request 3 equations without internal variables. Fixed ScrewEconomizerCompressor internal_state_len to perfectly align with the solver dimensions.
This commit is contained in:
Sepehr
2026-02-28 22:45:51 +01:00
parent c5a51d82dc
commit fdd124eefd
35 changed files with 10969 additions and 123 deletions

View File

@@ -22,19 +22,19 @@
//! ## Example
//!
//! ```rust
//! use entropyk_components::{Component, ComponentError, SystemState, ResidualVector, JacobianBuilder, ConnectedPort};
//! use entropyk_components::{Component, ComponentError, StateSlice, ResidualVector, JacobianBuilder, ConnectedPort};
//!
//! struct MockComponent {
//! n_equations: usize,
//! }
//!
//! impl Component for MockComponent {
//! fn compute_residuals(&self, state: &SystemState, residuals: &mut ResidualVector) -> Result<(), ComponentError> {
//! fn compute_residuals(&self, state: &StateSlice, residuals: &mut ResidualVector) -> Result<(), ComponentError> {
//! // Component-specific residual computation
//! Ok(())
//! }
//!
//! fn jacobian_entries(&self, state: &SystemState, jacobian: &mut JacobianBuilder) -> Result<(), ComponentError> {
//! fn jacobian_entries(&self, state: &StateSlice, jacobian: &mut JacobianBuilder) -> Result<(), ComponentError> {
//! // Component-specific Jacobian contributions
//! Ok(())
//! }
@@ -55,7 +55,10 @@
#![warn(missing_docs)]
#![warn(rust_2018_idioms)]
pub mod air_boundary;
pub mod brine_boundary;
pub mod compressor;
pub mod drum;
pub mod expansion_valve;
pub mod external_model;
pub mod fan;
@@ -68,9 +71,14 @@ pub mod polynomials;
pub mod port;
pub mod pump;
pub mod python_components;
pub mod refrigerant_boundary;
pub mod screw_economizer_compressor;
pub mod state_machine;
pub use air_boundary::{AirSink, AirSource};
pub use brine_boundary::{BrineSink, BrineSource};
pub use compressor::{Ahri540Coefficients, Compressor, CompressorModel, SstSdtCoefficients};
pub use drum::Drum;
pub use expansion_valve::{ExpansionValve, PhaseRegion};
pub use external_model::{
ExternalModel, ExternalModelConfig, ExternalModelError, ExternalModelMetadata,
@@ -88,8 +96,8 @@ pub use flow_junction::{
pub use heat_exchanger::model::FluidState;
pub use heat_exchanger::{
Condenser, CondenserCoil, Economizer, EpsNtuModel, Evaporator, EvaporatorCoil, ExchangerType,
FlowConfiguration, HeatExchanger, HeatExchangerBuilder, HeatTransferModel, HxSideConditions,
LmtdModel,
FloodedCondenser, FloodedEvaporator, FlowConfiguration, HeatExchanger, HeatExchangerBuilder,
HeatTransferModel, HxSideConditions, LmtdModel, MchxCondenserCoil,
};
pub use node::{Node, NodeMeasurements, NodePhase};
pub use pipe::{friction_factor, roughness, Pipe, PipeGeometry};
@@ -103,6 +111,8 @@ pub use python_components::{
PyCompressorReal, PyExpansionValveReal, PyFlowMergerReal, PyFlowSinkReal, PyFlowSourceReal,
PyFlowSplitterReal, PyHeatExchangerReal, PyPipeReal,
};
pub use refrigerant_boundary::{RefrigerantSink, RefrigerantSource};
pub use screw_economizer_compressor::{ScrewEconomizerCompressor, ScrewPerformanceCurves};
pub use state_machine::{
CircuitId, OperationalState, StateHistory, StateManageable, StateTransitionError,
StateTransitionRecord,