URAMSES
URAMSES provides the framework and tools needed to compile and link custom Fortran models with PyRAMSES and STEPSS.
Prerequisites
Section titled “Prerequisites”- Microsoft Visual Studio 2019 or later
- Intel oneAPI Fortran Compiler (see Installation)
- PyRAMSES or STEPSS
- gfortran (GNU Fortran compiler)
- OpenBLAS (optimized BLAS library)
- PyRAMSES
# Ubuntu/Debiansudo apt install gfortran libopenblas-dev
# Fedora/RHELsudo dnf install gcc-gfortran openblas-devel
# Arch Linuxsudo pacman -S gcc-fortran openblasProject Structure
Section titled “Project Structure”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)Model Types
Section titled “Model Types”| Type | Prefix | Description |
|---|---|---|
| Exciters | exc_* | Generator excitation system models |
| Injectors | inj_* | Current/voltage injection models |
| Torque | tor_* | Mechanical torque models |
| Two-port | twop_* | Two-port network models (SVC, STATCOM, HVDC) |
| Discrete Control | dctl_* | Discrete control system models |
Building
Section titled “Building”# Build shared library + executablemake -f Makefile.gfortran all
# Build only the shared library (for PyRAMSES)make -f Makefile.gfortran lib
# Build only the executablemake -f Makefile.gfortran exe
# Clean build artifactsmake -f Makefile.gfortran cleanThe shared library (ramses.so) will be in Release_gnu_l/.
- Open
URAMSES.slnin Visual Studio - Select the desired project:
dllramses— buildsramses.dll(for PyRAMSES)exeramses— buildsdynsim.exe(standalone)
- Build the solution (Release x64 configuration)
- Output will be in
Release_intel_w64/
Adding Custom Models
Section titled “Adding Custom Models”-
Write the model source: Create a
.f90file inmy_models/following the naming convention (exc_,inj_,tor_,twop_, ordctl_prefix) -
Register the model: Add the model association in the corresponding
usr_*_models.f90file insrc/ -
Rebuild: Compile and link the modified URAMSES
Example: Registering an Exciter Model
Section titled “Example: Registering an Exciter Model”In src/usr_exc_models.f90, add a case for your model:
case ('MY_EXCITER') call exc_MY_EXCITER(...)Included Example Models
Section titled “Included Example Models”The repository includes several example models:
| File | Description |
|---|---|
exc_ENTSOE_lim.f90 | ENTSO-E exciter with limits |
exc_GENERIC3.f90 | Generic exciter type 3 |
exc_ST1A.f90 | IEEE ST1A exciter |
tor_ENTSOE_simp.f90 | ENTSO-E simplified torque controller |
inj_AIR_COND1_mod.f90 | Air conditioning load injector |
Using Custom Models
Section titled “Using Custom Models”With PyRAMSES
Section titled “With PyRAMSES”Point PyRAMSES to your custom library:
import pyramsesram = pyramses.sim(custLibDir="path/to/Release_gnu_l")With STEPSS GUI
Section titled “With STEPSS GUI”Replace the default RAMSES DLL/executable with your custom-built version.
Helper Functions
Section titled “Helper Functions”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.
Repository
Section titled “Repository”Source code: SPS-L/stepss-URAMSES