Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
146 commits
Select commit Hold shift + click to select a range
272da11
Add isTransient member to a federated instance and parse the transien…
ChadliaJerad Jan 11, 2024
ab8b5d3
Set the transient indicator
ChadliaJerad Jan 11, 2024
4daef37
Make federates bin directory visible
ChadliaJerad Feb 20, 2024
dffabc4
Add support of transient attribute
ChadliaJerad Jan 11, 2024
eb5eb21
Transient annotation is only allowed for federates + Leave fixmes abo…
ChadliaJerad Jan 11, 2024
dc95f45
Align reactor-c
ChadliaJerad Feb 14, 2024
612d057
Add the number of transients option to the fderation launcher script
ChadliaJerad Feb 19, 2024
ee48c1d
Fix script identation
ChadliaJerad Feb 19, 2024
0766e03
Add transients tests
ChadliaJerad Feb 20, 2024
4925182
Apply spotless
ChadliaJerad Feb 20, 2024
94a10c2
Apply spotless
ChadliaJerad Feb 20, 2024
bbca7ac
Fix accidentally removed line from FederateInstance.java
ChadliaJerad Feb 21, 2024
6bfa7c8
Update core/src/main/java/org/lflang/federated/launcher/FedLauncherGe…
ChadliaJerad Feb 22, 2024
51eb135
Update test/C/src/federated/transient/TransientHotSwap.lf
ChadliaJerad Feb 22, 2024
e7b9505
Address review by removing FIXMEs and open an issue instead
ChadliaJerad Feb 22, 2024
3624e6b
Address review by removing period from TransientExec in transients te…
ChadliaJerad Feb 22, 2024
740e006
Reduce the probability of flaky failiures due to indeterminate amount…
ChadliaJerad Feb 22, 2024
de3c0ba
Fix TransientHotSwap documentation based on review
ChadliaJerad Feb 22, 2024
ad48c81
Apply spotless
ChadliaJerad Feb 22, 2024
1671246
Fix TransientDownstreamWithTwoUpstreams error condition to account do…
ChadliaJerad Feb 22, 2024
c99fe39
Add TransientStatePersistence test and align reactor-c
ChadliaJerad Feb 29, 2024
2f0be1c
Apply Spotless
ChadliaJerad Feb 29, 2024
b1a7436
Typo + Adjust message
ChadliaJerad Mar 18, 2024
5c1d050
Use lf_tag_effective_start() instead of lf_get_effective_start_tag()
ChadliaJerad Mar 18, 2024
35903ab
Fix comment
ChadliaJerad Mar 18, 2024
ff93cd7
Minor updates to transient tests
ChadliaJerad Mar 18, 2024
4d8849f
Add authentication to TransientDownstreamWithTimer.lf test
ChadliaJerad Apr 24, 2024
9167a31
TransientHotSwap test uses authentication + Align reactorC
ChadliaJerad May 18, 2024
6267fcb
Fix the usage of authentication is transient tests
ChadliaJerad Jun 19, 2024
d518b37
Include LF_FEDERATES_BIN_DIRECTORY in cmake for federaes + Align reac…
ChadliaJerad Jun 20, 2024
3c5a634
Align reactor-c
ChadliaJerad Dec 30, 2024
428fd00
Make federates bin directory visible
ChadliaJerad Feb 20, 2024
7d8638e
Include LF_FEDERATES_BIN_DIRECTORY is cmake for federaes + Align reac…
ChadliaJerad Jun 20, 2024
7dca421
Support zero-delay cycles
edwardalee Jul 15, 2024
07fd0cf
Fixed compile and Docker errors
edwardalee Jul 15, 2024
1ce4da7
Format
edwardalee Jul 15, 2024
8390155
Fix code printing of eroDelayCycleNetworkUpstreamFeds
ChadliaJerad Jul 17, 2024
1e6a1b1
Corrected upstream settings
edwardalee Jul 17, 2024
9cf954d
Fix merge of maybeQuote in CCmpiler + Align reactor-c
ChadliaJerad Jul 24, 2024
d1ac2e7
Revert quotes specification in cmakeOptions()
ChadliaJerad Aug 7, 2024
ec3b190
Remove no more needed import
ChadliaJerad Aug 7, 2024
2e349d2
Update the preamble in transients tests
ChadliaJerad Aug 7, 2024
ce66d8b
Remove compile definition of the federate bin path + Align reactor-c
ChadliaJerad Aug 7, 2024
aa8a2ee
Run spotles
ChadliaJerad Aug 7, 2024
2b8cb9b
Apply formatter
ChadliaJerad Aug 14, 2024
060c7e9
Apply spotless
ChadliaJerad Dec 2, 2024
34b6cb6
Attempt to pass tests by manually adding prototypes to lf code
ChadliaJerad Dec 2, 2024
9705333
Attempt to fix redundant declaration error
ChadliaJerad Dec 2, 2024
b08a78a
Removed lf_get_federates_bin_directory. Use LF_FED_PACKAGE_DIRECTORY
edwardalee Dec 2, 2024
58ca5b1
Debugging state persistence in CI
ChadliaJerad Dec 4, 2024
7d68906
More output in State Persistence test + Apply Spotless
ChadliaJerad Dec 4, 2024
84a96c3
Fix error in TransientStatePersistence
ChadliaJerad Dec 5, 2024
9212264
Avoid name tangling when running CCPP tests
ChadliaJerad Dec 5, 2024
418afdb
Try refactoring TransientStatePersistence test
ChadliaJerad Dec 5, 2024
6a943a5
Cleaned up lf_get_federation_id
edwardalee Dec 8, 2024
8da5c8a
Fix messages order in TransientStatePersistence test + format + align…
ChadliaJerad Dec 9, 2024
961f0a4
Better logical ordering of the reactions in transients tests + align …
ChadliaJerad Dec 11, 2024
ff68011
Cleanup after rebase
ChadliaJerad Jan 3, 2025
93b5719
Aligne reactor-c
ChadliaJerad Jan 3, 2025
322bc2b
Align reactr-c
ChadliaJerad Jan 4, 2025
a382d29
Merge branch 'master' into transient-fed
ChadliaJerad Jan 4, 2025
4e33e86
Align reactor-c
ChadliaJerad Jan 4, 2025
141a420
Align reactor-c
ChadliaJerad Jan 4, 2025
ea39b50
Align reactor-c
ChadliaJerad Jan 4, 2025
779df68
Align reactor-c
ChadliaJerad Jan 5, 2025
00e2492
Merge branch 'master' into transient-fed
ChadliaJerad Jan 13, 2025
b19c602
Fix adding LF_SOURCE_GEN_DIRECTORY flag to cmake
ChadliaJerad Jan 13, 2025
17413f7
Merge branch 'master' into transient-fed
ChadliaJerad Jan 23, 2025
b567efe
Align reactor-cpp
ChadliaJerad Jan 23, 2025
f304a44
Merge branch 'update-github-actions' into transient-fed
ChadliaJerad Jan 23, 2025
935b2e5
Merge branch 'master' into transient-fed
ChadliaJerad Jan 24, 2025
ea4a0ae
Merge branch 'master' into transient-fed
ChadliaJerad Jan 28, 2025
fc44ae5
Align reactor-c
ChadliaJerad Jan 31, 2025
aadc928
Align reactor-c
ChadliaJerad Jan 31, 2025
dd4fb0c
Report enclave errors on appropriate object. Align reactor-c
edwardalee Jan 1, 2026
4802f34
Spotless
edwardalee Jan 1, 2026
a8eb573
Merge pull request #2577 from lf-lang/enclave-error-reporting
edwardalee Jan 1, 2026
cc14467
Support cmake-args target property
lsk567 Jan 10, 2026
30568a6
Make trace-plugin property a dictionary that specifies package, libra…
lsk567 Jan 11, 2026
b2f515b
Convert relative plugin installation paths to absolute paths
lsk567 Jan 11, 2026
a5345a3
Bump reactor-c
lsk567 Jan 12, 2026
3c76659
Add CI workflow for trace plugin tests
lsk567 Jan 18, 2026
a1d1d77
Merge remote-tracking branch 'origin/master' into live-tracing2
lsk567 Jan 18, 2026
1dbce71
Spotless
lsk567 Jan 18, 2026
6743eab
Skip synthesized tests, add custom target property tests for trace-pl…
lsk567 Jan 19, 2026
4a84cfd
Fix ROS2 C++ build by using consistent reactor-cpp package name
lsk567 Jan 19, 2026
a03c741
Fix bug with includes for custom port types
edwardalee Jan 19, 2026
20b6805
Spotless
edwardalee Jan 19, 2026
ab60ebd
Fix bug with inherited reactor resources
edwardalee Jan 19, 2026
cce4a62
Disable ROS2 test
edwardalee Jan 20, 2026
28f7771
Second attempt to disable ROS2 tests
edwardalee Jan 20, 2026
62ea293
Another attempt to disable ROS2 testsgit status
edwardalee Jan 20, 2026
9b92d03
Spotless
edwardalee Jan 21, 2026
5238187
Fix ROS2 C++ build and coverage collection
lsk567 Jan 21, 2026
39b1221
Merge pull request #2580 from lf-lang/fix-ros2-cpp-build
lsk567 Jan 21, 2026
3082c95
Merge branch 'master' into live-tracing2
lsk567 Jan 21, 2026
89b8712
Update reactor-c
lsk567 Jan 21, 2026
451f5a9
Revert "Merge pull request #2580 from lf-lang/fix-ros2-cpp-build"
lsk567 Jan 22, 2026
0fedce5
bump reactor-cpp
cmnrd Jan 23, 2026
d8e6e08
drop ROS2 tests from CI
cmnrd Jan 23, 2026
8f804ec
Merge pull request #2581 from lf-lang/revert-pr-2580
edwardalee Jan 23, 2026
28daf14
Merge branch 'master' into top-level-preambles
edwardalee Jan 23, 2026
6747ef8
Prevent re-adding ROS tests
edwardalee Jan 23, 2026
5406e41
De-duplicate code
edwardalee Jan 23, 2026
29b3550
Merge pull request #2579 from lf-lang/top-level-preambles
edwardalee Jan 23, 2026
9f96a43
Update .github/workflows/trace-plugin-tests.yml
lsk567 Jan 27, 2026
0a41a5a
Merge branch 'master' into live-tracing2
lsk567 Jan 27, 2026
fd21997
Merge pull request #2578 from lf-lang/live-tracing2
lsk567 Jan 27, 2026
cd6a719
Relativize trace-plugin paths for federated builds
lsk567 Jan 30, 2026
8076fe8
Fix memory bug with fixed-sized arrays with after
edwardalee Feb 3, 2026
fdf2c36
Align reactor-c
edwardalee Feb 3, 2026
98e43f2
Revert to reactor-c main
edwardalee Feb 3, 2026
c007452
Revert back to whatever reactor-c master was using
edwardalee Feb 3, 2026
114b2f2
Merge pull request #2585 from lf-lang/fix/relativize-trace-plugin-paths
edwardalee Feb 3, 2026
22e8bc9
Revert to reactor-c main
edwardalee Feb 3, 2026
66b52f8
Merge branch 'master' into fixed-arrays
edwardalee Feb 3, 2026
d032f77
Merge pull request #2588 from lf-lang/fixed-arrays
edwardalee Feb 4, 2026
158c0bd
Added support for time and int command-line parameters
edwardalee Feb 20, 2026
3eec6df
Spotless
edwardalee Feb 20, 2026
a1d49e4
Added command-line -h and --help message
edwardalee Feb 20, 2026
d584a8d
Avoid command-line enhancements for platforms that don't support it
edwardalee Feb 21, 2026
19e8086
Check for name collisions in validator
edwardalee Feb 21, 2026
5f78814
Added support for overriding deadlines
edwardalee Feb 21, 2026
6381ad0
Error out on trying to change port/bank width on the command line
edwardalee Feb 21, 2026
6ce7ec4
Support command-line args for federates
edwardalee Feb 21, 2026
87ce8d5
Fix parameter overrides for Python
edwardalee Feb 22, 2026
f25ab9f
spotless and align reactor-c
edwardalee Feb 22, 2026
b01b36e
Use literal param values for Python target
edwardalee Feb 22, 2026
ce2ad2a
Support min_delay and min_spacing overrides on the command-line
edwardalee Feb 22, 2026
7d5a362
Refactoring to generate less code and remove code duplication
edwardalee Feb 22, 2026
5355bb0
Added CLI support for float and double parameters
edwardalee Feb 22, 2026
d94b10b
Added CLI param override for string and bool
edwardalee Feb 22, 2026
95647bc
Align reactor-c to main
edwardalee Feb 22, 2026
b2f88d5
Address issues raised by Copilot
edwardalee Feb 23, 2026
38743be
Spotless
edwardalee Feb 23, 2026
4e8e63a
Merge pull request #2591 from lf-lang/command-line-params
edwardalee Feb 24, 2026
fb1eb1a
Merge remote-tracking branch 'origin/master' into transient-fed-merge
edwardalee Feb 26, 2026
92d1a46
Align reactor-c
edwardalee Feb 27, 2026
901b622
Removed extra quoting of path variables
edwardalee Feb 27, 2026
f203797
Merge pull request #2593 from lf-lang/transient-fed-merge
edwardalee Mar 1, 2026
b48cead
Align reactor-c to merged reactor-c
edwardalee Feb 26, 2026
b35122f
Merge branch 'refresh' into transient-fed
kushalpaliwal01 Mar 2, 2026
28699ab
Add compiler support for RTI-driven transient federate launch
kushalpaliwal01 Mar 30, 2026
2c92bab
Merge branch 'sst' of https://github.com/lf-lang/lingua-franca into t…
kushalpaliwal01 Apr 1, 2026
e3485a1
Merge branch 'sst' of https://github.com/lf-lang/lingua-franca into t…
kushalpaliwal01 Apr 3, 2026
b77d316
resolved merge conflict in DictionaryType enum
kushalpaliwal01 Apr 3, 2026
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
43 changes: 0 additions & 43 deletions .github/workflows/cpp-ros2-tests.yml

This file was deleted.

4 changes: 0 additions & 4 deletions .github/workflows/only-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,3 @@ jobs:
uses: ./.github/workflows/cpp-tests.yml
with:
all-platforms: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}

# Run the C++ integration tests on ROS2.
cpp-ros2-tests:
uses: ./.github/workflows/cpp-ros2-tests.yml
19 changes: 19 additions & 0 deletions .github/workflows/trace-plugin-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Trace plugin tests

on:
push:
branches:
- master
pull_request:
types: [synchronize, opened, reopened, ready_for_review, converted_to_draft]
workflow_dispatch:

concurrency:
group: trace-plugin-${{ github.ref }}-${{ github.run_id }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
trace-plugin-tests:
uses: lf-lang/lf-trace-xronos/.github/workflows/ci.yml@main
with:
lf-ref: ${{ github.event.pull_request.head.sha || github.sha }}
137 changes: 137 additions & 0 deletions core/src/integrationTest/java/org/lflang/tests/runtime/CCliTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
package org.lflang.tests.runtime;

import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.lflang.target.Target;
import org.lflang.tests.LFTest;
import org.lflang.tests.LFTest.Result;
import org.lflang.tests.TestBase;
import org.lflang.tests.TestError;
import org.lflang.util.LFCommand;

/**
* Integration tests for command-line parameter override functionality.
*
* <p>Verifies that main reactor parameters can be overridden via command-line arguments and that
* the overridden values propagate correctly to child reactors, including timers and deadlines.
*
* <p>Uses a ThreadLocal so that the CLI arguments set in each test method are visible to the
* runner instance created reflectively by {@link TestBase#runSingleTestAndPrintResults}, which
* executes on the same thread. This is safe for concurrent test execution.
*
* @author Edward A. Lee
*/
public class CCliTest extends TestBase {

private static final ThreadLocal<List<String>> cliArgs = ThreadLocal.withInitial(List::of);

@AfterEach
void resetCliArgs() {
cliArgs.remove();
}

public CCliTest() {
super(Target.C);
}

@Override
protected ProcessBuilder getExecCommand(LFTest test) throws TestError {
LFCommand command = test.getFileConfig().getCommand();
if (command == null) {
throw new TestError("File: " + test.getFileConfig().getExecutable(), Result.NO_EXEC_FAIL);
}
List<String> cmdList = new ArrayList<>(command.command());
cmdList.addAll(cliArgs.get());
return new ProcessBuilder(cmdList).directory(command.directory());
}

/**
* Test that --period, --expected, and --value override timer behavior and double parameter.
* With defaults (period=1s, expected=6, value=3.14159), overriding to period=500ms changes
* the firing count to 11, and overriding value=2.71828 changes the double sent on each output.
*/
@Test
public void testCommandLineParameterOverride() {
cliArgs.set(List.of("--period", "500", "msec", "--expected", "11", "--value", "2.71828"));
Path testFile = Path.of("test/C/src/CommandLineParam.lf").toAbsolutePath();
LFTest test = new LFTest(testFile);
runSingleTestAndPrintResults(test, CCliTest.class, TestLevel.EXECUTION);
}

/**
* Test that --min_delay and --min_spacing override action timing. With defaults (min_delay=1ns,
* min_spacing=10ns), overriding to min_delay=10us and min_spacing=100us changes when the action
* fires. The test verifies that elapsed times match the overridden values.
*/
@Test
public void testCommandLineActionOverride() {
cliArgs.set(List.of("--min_delay", "10", "us", "--min_spacing", "100", "us"));
Path testFile = Path.of("test/C/src/CommandLineAction.lf").toAbsolutePath();
LFTest test = new LFTest(testFile);
runSingleTestAndPrintResults(test, CCliTest.class, TestLevel.EXECUTION);
}

/**
* Test that --deadline_time and --execution_time override deadline behavior. With defaults
* (execution_time=100ms, deadline_time=50ms) a deadline violation occurs. The CLI override
* sets execution_time=10ms and deadline_time=200ms, so NO violation occurs, proving both
* overrides took effect.
*/
@Test
public void testCommandLineDeadlineOverride() {
cliArgs.set(
List.of(
"--execution_time",
"10",
"msec",
"--deadline_time",
"500",
"msec",
"--expect_violation",
"0"));
Path testFile = Path.of("test/C/src/CommandLineDeadline.lf").toAbsolutePath();
LFTest test = new LFTest(testFile);
runSingleTestAndPrintResults(test, CCliTest.class, TestLevel.EXECUTION);
}

/**
* Test that --value and --use_default override string and bool parameters.
* With default use_default=false and value="Hello, world!", overriding value to "Goodbye!"
* should cause the Print reactor to expect "Goodbye!".
* Running with --use_default true should ignore the value parameter and use the hardcoded default.
*/
@Test
public void testCommandLineStringBoolOverride() {
cliArgs.set(List.of("--value", "Goodbye!", "--use_default", "false"));
Path testFile = Path.of("test/C/src/CommandLineStringBool.lf").toAbsolutePath();
LFTest test = new LFTest(testFile);
runSingleTestAndPrintResults(test, CCliTest.class, TestLevel.EXECUTION);
}

/**
* Test that CLI overrides propagate through the launch script in federated execution. With
* defaults (execution_time=100ms, deadline_time=50ms) a deadline violation occurs. The CLI
* override sets execution_time=10ms and deadline_time=500ms with expect_violation=0, so
* NO violation occurs, proving the launch script forwards arguments to federates.
*/
@Test
public void testCommandLineDeadlineFederatedOverride() {
cliArgs.set(
List.of(
"--execution_time",
"10",
"msec",
"--deadline_time",
"500",
"msec",
"--expect_violation",
"0"));
Path testFile =
Path.of("test/C/src/federated/CommandLineDeadlineFederated.lf").toAbsolutePath();
LFTest test = new LFTest(testFile);
runSingleTestAndPrintResults(test, CCliTest.class, TestLevel.EXECUTION);
}
}
5 changes: 5 additions & 0 deletions core/src/main/java/org/lflang/AttributeUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ public static boolean isSparse(EObject node) {
return findAttributeByName(node, "sparse") != null;
}

/** Return true if the node has an {@code @transient} attribute. */
public static boolean isTransient(Instantiation node) {
return findAttributeByName(node, "transient") != null;
}

/**
* Return true if the reactor is marked to be a federate.
*
Expand Down
45 changes: 41 additions & 4 deletions core/src/main/java/org/lflang/federated/extensions/CExtension.java
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ public String generatePortAbsentReactionBody(
+ receivingPortID
+ ", "
+ connection.getDstFederate().id
+ ", (long long) lf_time_logical_elapsed());",
+ ", lf_time_logical_elapsed());",
"if (" + sendRef + " == NULL || !" + sendRef + "->is_present) {",
"LF_PRINT_LOG(\"The output port is NULL or it is not present.\");",
" lf_send_port_absent_to_federate("
Expand Down Expand Up @@ -556,15 +556,33 @@ protected String makePreamble(
// that handles incoming network messages destined to the specified
// port. This will only be used if there are federates.
int numOfNetworkActions = federate.networkMessageActions.size();
int numZDCNetworkActions = federate.zeroDelayCycleNetworkMessageActions.size();
code.pr(
"""
interval_t _lf_action_delay_table[%1$s];
lf_action_base_t* _lf_action_table[%1$s];
size_t _lf_action_table_size = %1$s;
lf_action_base_t* _lf_zero_delay_cycle_action_table[%2$s];
size_t _lf_zero_delay_cycle_action_table_size = %2$s;
"""
.formatted(numOfNetworkActions, federate.zeroDelayCycleNetworkMessageActions.size()));
.formatted(numOfNetworkActions));
if (numZDCNetworkActions > 0) {
code.pr(
"""
lf_action_base_t* _lf_zero_delay_cycle_action_table[%1$s];
size_t _lf_zero_delay_cycle_action_table_size = %1$s;
uint16_t _lf_zero_delay_cycle_upstream_ids[%1$s];
bool _lf_zero_delay_cycle_upstream_disconnected[%1$s] = { false };
"""
.formatted(numZDCNetworkActions));
} else {
// Make sure these symbols are defined, even though only size will be used.
code.pr(
"""
lf_action_base_t** _lf_zero_delay_cycle_action_table = NULL;
size_t _lf_zero_delay_cycle_action_table_size = 0;
uint16_t* _lf_zero_delay_cycle_upstream_ids = NULL;
bool* _lf_zero_delay_cycle_upstream_disconnected = NULL;
""");
}

int numOfNetworkReactions = federate.networkReceiverReactions.size();
code.pr(
Expand Down Expand Up @@ -732,6 +750,25 @@ else if (globalSTP instanceof CodeExprImpl)
}
// Set global variable identifying the federate.
code.pr("_lf_my_fed_id = " + federate.id + ";");
// Set indicator variable that specifies whether the federate is transient or not.
code.pr("_fed.is_transient = " + federate.isTransient + ";");

// Emit initialization code for _fed.port_to_transient_feds_mapping: for each output port,
// record the IDs of transient downstream federates so the runtime can look them up.
int keyCount = 0;
for (String portName: federate.portNameTransientFedIdsMapping.keySet()) {
code.pr(String.format("_fed.port_to_transient_feds_mapping[%d].port_name = \"%s\" ;", keyCount, portName));
int numTransients = federate.portNameTransientFedIdsMapping.get(portName).size();
code.pr(String.format("_fed.port_to_transient_feds_mapping[%d].transient_fed_id = (uint16_t*)malloc(sizeof(uint16_t) * %d);", keyCount, numTransients));
int idCount = 0;
for(int fedId: federate.portNameTransientFedIdsMapping.get(portName)) {
code.pr(String.format("_fed.port_to_transient_feds_mapping[%d].transient_fed_id[%d] = %d;", keyCount, idCount, fedId));
idCount += 1;
}
code.pr(String.format("_fed.port_to_transient_feds_mapping[%d].num_of_transients = %d;", keyCount, idCount));
keyCount += 1;
}
code.pr(String.format("_fed.port_map_size = %d;",keyCount));

// We keep separate record for incoming and outgoing p2p connections to allow incoming traffic
// to be processed in a separate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ public static String initializeTriggersForNetworkActions(
CodeBuilder code = new CodeBuilder();
if (!federate.networkMessageActions.isEmpty()) {
var actionTableCount = 0;
var zeroDelayActionTableCount = 0;
for (int i = 0; i < federate.networkMessageActions.size(); ++i) {
// Find the corresponding ActionInstance.
Action action = federate.networkMessageActions.get(i);
Expand All @@ -83,10 +82,17 @@ public static String initializeTriggersForNetworkActions(
// Set the ID of the source federate.
code.pr(
trigger + ".source_id = " + federate.networkMessageSourceFederate.get(i).id + "; \\");
if (federate.zeroDelayCycleNetworkMessageActions.contains(action)) {
int j = federate.zeroDelayCycleNetworkMessageActions.indexOf(action);
if (j >= 0) {
var upstream = federate.zeroDelayCycleNetworkUpstreamFeds.get(j);
code.pr("_lf_zero_delay_cycle_upstream_ids[" + j + "] = " + upstream.id + "; \\");
if (upstream.isTransient) {
// Transient federates are assumed to be initially disconnected.
code.pr("_lf_zero_delay_cycle_upstream_disconnected[" + j + "] = true; \\");
}
code.pr(
"_lf_zero_delay_cycle_action_table["
+ zeroDelayActionTableCount++
+ j
+ "] = (lf_action_base_t*)&"
+ trigger
+ "; \\");
Expand Down Expand Up @@ -152,7 +158,8 @@ public static String stpStructs(FederateInstance federate) {
*/
public static String createPortStatusFieldForInput(Input input) {
StringBuilder builder = new StringBuilder();
// If it is not a multiport, then we could re-use the port trigger, and nothing needs to be done
// If it is not a multiport, then we could re-use the port trigger, and nothing
// needs to be done
if (ASTUtils.isMultiport(input)) {
// If it is a multiport, then create an auxiliary list of port
// triggers for each channel of
Expand Down Expand Up @@ -241,12 +248,13 @@ static boolean clockSyncIsOn(FederateInstance federate, RtiConfig rtiConfig) {
*
* <p>Clock synchronization can be enabled using the clock-sync target property.
*
* @see <a
* href="https://github.com/icyphy/lingua-franca/wiki/Distributed-Execution#clock-synchronization">Documentation</a>
* @see <a href=
* "https://github.com/icyphy/lingua-franca/wiki/Distributed-Execution#clock-synchronization">Documentation</a>
*/
public static void initializeClockSynchronization(
FederateInstance federate, RtiConfig rtiConfig, MessageReporter messageReporter) {
// Check if clock synchronization should be enabled for this federate in the first place
// Check if clock synchronization should be enabled for this federate in the
// first place
if (clockSyncIsOn(federate, rtiConfig)) {
messageReporter
.nowhere()
Expand All @@ -272,8 +280,8 @@ public static void initializeClockSynchronization(
*
* <p>Clock synchronization can be enabled using the clock-sync target property.
*
* @see <a
* href="https://github.com/icyphy/lingua-franca/wiki/Distributed-Execution#clock-synchronization">Documentation</a>
* @see <a href=
* "https://github.com/icyphy/lingua-franca/wiki/Distributed-Execution#clock-synchronization">Documentation</a>
*/
public static void addClockSyncCompileDefinitions(FederateInstance federate) {

Expand Down Expand Up @@ -316,8 +324,15 @@ public static void generateCMakeInclude(
"add_compile_definitions(LF_SOURCE_DIRECTORY=\"" + fileConfig.srcPath + "\")");
cmakeIncludeCode.pr(
"add_compile_definitions(LF_PACKAGE_DIRECTORY=\"" + fileConfig.srcPkgPath + "\")");
// After federates have been divided, their root package directory is different.
cmakeIncludeCode.pr(
"add_compile_definitions(LF_SOURCE_GEN_DIRECTORY=\"" + fileConfig.getSrcGenPath() + "\")");
"add_compile_definitions(LF_FED_PACKAGE_DIRECTORY=\""
+ fileConfig.srcPkgPath
+ File.separator
+ "fed-gen"
+ File.separator
+ fileConfig.name
+ "\")");
cmakeIncludeCode.pr("add_compile_definitions(LF_FILE_SEPARATOR=\"" + File.separator + "\")");
try (var srcWriter = Files.newBufferedWriter(cmakeIncludePath)) {
srcWriter.write(cmakeIncludeCode.getCode());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,10 @@ private static void addNetworkReceiverReactor(
connection.dstFederate.networkMessageSourceFederate.add(connection.srcFederate);
connection.dstFederate.networkMessageActionDelays.add(connection.getDefinition().getDelay());
if (connection.srcFederate.isInZeroDelayCycle()
&& connection.getDefinition().getDelay() == null)
&& connection.getDefinition().getDelay() == null) {
connection.dstFederate.zeroDelayCycleNetworkMessageActions.add(networkAction);

connection.dstFederate.zeroDelayCycleNetworkUpstreamFeds.add(connection.srcFederate);
}
// Get the largest STAA for any reaction triggered by the destination port.
TimeValue maxSTAA = findMaxSTAA(connection, coordination);

Expand Down
Loading