The development and use of renewable energy in Germany will likely double in the next ten years. Energy sources such as wind and sunshine are nearly inexhaustible resources, whose potential capacity is far greater than the entire consumption of electricity in Germany.
In practice, however, feeding solar and wind energy into the grid is rather difficult. Nobody knows exactly when there will be wind or sunshine. Natural fluctuations in the weather can put a strain on the grid, leading to substantial energy losses, as well as wildly fluctuating energy prices. enercast resolves this problem through a Software-as-a-Service (SaaS) solution for wind energy forecasts.
The web service enercast.de provides a wide variety of forecasts regarding the production, supply, and pricing of available energy from wind and photovoltaic facilities. The service offers a detailed overview of the location, time of day, and amount of wind and solar energy produced in Germany. For its energy production prognoses, the system's algorithms make use of forecasts provided by various European weather agencies as well as satellite measurements of solar radiation, performing calculations on hundreds of terabytes of weather and geospatial data. The forecast specialist enercast.de caters to energy traders, network operators, and operations managers, as well as to providers of smart home and smart grid services. With enercast.de, traders and operators can forecast the production of wind and solar energy, and efficiently feed this energy into the grid and into energy markets.
Project specifications
Producing energy capacity forecasts with a time resolution of fifteen minutes, the enercast.de data model establishes relationships between a wide variety of data structures, including:
Measurements and geospatial data from over 750 million datasets
Current weather data
Locations of over 1.2 million wind and solar parks
The high demand for various web services in the last ten years has led to increasing data processing volume as well as longer processing times. To meet this demand, over the last four years the enercast data model has been continually developed with JPA/Hibernate by eight software developers. The model consisted of many different submodules with over two thousand classes.
enercast.de is a SaaS solution provided by enercast GmbH. Based in Kassel, Germany, the company focuses on solutions to complex problems for the energy sector. The software engineering process used by enercast GmbH takes advantage of close relationships with academic researchers as well as with partners in the energy industry. As an example, the company works closely with the Fraunhofer Institute for Wind Energy and Energy System Technology (Fraunhofer IWES) in Kassel and Bremerhaven. Moreover, enercast has also taken part in the RWE energy group's Innogy venture.
Technical background
The Java hashcode()
and equals()
methods are used to verify object identity. This typically makes use of the Java VM's default implementation. For certain domains, however, for example database applications which reference a single real-world object with two different Java objects, this is insufficient. In this case, it is necessary to overwrite both methods in every class of the data model, and to account for the value of respective attributes in the implementation. There exist many appropriate implementation alternatives, each with individual advantages and disadvantages. In enercast's case, Project Leader Bernd Kratz has stipulated that the entire data model should be standardized using UML Lab.
If hashCode()
and equals()
are overwritten, this should be carried out in the same manner in all classes. A manual approach is often tedious, is rather uncreative, and requires a great deal of concentration and endurance on the part of the software developer. Moreover both methods must be must be changed consistently to one another each time an attribute is added to the classes.
When analyzing the connections between two objects or whether two objects are in fact identical, large portions of the data model are often imported from the database. This leads to an excessive memory footprint of the application and thus to poor performance. Especially for large databases such as that maintained by enercast GmbH, a smaller footprint is necessary.
The solution
For this reason, Yatta Solutions provided support to enercast GmbH for the standardization and refactoring of their data model with UML Lab. For its round-trip engineering, UML Lab uses a template-based approach for code-model transformations. These same templates, which are traditionally used for code generation only, are also used for reverse engineering. This results in an extremely flexible and powerful solution for agile modeling of software systems.
In detail, the stages of production at enercast GmbH were:
1. Specification of implementation requirements in a code style
In accordance with the enercast requirements, templates for hashCode()
and equals()
were implemented in their own code style scheme. These were tested in a sample project, and completed in iterative fashion in cooperation with enercast GmbH.
2. Generalization of templates
In the second step, the templates were extended to be able to import arbitrary legacy implementations of both methods. The extension enables the use of the templates with the new requirements for a wider range of compatible existing code. In cases where an implementation was inconsistent with the requirements, the project could still be imported completely, but the non-compliant methods were marked with their own UML keyword.
3. Reverse engineering
The enercast source code was subsequently imported using UML Lab's template-based reverse engineering. Existing hashCode()
and equals()
methods which did not meet requirements were automatically marked in the model with the appropriate keyword ("legacyHashCode" or "legacyEquals"), making them easy to find through problem markers automatically created by custom model validation rules.
4. Model-based refactoring
For model refactoring, a short script in QVTo was created. Upon execution, the script removed all legacy keywords from the model. Moreover, new and optimized method bodies were automatically generated.
This step can also be carried out manually by the developer, without the use of a QVTo script. However automation through UML Lab saves the developer from tedious and redundant tasks. In any case the result can be reproduced and tested in the model.
5. Code generation
The modified implementations were verified using the "Compare Generated Code" dialog. In the enercast project, only the method bodies of hashCode()
and equals()
were modified. When the code was found to meet the requirements, the modifications were applied to the source code using the UML Lab code generation.
The complete cycle can be repeated often and in any order. In the case of enercast.de there was a very agile response to the changing requirements of method implementation.
Benefits
Technical benefits
Simple conformance of the UML Lab code generators to specific project requirements
Application-supported refactoring simplifies automatically generated implementation
Uniform implementation of
hashCode()
andequals()
Optimized storage requirements of the application
Highly qualitative data model
Highly scalable application through a new data model
Customer benefits
High performance and high capacity software system
Cost-effective, fast, and future-oriented data model
What enercast GmbH says about UML Lab
Customer satisfaction
[Disclaimer: This case study refers to a consulting project that took place in June 2011.]