Skip to content

Commit

Permalink
Changing helicsport to sidestep bug with not connecting on correct port.
Browse files Browse the repository at this point in the history
  • Loading branch information
misha committed Dec 12, 2023
1 parent 5eab3a1 commit 8c789ff
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion example_case_folders/02_amr_wind_dummy_only/amr_input.inp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ ABL.stats_output_format = netcdf

# Whether to use helics
helics.activated = true
helics.broker_port =32000
helics.broker_port = 32000

#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# ADAPTIVE MESH REFINEMENT #
Expand Down
5 changes: 3 additions & 2 deletions example_case_folders/02_amr_wind_dummy_only/bash_script.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
conda activate hercules

# Set the helics port to use:
export HELICS_PORT=32000
export HELICS_PORT=23404

#make sure you use the same port number in the amr_input.inp and hercules_input_000.yaml files.

# Set up the helics broker
helics_broker -f 2 --consoleloglevel=trace --loglevel=debug --local_port=$HELICS_PORT &
helics_broker -t zmq -f 2 --loglevel="debug" --local_port=$HELICS_PORT &
#helics_broker -f 2 --consoleloglevel=trace --loglevel=debug --local_port=$HELICS_PORT >> loghelics &

# Need to set this to your hercules folder
# cd /home/pfleming/hercules/hercules
Expand Down
14 changes: 12 additions & 2 deletions hercules/dummy_amr_wind.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,18 @@ def read_amr_wind_input(amr_wind_input):
for f in line.split()[-3:-1]])
turbine_locations.append(locations)

# Get the helics port
for line in Lines:
if 'helics.broker_port' in line:
broker_port = int(line.split()[2])

return_dict = {
'dt':dt,
'num_turbines': num_turbines,
'turbine_labels': turbine_labels,
'rotor_diameter': D,
'turbine_locations': turbine_locations
'turbine_locations': turbine_locations,
'helics_port': broker_port,
}


Expand Down Expand Up @@ -238,6 +244,9 @@ def process_subscription_messages(self, msg):

def launch_dummy_amr_wind(amr_input_file):

temp = read_amr_wind_input(amr_input_file)
print(temp["helics_port"])

config = {
"name": "dummy_amr_wind",
"gridpack": {
Expand All @@ -253,7 +262,8 @@ def launch_dummy_amr_wind(amr_input_file):

],
"endpoints": [
]
],
"helicsport":temp["helics_port"],
},

"publication_interval": 1,
Expand Down

0 comments on commit 8c789ff

Please sign in to comment.