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

Data path and synchronisation, and refactoring #17

Merged
merged 19 commits into from
Apr 5, 2024
Merged

Conversation

TeraMika
Copy link
Collaborator

@TeraMika TeraMika commented Apr 4, 2024

A lot of changes related to data path and synchronisation and to general code readability.

Issues approached

Closes #15. The final idea was a FIFO buffer on the PLC that then required data to be streamed via TCP to the adapter. This ensures that nothing is missed - Modbus was simply not reliable enough no matter what buffer implementation was used.
Approaches #11. The 50Hz readings are now written to a file along with some to-be-defined secondary readings.
Approaches #12 in that the graph adapter has been removed now that it is not associated with file writing. The data stored has been moved into the main livex class.
References #16 in that the mechanism to trigger the cameras has been decided - an external source and not the main PLC. This is for consistency reasons.
References #3. Some UI elements have been 'componentised' to make future changes easier.

Changes made

+ PLC code completely refactored. The looping tasks are moved to their own files with any relevant functions.
~ PLC now operates on interrupts instead of comparison timers and millis(). At present, that's one timer for the 'secondary' functions (default 200Kus) and a pin interrupt for the PID readings.
~ A decision made about the data synchronisation, this PLC is too busy to consistently also manage cameras. It consistently sends signals at least one millisecond out from a regular period even if the average is perfect. This will be manged by an external device (TBD, another smaller PLC?), which will also trigger the PID readings from the PLC to ensure that these are in-time with the data
+ Buffer added to PLC. Values are added to this in the 'pid task' (which is to be renamed?) and removed from this when written via TCP in the 'comms task'.
+ The 50Hz data is now streamed via TCP to the adapter. This queues up data and the adapter will read this data at a rate of twice the pid frequency (defined in config) so that it can catch up.
+ Adapter now writes data to a file. The name is fixed right now so it just appends to that file whenever you click 'acquire'.
+ FileWriter class now exists independently of graph adapter
- Graph adapter is gone, the temperature monitoring graph is now in the livex adapter with a retention defined in the config.
+ Added a lot of options to livex.cfg to make these values easier to adjust
~ Some config options changed
~ Controls (auto set point control, thermal gradient, motor) moved to their own Python files to match PID and reduce clutter in livex.py. This includes definition of address dictionaries for these classes in modbusAddresses.py.
~ Controls moved to their own React components to make this easier to edit in future

Future notes

  • Think about camera triggers and communication. What is this going to look like? Generally just the shape of it - how does the UI get a signal to the other PLC/signal generator, for example?
  • What data, aside from temperature readings, needs to be saved? Assuming 1Hz, but if there's more data for 50Hz that is included here too.
  • Anything else that could be defined in a config file?

@TeraMika TeraMika changed the title Data sync eth Data path and synchronisation, and refactoring Apr 4, 2024
@TeraMika TeraMika merged commit d7926a5 into main Apr 5, 2024
@TeraMika TeraMika deleted the data-sync-eth branch April 5, 2024 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Data Path and Synchronisation
1 participant