JuliaCon 2023

Replacing legacy Fortran in a hydroelectrical critical system
07-27, 15:00–15:30 (US/Eastern), 32-123

Hydro-Quebec is a public electricity utility for the province of Quebec in Canada. Its demand forecast team has been working for decades with Fortran models used daily in a critical system. Julia was selected as the replacement for Fortran. An optimisation library with call-backs was converted to Julia. The Julia version of the library is exempt of Fortran interface, and we present how the Fortran applications are modified to call either version of the library as to compare their behaviours.


Hydro-Quebec is the main public electricity utility for the province of Quebec. Its demand forecast team has been working for decades with Fortran coded models. Julia was selected as the replacement for Fortran. Since those models are used daily in a critical system and history vouches for their reliability, great care will be taken to ensure the quality of the Julia replacements. The first step undertaken in this transition is to replace one of the optimisation libraries, ENLSIP, written in the 80’s. This is a least square error minimisation library for non-linear equations with non-linear constraints. Conversion and upgrade of that library is in the process but before improving the optimisation process, current efforts are made to ensure that the Julia version reproduces the original Fortran version. To that effect, Julia-Fortran interface is used to create a Julia application that allows to compare both versions of the library in context of the calling applications, still in Fortran. The talk will describe the intertwining of Fortran and Julia as the optimisation library is provided with call back functions to calculate the errors and derivates. In a nutshell, Julia calls Fortran that calls Julia which calls Fortran. This approach isolated the Julia version of the library which can be called by a Julia application devoid of Fortran code as the callback subroutines were wrapped in Julia. An example stripped of the proprietary code illustrating the handling of data and functions will be made public. We will also cover in the talk the tests methodology and graphical tools used to analyze the search space.

More than forty years in scientific computing after a bachelor degree in mathematics.
Worked on applications such as gas turbine simulation, autocad for the garment industry, flying personnel schedulers.
Amongst the different computing languages I've used Scheme and now favor functional programming.
Currently in the demand forecast team of Hydro-Québec, the main public electric utility in the province of Quebec in Canada . This team is revamping their forecast models; my contribution includes converting some of their models from Fortran to Julia.