Skip to content

Commit

Permalink
Stand-in AMR-wind uses stop time defined in amr_input.inp (#47)
Browse files Browse the repository at this point in the history
* Set stand-in stop time from amr_input file.

* Controlling amr standin stop time via endtime rather than absolute_helics_time.

* Setting stop_time to 100.0 to mimic earlier behavior.

* Updating stop times in other dummy amr_input files.

---------

Co-authored-by: misi9170 <msinner@nrel.gov>
  • Loading branch information
misi9170 and misi9170 authored Dec 14, 2023
1 parent 18190a6 commit 7cd276d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 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
@@ -1,7 +1,7 @@
#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# SIMULATION STOP #
#.......................................#
time.stop_time = 10800.0 # Max (simulated) time to evolve
time.stop_time = 100.0 # Max (simulated) time to evolve
time.max_step = -1 # Max number of time steps

#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# SIMULATION STOP #
#.......................................#
time.stop_time = 10800.0 # Max (simulated) time to evolve
time.stop_time = 100.0 # Max (simulated) time to evolve
time.max_step = -1 # Max number of time steps

#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# SIMULATION STOP #
#.......................................#
time.stop_time = 10800.0 # Max (simulated) time to evolve
time.stop_time = 900.0 # Max (simulated) time to evolve
time.max_step = -1 # Max number of time steps

#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
Expand Down
13 changes: 10 additions & 3 deletions hercules/dummy_amr_wind.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,19 @@ def read_amr_wind_input(amr_wind_input):
if "helics.broker_port" in line:
broker_port = int(line.split()[2])

# Get the stop time
for line in Lines:
if "time.stop_time" in line:
stop_time = float(line.split()[2])

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

return return_dict
Expand Down Expand Up @@ -171,7 +177,8 @@ def run(self):

self.message_from_server = None

while self.absolute_helics_time < (self.endtime - self.starttime + 1):
#while self.absolute_helics_time < (self.endtime - self.starttime + 1):
while sim_time_s <= (self.endtime - self.starttime):
# SIMULATE A CALCULATION STEP IN AMR WIND=========================
logger.info("Calculating simulation time: %.1f" % sim_time_s)

Expand Down Expand Up @@ -308,7 +315,7 @@ def process_subscription_messages(self, msg):

def launch_dummy_amr_wind(amr_input_file, amr_standin_data_file=None):
temp = read_amr_wind_input(amr_input_file)
print(temp["helics_port"])

config = {
"name": "dummy_amr_wind",
"gridpack": {},
Expand All @@ -322,7 +329,7 @@ def launch_dummy_amr_wind(amr_input_file, amr_standin_data_file=None):
"publication_interval": 1,
"endpoint_interval": 1,
"starttime": 0,
"stoptime": 900,
"stoptime": temp["stop_time"],
"Agent": "dummy_amr_wind",
}

Expand Down

0 comments on commit 7cd276d

Please sign in to comment.