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

Handle cyclic dependencies by applying the MLAA based execution and TPO level #198

Merged
merged 41 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
ea4e12b
Add port status information to federatePortAction and some functions …
byeonggiljun Jul 19, 2023
97609a2
Add new function for updating the MLAA and add TODOs
byeonggiljun Jul 19, 2023
ab2bf25
Merge branch 'ts-level-assignment' into ts-cyclic-dependencies
byeonggiljun Jul 26, 2023
1a71c0b
Seperate network receiver and sender reactors
byeonggiljun Jul 26, 2023
677169f
Merge branch 'master' into 'ts-cyclic-dependencies'
byeonggiljun Jul 28, 2023
0660ee3
Add last known status tag for network receivers and fill some functions
byeonggiljun Jul 29, 2023
9691783
Update lingua-franca-ref.txt
byeonggiljun Jul 29, 2023
f525493
Fill the function updateMaxLevel and add FIXMEs
byeonggiljun Jul 29, 2023
76cb712
Handle network reactors without a TPO level
byeonggiljun Jul 31, 2023
adf45dc
Prevent executing reactions with lower priority than MLAA
byeonggiljun Aug 1, 2023
2400ed5
Use a network receiver itself to get the priority
byeonggiljun Aug 1, 2023
6f2e027
Allow the top upstream federate can advance its level itself
byeonggiljun Aug 2, 2023
1e51c21
Enabling port absent handling
byeonggiljun Aug 2, 2023
3e496b6
Set `isDone` at the start of the execution
byeonggiljun Aug 2, 2023
f50f436
Update the max level at the start of execution
byeonggiljun Aug 2, 2023
5acc3e6
Do not call `_next()` inside the `updateMaxLevel` function
byeonggiljun Aug 2, 2023
ef2e0cf
Update the max level properly update it when reset ports
byeonggiljun Aug 2, 2023
2fbe162
Call `_next()` after handle TAG and PTAG
byeonggiljun Aug 2, 2023
254ce61
Enqueue port absent reactions before updating the max level
byeonggiljun Aug 3, 2023
2667771
Handling non-reaction leafs in `ReactionGraph` by checking their upst…
byeonggiljun Aug 4, 2023
7c54b34
Add a microstep if we add zero to a tag
byeonggiljun Aug 4, 2023
4d65043
Using the physical time if the action is a physical action
byeonggiljun Aug 4, 2023
a9e9e10
Add comments and clean up
byeonggiljun Aug 4, 2023
84e3ff1
Add a comment for the '_popEvent' function
byeonggiljun Aug 4, 2023
688c9ae
Merge branch 'master' into ts-cyclic-dependencies
byeonggiljun Aug 4, 2023
f66892d
Call `_updateMaxLevel()` before reacting reactions
byeonggiljun Aug 7, 2023
e5e0705
Waiting for PTAG before executing startup reactions
byeonggiljun Aug 8, 2023
88482eb
Minor fix
byeonggiljun Aug 8, 2023
19cdec2
Allow a federate without any connection can advance its tag itself
byeonggiljun Aug 8, 2023
e35e444
Passing LoopDistributedCentralized.lf and PingPongDistributedPhysical.lf
byeonggiljun Aug 8, 2023
a413a9f
Minor fix
byeonggiljun Aug 8, 2023
45d52d4
Call the function `_updateMaxLevel()` only when it's needed
byeonggiljun Aug 9, 2023
f062b9d
Do not insert unnecessary dummy events when receiving ptag
byeonggiljun Aug 10, 2023
3b18b49
Minor fix
byeonggiljun Aug 10, 2023
1a95d5e
Suspend processing of PTAG before starting the execution
byeonggiljun Aug 10, 2023
d31956a
Minor fix
byeonggiljun Aug 10, 2023
05480e3
Merge branch 'master' into ts-cyclic-dependencies
byeonggiljun Aug 11, 2023
00f6092
Update a comment of src/core/action.ts
byeonggiljun Aug 15, 2023
72cdcec
Update error string
byeonggiljun Aug 15, 2023
2243ed7
Renamed variables for clarity and traverse from sources to sinks.
lhstrh Aug 15, 2023
b3c9595
Update src/core/graph.ts
lhstrh Aug 15, 2023
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
2 changes: 1 addition & 1 deletion __tests__/action.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe("Intended tag tests", function () {
const app = new ReactorWithFederatePortAction();
expect(() => {
app._start();
}).toThrowError("FederatedPortAction must have an intended tag from RTI.");
}).toThrowError("No intended tag given while attempting to schedule an event coming from another federate.");
});

it("Intended tag smaller than current tag", function () {
Expand Down
4 changes: 2 additions & 2 deletions __tests__/time.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,12 +310,12 @@ describe("add time value", function () {
expect(
new Tag(oneThousandMS, 0)
.getLaterTag(straightZero)
.isSimultaneousWith(new Tag(oneThousandMS, 0))
.isSimultaneousWith(new Tag(oneThousandMS, 1))
).toBeTruthy();
expect(
new Tag(oneThousandMS, 1)
.getLaterTag(straightZero)
.isSimultaneousWith(new Tag(oneThousandMS, 1))
.isSimultaneousWith(new Tag(oneThousandMS, 2))
).toBeTruthy();
});

Expand Down
2 changes: 1 addition & 1 deletion lingua-franca-ref.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
master
ts-cyclic-dependencies
17 changes: 3 additions & 14 deletions src/core/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,11 @@ export class Action<T> extends ScheduledTrigger<T> implements Read<T> {
tag = tag.getLaterTag(delay);

if (this.action.origin === Origin.physical) {
// If the resulting timestamp from delay is less than the current physical time
// on the platform, then the timestamp becomes the current physical time.
// Otherwise the tag is computed like a logical action's tag.

const physicalTime = getCurrentPhysicalTime();
if (tag.time.isEarlierThan(physicalTime)) {
tag = new Tag(getCurrentPhysicalTime(), 0);
} else {
tag = tag.getMicroStepsLater(1);
}
tag = new Tag(getCurrentPhysicalTime(), 0).getLaterTag(delay);
lhstrh marked this conversation as resolved.
Show resolved Hide resolved
} else if (this.action instanceof FederatePortAction) {
if (intendedTag === undefined) {
throw new Error(
"FederatedPortAction must have an intended tag from RTI."
"No intended tag given while attempting to schedule an event coming from another federate."
);
}
if (
Expand Down Expand Up @@ -132,8 +123,6 @@ export class Action<T> extends ScheduledTrigger<T> implements Read<T> {
)}`
);
tag = intendedTag;
} else if (delay.isEqualTo(TimeValue.zero())) {
tag = tag.getMicroStepsLater(1);
}

Log.debug(
Expand Down Expand Up @@ -198,7 +187,7 @@ export class FederatePortAction<T> extends Action<T> {
constructor(
__parent__: Reactor,
origin: Origin,
minDelay: TimeValue = TimeValue.secs(0)
minDelay: TimeValue = TimeValue.zero()
) {
super(__parent__, origin, minDelay);
}
Expand Down
Loading