Skip to main content

ModNN

ModNN is a Modularized Physics-Informed Neural Network for building energy modeling.

It incorporates with physics-informed model structure, loss function, and model constraints.


🚀 Installation

You can install the package using pip:

pip install modnn

🧠 Example

Please find the online Jupyter notebook for a step-by-step instruction: https://colab.research.google.com/drive/1A2jt1q53RtxGuaoym6N1PmlKELDPpYFX?usp=sharing

⚡ Quick start

Your CSV needs a datetime index and the columns temp_room, temp_amb, solar, occ and phvac.

from modnn import get_config, Mod

args = get_config({"datapath": "your_data.csv"})
model = Mod(args)
model.data_ready()       # or model.data_ready(df) with a pandas DataFrame
model.train()
model.load()
model.test()

or from the command line: python -m modnn.run your_data.csv

Scalers, checkpoints, trained models, results and figures are written to ./modnn_output (change with "output_dir"). The GPU is used when available, otherwise the CPU.

🧩 Model options

option values meaning
architecture "v3" (default), "v1" "v1" is the first-generation model (LSTM envelope, as in 1.0.1)
ext_input "state" (default), "delta" envelope module input: [T_zone, T_ambient] or T_ambient - T_zone (as in 3.0.0)
constraints any of "hvac", "internal", "ambient", "solar" inputs whose effect on zone temperature must follow physics (default ["hvac", "internal"])

"ambient" and "solar" constrain the envelope module and need architecture="v3" with ext_mdl="RNN". For example, a model whose responses to HVAC, occupancy, weather and sun all follow physics:

args = get_config({"datapath": "your_data.csv", "ext_input": "delta",
                   "constraints": ["hvac", "internal", "ambient", "solar"]})

🧠 Update log

🧠 [2.0.0] 2025 May 9

To further improve physical consistency,

I replaced heat transfer module by set of energy balance equations,

Start from version 2.0.0

🧠 [2.0.1] 2025 May 10

Add another parameter: "envelop_mdl",

Allow user to use the new physics based module or previous data driven module.

🧠 [2.0.2] 2025 May 10

Fix bug due to parameter: "envelop_mdl",

Vectorize calculation,speed improved by ~6 times.

🧠 [3.0.0] 2025 June 11

Update datadriven modnn RC based envelop_mdl really hard to tune on new dataset

🧠 [3.0.1] 2025 June 11

Add a step function for one step ahead prediction

🧠 [3.0.2] 2025 June 11

Fix bug for step function

🧠 [3.0.3] 2025 June 11

Fix bug for step function

🧠 [3.0.4] 2025 Sept 10

Didn't work on it for 3 months, just update the latest version Will use it for BESTOpt building dynamic model

🧠 [3.0.5] 2025 Sept 15

3.0.4 CAN-NOT work at all, I mistakenly comment one line and add a new line of code

🧠 [3.0.6] 2025 Sept 15

Fix temperature unit conversion issue

🧠 [3.0.7] 2025 Sept 15

Fix step model zone module dimension issue

🧠 [3.1.0] 2026 Sept 25

New options: "architecture" (v1/v3) and "ext_input" (state/delta); physical constraints applied through model.apply_constraints()

Easier to use: from modnn import get_config, Mod, python -m modnn.run your_data.csv, outputs in ./modnn_output (previously ../), device defaults to "cuda" with CPU fallback, clear errors for a missing data file or column, scipy added to requirements

🧠 [3.2.0] 2026 Sept 25

Choose which responses are physically constrained with "constraints": any of "hvac", "internal", "ambient", "solar"

Presets removed

🧪 Requirements

Python 3.7+

PyTorch

NumPy

Pandas

Matplotlib

Seaborn

scikit-learn

tqdm

📬 License

MIT License

🙋‍♂️ Author

Zixin Jiang: zjiang19@syr.edu

Release files for modnn 3.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for modnn 3.2.0
File Size Uploaded
modnn-3.2.0.tar.gz 41.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for modnn 3.2.0
File Interpreter ABI Platform
modnn-3.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 86.7 kB

Release files / modnn-3.2.0.tar.gz

Download URL modnn-3.2.0.tar.gz
Size 41.6 kB
Tags Source
SHA-256 checksum
How to use checksums
5679852464b9c143c7eba65c40803e428bb69aac01d61c906449716a8d89c9b6
BLAKE2b-256 checksum
How to use checksums
5a5235069117207e1435dbd7891305968d61c3c0d73cc584a5c1e38feb42a4fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Release files / modnn-3.2.0-py3-none-any.whl

Download URL modnn-3.2.0-py3-none-any.whl
Size 45.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1ecb7b948a979ca3c972a4b57735aae354586d1f1fdeb65f07f80170e0ebf70c
BLAKE2b-256 checksum
How to use checksums
4e97f9cc75d4fad0cf643fcd5dca06c937733c2ae435ed287e0c39636acc92ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Release history Release notifications | RSS feed

This release

3.2.0 This release

2 release files

3.1.0

2 release files

3.0.9

2 release files

3.0.8

2 release files

3.0.7

2 release files

3.0.6

2 release files

3.0.5

2 release files

3.0.4

2 release files

3.0.3

2 release files

3.0.2

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.0.5

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page