From 5194bf1ed2b62cf3ad0d17e1ca5c4042de88033e Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Sun, 1 Oct 2023 16:36:04 -0700 Subject: [PATCH] Fix another mysterious federated execution bug --- .../java/org/lflang/federated/extensions/CExtension.java | 6 ++++-- .../org/lflang/federated/extensions/CExtensionUtils.java | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) 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 f5de233de4..fcec922584 100644 --- a/core/src/main/java/org/lflang/federated/extensions/CExtension.java +++ b/core/src/main/java/org/lflang/federated/extensions/CExtension.java @@ -796,7 +796,9 @@ private String generateCodeToInitializeFederate(FederateInstance federate, RtiCo private String generateCodeForPhysicalActions( FederateInstance federate, MessageReporter messageReporter) { CodeBuilder code = new CodeBuilder(); - if (federate.targetConfig.coordination.equals(CoordinationMode.CENTRALIZED)) { + var coordinationMode = federate.targetConfig.coordination.get(); + var coordinationOptions = federate.targetConfig.coordinationOptions.get(); + if (coordinationMode.equals(CoordinationMode.CENTRALIZED)) { // If this program uses centralized coordination then check // for outputs that depend on physical actions so that null messages can be // sent to the RTI. @@ -819,7 +821,7 @@ private String generateCodeForPhysicalActions( } if (minDelay != TimeValue.MAX_VALUE) { // Unless silenced, issue a warning. - if (federate.targetConfig.coordinationOptions.get().advanceMessageInterval == null) { + if (coordinationOptions.advanceMessageInterval == null) { String message = String.join( "\n", diff --git a/core/src/main/java/org/lflang/federated/extensions/CExtensionUtils.java b/core/src/main/java/org/lflang/federated/extensions/CExtensionUtils.java index db0cb2d0b4..4cc93c2258 100644 --- a/core/src/main/java/org/lflang/federated/extensions/CExtensionUtils.java +++ b/core/src/main/java/org/lflang/federated/extensions/CExtensionUtils.java @@ -192,7 +192,6 @@ public static void handleCompileDefinitions( private static void handleAdvanceMessageInterval(FederateInstance federate) { var advanceMessageInterval = federate.targetConfig.coordinationOptions.get().advanceMessageInterval; - federate.targetConfig.coordinationOptions.reset(); if (advanceMessageInterval != null) { federate.targetConfig.compileDefinitions.put( "ADVANCE_MESSAGE_INTERVAL", String.valueOf(advanceMessageInterval.toNanoSeconds()));