-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
experimental: add synchronous run_simulation (#390)
- No asynchronous implementation as that'll be mildly different. - No docs. - One example, no tests. Python unit tests for simulations aren't really feasible as things stand. - Tested manually using the example. - No handling of log or dataset returns, the current server doesn't send those. - No handling of resolution. - No handling of scenarios, which is currently not supported on the server. - Interface subject to change. See Volue/energy-sim#742.
- Loading branch information
1 parent
4fe24cf
commit b8a0edf
Showing
4 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from datetime import datetime | ||
|
||
from volue import mesh | ||
from volue.mesh.examples import _get_connection_info | ||
|
||
|
||
def main(address, port, root_pem_certificate): | ||
print("connecting...") | ||
connection = mesh.Connection(address, port, root_pem_certificate) | ||
|
||
with connection.create_session() as session: | ||
start_time = datetime(2023, 11, 1) | ||
end_time = datetime(2023, 11, 2) | ||
|
||
print("running simulation...") | ||
|
||
try: | ||
for response in session.run_simulation( | ||
"Mesh", "Cases", "Demo", start_time, end_time, None, 0, False | ||
): | ||
pass | ||
print("done") | ||
except Exception as e: | ||
print(f"failed to run simulation: {e}") | ||
|
||
|
||
if __name__ == "__main__": | ||
address, port, root_pem_certificate = _get_connection_info() | ||
main(address, port, root_pem_certificate) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters