ValentinChb / FASTFarm2Simulink

Apache License 2.0
6 stars 0 forks source link

FASTFarm and MATLAB/Simulink interface

This project aims at coupling NREL's FAST.Farm with The Mathworks' MATLAB/Simulink for wind turbine and farm control purposes, via MPI-based co-simulation on Windows 64-bit machines.

The original MPI Client/Server interface with FAST.Farm has been developed at SINTEF; this project is an extension to MATLAB/Simulink developed by Coen-Jan Smits during his master thesis at TU Delft.

Installation

The following needs to be installed in order to run the FAST.Farm and MATLAB/Simulink interface:

Binaries for FAST.Farm, the wind turbine controller and libraries for the MPI bridge are provided.

See the OpenFAST documentation for more information about the input files of FAST.Farm and OpenFAST. Be sure that OpenFAST and FAST.Farm work. The 'r-test' folder form the OpenFAST GitHub (https://github.com/OpenFAST) contains simulation tests, try to run 1 or 2 of these tests.
The OpenFAST GitHub also contains a 'MATLAB_Toolbox', this toolbox contains functions that can be run in MATLAB in order to visualize the generated simulation results.

It may be necessary to add the following libraries to your path (they should be found in the Python distribution's bin folder). These libraries are needed for running FAST.Farm (OpenFAST works without those). If a library has a sligthly different name (e.g. '.1' at the end), create a copy and rename.

Use

Matlab/Simulink acts as an MPI server communicating with MPI client dlls for each turbine, used in lieu of the turbine controller dll in ServoDyn. Information about the client may be found in https://github.com/ValentinChb/SC_MPIClient. This repository provides three versions of client dlls in the OpenFAST/T\<Turbine Number>/ControlData folder:

Templates of turbine-level and farm-level controllers are provided in the files 'SC_MATLAB.m' or 'SC_Simulink.m' in the 'SC_MPIServer' folder. NOTE: This repository only provides a template skeletton of turbine-level controller. Using SCClient_64.dll (without linking to DTUWEC or ROSCO) and 'SC_MATLAB.m' or 'SC_Simulink.m' as is will lead to unstable behaviour, unless the effect of controls has been switched off in ElastoDyn through the generator DOF (i.e. using fixed rotor speed).

Running a simulation:

The 'Test3turbines' folder contains the FAST.Farm input file (.fstf file) and the OpenFAST input files (.fst file and servodyn, elastodyn etc). These files can be modified accordingly, but the path tree architecture must be kept.

Debugging

FAST.Farm and linking to DTUWEC or ROSCO may be checked separately by using Standalone versions of the client dll.

Information about the MPI connection may be found in stdout_MPIServerSubs.txt for the server (Matlab) side in the SC_MPIServer folder, and in stdout_SCClientSubs.txt for the client (Wind turbine controller dlls) side in the OpenFAST/T\<Turbine Number>/ControlData folder. Compare with the files provided in this repository to identify where the communication fails/halts. When the communication is deemed robust, outputting these files may be deactivated to save computational time. This is done by switching the verbose flag to false in source code and recompiling (see below).

This is not an official NREL product and thorough testing has not been conducted. It is expected that users have some knowledge about coding and willingness to look into the various source codes and be able to recompile to find solutions themselves.

Recompiling/Updating

The MPI-based co-simulation interface consists of a client dll on the OpenFAST side and a server dll and mex files on the Matlab side. This project uses MinGW64 with gcc/gfortran to build these files.

Citing

When using this work, credit may be given to the associated publication https://iopscience.iop.org/article/10.1088/1742-6596/2626/1/012069 (itself citing this repository)