Python code for implementation of the paper 'Reinforcement Learning-Based Adaptive PID Controller for DPS'.
Python libraries:
- numpy
- pandas
- tensorflow (version-2.3 is used in the paper)
- OrcFxAPI
Software:
- OrcaFlex developed by Orcina (version-10.3 is used in the paper) [NOTE: its license is required to use the OrcaFlex]
- download the zip file or do
git clone ...
and save in your directory pip install
all the libraries for the dependency- check if the OrcaFlex recognizes Python (otherwise, read an OrcaFlex's documentation for Python API)
- move the file
DP/dp_force_source/dp_force_windff.cp37-win_amd64.pyd
to theLib
directory where your python is installed
- set
self.TEST = False
inDP/DP_DDPG/settings.py
- open
DP/DP_DDPG/DDPG_based_DPS.dat
- run dynamic simulation
- check the training results in
DP/results/train/reward_func_case1
*description for the results is documented inDP/results/README.md
- set
self.TEST = True
inDP/DP_DDPG/settings.py
- open
DP/DP_DDPG/DDPG_based_DPS.dat
- run dynamic simulation
- check the testing results in
DP/results/test/reward_func_case1
- open
DP/DP_ZN/ZN_based_DPS.dat
( ZN stands for Ziegler–Nichols ) - run dynamic simulation
- check the results in
DP/results/ZN/temp
-
environmental condition
inDP/DDPG/DDPG_based_DPS.dat
, you can change the environmental condition. In the same way, the environmental condition for the testing can be set. -
hyper-parameters for the DDPG
the hyper-parameters are stated below '# params for ddpg' inDP/DP_DDPG/settings.py
-
use of the fixed P, D base gains (= not to use the adaptive P, D gains)
setself.use_max_PD_gains = True
inDP/DP_DDPG/settings.py
-
use of the fixed I base gains (= not to use the adaptive I gains)
setself.use_max_I_gain = True
inDP/DP_DDPG/settings.py
-
use of the update-gates for the integral of the errors
setself.use_gate_err_accumulation = True
inDP/DP_DDPG/settings.py
-
neural network (NN) architecture
NN architecture with batch normalization:DP/baselines/ddpg/ddpg_simple_bn_only.py
NN architecture without batch normalization:DP/baselines/ddpg/ddpg_simple.py
*the above models can be switched byself.use_bn
inDP/DP_DDPG/settings.py
-
environmental condition
inDP/DP_ZN/ZN_based_DPS.dat
, you can change the environmental condition. -
fixed base gains
inDP/DP_ZN/ZN_based_DPS.dat
, there is 'Vessel1' under a 'Vessels' directory. Under a tag named 'Tags' in the 'Vessel1', you can access 'ExternalFunctionParameters' where you can see the fixed base PID gains. ( If you change the fixed base gains inDP/DP_ZN/ZN_based_DPS.dat
, you should change theself.ZN_gains
inDP/DP_DDPG/settings.py
accordingly. )