feat(python): implement python bindings for all components and solvers

This commit is contained in:
Sepehr
2026-02-21 20:34:56 +01:00
parent 8ef8cd2eba
commit 4440132b0a
310 changed files with 11577 additions and 397 deletions

89
docs/TUTORIAL.md Normal file
View File

@@ -0,0 +1,89 @@
# Tutorial: Getting Started with Entropyk
This guide will walk you through setting up your environment, running your first simulation, using the visual UI, and building your own thermodynamic models.
## 1. Environment Setup
### Prerequisites
Ensure you have the latest stable version of [Rust](https://www.rust-lang.org/) installed:
```bash
rustup update stable
```
### Clone and Build
Clone the repository and build the workspace:
```bash
git clone https://github.com/your-username/Entropyk.git
cd Entropyk
cargo build --workspace
```
## 2. Running Your First Simulation
The best way to understand Entropyk's capabilities is by running the **Water Chiller Demo**.
### Run the Demo
```bash
cargo run --bin chiller
```
### What's Happening?
The `chiller.rs` demo sets up a complete refrigeration cycle:
1. **Water Side (Circuit 1)**: Pump moves 12°C water at 0.5 kg/s through an evaporator.
2. **Refrigerant Side (Circuit 0)**: R410A flows through a compressor (2900 RPM), condenser (air-cooled at 35°C), expansion valve, and evaporator.
3. **Thermal Coupling**: The evaporator exchanges heat between the water and refrigerant circuits.
The output displays the **Point de Design** (COP, power consumption, heat transfer).
## 3. Using the Visual UI
Entropyk includes a web-based interface to build systems without writing code.
### Launch the UI Server
```bash
cargo run -p entropyk-demo --bin ui-server
```
### Build a System Graphically
1. Open [http://localhost:3030](http://localhost:3030).
2. **Palette**: Drag and drop components (Pump, Compressor, Pipe, etc.) onto the canvas.
3. **Configure**: Click a component to adjust its parameters (fluids, polynomials, geometry).
4. **Connect**:
- Click "Relier" in the toolbar.
- Click a **Source** (orange port) and then a **Target** (green port).
5. **Simulate**: The UI sends the configuration to the Rust backend, which performs calculations using real thermodynamic models.
## 4. Coding with the Library
Here's how to create a simple unit-safe model using the Entropyk crates.
### Basic Physical Quantities
```rust
use entropyk_core::{Pressure, Temperature};
let p = Pressure::from_bar(3.5);
let t = Temperature::from_celsius(25.0);
println!("Pressure: {} Pa", p.to_pascals());
```
### Creating and Connecting Ports
Entropyk uses the **Type-State Pattern** to prevent uninitialized connections.
```rust
use entropyk_components::port::{Port, FluidId};
// 1. Create disconnected ports
let p1 = Port::new(FluidId::new("Water"), p, h);
let p2 = Port::new(FluidId::new("Water"), p, h);
// 2. Connect (returns Result of connected ports)
let (mut c1, mut c2) = p1.connect(p2).expect("Incompatible ports!");
```
## 5. Next Steps
- **[EXAMPLES.md](../EXAMPLES.md)**: Explore code snippets for every component (Heat Exchangers, Pumps, Fans, etc.).
- **[Crates Documentation](../crates/entropyk/README.md)**: Deep dive into the library architecture.
- **[Story 1.3 README](../README_STORY_1_3.md)**: Technical details on the port and connection system.
Happy simulating!

22
docs/index.md Normal file
View File

@@ -0,0 +1,22 @@
# Directory Index
## General Documentation
- **[README.md](../README.md)** - Main project overview and getting started guide.
- **[TUTORIAL.md](./TUTORIAL.md)** - Step-by-step guide to using Entropyk (CLI & UI).
- **[EXAMPLES.md](../EXAMPLES.md)** - Comprehensive usage examples for all library components.
- **[README_STORY_1_3.md](../README_STORY_1_3.md)** - Technical details of Port and Connection system implementation.
## Project Subdirectories
### demo/
- **[demo/README.md](../demo/README.md)** - Documentation for demo applications and system simulations.
### crates/
- **[crates/entropyk/README.md](../crates/entropyk/README.md)** - Specific documentation for the main Entropyk library crate.
## Assets
- **[docs/katex-header.html](./katex-header.html)** - KaTeX configuration for rendering mathematical formulas in documentation.

9
docs/katex-header.html Normal file
View File

@@ -0,0 +1,9 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/katex.min.css">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/katex.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/contrib/auto-render.min.js"
onload="renderMathInElement(document.body, {
delimiters: [
{left: '$$', right: '$$', display: true},
{left: '$', right: '$', display: false}
]
});"></script>