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

[DRAFT] Declarative Port Graph #46

Closed
wants to merge 58 commits into from
Closed

Conversation

tanneberger
Copy link
Member

@tanneberger tanneberger commented May 15, 2023

Declarative Port Graph

This pull request is a tremendous refactor of reactor-cpp instead of connecting ports in the assemble methods, this pull requests introduces a way to declarative define the port graph. On this more formal definition of a graph (PropertyGraph) I implemented a spanning tree style optimization that figures out all the connected downstream ports. Consequently, this spanning tree is then "flattened" into a tree of depth one in the process all the connections to every leaf of the tree is merged. This merging logic also takes Delayed, Enclaved and Physical connections into consideration.

Important Changes for the Code Generator

Declaring the PortGraph

# pushing the port objects into the environment
auto add_i1 = env.register_port(&add.i1);
auto add_i2 = env.register_port(&add.i2);
auto add_sum = env.register_port(&add.sum);
auto p_add_forward = env.register_port(&p_add.forward);
auto p_add_value = env.register_port(&p_add.value);

# connecting up the ports with their identifier 
env.draw_connection(counter1_count, add_i1, ConnectionProperties{});
env.draw_connection(counter2_count, add_i2, ConnectionProperties{});
env.draw_connection(add_sum, p_add_forward, ConnectionProperties{ConnectionType::Delayed, 10s, nullptr});
env.draw_connection(p_add_forward, p_add_value, ConnectionProperties{ConnectionType::Delayed, 5s, nullptr});

Start Up

# first we need to "optimize" the graph this is currently a mandetory 
env.optimize();

# assembeling everything
# 1.) assembeling reactors
# 2.) intantiating port graph
# 3.) calculating dependency graph and calculate reaction indices
env.assemble();

# beginning execution
auto thread = env.startup();
thread.join();

@tanneberger tanneberger requested a review from cmnrd May 15, 2023 13:58
@tanneberger tanneberger self-assigned this May 15, 2023
@lhstrh
Copy link
Member

lhstrh commented May 15, 2023

This looks interesting, but could you provide a high-level description of what this is meant to do?

@tanneberger tanneberger force-pushed the connection-optimization branch 2 times, most recently from 7e41093 to 5c6e72e Compare June 29, 2023 14:24
@tanneberger tanneberger requested a review from cmnrd July 21, 2023 16:02
tanneberger added a commit that referenced this pull request Jul 25, 2023
@tanneberger
Copy link
Member Author

Closing because #51 is the small tiny rewrite

@tanneberger tanneberger mentioned this pull request Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement of existing feature feature New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants