URAMSES is a project that enables the integration of custom user models into PyRAMSES (Python interface for RAMSES power system simulator) and STEPSS. This repository provides the framework and tools needed to compile and link your own Fortran models with the simulation environment.
- Microsoft Visual Studio (2019 or later recommended)
- Intel oneAPI Fortran Compiler (formerly Intel Fortran)
- PyRAMSES (Python package) or STEPSS (java package)
For detailed installation instructions of the Intel oneAPI Fortran compiler, refer to the included PDF: Installing the Intel oneAPI Fortran compiler.pdf
URAMSES/
├── src/ # Source code files
│ ├── c_interface.f90 # C interface for Python integration
│ ├── main.f90 # Main entry point
│ ├── 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 control model associations
├── my_models/ # Your custom models go here
│ ├── exc_*.f90 # Exciter models
│ ├── inj_*.f90 # Injector models
│ ├── tor_*.f90 # Torque models
│ ├── twop_*.f90 # Two-port models
│ └── *.txt # Model parameter files
├── modules/ # Compiled Fortran modules
├── URAMSES.sln # Visual Studio solution file
├── dllramses.vfproj # Main DLL project (ramses.dll)
├── exeramses.vfproj # Executable project (dynsim.exe)
├── MDL.vfproj # Model library project (ramsesmdl.dll)
└── Release_intel_w64/ # Compiled output directory
The solution contains three main projects:
- Purpose: Creates the main dynamic link library for PyRAMSES integration
- Output:
ramses.dll- Used by PyRAMSES to access your custom models - Usage: Primary project for Python integration
- Purpose: Creates a standalone executable for direct simulation
- Output:
dynsim.exe- Command-line simulation tool - Usage: Run simulations directly without Java interface
- Features: Includes all your custom models for standalone operation
- Purpose: Creates a model library DLL
- Output:
ramsesmdl.dll- Additional model library - Usage: Supplementary model library for advanced use cases
URAMSES supports several types of power system models:
- Exciters (
exc_*): Generator excitation system models - Injectors (
inj_*): Current/voltage injection models for faults/disturbances - Torque (
tor_*): Mechanical torque models for generators - Two-port (
twop_*): Two-port network models (e.g., SVC, STATCOM) - Discrete Control (
dctl_*): Discrete control system models
# Download the latest release from:
# https://github.com/SPS-L/URAMSES/releases/
# Extract to your desired locationPlace your generated .f90 model files (created by CODEGEN) into the my_models/ directory. Each model should have:
- A Fortran source file (
.f90) - An optional parameter file (
.txt) defining model parameters
Edit the appropriate association file in src/ to register your models:
For Exciters (src/usr_exc_models.f90):
select case (modelname)
case('YOUR_MODEL_NAME')
exc_ptr => your_model_subroutine
end selectFor Injectors (src/usr_inj_models.f90):
select case (modelname)
case('YOUR_MODEL_NAME')
inj_ptr => your_model_subroutine
end selectFor Torque Models (src/usr_tor_models.f90):
select case (modelname)
case('YOUR_MODEL_NAME')
tor_ptr => your_model_subroutine
end selectFor Two-port Models (src/usr_twop_models.f90):
select case (modelname)
case('YOUR_MODEL_NAME')
twop_ptr => your_model_subroutine
end select- Open
URAMSES.slnin Microsoft Visual Studio - Ensure the Intel Fortran compiler is properly configured
- Right-click on the
dllramsesproject in Solution Explorer - Select "Add" → "Existing Item"
- Navigate to
my_models/and select your.f90files - Click "Add" to include them in the project
You can compile individual projects or the entire solution:
Option A: Compile all projects (recommended)
- Right-click on the
URAMSESsolution in Solution Explorer - Select "Build Solution"
- This will create:
ramses.dll(from dllramses project)dynsim.exe(from exeramses project)ramsesmdl.dll(from MDL project)
Option B: Compile individual projects
- For PyRAMSES integration: Right-click
dllramses→ "Build" - For STEPSS integration: Right-click
exeramses→ "Build" - For model library: Right-click
MDL→ "Build"
All compiled files will be created in Release_intel_w64/
Option A: With PyRAMSES (Python)
import pyramses
# Initialize simulation with your custom DLL
ram = pyramses.sim(r'C:\path\to\your\URAMSES\Release_intel_w64')
# Your models are now available for use in simulationsOption B: With STEPSS (Java)
// Use the same ramses.dll with STEPSS Java interface
// Your custom models will be available in STEPSS simulationsOption C: Standalone Simulation
# Run simulations directly using the compiled executable
cd Release_intel_w64
./dynsim.exe- Compilation Errors: Ensure Intel Fortran compiler is properly installed and configured
- Missing Models: Verify model names match exactly in association files
- DLL Loading: Check that the path to
ramses.dllis correct in PyRAMSES - Model Parameters: Ensure parameter files are properly formatted
- Check Visual Studio output window for compilation errors
- Verify model subroutine names match exactly in association files
- Test with simple models first before complex implementations
The my_models/ directory contains several example models:
exc_ENTSOE_lim.f90: ENTSO-E exciter model with limitersexc_GENERIC3.f90: Generic exciter model type 3inj_AIR_COND1_mod.f90: Air conditioning load modeltor_ENTSOE_simp.f90: Simplified ENTSO-E torque model
For comprehensive PyRAMSES documentation, visit: https://pyramses.sps-lab.org
This project is licensed under the Academic Public License. See LICENSE.rst for details.
For issues and questions:
- Check the PyRAMSES documentation
- Review example models in
my_models/ - Ensure all prerequisites are properly installed
When contributing models:
- Follow the existing naming conventions
- Include parameter files (
.txt) for your models - Test thoroughly before submission
- Document any special requirements or dependencies