controls-kt/README.md

248 lines
8.5 KiB
Markdown
Raw Permalink Normal View History

2020-06-07 21:16:19 +03:00
[![JetBrains Research](https://jb.gg/badges/research.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)
2024-03-04 15:58:53 +03:00
[![](https://maven.sciprog.center/api/badge/latest/kscience/space/kscience/controls-core-jvm?color=40c14a&name=repo.kotlin.link&prefix=v)](https://maven.sciprog.center/)
2024-03-04 15:58:53 +03:00
# Controls.kt
2023-08-23 16:37:35 +03:00
2024-03-04 15:58:53 +03:00
Controls.kt (former DataForge-control) is a data acquisition framework (work in progress). It is based on DataForge, a software framework for automated data processing.
2023-05-03 11:05:54 +03:00
This repository contains a prototype of API and simple implementation
of a slow control system, including a demo.
2024-03-04 15:58:53 +03:00
Controls.kt uses some concepts and modules of DataForge,
2023-05-03 11:05:54 +03:00
such as `Meta` (tree-like value structure).
To learn more about DataForge, please consult the following URLs:
2023-05-03 11:05:54 +03:00
* [Kotlin multiplatform implementation of DataForge](https://github.com/mipt-npm/dataforge-core)
* [DataForge documentation](http://npm.mipt.ru/dataforge/)
* [Original implementation of DataForge](https://bitbucket.org/Altavir/dataforge/src/default/)
DataForge-control is a [Kotlin-multiplatform](https://kotlinlang.org/docs/reference/multiplatform.html)
2023-05-03 11:05:54 +03:00
application. Asynchronous operations are implemented with
[kotlinx.coroutines](https://github.com/Kotlin/kotlinx.coroutines) library.
2021-10-06 22:39:38 +03:00
## Materials and publications
* Video - [A general overview seminar](https://youtu.be/LO-qjWgXMWc)
* Video - [A seminar about the system mechanics](https://youtu.be/wES0RV5GpoQ)
2023-05-03 11:05:54 +03:00
* Article - [A Novel Solution for Controlling Hardware Components of Accelerators and Beamlines](https://www.preprints.org/manuscript/202108.0336/v1)
### Features
Among other things, you can:
2023-05-03 11:05:54 +03:00
- Describe devices and their properties.
- Collect data from devices and execute arbitrary actions supported by a device.
- Property values can be cached in the system and requested from devices as needed, asynchronously.
- Connect devices to event bus via bidirectional message flows.
2023-05-03 11:05:54 +03:00
Example view of a demo:
2023-05-03 11:05:54 +03:00
![](docs/pictures/demo-view.png)
2023-05-08 21:25:25 +03:00
## Documentation
* [Creating a device](docs/Device%20and%20DeviceSpec.md)
2023-05-03 11:05:54 +03:00
## Modules
2024-03-04 15:58:53 +03:00
### [controls-constructor](controls-constructor)
> A low-code constructor for composite devices simulation
>
> **Maturity**: PROTOTYPE
2023-05-03 11:05:54 +03:00
### [controls-core](controls-core)
2023-08-23 16:21:11 +03:00
> Core interfaces for building a device server
2023-05-03 11:05:54 +03:00
>
> **Maturity**: EXPERIMENTAL
>
> **Features:**
> - [device](controls-core/src/commonMain/kotlin/space/kscience/controls/api/Device.kt) : Device API with subscription (asynchronous and pseudo-synchronous properties)
> - [deviceMessage](controls-core/src/commonMain/kotlin/space/kscience/controls/api/DeviceMessage.kt) : Specification for messages used to communicate between Controls-kt devices.
> - [deviceHub](controls-core/src/commonMain/kotlin/space/kscience/controls/api/DeviceHub.kt) : Grouping of devices into local tree-like hubs.
2023-08-23 16:21:11 +03:00
> - [deviceSpec](controls-core/src/commonMain/kotlin/space/kscience/controls/spec) : Mechanics and type-safe builders for devices. Including separation of device specification and device state.
> - [deviceManager](controls-core/src/commonMain/kotlin/space/kscience/controls/manager) : DataForge DI integration for devices. Includes device builders.
> - [ports](controls-core/src/commonMain/kotlin/space/kscience/controls/ports) : Working with asynchronous data sending and receiving raw byte arrays
2023-05-03 11:05:54 +03:00
2024-03-04 15:58:53 +03:00
### [controls-jupyter](controls-jupyter)
>
> **Maturity**: EXPERIMENTAL
2023-08-23 16:21:11 +03:00
### [controls-magix](controls-magix)
> Magix service for binding controls devices (both as RPC client and server)
2023-05-03 11:05:54 +03:00
>
> **Maturity**: EXPERIMENTAL
2023-08-23 16:21:11 +03:00
>
> **Features:**
> - [controlsMagix](controls-magix/src/commonMain/kotlin/space/kscience/controls/client/controlsMagix.kt) : Connect a `DeviceManage` with one or many devices to the Magix endpoint
> - [DeviceClient](controls-magix/src/commonMain/kotlin/space/kscience/controls/client/DeviceClient.kt) : A remote connector to Controls-kt device via Magix
2023-05-03 11:05:54 +03:00
2023-08-16 18:26:21 +03:00
### [controls-modbus](controls-modbus)
2023-08-23 16:21:11 +03:00
> A plugin for Controls-kt device server on top of modbus-rtu/modbus-tcp protocols
2023-05-03 11:05:54 +03:00
>
> **Maturity**: EXPERIMENTAL
2023-08-23 16:21:11 +03:00
>
> **Features:**
> - [modbusRegistryMap](controls-modbus/src/main/kotlin/space/kscience/controls/modbus/ModbusRegistryMap.kt) : Type-safe modbus registry map. Allows to define both single-register and multi-register entries (using DataForge IO).
Automatically checks consistency.
> - [modbusProcessImage](controls-modbus/src/main/kotlin/space/kscience/controls/modbus/DeviceProcessImage.kt) : Binding of slave (server) modbus device to Controls-kt device
> - [modbusDevice](controls-modbus/src/main/kotlin/space/kscience/controls/modbus/ModbusDevice.kt) : A device with additional methods to work with modbus registers.
2023-05-03 11:05:54 +03:00
2023-08-16 18:26:21 +03:00
### [controls-opcua](controls-opcua)
2023-08-23 16:21:11 +03:00
> A client and server connectors for OPC-UA via Eclipse Milo
2023-05-03 11:05:54 +03:00
>
> **Maturity**: EXPERIMENTAL
2023-08-23 16:21:11 +03:00
>
> **Features:**
> - [opcuaClient](controls-opcua/src/main/kotlin/space/kscience/controls/opcua/client) : Connect a Controls-kt as a client to OPC UA server
> - [opcuaServer](controls-opcua/src/main/kotlin/space/kscience/controls/opcua/server) : Create an OPC UA server on top of Controls-kt device (or device hub)
2023-05-03 11:05:54 +03:00
2023-08-16 18:26:21 +03:00
### [controls-pi](controls-pi)
2023-08-23 16:21:11 +03:00
> Utils to work with controls-kt on Raspberry pi
2023-08-16 18:26:21 +03:00
>
> **Maturity**: EXPERIMENTAL
2024-05-15 22:49:08 +03:00
### [controls-plc4x](controls-plc4x)
> A plugin for Controls-kt device server on top of plc4x library
>
> **Maturity**: EXPERIMENTAL
2023-08-16 18:26:21 +03:00
### [controls-ports-ktor](controls-ports-ktor)
2023-08-23 16:21:11 +03:00
> Implementation of byte ports on top os ktor-io asynchronous API
2023-05-03 11:05:54 +03:00
>
2023-08-23 16:21:11 +03:00
> **Maturity**: PROTOTYPE
2023-05-03 11:05:54 +03:00
### [controls-serial](controls-serial)
2023-08-23 16:21:11 +03:00
> Implementation of direct serial port communication with JSerialComm
2023-05-03 11:05:54 +03:00
>
> **Maturity**: EXPERIMENTAL
### [controls-server](controls-server)
2023-08-23 16:21:11 +03:00
> A combined Magix event loop server with web server for visualization.
2023-05-03 11:05:54 +03:00
>
2023-08-23 16:21:11 +03:00
> **Maturity**: PROTOTYPE
2023-05-03 11:05:54 +03:00
### [controls-storage](controls-storage)
2023-08-23 16:21:11 +03:00
> An API for stand-alone Controls-kt device or a hub.
2023-05-03 11:05:54 +03:00
>
> **Maturity**: PROTOTYPE
2024-03-04 15:58:53 +03:00
### [controls-vision](controls-vision)
> Dashboard and visualization extensions for devices
>
> **Maturity**: PROTOTYPE
2024-06-17 17:49:12 +03:00
### [controls-visualisation-compose](controls-visualisation-compose)
> Visualisation extension using compose-multiplatform
>
> **Maturity**: PROTOTYPE
2023-05-03 11:05:54 +03:00
### [demo](demo)
>
> **Maturity**: EXPERIMENTAL
### [magix](magix)
>
> **Maturity**: EXPERIMENTAL
### [controls-storage/controls-xodus](controls-storage/controls-xodus)
2023-08-23 16:21:11 +03:00
> An implementation of controls-storage on top of JetBrains Xodus.
2023-05-03 11:05:54 +03:00
>
> **Maturity**: PROTOTYPE
### [demo/all-things](demo/all-things)
>
> **Maturity**: EXPERIMENTAL
### [demo/car](demo/car)
>
> **Maturity**: EXPERIMENTAL
2024-03-04 15:58:53 +03:00
### [demo/constructor](demo/constructor)
>
> **Maturity**: EXPERIMENTAL
2024-06-17 17:49:12 +03:00
### [demo/device-collective](demo/device-collective)
>
> **Maturity**: EXPERIMENTAL
2023-05-03 11:05:54 +03:00
### [demo/echo](demo/echo)
>
> **Maturity**: EXPERIMENTAL
### [demo/magix-demo](demo/magix-demo)
>
> **Maturity**: EXPERIMENTAL
2023-05-08 21:25:25 +03:00
### [demo/many-devices](demo/many-devices)
>
> **Maturity**: EXPERIMENTAL
2023-05-03 11:05:54 +03:00
### [demo/mks-pdr900](demo/mks-pdr900)
>
> **Maturity**: EXPERIMENTAL
### [demo/motors](demo/motors)
>
> **Maturity**: EXPERIMENTAL
### [magix/magix-api](magix/magix-api)
2023-08-23 16:21:11 +03:00
> A kotlin API for magix standard and some zero-dependency magix services
2023-05-03 11:05:54 +03:00
>
> **Maturity**: EXPERIMENTAL
2023-08-23 16:21:11 +03:00
### [magix/magix-java-endpoint](magix/magix-java-endpoint)
> Java API to work with magix endpoints without Kotlin
2023-05-03 11:05:54 +03:00
>
> **Maturity**: EXPERIMENTAL
### [magix/magix-mqtt](magix/magix-mqtt)
2023-08-23 16:21:11 +03:00
> MQTT client magix endpoint
2023-05-03 11:05:54 +03:00
>
> **Maturity**: PROTOTYPE
### [magix/magix-rabbit](magix/magix-rabbit)
2023-08-23 16:21:11 +03:00
> RabbitMQ client magix endpoint
2023-05-03 11:05:54 +03:00
>
> **Maturity**: PROTOTYPE
### [magix/magix-rsocket](magix/magix-rsocket)
2023-08-23 16:21:11 +03:00
> Magix endpoint (client) based on RSocket
2023-05-03 11:05:54 +03:00
>
> **Maturity**: EXPERIMENTAL
### [magix/magix-server](magix/magix-server)
2023-08-23 16:21:11 +03:00
> A magix event loop implementation in Kotlin. Includes HTTP/SSE and RSocket routes.
2023-05-03 11:05:54 +03:00
>
> **Maturity**: EXPERIMENTAL
### [magix/magix-storage](magix/magix-storage)
2023-08-23 16:21:11 +03:00
> Magix history database API
2023-05-03 11:05:54 +03:00
>
2023-08-23 16:21:11 +03:00
> **Maturity**: PROTOTYPE
2023-05-03 11:05:54 +03:00
2024-05-15 22:49:08 +03:00
### [magix/magix-utils](magix/magix-utils)
> Common utilities and services for Magix endpoints.
>
> **Maturity**: EXPERIMENTAL
2023-05-03 11:05:54 +03:00
### [magix/magix-zmq](magix/magix-zmq)
2023-08-23 16:21:11 +03:00
> ZMQ client endpoint for Magix
2023-05-03 11:05:54 +03:00
>
> **Maturity**: EXPERIMENTAL
### [magix/magix-storage/magix-storage-xodus](magix/magix-storage/magix-storage-xodus)
>
> **Maturity**: PROTOTYPE
### `demo` module
The demo includes a simple mock device with a few properties changing as `sin` and `cos` of
2023-05-03 11:05:54 +03:00
the current time. The device is configurable via a simple TornadoFX-based control panel.
You can run a demo by executing `application/run` Gradle task.
The graphs are displayed using [plotly.kt](https://github.com/mipt-npm/plotly.kt) library.