blog image

Modernizing 400K Lines of Legacy Smalltalk for Global Transformer Manufacturing

Kyte Powertech is a market-leading designer and manufacturer of distribution and power transformers, supplying mission-critical electrical infrastructure to utility, renewable energy, and industrial clients across more than 70 countries. In Summer 2025, the company joined the Swiss-headquartered R&S Group, further expanding its global engineering reach.

For decades, the cornerstone of transformer engineering and quotation workflows at Kyte Powertech was an internal desktop calculation system known as DESDT.

The Legacy Challenge

Originally developed in 1995 using Smalltalk, DESDT was a massive ~400,000 lines-of-code (LOC) monolithic desktop system. It handled complex mathematical modeling, core-and-coil sizing, and technical parameter calculations for custom transformer designs. Over nearly three decades of service, the application accumulated significant technical debt:

  • Obsolete Runtime & Infrastructure: Because legacy Smalltalk libraries lacked compatibility with modern database drivers and ERP systems, the company was forced to maintain obsolete infrastructure, including Oracle 9i and legacy SAP integrations, at significant operational and licensing expense.
  • Absence of Version Control & Automated Testing: Decades of ad-hoc patch updates without a modern version control system (VCS) or automated test suites resulted in frequent regressions, difficult debugging, and operational fragility.
  • Feature Stagnation & Outdated UX: The 1990s Windows desktop interface offered poor ergonomics for engineering teams, lacked modern collaboration features, and required manual local installations on client machines. Implementing new transformer formulas or customer-specific engineering requirements had become virtually impossible.

Kyte Powertech partnered with us to execute a complete architectural modernization—transitioning the mission-critical core into a modern, maintainable web platform while guaranteeing zero downtime and mathematical equivalence with existing verified designs.

Semi-Automated Transpilation & Iterative Porting

Faced with a 400,000-line Smalltalk codebase, a manual rewrite from scratch would have been error-prone, while a naive automated translation would produce unmaintainable code. Instead, we devised a pragmatic, tool-assisted porting strategy:

  1. Custom Scaffolding Generator: We built a custom conversion tool that parsed the entire Smalltalk codebase and generated a cleanly organized tree of Python classes and method stubs.
  2. Context-Preserving Docstrings: Every generated Python function automatically preserved the original Smalltalk implementation verbatim inside its docstring, giving engineers instant reference context.
  3. Type-Annotated, Demand-Driven Implementation: We introduced strict Python typing annotations and systematically implemented only the required methods needed to successfully compute the first transformer design model end-to-end.
  4. Iterative Model Verification: Once the first transformer model achieved 100% computational parity against historical benchmarks, we repeated the process model-by-model until approximately 20 distinct transformer designs were fully ported, implemented, and verified.
Engineering KCALC: Architecture & Transformation

Starting in February 2022, we built and delivered KCALC, a high-performance web platform deployed entirely within Kyte Powertech's private infrastructure and secured via corporate VPN.

  • Hybrid High-Performance Backend (Python, C++ & pybind11): The business logic was modernized in Python with clean domain boundaries. To maximize calculation throughput, compute-intensive mathematical routines were implemented in C++ and seamlessly bound to Python using pybind11, alongside NumPy and SciPy for vectorized numerical simulations.
  • Modern Frontend (Vue.js): We designed an intuitive, responsive single-page web interface in Vue.js. Between 10 and 20 specialized design and quotation engineers now configure specifications, inspect electrical models, and generate design variants directly in their web browsers without any local client installations.
  • Database & BOM Modernization: We migrated legacy Oracle 9i data structures to modern Microsoft SQL Server. In addition, the Bill of Materials (BOM) generation engine was completely modernized within KCALC, architected to directly sync with modern SAP systems upon upcoming enterprise license upgrades.
  • Automated Regression Testing (pytest & Docker): We harvested baseline calculation datasets across thousands of historical runs from DESDT and established automated regression test suites using pytest. The entire stack is containerized with Docker and integrated into continuous integration (CI) pipelines.
Delivery & Business Impact

Within 18 months, KCALC achieved full operational parity and was successfully rolled out to the engineering department. Following the initial release, the platform enabled rapid delivery of high-impact enhancements, including support for next-generation transformer product lines and advanced configuration workflows.

Key outcomes include:

  • 5x–10x Performance Increase: Optimizing algorithms with C++ extensions and modern numerical libraries accelerated transformer calculation speeds by 5x to 10x compared to the legacy Smalltalk desktop app.
  • Zero Desktop Footprint & Secure Access: Transitioning to a centralized web application running on internal infrastructure via VPN eliminated local workstation installations and simplified IT administration.
  • Mathematical Parity & Reliability: Exhaustive automated testing against historical DESDT benchmarks eliminated regression risks and ensured 100% computational accuracy for critical manufacturing specifications.
  • Elimination of Legacy Licensing Costs: Decommissioning obsolete database versions and runtime dependencies substantially reduced infrastructure maintenance costs.
  • Accelerated Feature Velocity: A modular codebase and CI/CD automation shortened the release cycle for new transformer calculations and design variants from months to days.