Skip to content
Snippets Groups Projects
Commit 41119492 authored by Dustin Kern's avatar Dustin Kern
Browse files

run script

parent d0a8eeaf
No related branches found
No related tags found
No related merge requests found
#!/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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment