The Problem: Field Work is Stuck in the 90s
As an electrical engineer, I spent years taking notes on paper at construction sites, only to spend my nights at home fighting with endless Excel sheets to verify safety standards and generate quotes.
I wanted to come home and rest, not continue working.
Most existing apps were just simple calculators or closed-source "black boxes." I decided to build Electrics-App: an Open Source "Digital Twin" for the pocket that understands real physics and strict regulatory standards (REBT/IEC).
🧬 The Core: A Bidirectional Physics Engine
The biggest challenge was handling the complexity of an electrical installation. It’s not a list; it’s a Directed Acyclic Graph (DAG). To solve this, I implemented a Two-Pass Calculation Algorithm:
1. Bottom-Up Pass (Load Flow)
We traverse from the loads (leaf nodes) up to the source.
- Vector Summation: We don't just add Amps. We perform vector addition of Active ($P$) and Reactive ($Q$) power to find the Apparent Power ($S$) and Design Current ($I_b$).
- Simultaneity Factors: Applying coefficients at each panel level recursively to reflect real-world diversity.
2. Top-Down Pass (Impedance & Faults)
Once we know the load, we traverse from the source down.
- Impedance Propagation: We calculate the cumulative Resistance ($R$) and Reactance ($X$) of every cable and connection.
- Voltage Drop ($\Delta U$): Calculations based on the UNE-HD 60364-5-52 standard.
- Short-Circuit ($I_{cc}$): Calculating max and min fault levels to ensure protections actually trip when they should.
// Example of the impedance logic in our engine
double calculateZ(double R, double X) {
return sqrt(pow(R, 2) + pow(X, 2));
}
🌳 Data Architecture: Recursive Trees
I used a Composite Pattern to allow for infinite nesting. A PanelNode can contain ProtectionNodes, which contain CableNodes, which might lead to another PanelNode.
To handle this in Flutter, I chose:
BLoC/Cubit: For predictable state management.
Freezed: For type-safe, immutable data models.
Isar DB: A high-performance NoSQL database that allows the app to be Offline-First. No cloud needed when you are in a basement!
🤖 Automating the Catalog with AI
One of the "magic" features is the AI Component Agent. Adding technical specs for every circuit breaker on the market is a nightmare.
I built a Python script that monitors GitHub Issues. When a user requests a component:
They open an issue: [COMPONENT REQUEST] Schneider iDPN H Vigi.
** A GitHub Action triggers the script. **
An AI model parses the manufacturer's data and maps it to a JSON template.
It creates a PR to update the app's internal library automatically.
⚖️ Regulatory Transparency
Engineering software shouldn't be a black box. I’ve hardcoded the REBT (Spanish Regulation) and UNE/IEC standards into the engine.
I even uploaded the reference PDFs directly to the repository. If the app says a cable is undersized, you can check the code against the actual law in the same repo.
📱 Tour of the App
Health Check System:
A "traffic light" dashboard that compares field measurements vs. theoretical models.
Automatic Budgeting:
Generating professional quotes on-site.
🤝 Open Source & Contributions
I’ve opened this project because I believe our industry deserves better, more collaborative tools.
Whether you are a Flutter Dev interested in complex state management or an Engineer who wants to audit the physics logic, I’d love your help!
⭐ Check out the Repo: https://github.com/rubenOrtz/Electrics-App
What do you think about bringing "Digital Twins" to mobile devices? Let's discuss in the comments!




Top comments (0)