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

Fix network sender reaction multiport #1061

Merged
merged 2 commits into from
Mar 26, 2022
Merged
Changes from all 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
7 changes: 7 additions & 0 deletions org.lflang/src/org/lflang/generator/c/CNetworkGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,13 @@ public static String generateNetworkSenderBody(
result.pr("// " + ReactionInstance.UNORDERED_REACTION_MARKER + "\n");

result.pr("// Sending from "+sendRef+" in federate "+sendingFed.name+" to "+receiveRef+" in federate "+receivingFed.name);

// In case sendRef is a multiport or is in a bank, this reaction will be triggered when any channel or bank index of sendRef is present
// ex. if a.out[i] is present, the entire output a.out is triggered.
if (sendingBankIndex != -1 || sendingChannelIndex != -1) {
result.pr("if (!"+sendRef+"->is_present) return;");
}

// If the connection is physical and the receiving federate is remote, send it directly on a socket.
// If the connection is logical and the coordination mode is centralized, send via RTI.
// If the connection is logical and the coordination mode is decentralized, send directly
Expand Down