Skip to content

URAMSES

URAMSES provides the framework and tools needed to compile and link custom Fortran models with PyRAMSES and STEPSS.

  • Microsoft Visual Studio 2019 or later
  • Intel oneAPI Fortran Compiler (see Installation)
  • PyRAMSES or STEPSS
URAMSES/
├── src/ # Source code (common)
│ ├── c_interface.f90 # C interface for Python integration
│ ├── main.f90 # Main entry point (executable only)
│ ├── FUNCTIONS_IN_MODELS.f90 # Helper functions for models
│ ├── usr_exc_models.f90 # Exciter model associations
│ ├── usr_inj_models.f90 # Injector model associations
│ ├── usr_tor_models.f90 # Torque model associations
│ ├── usr_twop_models.f90 # Two-port model associations
│ └── usr_dctl_models.f90 # Discrete controller associations
├── my_models/ # Custom models
│ ├── exc_*.f90 # Exciter models
│ ├── inj_*.f90 # Injector models
│ ├── tor_*.f90 # Torque models
│ ├── twop_*.f90 # Two-port models
│ └── *.txt # Model parameter files
├── modules/ # Pre-compiled modules (Windows/Intel)
│ ├── *.mod # Module interface files
│ └── libramses.lib # Pre-compiled RAMSES library
├── modules_lin/ # Pre-compiled modules (Linux/gfortran)
│ ├── *.mod # Module interface files
│ └── libramses.a # Pre-compiled RAMSES library
├── URAMSES.sln # Visual Studio solution (Windows)
├── Makefile.gfortran # Makefile (Linux)
├── Release_intel_w64/ # Build output (Windows)
└── Release_gnu_l/ # Build output (Linux)
TypePrefixDescription
Excitersexc_*Generator excitation system models
Injectorsinj_*Current/voltage injection models
Torquetor_*Mechanical torque models
Two-porttwop_*Two-port network models (SVC, STATCOM, HVDC)
Discrete Controldctl_*Discrete control system models
Terminal window
# Build shared library + executable
make -f Makefile.gfortran all
# Build only the shared library (for PyRAMSES)
make -f Makefile.gfortran lib
# Build only the executable
make -f Makefile.gfortran exe
# Clean build artifacts
make -f Makefile.gfortran clean

The shared library (ramses.so) will be in Release_gnu_l/.

  1. Write the model source: Create a .f90 file in my_models/ following the naming convention (exc_, inj_, tor_, twop_, or dctl_ prefix)

  2. Register the model: Add the model association in the corresponding usr_*_models.f90 file in src/

  3. Rebuild: Compile and link the modified URAMSES

In src/usr_exc_models.f90, add a case for your model:

case ('MY_EXCITER')
call exc_MY_EXCITER(...)

The repository includes several example models:

FileDescription
exc_ENTSOE_lim.f90ENTSO-E exciter with limits
exc_GENERIC3.f90Generic exciter type 3
exc_ST1A.f90IEEE ST1A exciter
tor_ENTSOE_simp.f90ENTSO-E simplified torque controller
inj_AIR_COND1_mod.f90Air conditioning load injector

Point PyRAMSES to your custom library:

import pyramses
ram = pyramses.sim(custLibDir="path/to/Release_gnu_l")

Replace the default RAMSES DLL/executable with your custom-built version.

The FUNCTIONS_IN_MODELS.f90 module provides utility functions available in all models. Refer to the source code for the complete list of available helper routines.

Source code: SPS-L/stepss-URAMSES