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

Support zero-delay cycles #468

Merged
merged 60 commits into from
Jan 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
38fa47c
Start on adding federate type (transient or not)
ChadliaJerad Feb 1, 2024
8ba6499
Add cmdline argument -nt to RTI and add nbr_transient_federates attri…
ChadliaJerad Feb 1, 2024
7250f37
Differentiate between connecting to persistent federates and transien…
ChadliaJerad Feb 1, 2024
c5d6c3c
Add support of the effective_start_tag cont.
ChadliaJerad Feb 1, 2024
2c67650
Federate shares its type (persistent or transient)
ChadliaJerad Feb 1, 2024
fc7f2a7
Granting TAG or PTAGs can be delayed if one of the upstream federates…
ChadliaJerad Feb 15, 2024
37d0bcf
Start on enabling the hot swap mechanism
ChadliaJerad Feb 15, 2024
f99ca52
More on the hot swap mechanism + various fixes
ChadliaJerad Feb 15, 2024
5de242d
RTI can sent a request for immediate stop. This is required by the ho…
ChadliaJerad Feb 15, 2024
d5b26de
A federate can get its id, its effective_start_time, and the start_ti…
ChadliaJerad Feb 16, 2024
f286539
Fix the use of lf_stop()
ChadliaJerad Feb 19, 2024
e8b4a81
Attemp to fix the hot swap mechanism
ChadliaJerad Feb 20, 2024
ecc3680
Code review: remove redundancy and add has_transient_upstream_federats
ChadliaJerad Feb 29, 2024
38f25d1
Add comments and more formatting
ChadliaJerad Mar 14, 2024
693f189
Fix bugs due to rebase + Tracepoint lf_stop()
ChadliaJerad Mar 14, 2024
e299261
Use a tag queue to manage delayed grants
ChadliaJerad Mar 3, 2024
286c999
Fix missing code from the previous commit
ChadliaJerad Mar 15, 2024
a2b14d0
Fix implicit declaration error by moving lf_stop(), lf_get_federates_…
ChadliaJerad Mar 18, 2024
f400d25
Fix merge
ChadliaJerad Apr 12, 2024
5bb32b4
Support zero-delay cycles
edwardalee Jul 15, 2024
64921a5
Fix the type of _lf_zero_delay_cycle_action_table_size iterator to be…
ChadliaJerad Jul 15, 2024
f4e6090
Removed unnecessary parens
edwardalee Jul 15, 2024
ca93b7c
Run clang formatter
ChadliaJerad Jul 17, 2024
224d0b0
Fixed thread interactions
edwardalee Jul 17, 2024
1d30293
Format
edwardalee Jul 17, 2024
cb380f9
Fix mutex access in lf_delayed_grants()
ChadliaJerad Jul 18, 2024
5094663
Made functions static and use free function for queue
edwardalee Jul 18, 2024
c2ae14b
Added max function
edwardalee Jul 19, 2024
5427721
Revert to holding mutex plus general cleanups
edwardalee Jul 19, 2024
c92b62e
Hold mutex and notify downstream not upstream
edwardalee Jul 19, 2024
f33d44e
Fix the pqueue tag iterator type
ChadliaJerad Jul 24, 2024
844a70d
Fix condition 2 for computing the effective start time of a transient…
ChadliaJerad Jul 24, 2024
bfceff7
Update lingua-franca-ref.txt
ChadliaJerad Jul 24, 2024
01800c3
Revert to 0 microstep
edwardalee Jul 27, 2024
9fa202a
Fix lf_get_federates_bin_directory() + Fix its scope, as well as lf_g…
ChadliaJerad Aug 7, 2024
2b16561
Remove no more needed LF_FEDERATED_BIN_DIRECTORY
ChadliaJerad Aug 7, 2024
213f814
Run Clang formatter
ChadliaJerad Aug 7, 2024
a4dd1a1
Remove overlooked code when merging
ChadliaJerad Aug 14, 2024
c95d25d
Handle corner cases where connection messages about transients are re…
ChadliaJerad Aug 21, 2024
c9fb4fa
Reset timing info from previous runs
ChadliaJerad Aug 21, 2024
98e68f8
Skip checking the satet in the first call of _update_min_delays_upsteam
ChadliaJerad Aug 21, 2024
586a4e1
Invalidate min delays of all federates once a tansient joins
ChadliaJerad Aug 28, 2024
7a593c3
Do not skip the node itself in _updat_min_delays
ChadliaJerad Aug 28, 2024
891a95a
Removed duplicated function
ChadliaJerad Dec 2, 2024
301b2b2
Formatting
ChadliaJerad Dec 2, 2024
fb0bc94
Attempt to pass tests by manually adding prototypes to lf code
ChadliaJerad Dec 2, 2024
23a15d3
Removed lf_get_federates_bin_directory. Use LF_FED_PACKAGE_DIRECTORY
edwardalee Dec 2, 2024
8a71611
Do not account for absent trnsients when calculating efimt
ChadliaJerad Dec 4, 2024
514abbb
Restored declaration of lf_get_federation_id
edwardalee Dec 8, 2024
1bd28e8
Attempt to make sure a persistent knows that a transient joined
ChadliaJerad Dec 9, 2024
21becf3
Fix send_start_tag() function name, comments, and actions ordering
ChadliaJerad Dec 10, 2024
060a85d
Fix message ordering in send_start_tag_locked() + apply suggestions t…
ChadliaJerad Dec 11, 2024
15c6474
Allow federate to handle that an upstream has connected or disconnect…
ChadliaJerad Dec 11, 2024
0643ca9
Format?!
ChadliaJerad Dec 11, 2024
dcf99da
Formatting using clang-format-19
ChadliaJerad Dec 11, 2024
a869e79
Fix dropping the message when a transient's effective start tag is no…
ChadliaJerad Dec 11, 2024
3d31b31
Simplify the code of message dropping in the remote RTI.
ChadliaJerad Dec 13, 2024
fe03b3f
Account for delay when dropping a message to be forwarded to a transi…
ChadliaJerad Dec 16, 2024
09d31fe
Cleanup after rebase
ChadliaJerad Jan 3, 2025
6893de6
Fix segmentation fault and use accept_ocket() when connecting to trab…
ChadliaJerad Jan 3, 2025
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
1 change: 0 additions & 1 deletion core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ define(SCHEDULER)
define(LF_SOURCE_DIRECTORY)
define(LF_SOURCE_GEN_DIRECTORY)
define(LF_PACKAGE_DIRECTORY)
define(LF_FEDERATES_BIN_DIRECTORY)
define(LF_FILE_SEPARATOR)
define(WORKERS_NEEDED_FOR_FEDERATE)
define(LF_ENCLAVES)
8 changes: 4 additions & 4 deletions core/federated/RTI/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void usage(int argc, const char* argv[]) {
lf_print(" -n, --number_of_federates <n>");
lf_print(" The number of federates in the federation that this RTI will control.\n");
lf_print(" -nt, --number_of_transient_federates <n>");
lf_print(" The number of federates that are transient; this must be strictly less than the number of federates.\n");
lf_print(" The number of transient federates in the federation that this RTI will control.\n");
lf_print(" -p, --port <n>");
lf_print(" The port number to use for the RTI. Must be larger than 0 and smaller than %d. Default is %d.\n",
UINT16_MAX, DEFAULT_PORT);
Expand Down Expand Up @@ -242,7 +242,7 @@ int process_args(int argc, const char* argv[]) {
}
i++;
long num_transient_federates = strtol(argv[i], NULL, 10);
if (num_transient_federates < 0L || num_transient_federates == LONG_MAX || num_transient_federates == LONG_MIN) {
if (num_transient_federates == LONG_MAX || num_transient_federates == LONG_MIN) {
lf_print_error("--number_of_transient_federates needs a valid positive or null integer argument.");
usage(argc, argv);
return 0;
Expand Down Expand Up @@ -294,8 +294,8 @@ int process_args(int argc, const char* argv[]) {
usage(argc, argv);
return 0;
}
if (rti.number_of_transient_federates >= rti.base.number_of_scheduling_nodes) {
lf_print_error("--number_of_transient_federates cannot be higher or equal to the number of federates.");
if (rti.number_of_transient_federates > rti.base.number_of_scheduling_nodes) {
lf_print_error("--number_of_transient_federates cannot be higher than the number of federates.");
usage(argc, argv);
return 0;
}
Expand Down
2 changes: 2 additions & 0 deletions core/federated/RTI/rti_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ tag_t earliest_future_incoming_message_tag(scheduling_node_t* e) {
for (int i = 0; i < e->num_min_delays; i++) {
// Node e->min_delays[i].id is upstream of e with min delay e->min_delays[i].min_delay.
scheduling_node_t* upstream = rti_common->scheduling_nodes[e->min_delays[i].id];
if (upstream->state == NOT_CONNECTED)
continue;
// If we haven't heard from the upstream node, then assume it can send an event at the start time.
if (lf_tag_compare(upstream->next_event, NEVER_TAG) == 0) {
tag_t start_tag = {.time = start_time, .microstep = 0};
Expand Down
561 changes: 305 additions & 256 deletions core/federated/RTI/rti_remote.c

Large diffs are not rendered by default.

15 changes: 7 additions & 8 deletions core/federated/RTI/rti_remote.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ typedef enum clock_sync_stat { clock_sync_off, clock_sync_init, clock_sync_on }
/**
* The federation life cycle phases.
*/
typedef enum federation_life_cycle_phase { startup_phase, execution_phase, shutdown_phase } federation_life_cycle_phase;
typedef enum federation_life_cycle_phase {
startup_phase, // Not all persistent federates have joined.
execution_phase, // All persistent federates have joined.
shutdown_phase // Federation is shutting down.
} federation_life_cycle_phase;

/**
* @brief The type for an element in a delayed grants priority queue that is sorted by tag.
Expand Down Expand Up @@ -390,15 +394,15 @@ void* federate_info_thread_TCP(void* fed);
* @param socket_id Pointer to the socket ID.
* @param error_code An error code.
*/
void send_reject(int* socket_id, unsigned char error_code);
void send_reject(int* socket_id, rejection_code_t error_code);

/**
* Wait for one incoming connection request from each (persistent) federate,
* and upon receiving it, create a thread to communicate with that federate.
* Return when all persistent federates have connected.
* @param socket_descriptor The socket on which to accept connections.
*/
void lf_connect_to_persistent_federates(int socket_descriptor);
void* lf_connect_to_persistent_transient_federates_thread(int socket_descriptor);

/**
* Thread to wait for incoming connection request from transient federates.
Expand All @@ -408,11 +412,6 @@ void lf_connect_to_persistent_federates(int socket_descriptor);
*/
void* lf_connect_to_transient_federates_thread(void* nothing);

/**
* Thread that manages the delayed grants using a priprity queue.
*/
void* lf_delayed_grants_thread(void* nothing);

/**
* Thread to respond to new connections, which could be federates of other
* federations who are attempting to join the wrong federation.
Expand Down
Loading
Loading