Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stand-in AMR-wind uses stop time defined in amr_input.inp #47

Merged
merged 4 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
misi9170 marked this conversation as resolved.
Show resolved Hide resolved
time.stop_time = 100.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"])
misi9170 marked this conversation as resolved.
Show resolved Hide resolved

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