Skip to content

Commit

Permalink
update readme and runscript
Browse files Browse the repository at this point in the history
  • Loading branch information
paulf81 committed Nov 21, 2024
1 parent d8cccf8 commit fccf59a
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 27 deletions.
23 changes: 23 additions & 0 deletions example_case_folders/10_heterogeneous_wind/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Example 10: Heterogeneous Wind

## Description

This example runs a wind farm level power tracking controller, using FLORIS as a simulation
testbed, with heterogeneous inflow. The control algorithm is based on the A2e2g project.
This will the closed loop power tracking controller.


## Running

To run the example, execute the following command in the terminal:

```bash
bash run_script.sh
```
## Outputs

To plot the outputs run the following command in the terminal:

```bash
python plot_outputs.py
```
23 changes: 0 additions & 23 deletions example_case_folders/10_heterogeneous_wind/bash_script.sh

This file was deleted.

4 changes: 0 additions & 4 deletions example_case_folders/10_heterogeneous_wind/readme.txt

This file was deleted.

54 changes: 54 additions & 0 deletions example_case_folders/10_heterogeneous_wind/run_script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash

# Determine the base path for Conda initialization
if [ -f "/home/$USER/anaconda3/etc/profile.d/conda.sh" ]; then
# Common path for Anaconda on Linux
CONDA_PATH="/home/$USER/anaconda3/etc/profile.d/conda.sh"
elif [ -f "/Users/$USER/anaconda3/etc/profile.d/conda.sh" ]; then
# Common path for Anaconda on macOS
CONDA_PATH="/Users/$USER/anaconda3/etc/profile.d/conda.sh"
elif [ -f "/opt/anaconda3/etc/profile.d/conda.sh" ]; then
# Alternative system-wide installation path
CONDA_PATH="/opt/anaconda3/etc/profile.d/conda.sh"
elif [ -f "opt/miniconda3/etc/profile.d/conda.sh" ]; then
# Alternative system-wide installation path
CONDA_PATH="/opt/miniconda3/etc/profile.d/conda.sh"
elif command -v conda &> /dev/null; then
# If conda is in PATH, use the which command to find conda location
CONDA_PATH=$(dirname "$(which conda)")/../etc/profile.d/conda.sh
else
echo "Conda installation not found. Please ensure Conda is installed and in your PATH."
exit 1
fi

# Source the Conda initialization script
source "$CONDA_PATH"
conda activate hercules

# Clean up existing outputs
if [ -d outputs ]; then rm -r outputs; fi
mkdir -p outputs

# Set the helics port to use:
#make sure you use the same port number in the amr_input.inp and hercules_input_000.yaml files.
export HELICS_PORT=32000

# Wait for the open-loop control simulation to finish and then run the closed-loop simulation
helics_broker -t zmq -f 2 --loglevel="debug" --local_port=$HELICS_PORT &
python3 hercules_runscript_CLcontrol.py hercules_input_000.yaml >> outputs/hercules.log 2>&1 &
python3 floris_runscript.py inputs/amr_input.inp floris_standin_data.csv >> outputs/floris.log 2>&1

# Clean up helics output if there
# Search for a file that begins with the current year
# And ends with csv
# If the file exists, move to outputs folder
current_year=$(date +"%Y")
for file in ${current_year}*.csv; do
if [ -f "$file" ]; then
mv "$file" outputs/
fi
done

# If everything is successful
echo "Finished running hercules"
exit 0

0 comments on commit fccf59a

Please sign in to comment.