| Crates.io | rustpower |
| lib.rs | rustpower |
| version | 0.4.0 |
| created_at | 2025-06-04 21:43:44.232973+00 |
| updated_at | 2025-11-21 00:00:50.962588+00 |
| description | An experimental ECS world snapshot system built on Bevy, featuring structured archetype storage and manifest-based serialization. |
| homepage | |
| repository | https://github.com/chengts95/rustpower |
| max_upload_size | |
| id | 1700902 |
| size | 10,986,142 |
RustPower is a cutting-edge power flow calculation library written in Rust, specifically designed for steady-state analysis of electrical power systems. With the introduction of ECS-based architecture in version 0.2.0, RustPower offers unparalleled modularity and extensibility.
World's First ECS-Based Power Flow Solver:
RustPower now adopts the Entity-Component-System (ECS) architecture using Bevy, enabling modular design and extensibility for domain-specific applications such as:
PFNetwork is now deprecated but remains available as a demo for the basic Newton-Raphson solver.Post-Processing Trait:
Added a flexible post-processing trait to manage simulation results, allowing users to handle data as if working with a dataframe. This demonstrates Rust's compositional design philosophy and makes ECS highly effective for handling large datasets.
Experimental Switch Handling:
Introduced two optional methods for modeling switch elements:
pandapower JSON network files (with experimental CSV support).SUITESPARSE_DIR on Windows).RustPower achieves industry-leading performance in power flow calculations:
IEEE 39-Bus System:
PEGASE 9241 System:
Demonstrates significant performance advantages over Python-based solutions, even without multi-threading. RustPower is highly optimized for speed and avoids the complexity of C/C++ memory management.

(Measured in Pandapower 2.14.11, Pandapower 3.0 becomes much faster).
As rustpower is not yet published on Crates.io, you can add it to your project directly from GitHub:
Add the following line to your Cargo.toml:
[dependencies]
rustpower = { git = "https://github.com/chengts95/rustpower", branch = "main" }
use rustpower::{io::pandapower::*, prelude::*};
use ecs::post_processing::PostProcessing; // for print bus results
fn main() {
let dir = env::var("CARGO_MANIFEST_DIR").unwrap();
let zipfile = format!("{}/cases/pegase9241/data.zip", dir);
let net = load_csv_zip(&zipfile).unwrap();
// Initialize the ECS application with plugins
let mut pf_net = default_app();
// Register the power network as a resource
pf_net.world_mut().insert_resource(PPNetwork(net));
pf_net.update(); // Initializes the data for the first run
// Retrieve results
let results = pf_net.world().get_resource::<PowerFlowResult>().unwrap();
assert!(results.converged);
println!("Converged in {} iterations", results.iterations);
// Post-process and print results
pf_net.post_process();
pf_net.print_res_bus();
}
For more examples, check the examples and cases folder.
This project is licensed under the MPLv2 License. See the LICENSE file for more details.
Contributions are welcome! Feel free to open an issue or submit a pull request to help improve the library.
This project draws inspiration from:
Although ECS-Grid is a more complex electromagnetic transient (EMT) simulation system, its design philosophy and methodologies greatly influenced the development of this steady-state power flow solver.