This repository contains the scripts 📜 and data 📂 used for the EMS-SMPC based on this paper.
Need to load data:
GFA_15_min(platform load)RES(wind speed)
load('\\home.ansatt.ntnu.no\spyridoc\Documents\MATLAB\J2_PAPER\EMS-SMPC\DataFiles\dataTimeseries.mat')
-
TRAINING
train_RF.mtrain RF models- Output:
Mdl_ld(load RF models)Mdl_wp(wind power RF models)
-
OUTPUT FIGURES
figures_section_2_2.mcreate figures of paper Section 2.2 (MSE, NRMSE, zoom forecasts k=1/k=6) (Figures 2-3)forecast_plots.mplot deterministic, probabilistic and scenario K steps ahead forecasts for selected date
Need to load trained RF models:
load('\\home.ansatt.ntnu.no\spyridoc\Documents\MATLAB\J2_PAPER\EMS-SMPC\DataFiles\trainedRFmodels.mat')
-
INPUTS 📋 💾
user_defined_inputs.mdefine theinputvariable
-
SYSTEM SIMULATION
main.msimulate system with DMPC/SMPCoptProb.mformulate the MILP optimization for poblem for DMPC/SMPCcontrol_plots.mplot MPC states evolution and control effort for selected method (DMPC/SMPC)
-
PAPER RESULTS
kpi_compare.mperform comparison of calculated KPIs from DMPC/SMPC (Table 8)figures_section_4_1_2.mcreate figures of Section 4.1.2 (forecasts on events, mean, quantiles, scenarios) (Figures 7-9)figures_section_4_2.mcreate figures of Section 4.2 (net load, rule-based areas, GT status and SoC (DMPC/SMPC)) (Figures 10-15)
Default input values 🔢
input.startingDay = 100input.durationDays = 1input.giveStartingTime = 0% {0, 1}inut.startingTime = 7630input.doAnimation = 0% {0, 1}input.animationVar = 'load'% {'load', 'wind'}input.randomSeed = 24input.method = 'scn_frcst'% {'point_frcst', 'scn_frcst'}input.degradWeight = 'noWeight'% {'noWeight','none', 'normal', 'low', 'medium', 'high'}input.N_steps = 300input.N_prd = 6% {MPC simulation, CRPS calculation} = {6, 12}input.lgdLocationDstrb = 'southwest'input.lgdLocationIgtOn = 'southeast'input.lgdLocationSoC = 'southeast'
Specialized functions used by the above main scripts ⬇️
-
preamble.massigns 📎 parameter values to variablepar.Default
parvalues 🔢
Geenric
par.Ts = 15% Timestep (minutes)par.dol2eur = 0.89% dollars to euros conversionpar.rhoGas = 0.717% Natural Gas density [kg/m^3]
Sets
par.N_pwl = 11% # of discretization points for PieceWise Linear approx.par.N_gt = 4% # of Gas Turbinespar.N_scn = 10% # of scenarios
Random forests
par.leafSizeIdx = 1par.lamda = 0.5par.tau = linspace(0,1,21)par.lagsNum = 6
Cost coeeficicents
par.c_dump = 10*100% artificial cost (per unit of dumped power per period)par.c_soc_dev = 0*10*100*100% artificial cost (per unit of absolute SoC deviation in the end)par.c_fuel = 0.24/par.rhoGas * par.dol2eur% [euros/kgGas]par.c_gt_srt = 1217% [euros/GTstart]par.c_gt_ON = 5000% [euros/GT_ON sattus]par.c_Bat_rpl = par.degradWeight * 500000 * par.dol2eur% replacement cost [euros/MWh]par.c_Bat_res = par.degradWeight * 50000 * par.dol2eur% residual value [euros/MWh]
Gas Turbines
par.P_gt_nom = 20.2% Nominal GT power ratingpar.P_gt_min = 0.20 * par.P_gt_nompar.P_gt_max = 1.09 * par.P_gt_nompar.gt_RR = par.P_gt_max% Ramping Ratepar.spinRes = 1.05par.idleFuel = 172*0.2*20.2+984% [kg/h] coming from min GT fuel consumption (linear curve) - intercept @ no load: 1720.220.2+984par.P_gt_data = linspace(par.P_gt_min,par.P_gt_max,par.N_pwl)par.fuel_data = (0.5109 * par.P_gt_data.^2 -20.933 .* par.P_gt_data + 433.83)% [kg/MWh]
BESS
par.eta_ch = 0.95% charging efficienypar.eta_dis = 0.95% discharging efficienypar.P_bat_max = 5% power rating [MW] nominal: 5par.E_bat_max = 10% capacity rating [MWh] nominal: 10par.socUPlim = 0.8% up SoC limit [-]par.socDOWNlim = 0.2% down SoC limit [-]par.SoC_ref = 0.5% reference SoC
Degradation
par.batLifetime = 10% Lifetime expectancy of batterypar.a = 1591.1% Proportional constant of cycling curvepar.k = 2.089% Exponent of cycling curvear.DoD_data = linspace(0,1,par.N_pwl)'% Depth-Of-Discharge [0-1]par.Ncyc = par.a*par.DoD_data.^(-par.k)% Cycle lifetime (# of cycles)par.rho_data = 100*100./par.Ncyc% Percentage degradation [%] - (times 100 for scaling purposes)
funScenGenQRF1.missue K steps ahead scenarios forecasts at time tfunScenGenQRF.missue K steps ahead scenarios forecasts itteratively for t>1 (used withfunAnimateQRF.m)funScenFrcstFig1step.mplot K steps ahead scenario forecasts for selected time tfunProbFrcstFig1step.mplot K steps ahead quantile forecasts for selected time tfunFrcstFig1step.mplot both scenario and quantile K steps ahead forecasts for selected time tfunAnimateQRF.mproduce forecasting animation (.gif) for itterative forecasts (t>1)
funGetCtrlRslt.mcalculated KPIs from simulation in variablekpifunPltCtrlRslt.mplot the control variables (states and inputs) results for a method (DMPC/SMPC)funPltCtrlRsltPretty.mplot the control variables (states and inputs) results for a method (DMPC/SMPC) in a pretty way
funCalcCRPS.mcalculate CRPS, skill score and plot CRPS for all lead times, for selected period of time with QRF forecasts and benchmark method (paper: Figure 6, Table 1)funCalcCRPS1step.mcalculate CRPS for single predictions and plot cdf to compare QRF and benchmark method forecasts for each lead timefunCovCorrGenQRF.mEstimate covariance and correlation matrices from inverse transformed data based on probabilistic forecasts from QRF models
Cases studies (Section 4.2) 📅
input.durationDays = 1 and input.giveStartingTime = 0
input.startingDay=100 (10 April)input.startingDay=118 (27 April)input.startingDay=226 (14 August)input.startingDay=61 (02 March)input.startingDay=166 (15 June)input.startingDay=160 (09 June)
Irregular events (Section 4.1.2) 📅
input.durationDays = 0 and input.giveStartingTime = 1 and par.N_scn = 25 (for scenarios visualization)
Load
inut.startingTime= 7630inut.startingTime= 7635inut.startingTime= 7636inut.startingTime= 7709
Wind
-
inut.startingTime= 7646 -
inut.startingTime= 7647 -
inut.startingTime= 7648 -
inut.startingTime= 7649 -
inut.startingTime= 7760 -
inut.startingTime= 7761 -
inut.startingTime= 7762 -
inut.startingTime= 7763
- To upload the data