-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathmain.m
50 lines (44 loc) · 1.59 KB
/
main.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
% DESCRIPTION:
% Top script running machine learning framework for the DC grid with the
% chosen parameters:
% - 'model': The simulink model to run representing the DC grid.
% - 'maxEpi': number of episodes, i.e. how many times the learning process
% is repeated for the same. An improvement of the behavior is
% expected along the episodes.
% - 'iterationTime': An episode is divided in iterations. At each
% iteration, the FC reference power is recalculated by
% the ML algorithm.
% - 'epsilon' & 'epsilon decay': Learning parameters
% - 'discount': Learning parameter setting the learning horizon time (i.e.
% how important are the past actions).
% - 'sucessRate': Make the reference power noised if not 1.
% - 'weightX': How important we want this parameter relatively to the
% others.
% - Folder: Crete folders to store the results from the current directory.
% The files linked to this main script are:
% - QlearningEMS.m
% - The simulink model (DC_grid_simple)
%%
clear all
close all
clc
%% Initialize the parameters for learning session:
simulation_parameters = struct(...
'model','DC_grid_simple',...
'maxEpi',1000,...
'totalTime',2000,...
'iterationTime',1.95,...
'epsilon',3,...
'epsilonDecay',0.997,...
'discount',0.999,...
'successRate',1,...
'weightSOC',1,...
'weightP_FC',1,...
'weightP_batt',1,...
'weightSteady',0,...
'parentFolder','16_september',...
'subFolder','test1'...
);
%% Run Machine Learning
global inputsFromWS
QlearningEMS(simulation_parameters);