Crates.io | ems-model |
lib.rs | ems-model |
version | 0.1.1 |
created_at | 2025-09-16 14:59:48.46787+00 |
updated_at | 2025-09-25 17:34:52.007477+00 |
description | Model structs for Energy Modeling |
homepage | |
repository | |
max_upload_size | |
id | 1841891 |
size | 72,006 |
A Rust library providing data models and structures for Energy Management
Systems (EMS), with a focus on building energy modeling and factory production
optimization. This library serves as the foundation for the solar-system-opt
library and other energy management applications.
The ems-model
library provides comprehensive data structures for modeling:
building
)Models building energy characteristics and insulation requirements:
factory
)Models industrial production systems and workforce management:
general
)Provides common utilities and geographic information:
Add to your Cargo.toml
:
[dependencies]
ems-model = { path = "../ems-model" }
use ems_model::building::insulation::{
BuildingTypeEnum, YearCategoryESEnum, YearCategoryESMapping
};
// Get heating requirements for a Spanish apartment built after 2007
let mapping = YearCategoryESMapping::default();
let heating_need = mapping
.get(YearCategoryESEnum::After2007)
.and_then(|building_mapping| {
building_mapping.get(BuildingTypeEnum::Apartment)
});
if let Some(heating) = heating_need {
println!("National minimum: {} kWh/m²/year",
heating.national_minimum_requirement);
println!("Improved standard: {} kWh/m²/year",
heating.improved_standard);
println!("Ambitious standard: {} kWh/m²/year",
heating.ambitious_standard);
}
use ems_model::factory::{Factory, Line, machine::{Step, StepType, MachineControl}};
// Create a production line
let mut line = Line::new("Assembly Line".to_string(), "line1".to_string());
// Add production steps
line.add_step("step1".to_string(), "Cutting".to_string(), "step1".to_string());
line.add_step("step2".to_string(), "Assembly".to_string(), "step2".to_string());
// Define dependencies
line.add_dependency("step1".to_string(), "step2".to_string()).unwrap();
// Get execution order
let execution_order = line.topological_sort().unwrap();
println!("Execution order: {:?}", execution_order);
use ems_model::general::location::{Location, Country, Address, Coordinates};
// Create a location
let coordinates = Coordinates::new(40.4168, -3.7038).unwrap(); // Madrid
let address = Address::new(
"Plaza Mayor 1".to_string(),
"Madrid".to_string(),
Some("Madrid".to_string()),
"28012".to_string(),
None
);
let location = Location::new(
"Madrid Office".to_string(),
Country::Spain,
address,
coordinates
);
println!("Location: {}", location.display());
This library is specifically designed to support the solar-system-opt
library,
providing:
The library enables precise modeling of building energy requirements based on construction period and building type, which is essential for solar system sizing and optimization.
serde
- Serialization and deserializationutoipa
- OpenAPI schema generationts-rs
- TypeScript type generationThe library generates comprehensive API documentation and TypeScript bindings:
./bindings/
directory for frontend
integrationThis library is part of the EverBlue P2P EMS project. When contributing:
Part of the EverBlue P2P EMS project. See the main project repository for licensing information.