User Stories

Shanghai Electric Builds and Deploys Cost-Saving Enterprise Software for Planning and Designing Distributed Energy Systems


Develop web-accessible software for planning and designing distributed energy systems


Use MATLAB to develop algorithms that compute investment return based on models of energy production subsystems, loads, and grids, and then use MATLAB Production Server to deploy the algorithms in a production IT system


  • Delivery time reduced by six months
  • 2 million Chinese yuan saved on a single project
  • Updates deployed immediately and without IT assistance 

“My team’s expertise is in energy modeling or algorithm development, not in deploying software into production. MATLAB saved us months of development time on the models and algorithms, and then made it easy to deploy them as part of a stable, reliable web application without recoding.”

Yunjiao Gu, Shanghai Electric

DES-PSO web user interface.

Shanghai Electric Group’s distributed energy planning and design platform enables the company and its customers to evaluate the financial viability of large-scale energy production projects before they are built. The DES-PSO platform calculates estimated payback periods, cash flows, and internal rates of return (IRR). Calculations are based on the power generation and storage technologies to be used in a particular design and on a variety of other factors, including weather patterns, energy prices, and government subsidies.

Working with researchers from the Lawrence Berkeley Laboratory at the University of California, Berkeley, engineers at Shanghai Electric developed the platform models and algorithms in MATLAB® and deployed them to a production IT environment using MATLAB Production Server™.

“As energy engineers we found it easy to develop and test models and algorithms for distributed energy systems in MATLAB,” says Yunjiao Gu, product director at Shanghai Electric. “MATLAB Production Server empowered our team, who had little experience with programming, to deploy those models and algorithms as production software that can be used by internal teams and our customers.” 


Shanghai Electric engineers wanted to model a broad range of components, including different loads, the grid, batteries and other energy storage units, and a variety of power generation systems, such as wind turbines, photovoltaic solar panels, and combined heat and power (CHP) subsystems. The engineers needed to visualize more than 10 years of weather data measured hourly for hundreds of cities and then use this data with their models to identify optimal distributed energy system designs.

To keep pace with rapid advances in distributed energy technology, the team needed the ability to add models for newly introduced technologies or to update existing models. Further, they wanted to deploy system updates themselves, without burdening other programmers or IT team members.


Shanghai Electric used MATLAB and MATLAB Production Server to develop its distributed energy system planning and design platform.

Working in MATLAB, energy engineers developed mathematical models of the components in a distributed energy system. The models captured physical as well as economic characteristics; for example, the wind turbine model captured ongoing maintenance costs as well as power output as a function of wind speed.

As they developed the models, the team took advantage of the object-oriented programming capabilities of the MATLAB language to create reusable objects with well-defined interfaces. This approach made it easier for the team to later add new models and improve existing ones.

Using Financial Toolbox™, they developed algorithms that computed IRR and other financial outcomes for a given distributed energy system assembled from multiple component models. These algorithms factor energy price trends, time-series weather data, and available government subsidies into their analyses.

To validate their models and algorithms, the team ran tests in which they varied certain parameter values and then plotted energy production and revenue curves to visualize how the changes affected the results.

Working with MathWorks Consulting Services, they packaged the DES-PSO models and algorithms using MATLAB Compiler SDK™ and deployed them using MATLAB Production Server.

Programmers from another Shanghai Electric group wrote a C# web interface application that accesses the DES-PSO model deployed with MATLAB Production Server. Hundreds of users both inside and outside Shanghai Electric are already using the application to plan and design distributed energy systems. Gu and his team continue to develop new models, and recently added diesel engine and cooling storage models. 

Plot of actual energy production by type of power generation system.


  • Delivery time reduced by six months. “Without MATLAB Production Server we would have had to recode all our models and algorithms in C# or a similar language before we could deploy them to the server,” says Gu. “That could easily have added six months or more to our schedule.”
  • 2 million Chinese yuan saved on a single project. “Our engineering company had created a design for a desalination plant power system that included solar panels, wind turbines, and batteries,” says Gu. “We used DES-PSO to redesign the system and improved the project’s IRR by a full percentage point, saving approximately 2 million Chinese yuan.”
  • Updates deployed immediately and without IT assistance. “In the eight months since deploying DES-PSO with MATLAB Production Server, we have already updated our algorithms and models more than 10 times,” notes Gu. “The IT team doesn’t have to do anything—we do all the work ourselves.”