diff --git a/.github/workflows/ts-tests.yml b/.github/workflows/ts-tests.yml index f81db50c19..d02cc145fc 100644 --- a/.github/workflows/ts-tests.yml +++ b/.github/workflows/ts-tests.yml @@ -38,8 +38,7 @@ jobs: if: ${{ runner.os == 'macOS' || runner.os == 'Linux' }} - name: Perform TypeScript tests run: | - ./gradlew targetTest -Ptarget=TypeScript - # -Druntime="git://github.com/lf-lang/reactor-ts.git#master" + ./gradlew targetTest -Ptarget=TypeScript -Druntime="git://github.com/lf-lang/reactor-ts.git#master" - name: Report to CodeCov uses: ./.github/actions/report-code-coverage with: diff --git a/core/src/main/java/org/lflang/federated/extensions/CExtension.java b/core/src/main/java/org/lflang/federated/extensions/CExtension.java index 12edb2e693..9e91349c98 100644 --- a/core/src/main/java/org/lflang/federated/extensions/CExtension.java +++ b/core/src/main/java/org/lflang/federated/extensions/CExtension.java @@ -43,6 +43,7 @@ import org.lflang.federated.generator.FederationFileConfig; import org.lflang.federated.launcher.RtiConfig; import org.lflang.federated.serialization.FedROS2CPPSerialization; +import org.lflang.generator.ActionInstance; import org.lflang.generator.CodeBuilder; import org.lflang.generator.LFGeneratorContext; import org.lflang.generator.ReactorInstance; @@ -60,6 +61,7 @@ import org.lflang.target.property.ClockSyncOptionsProperty; import org.lflang.target.property.CoordinationOptionsProperty; import org.lflang.target.property.CoordinationProperty; +import org.lflang.target.property.DNETProperty; import org.lflang.target.property.FedSetupProperty; import org.lflang.target.property.KeepaliveProperty; import org.lflang.target.property.SingleThreadedProperty; @@ -833,6 +835,22 @@ private String generateCodeForPhysicalActions( outputFound = output; } } + if (federate.targetConfig.getOrDefault(DNETProperty.INSTANCE)) { + ActionInstance found = federate.findPhysicalAction(instance); + if (found != null) { + String warning = + String.join( + "\n", + "Found a physical action inside the federate " + + addDoubleQuotes(instance.getName()), + "and a signal downstream next event tag (DNET) will be used.", + "The signal DNET may increase the lag, the time difference between ", + "the time this physical action is scheduled and the time it is executed, ", + "specifically when this federate has multiple upstream reactors.", + "Consider disabling the signal DNET with a property {DNET: false}."); + messageReporter.at(found.getDefinition()).warning(warning); + } + } if (minDelay != TimeValue.MAX_VALUE) { // Unless silenced, issue a warning. if (coordinationOptions.advanceMessageInterval == null) { diff --git a/core/src/main/java/org/lflang/federated/generator/FederateInstance.java b/core/src/main/java/org/lflang/federated/generator/FederateInstance.java index 4ce02d4793..5b7775719d 100644 --- a/core/src/main/java/org/lflang/federated/generator/FederateInstance.java +++ b/core/src/main/java/org/lflang/federated/generator/FederateInstance.java @@ -647,6 +647,27 @@ private boolean containsAllVarRefs(Iterable varRefs) { return inFederate; } + /** + * Return the first found physical action or null if there is no physical action in this federate. + * + * @param instance The reactor instance to check whether there is a physical action. + */ + public ActionInstance findPhysicalAction(ReactorInstance instance) { + for (ActionInstance action : instance.actions) { + if (action.isPhysical()) { + return action; + } + } + for (ReactorInstance child : instance.children) { + for (ActionInstance action : child.actions) { + if (action.isPhysical()) { + return action; + } + } + } + return null; + } + /** * Find output ports that are connected to a physical action trigger upstream in the same reactor. * Return a list of such outputs paired with the minimum delay from the nearest physical action. diff --git a/core/src/main/java/org/lflang/federated/launcher/FedLauncherGenerator.java b/core/src/main/java/org/lflang/federated/launcher/FedLauncherGenerator.java index 10816dc111..192dcef334 100644 --- a/core/src/main/java/org/lflang/federated/launcher/FedLauncherGenerator.java +++ b/core/src/main/java/org/lflang/federated/launcher/FedLauncherGenerator.java @@ -40,6 +40,7 @@ import org.lflang.target.property.AuthProperty; import org.lflang.target.property.ClockSyncModeProperty; import org.lflang.target.property.ClockSyncOptionsProperty; +import org.lflang.target.property.DNETProperty; import org.lflang.target.property.TracingProperty; import org.lflang.target.property.type.ClockSyncModeType.ClockSyncMode; @@ -323,6 +324,9 @@ private String getRtiCommand(List federates, boolean isRemote) if (targetConfig.getOrDefault(TracingProperty.INSTANCE).isEnabled()) { commands.add(" -t \\"); } + if (!targetConfig.getOrDefault(DNETProperty.INSTANCE)) { + commands.add(" -d \\"); + } commands.addAll( List.of( " -n " + federates.size() + " \\", diff --git a/core/src/main/java/org/lflang/target/Target.java b/core/src/main/java/org/lflang/target/Target.java index 81adb25d3f..1e2e67788f 100644 --- a/core/src/main/java/org/lflang/target/Target.java +++ b/core/src/main/java/org/lflang/target/Target.java @@ -560,6 +560,7 @@ public void initialize(TargetConfig config) { CompilerProperty.INSTANCE, CoordinationOptionsProperty.INSTANCE, CoordinationProperty.INSTANCE, + DNETProperty.INSTANCE, DockerProperty.INSTANCE, FilesProperty.INSTANCE, KeepaliveProperty.INSTANCE, diff --git a/core/src/main/java/org/lflang/target/property/DNETProperty.java b/core/src/main/java/org/lflang/target/property/DNETProperty.java new file mode 100644 index 0000000000..d8c76d7e43 --- /dev/null +++ b/core/src/main/java/org/lflang/target/property/DNETProperty.java @@ -0,0 +1,27 @@ +package org.lflang.target.property; + +/** + * @brief Target property turning on or off the DNET signal optimization. + *

If this target property is true, the RTI sends DNET (downstream next event tag) signals to + * an upstream federate to tell the federate that sending LTC and NET signals with tags less + * than the specified value is unnecessary. The default is true. + */ +public final class DNETProperty extends BooleanProperty { + + /** Singleton target property instance. */ + public static final DNETProperty INSTANCE = new DNETProperty(); + + private DNETProperty() { + super(); + } + + @Override + public Boolean initialValue() { + return true; + } + + @Override + public String name() { + return "DNET"; + } +} diff --git a/core/src/main/resources/lib/c/reactor-c b/core/src/main/resources/lib/c/reactor-c index a70c3d0f06..77ed6d15e4 160000 --- a/core/src/main/resources/lib/c/reactor-c +++ b/core/src/main/resources/lib/c/reactor-c @@ -1 +1 @@ -Subproject commit a70c3d0f06b4ba8a14272e92dbde0c7e224a74ba +Subproject commit 77ed6d15e4176103bdb2b410729c74533b1dbf73