Here is a README file for your project:
This project focuses on predicting the electrical power output of a micro gas turbine using time series data of input voltage and output energy. The approach integrates knowledge of permissible system states with a machine learning model by adding constraints to the model's loss function. The constraints are based on the constant change rates of the system in stationary and transition states.
The dataset used in this project is sourced from the UCI Machine Learning Repository. It consists of time series data for input voltage and output energy of a micro gas turbine.
The methodology and theoretical foundations for the model are based on the paper titled "Knowledge Guided Machine Learning: Combining System Knowledge with Data for Dynamical System Prediction".
-
Read the Data
- Function to read CSV files from specified folders for training and test datasets.
-
Visualize the Data
- Plot input voltage and output energy over time for both training and test datasets.
-
Calculate Change Rate
- Compute the change rate of output energy to analyze the dynamics of the system.
-
Slice Transition Phases
- Define and slice transition phases based on change rate conditions.
-
Signal Processing Techniques
- Apply Fourier Transform and Wavelet Transform to extract features from the signal.
-
Preprocess the Data
- Normalize data and prepare it for model training.
-
Define Custom Loss Function
- Implement a loss function incorporating system constraints to guide the learning process.
-
Define the Model
- Build and compile an LSTM model for time series prediction.
-
Train the Model
- Train the model with early stopping and plot training history.
The code imports necessary libraries including pandas
, numpy
, matplotlib
, tensorflow
, and pywt
.
Functions for reading data from CSV files and printing dataset shapes and information.
Functions for plotting input voltage and output energy.
Calculation of the change rate of output energy and printing of its statistics.
Function to slice transition phases based on predefined change rate conditions.
Commented-out sections for applying Fourier Transform and Wavelet Transform.
Function to preprocess data, including scaling and reshaping for LSTM input.
Definition of a custom loss function with constraints on change rates.
Construction and training of an LSTM model, with plotting of Root Mean Squared Error (RMSE) over epochs.
To run the code, make sure to install the required packages:
pip install pandas matplotlib numpy scipy tensorflow scikit-learn pywt
- Place the CSV files in
train
andtest
folders. - Run the script to perform all steps from data reading to model training.
This project is licensed under the MIT License. See the LICENSE file for details.