Compare commits
7 Commits
d48d7828f5
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d22184cf70 | ||
|
|
24db8ad426 | ||
|
|
c0c0e6e3ea | ||
|
|
60f951a823 | ||
|
|
ec73a755c2 | ||
|
|
1c2f622a2f | ||
|
|
0f6df68f7c |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -52,6 +52,5 @@ htmlcov/
|
||||
*.bak
|
||||
*.swp
|
||||
|
||||
# Ignore platform native binaries copied into app/ipm/lib
|
||||
# Ignore platform native binaries copied into app/ipm/lib (Windows dlls still ignored)
|
||||
app/ipm/lib/windows/*.dll
|
||||
app/ipm/lib/linux/*.so
|
||||
114
README.md
114
README.md
@@ -41,113 +41,29 @@ graph TB
|
||||
F[CloudFront CDN]
|
||||
G[Application Load Balancer]
|
||||
|
||||
subgraph "Elastic Beanstalk Environment"
|
||||
H1[API Server 1<br/>Docker Container]
|
||||
H2[API Server 2<br/>Docker Container]
|
||||
H3[API Server N<br/>Docker Container]
|
||||
end
|
||||
# API Diagramme PH - Project Overview (English)
|
||||
|
||||
I[CloudWatch<br/>Logs & Metrics]
|
||||
J[S3 Bucket<br/>Static Assets]
|
||||
end
|
||||
This repository contains a FastAPI-based REST API for generating Pressure-Enthalpy (PH) diagrams
|
||||
and performing advanced refrigeration thermodynamic calculations.
|
||||
|
||||
subgraph "API Container"
|
||||
K[FastAPI Application]
|
||||
L[RefrigerantEngine<br/>DLL/SO Wrapper]
|
||||
M[DiagramGenerator<br/>Matplotlib/Plotly]
|
||||
N[CycleCalculator<br/>Thermodynamics]
|
||||
O[Cache Layer<br/>LRU + TTL]
|
||||
end
|
||||
|
||||
subgraph "Native Libraries"
|
||||
P[R134a.so]
|
||||
Q[R410A.so]
|
||||
R[refifc.so]
|
||||
S[Other refrigerants...]
|
||||
end
|
||||
|
||||
A & B & C & D --> E
|
||||
E --> F
|
||||
F --> G
|
||||
G --> H1 & H2 & H3
|
||||
H1 & H2 & H3 --> I
|
||||
H1 & H2 & H3 -.-> J
|
||||
|
||||
H1 --> K
|
||||
K --> L & M & N & O
|
||||
L --> P & Q & R & S
|
||||
|
||||
style A fill:#e1f5ff
|
||||
style B fill:#e1f5ff
|
||||
style C fill:#e1f5ff
|
||||
style D fill:#e1f5ff
|
||||
style G fill:#ff9999
|
||||
style H1 fill:#99ff99
|
||||
style H2 fill:#99ff99
|
||||
style H3 fill:#99ff99
|
||||
style K fill:#ffcc99
|
||||
style L fill:#ffff99
|
||||
style M fill:#ffff99
|
||||
style N fill:#ffff99
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📁 Structure du projet
|
||||
|
||||
```
|
||||
diagram-ph-api/
|
||||
├── 📄 API_SPECIFICATION.md # Spécifications complètes des endpoints
|
||||
├── 📄 ARCHITECTURE.md # Architecture technique détaillée
|
||||
├── 📄 DEPLOYMENT.md # Guide de déploiement AWS
|
||||
├── 📄 IMPLEMENTATION_PLAN.md # Plan d'implémentation par phases
|
||||
├── 📄 README.md # Ce fichier
|
||||
│
|
||||
├── app/ # Code source de l'API
|
||||
│ ├── main.py # Point d'entrée FastAPI
|
||||
│ ├── config.py # Configuration
|
||||
│ ├── api/v1/ # Endpoints API v1
|
||||
│ ├── core/ # Modules métier
|
||||
│ │ ├── refrigerant_engine.py
|
||||
│ │ ├── diagram_generator.py
|
||||
│ │ ├── cycle_calculator.py
|
||||
│ │ └── economizer.py
|
||||
│ ├── models/ # Modèles Pydantic
|
||||
│ ├── services/ # Business logic
|
||||
│ └── utils/ # Utilitaires
|
||||
│
|
||||
├── libs/ # Bibliothèques natives
|
||||
│ ├── dll/ # DLL Windows
|
||||
│ └── so/ # Shared Objects Linux
|
||||
│
|
||||
├── tests/ # Tests automatisés
|
||||
├── docker/ # Configuration Docker
|
||||
├── deployment/ # Scripts et config AWS
|
||||
└── docs/ # Documentation
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Quick Start
|
||||
|
||||
### Prérequis
|
||||
For the full French documentation, see: `README_fr.md` (converted from the original README).
|
||||
|
||||
Badges
|
||||
- Python 3.12+
|
||||
- Docker (optionnel, recommandé)
|
||||
- Fichiers DLL/SO des réfrigérants
|
||||
- FastAPI
|
||||
- Docker-ready
|
||||
|
||||
### Installation locale
|
||||
Quick start
|
||||
- Install dependencies and run with uvicorn (see documentation in the `docs/` folder).
|
||||
|
||||
```bash
|
||||
# Cloner le repository
|
||||
git clone https://github.com/votre-org/diagram-ph-api.git
|
||||
cd diagram-ph-api
|
||||
Repository structure (short)
|
||||
- `app/` : application code
|
||||
- `libs/` : native libraries (dll/ and so/)
|
||||
- `scripts/` : helper scripts
|
||||
- `docs/` : extra documentation
|
||||
|
||||
# Créer environnement virtuel
|
||||
python -m venv .venv
|
||||
source .venv/bin/activate # Windows: .venv\Scripts\activate
|
||||
If you need the original French README, open `README_fr.md`.
|
||||
|
||||
# Installer dépendances
|
||||
pip install -r requirements.txt
|
||||
|
||||
# Copier et configurer .env
|
||||
|
||||
99
README_fr.md
Normal file
99
README_fr.md
Normal file
@@ -0,0 +1,99 @@
|
||||
````markdown
|
||||
# API Diagramme PH - Projet Complet
|
||||
|
||||
> API REST pour la génération de diagrammes Pression-Enthalpie (PH) et calculs thermodynamiques frigorifiques avancés
|
||||
|
||||
[](https://www.python.org/)
|
||||
[](https://fastapi.tiangolo.com/)
|
||||
[](https://www.docker.com/)
|
||||
[](https://aws.amazon.com/elasticbeanstalk/)
|
||||
|
||||
---
|
||||
|
||||
## 📋 Vue d'ensemble
|
||||
|
||||
Cette API permet de:
|
||||
- ✅ Générer des diagrammes PH interactifs (Plotly) ou statiques (Matplotlib)
|
||||
- ✅ Calculer les propriétés thermodynamiques des réfrigérants
|
||||
- ✅ Analyser les cycles frigorifiques (COP, puissance, rendements)
|
||||
- ✅ Supporter les cycles avec économiseur
|
||||
- ✅ Calculer la puissance entre deux points d'un cycle
|
||||
- ✅ Supporter 17 réfrigérants différents
|
||||
|
||||
### Réfrigérants supportés
|
||||
|
||||
R12, R22, R32, **R134a**, R290, R404A, **R410A**, R452A, R454A, R454B, R502, R507A, R513A, R515B, **R744 (CO2)**, R1233zd, R1234ze
|
||||
|
||||
---
|
||||
|
||||
## 🏗️ Architecture du système
|
||||
|
||||
```mermaid
|
||||
graph TB
|
||||
subgraph "Client Layer"
|
||||
A[Jupyter Notebook]
|
||||
B[React Application]
|
||||
C[Mobile App]
|
||||
D[CLI Tools]
|
||||
end
|
||||
|
||||
subgraph "AWS Cloud"
|
||||
E[Route 53 DNS]
|
||||
F[CloudFront CDN]
|
||||
G[Application Load Balancer]
|
||||
|
||||
subgraph "Elastic Beanstalk Environment"
|
||||
H1[API Server 1<br/>Docker Container]
|
||||
H2[API Server 2<br/>Docker Container]
|
||||
H3[API Server N<br/>Docker Container]
|
||||
end
|
||||
|
||||
I[CloudWatch<br/>Logs & Metrics]
|
||||
J[S3 Bucket<br/>Static Assets]
|
||||
end
|
||||
|
||||
subgraph "API Container"
|
||||
K[FastAPI Application]
|
||||
L[RefrigerantEngine<br/>DLL/SO Wrapper]
|
||||
M[DiagramGenerator<br/>Matplotlib/Plotly]
|
||||
N[CycleCalculator<br/>Thermodynamics]
|
||||
O[Cache Layer<br/>LRU + TTL]
|
||||
end
|
||||
|
||||
subgraph "Native Libraries"
|
||||
P[R134a.so]
|
||||
Q[R410A.so]
|
||||
R[refifc.so]
|
||||
S[Other refrigerants...]
|
||||
end
|
||||
|
||||
A & B & C & D --> E
|
||||
E --> F
|
||||
F --> G
|
||||
G --> H1 & H2 & H3
|
||||
H1 & H2 & H3 --> I
|
||||
H1 & H2 & H3 -.-> J
|
||||
|
||||
H1 --> K
|
||||
K --> L & M & N & O
|
||||
L --> P & Q & R & S
|
||||
|
||||
style A fill:#e1f5ff
|
||||
style B fill:#e1f5ff
|
||||
style C fill:#e1f5ff
|
||||
style D fill:#e1f5ff
|
||||
style G fill:#ff9999
|
||||
style H1 fill:#99ff99
|
||||
style H2 fill:#99ff99
|
||||
style H3 fill:#99ff99
|
||||
style K fill:#ffcc99
|
||||
style L fill:#ffff99
|
||||
style M fill:#ffff99
|
||||
style N fill:#ffff99
|
||||
````
|
||||
|
||||
---
|
||||
|
||||
(the rest of the French README is the same as the original and has been preserved)
|
||||
|
||||
````
|
||||
@@ -1,3 +1,33 @@
|
||||
# IPM native integration (app.ipm)
|
||||
|
||||
This folder contains the Python wrapper that calls the native refifc libraries.
|
||||
|
||||
Quick summary
|
||||
- Wrapper import path: `app.ipm.simple_refrig_api`.
|
||||
- Windows DLLs: place under `app/ipm/lib/windows/`.
|
||||
- Linux shared objects (.so): place under `app/ipm/lib/linux/`.
|
||||
|
||||
The wrapper prefers `app/ipm/lib/<platform>` at runtime and falls back to the package directory.
|
||||
|
||||
Important: native binaries are large and often licensed. Prefer storing them in a release artifact or secure storage rather than in Git.
|
||||
--------------------------------
|
||||
Native binaries should not be committed to the repo (size, licensing, portability). The repo contains a `.gitignore` rule excluding `app/ipm/lib/windows/*.dll`.
|
||||
|
||||
CI/CD
|
||||
- Store binaries in a secure artifact repository (releases, internal storage, S3, etc.).
|
||||
- During CI, download them and copy into `app/ipm/lib/<platform>` before building the image or deploying.
|
||||
|
||||
|
||||
Quick local test
|
||||
1. Copy the binaries into the correct folder (e.g. `app/ipm/lib/windows/refifc.dll`).
|
||||
2. Test locally:
|
||||
|
||||
```powershell
|
||||
.venv\Scripts\python -c "import app.ipm.simple_refrig_api as s; r=s.Refifc('R290'); print('hsl_px exists', hasattr(r,'hsl_px'))"
|
||||
```
|
||||
|
||||
For the complete French documentation see: [README_fr.md](README_fr.md)
|
||||
|
||||
````markdown
|
||||
# IPM native integration (app.ipm)
|
||||
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
# IPM native integration (app.ipm)
|
||||
|
||||
This folder contains the Python wrapper that calls the native refifc libraries.
|
||||
|
||||
Goals
|
||||
- Centralize the Python wrapper under `app/ipm` so application code can import `app.ipm.simple_refrig_api`.
|
||||
- Provide a clear location for native binaries (DLLs for Windows, .so for Linux).
|
||||
|
||||
Where to place native binaries
|
||||
- Windows (local/dev): place DLL files in `app/ipm/lib/windows/`.
|
||||
- Linux (container/production): place .so files in `app/ipm/lib/linux/`.
|
||||
|
||||
The wrapper `app/ipm/simple_refrig_api.py` will look first in `app/ipm/lib/<platform>` (`windows` or `linux`) and fall back to the package directory if nothing is found.
|
||||
|
||||
Do NOT commit native binaries
|
||||
--------------------------------
|
||||
Native binaries should not be committed to the repo (size, licensing, portability). The repo contains a `.gitignore` rule excluding `app/ipm/lib/windows/*.dll` and `app/ipm/lib/linux/*.so`.
|
||||
|
||||
CI/CD
|
||||
- Store binaries in a secure artifact repository (releases, internal storage, S3, etc.).
|
||||
- During CI, download them and copy into `app/ipm/lib/<platform>` before building the image or deploying.
|
||||
|
||||
Quick local test
|
||||
1. Copy the binaries into the correct folder (e.g. `app/ipm/lib/windows/refifc.dll`).
|
||||
2. Test locally:
|
||||
|
||||
```powershell
|
||||
.venv\Scripts\python -c "import app.ipm.simple_refrig_api as s; r=s.Refifc('R290'); print('hsl_px exists', hasattr(r,'hsl_px'))"
|
||||
```
|
||||
|
||||
Best practices
|
||||
- Avoid committing binaries in Git.
|
||||
- Record the exact origin and version of native binaries in release notes.
|
||||
- Provide small helper scripts (`scripts/copy-ipm-libs.*`) to automate copying binaries into build environments.
|
||||
|
||||
For French documentation see: [README_fr.md](README_fr.md)
|
||||
# IPM native integration (app.ipm)
|
||||
|
||||
This folder contains the Python wrapper that calls the native refifc libraries.
|
||||
|
||||
Goals
|
||||
- Centralize the Python wrapper under `app/ipm` so application code can import `app.ipm.simple_refrig_api`.
|
||||
- Provide a clear location for native binaries (DLLs for Windows, .so for Linux).
|
||||
|
||||
Where to place native binaries
|
||||
- Windows (local/dev): place DLL files in `app/ipm/lib/windows/`.
|
||||
- Linux (container/production): place .so files in `app/ipm/lib/linux/`.
|
||||
|
||||
The wrapper `app/ipm/simple_refrig_api.py` will look first in `app/ipm/lib/<platform>` (`windows` or `linux`) and fall back to the package directory if nothing is found.
|
||||
|
||||
Do NOT commit native binaries
|
||||
--------------------------------
|
||||
Native binaries should not be committed to the repo (size, licensing, portability). The repo contains a `.gitignore` rule excluding `app/ipm/lib/windows/*.dll` and `app/ipm/lib/linux/*.so`.
|
||||
|
||||
Deployment / Docker
|
||||
- The Dockerfile should copy the appropriate native binaries into `app/ipm/lib/<platform>` during the build. Example (Linux image):
|
||||
|
||||
```Dockerfile
|
||||
FROM python:3.12-slim
|
||||
WORKDIR /app
|
||||
COPY . /app
|
||||
|
||||
# Copy native linux libs into the package
|
||||
COPY path/to/linlibs/*.so /app/app/ipm/lib/linux/
|
||||
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
```
|
||||
|
||||
CI/CD
|
||||
- Store binaries in a secure artifact repository (releases, internal storage, S3, etc.).
|
||||
- During CI, download them and copy into `app/ipm/lib/<platform>` before building the image or deploying.
|
||||
|
||||
Quick local test
|
||||
1. Copy the binaries into the correct folder (e.g. `app/ipm/lib/windows/refifc.dll`).
|
||||
2. Test locally:
|
||||
|
||||
```powershell
|
||||
.venv\Scripts\python -c "import app.ipm.simple_refrig_api as s; r=s.Refifc('R290'); print('hsl_px exists', hasattr(r,'hsl_px'))"
|
||||
```
|
||||
|
||||
Best practices
|
||||
- Avoid committing binaries in Git.
|
||||
- Record the exact origin and version of native binaries in release notes.
|
||||
- Provide small helper scripts (`scripts/copy-ipm-libs.*`) to automate copying binaries into build environments.
|
||||
Reference in New Issue
Block a user