This directory documents the methodology for integrating Marine Hydrokinetic (MHK) device models into power system analysis tools using Functional Mock-up Units (FMUs).
The FMU (Functional Mock-up Unit) method enables co-simulation between detailed device models (typically developed in MATLAB/Simulink) and power system analysis software (such as PowerFactory). This approach allows:
- Detailed device modeling in specialized simulation environments
- System-level analysis in power system tools
- Standardized interface through the FMI (Functional Mock-up Interface) standard
- Efficient co-simulation without requiring full model ports
- ✅ Preserve proprietary models: Device models remain encapsulated
- ✅ Leverage specialized tools: Use best tool for each component
- ✅ Standard interface: FMI is an open standard supported by many platforms
- ✅ Computational efficiency: Optimized for co-simulation
- ✅ Version control: FMUs are portable across different platforms
- Grid impact studies with detailed MHK device models
- Fault ride-through analysis
- Power quality assessment
- Integration planning and feasibility studies
- Control strategy evaluation
-
Define Interface Variables
- Inputs from grid: Voltage (3-phase), frequency, grid events
- Outputs to grid: Active power, reactive power, current
-
Configure Model Settings
- Set fixed-step solver (required for FMU export)
- Choose appropriate time step (typically 10-100 μs for power electronics)
- Ensure all blocks are compatible with code generation
-
Add FMU Export Blocks
- Use Simulink's "FMU Export" capability
- Map input/output signals to FMU interface
- Configure variable names and units
-
Test in Simulink First
- Verify model runs correctly standalone
- Check output signal ranges and behavior
- Validate control system response
-
Configure FMU Export Settings
% In Simulink model configuration % Code Generation -> Interface -> Advanced parameters % Set "Support: Model reference" to FMU
-
Build the FMU
- Simulink Coder -> Build Model
- Select FMU export type (typically Co-Simulation FMU)
- Choose appropriate solver settings
-
Verify FMU Package
- Check that
.fmufile is generated - Verify
modelDescription.xmlcontains correct interface - Test FMU with FMU Checker tool (optional but recommended)
- Check that
We provide a template PowerFactory model that uses an AC Current Source as a proxy for the MHK device. This approach allows the FMU to control the current injection into the grid, providing a flexible and stable interface for co-simulation.
PowerFactory template showing AC Current Source proxy for FMU integration
The PowerFactory template includes:
-
AC Current Source (ElmIac)
- Acts as the proxy element for the MHK device
- Controlled by the FMU outputs (active and reactive current)
- Connected at the point of common coupling (PCC)
-
FMU Controller (ElmFmu)
- Contains the MHK device model (WEC or CEC)
- Receives voltage measurements from the grid
- Outputs current commands to the AC current source
-
Measurement Elements
- Voltage measurement (StaVmea) - reads 3-phase voltage at PCC
- Current measurement (StaImea) - monitors injected current (optional)
- Frequency measurement - provides grid frequency to FMU
-
Control Connections
- Voltage signals from PCC → FMU inputs
- FMU current outputs → AC Current Source setpoints
- Proper signal scaling and unit conversion
-
Load Template Project
- Open the PowerFactory template file
- Identify the placeholder AC current source location
- Note the existing measurement and control connections
-
Import Your FMU
- Navigate to Library → FMU Frames
- Create new FMU frame element
- Load your
.fmufile (WEC or CEC model) - Verify FMU interface variables in the properties
-
Configure FMU Interface
Inputs (Grid → FMU):
- Three-phase voltage magnitude and angle at PCC
- Grid frequency
- Any additional grid status signals (optional)
Outputs (FMU → Grid):
- Active current component (Id or Ip)
- Reactive current component (Iq)
- Device status signals (optional)
-
Connect FMU to AC Current Source
- Map FMU current outputs to the AC current source control inputs
- Set proper scaling factors (ensure units match: A or pu)
- Configure control block connections using composite model frame
-
Configure Measurement Elements
- Link voltage measurement at PCC to FMU voltage inputs
- Set measurement element parameters (voltage level, nominal values)
- Ensure proper coordinate transformations (abc → dq if needed)
-
Set Co-simulation Parameters
- Communication time step: Match Simulink FMU time step
- Solver: Select RMS or EMT (EMT recommended for detailed dynamics)
- Interpolation method: Zero-order hold or linear
- Maximum iterations: 20-50 for convergence
Using an AC current source as a proxy offers several advantages:
- ✅ Numerical Stability: Current sources are more stable than power sources in power flow calculations
- ✅ Direct Control: FMU directly specifies current injection, avoiding additional conversion steps
- ✅ Flexibility: Easy to switch between grid-feeding and grid-forming modes
- ✅ Convergence: Better convergence properties in iterative co-simulation
- ✅ Standard Practice: Widely used in power system analysis for converter modeling
For grid-forming applications, you can alternatively use a controlled voltage source (ElmVac), where the FMU specifies voltage magnitude and angle. However, the current source approach is more commonly used and more stable for grid-following inverters, which is typical for MHK devices.
-
Initial Testing
- Start with steady-state conditions
- Verify power flow convergence
- Check variable magnitudes are reasonable
-
Dynamic Simulation
- Run time-domain simulation
- Monitor FMU status and errors
- Analyze power flows and device behavior
-
Validation
- Compare with standalone Simulink results
- Verify energy conservation
- Check numerical stability
- ⚡ Keep FMU interface simple (minimize number of variables)
- ⚡ Use consistent units (SI units recommended)
- ⚡ Document all interface variables clearly
- ⚡ Include saturation limits on outputs to prevent numerical issues
- ⚡ Match time steps between Simulink and PowerFactory
- ⚡ Use fixed-step solvers in both environments
- ⚡ Choose appropriate stiffness for solver selection
- ⚡ Start with larger time steps, reduce if needed for stability
- ⚡ Test Simulink model thoroughly before FMU export
- ⚡ Use signal logging to compare standalone vs. co-simulation
- ⚡ Check FMU
modelDescription.xmlfor correct interface - ⚡ Verify units and scaling factors match between tools
- ⚡ Simplify models where possible without losing fidelity
- ⚡ Use lookup tables for complex calculations when appropriate
- ⚡ Minimize algebraic loops
- ⚡ Balance accuracy with computational efficiency
Solutions:
- Ensure all Simulink blocks support code generation
- Check that fixed-step solver is selected
- Verify Simulink Coder license is available
- Remove incompatible blocks (Scope, Display, etc.)
Solutions:
- Reduce communication time step
- Check initial conditions match between models
- Verify scaling of input/output variables
- Add damping or filtering to outputs
Solutions:
- Verify sign conventions match (generation vs. consumption)
- Check per-unit vs. actual unit conversions
- Validate measurement point locations
- Ensure proper phase angle references
Solutions:
- Increase communication time step (if stable)
- Simplify FMU model complexity
- Use more efficient numerical methods
- Consider model order reduction
See the Synthetic Grid Example directory for complete working examples of:
- PowerFactory projects with FMUs integrated
- Pre-compiled FMU files
- Configured interface connections