In the synchrophasors branch of the playground, I've pushed a first version of the synchrophasors example.
When consistency is enforced (which happens by default in LF), the data in the browser looks like this:
[x] With the random delay, the web socket gets overwhelmed. Reduce the payload to include only the update.
[x] Put both of these on the same web page. This means creating two Observers, each with a separate web socket port, and routing the PhaseMeasurementUnit output directly to the second observer to get the clean data.
[x] (optional) Add the imaginary part of the phasor data as a second data set. I think this will make the plots much cooler.
[x] Introduce a fault, where one of the PMUs starts malfunctioning. This will be easy to spot on the clean plot, but not on the messy one.
[ ] Measure the lag and display it on the web page for each version. This will be an indicator of how early a fault detection can be made. The messy version will have low lag (high availability), but low consistency, making the fault difficult to spot. The clean version will have higher lag (low availability) and high consistency, making the fault easy to spot, but at the cost of a delay.
[ ] Add a third version that also includes the random network delay, but instead of plotting new data with the most recently received other data, plots the new data with a prediction for each other datum. This illustrates a relaxation of consistency to improve availability, where availability in this case is the ability to see faults as soon as possible.
[x] The network delay + physical connection is simulated with a RandomDelay reactor. I tried running the clean version federated with 51 federates, and, somewhat amazingly, it worked flawlessly. But the data remained clean. There isn't enough timing variability when I run all the federates on my laptop. This is why I resorted to simulating the network delays. But we should consider carefully whether there is a better way to do this.
In the synchrophasors branch of the playground, I've pushed a first version of the synchrophasors example. When consistency is enforced (which happens by default in LF), the data in the browser looks like this:
https://github.com/lf-lang/playground-lingua-franca/assets/8513334/e10208bc-bbaf-4df2-b540-661a270aadda
When I simulate a physical connection with random delay, the data look like this:
https://github.com/lf-lang/playground-lingua-franca/assets/8513334/c13661d8-4150-46da-a7b8-a180f5fa1c1e
The next steps: