From 41119492e5bbab39d63c32ffe47878772d773cd9 Mon Sep 17 00:00:00 2001 From: dk <dustin.kern@h-da.de> Date: Wed, 5 Jun 2024 18:32:24 +0200 Subject: [PATCH] run script --- run_wattson.sh | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 run_wattson.sh diff --git a/run_wattson.sh b/run_wattson.sh new file mode 100644 index 0000000..39cdfeb --- /dev/null +++ b/run_wattson.sh @@ -0,0 +1,62 @@ +#!/bin/bash +#sudo bash run_wattson.sh + +if [ "$(id -u)" -ne 0 ]; then + echo 'This script must be run by root' >&2 + exit 1 +fi + +mkdir -p logs +cd .. + +#change /home/dk/git/wattson/scenarios/powerowl_example/extensions.yml for scaling +#change /home/dk/git/wattson/wattson/apps/script_controller/scripts/ev_atks.py for attack case setting +#change /home/dk/git/wattson/scenarios/powerowl_example/extensions/power-profiles.yml for start_datetime + +init_scale=1.0 +sed -E -i "s/init\_load\_scaling: [0-9\.]+/init_load_scaling: $init_scale/g" wattson/scenarios/powerowl_example/extensions.yml + + +echo "year" +sed -E -i "s/self\.case = \"\w+\"/self.case = \"base\"/g" wattson/wattson/apps/script_controller/scripts/ev_atks.py +sed -E -i "s/start\_datetime: \".+\"/start_datetime: \"2023-01-01 00:00:00\"/g" wattson/scenarios/powerowl_example/extensions/power-profiles.yml + +sed -E -i "s/cp_num_mean=.+ #use/cp_num_mean=85 #use/g" wattson/scenarios/powerowl_example/extensions/ev_charging_extension.py +sed -E -i "s/cp_num_stdev=.+ #use/cp_num_stdev=10 #use/g" wattson/scenarios/powerowl_example/extensions/ev_charging_extension.py + +log_out="wattson/logs/log_base_out.log" +log_err="wattson/logs/log_base_err.log" +python3 -m wattson wattson/scenarios/powerowl_example --no-cli --seed 5 >>$log_out 2>>$log_err + +l_name=$(readlink -f wattson-artifacts/latest) +new_name="wattson-artifacts/year_powerowl_example" +mv $l_name $new_name + +chown -R $USER $new_name + + +echo "attacks" +sed -E -i "s/self\.case = \"\w+\"/self.case = \"atk\"/g" wattson/wattson/apps/script_controller/scripts/ev_atks.py +sed -E -i "s/start\_datetime: \".+\"/start_datetime: \"2023-11-29 00:00:00\"/g" wattson/scenarios/powerowl_example/extensions/power-profiles.yml + +for s in {1..5} +do + #for p in 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 + for p in 1.0 0.8 0.6 0.4 0.2 + do + echo "$s $p" + sed -E -i "s/attack_p: [\.0-9]+/attack_p: $p/g" wattson/scenarios/powerowl_example/extensions/script-controller.yml + sed -E -i "s/attack_seed: [0-9]+/attack_seed: $s/g" wattson/scenarios/powerowl_example/extensions/script-controller.yml + log_out="wattson/logs/log_"$s"_"$p"_out.log" + log_err="wattson/logs/log_"$s"_"$p"_err.log" + python3 -m wattson wattson/scenarios/powerowl_example --no-cli --seed 5 >>$log_out 2>>$log_err + l_name=$(readlink -f wattson-artifacts/latest) + new_name="wattson-artifacts/atk_"$s"_"$p"_powerowl_example" + mv $l_name $new_name + echo "$s $p $l_name $new_name" >> wattson/logs/log_file.log + chown -R $USER $new_name + done +done + + + -- GitLab