Initial commit

This commit is contained in:
chernov 2024-03-05 12:10:53 +03:00
commit caf209981a
17 changed files with 220 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
book

6
book.toml Normal file
View File

@ -0,0 +1,6 @@
[book]
authors = ["chernov"]
language = "en"
multilingual = false
src = "src"
title = "Controls-kt"

View File

@ -0,0 +1,14 @@
# Introduction
<div class="warning">
🚧 Черновой вариант. Здесь нет осмысленного текста. только наброски.
</div>
Общие слова
## Key features
- async
- dynamic structures under the hood (to do not mess with tools like CORBA, Protobuf)
- interoperation with [Tango-CS](../advanced/tango-interop.md)

View File

@ -0,0 +1,75 @@
# Setting up the project
For quick start we provide a minimal working [boilerplate](https://github.com/kapot65/controls-kt-boilerplate) project with controls-kt. We are going to use it as a base for our tutorial. Follow the next preparation steps:
```shell
git clone https://github.com/kapot65/controls-kt-boilerplate.git
```
After cloning you will have a project structure like this:
```
controls-kt-boilerplate/
├── build.gradle.kts
├── gradle.properties
├── README.md
├── settings.gradle.kts
└── src
├── commonMain
│   └── kotlin
│   └── devices
│   └── IDemoDevice.kt
├── jsMain
│   ├── kotlin
│   │   └── Main.kt
│   └── resources
│   └── index.html
└── jvmMain
└── kotlin
├── devices
│   └── DemoDevice.kt
└── Server.kt
```
This is a common kotlin mutliplatform project with enabled `jvm` and `js` targets and some controls-kt dependencies:
- ./src/commonMain/kotlin/devices/IDemoDevice.kt - contains a demo device interface and specification of its properties and actions.
- ./src/jvmMain/kotlin/devices/DemoDevice.kt - contains a demo device implementation.
- ./src/jvmMain/kotlin/Server.kt file contains a magix server with embed device manager with installed demo device.
- ./src/jsMain/kotlin/Main.kt - contains a simple controls-kt client example.
<div class="warning">🚧 Work in progress
? WASM supported ?
? What is the recommended way to use kotlin multiplatform project with controls-kt ?
</div>
In this section we are going to work with kotlin multiplatform project.
If you plan to use only one platfrom (jvm/native/js) you can use regular kotlin project to simplify your SCADA architecture.
<!-- Вариант 1: переделка kotlin/JVM проекта в kotlin multiplatform
сделать
- ? как подключить Compose
-->
<!-- Вариант 2: создание проекта с помощью Kotlin Multiplatform Wizard
## Initialize kotlin project from Idea
First you need to create project base with [Kotlin Multiplatform Wizard](https://kmp.jetbrains.com/)
<div class="warning">avoid dashes in project name</div>
- check `Server` and `Web` checkboxes
- optionally check `Desktop` if you plan to use desktop graphics.
Generated project will have structure like: -->
<!-- выбран 1 вариант [обсуждение](https://mm.sciprog.center/controls/channels/controls-kt)
жду новой версии controls-kt для бойлерплейта
-->
<!-- добавить секцию для людей, которые имеют опыт с kotlin/multiplatform и собираются создать проект вручную
какие модули нужны и для чего
какие реализации сейчас есть
-->

View File

@ -0,0 +1,5 @@
# Define the device specification
## Device interface

View File

@ -0,0 +1,25 @@
This chapter contains step-by-step tutorial teaching you how to use basic controls-kt functionality:
- define device specification (device properties, actions)
- create controls-kt event loop
- read/write device properties
- execute device actions
During this chapter we are going to create a simple device that simulates a simple attractor in 2D space defined by the following differential equations:
```
dx/dt = y - ax^2
dy/dt = -x - y
```
The device will have the following properties:
- (x, y) - coordinates as current step
- a - parameter of the attractor
and the following action:
- reset - reset the coordinates
## Prerequisites
- Tutorial assumes that you use IntelliJ IDEA as your IDE as currently it's the only way to work with Kotlin Multiplatform projects.
<!-- - Examples in tutorial is based on [controls-kt-experiments](https://github.com/kapot65/controls-kt-experiments) project. -->
<!-- You can clone it and follow the tutorial or use your own project. (переделать)-->
<!-- Придумать простое демо (желательно поинтереснее SinCos) устройство для этой секции -->

View File

@ -0,0 +1 @@
# Setting up the project

View File

@ -0,0 +1,3 @@
<div class="warning">
🚧 Work in progress
</div>

View File

@ -0,0 +1,3 @@
<div class="warning">
🚧 Work in progress
</div>

View File

@ -0,0 +1,3 @@
<div class="warning">
🚧 Work in progress
</div>

View File

View File

@ -0,0 +1,44 @@
# Use the latest build from the development branch
Currently controls-kt is under active development. If you want to use the latest build from the development branch, you can do the following steps:
1. Clone the repository:
```bash
git clone -b dev https://git.sciprog.center/kscience/controls-kt.git
```
2. Change the [version](https://git.sciprog.center/kscience/controls-kt/src/commit/5b655a9354de5ddb4be25ee9e6be876f14f10b87/build.gradle.kts#L16) in your `build.gradle.kts` file to new unique:
```kotlin
allprojects {
// ...
version = "0.3.0-dev-6-19-02-24-local"
// ...
}
```
3. Execute `publishToMavenLocal` task:
```bash
./gradlew publishToMavenLocal
```
or from Idea Gradle panel:
![publishToMavenLocal](./images/publishToMavenLocal.png)
Latest version of the library will be published to your local maven repository.
4. In your project add mavenLocal() to your repositories:
```kotlin
repositories {
mavenLocal()
mavenCentral()
// ...
}
```
5. Add the dependencies you need using the unique version you set in p2:
```kotlin
// ...
dependencies {
implementation("space.kscience:controls-core:0.3.0-dev-6-19-02-24-local")
// ...
}
// ...
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -0,0 +1,3 @@
<div class="warning">
🚧 Work in progress
</div>

View File

@ -0,0 +1,7 @@
# Interoperability with Tango
<div class="warning">
🚧 Work in progress
</div>

View File

@ -0,0 +1,16 @@
# Work with c libraries
<div class="warning">
🚧 Work in progress
</div>
Controls-kt can be used in kotlin native projects. As long as your devices drivers have c interface, you can controls-kt as SCADA system for your devices.
## setting up kotlin native project
🚧 Work in progress
## using c libraries in kotlin native
🚧 Work in progress
drawbacks:
- even in final binaries is fully native you still need to have jvm installed on your machine to run gradle tasks

14
src/SUMMARY.md Normal file
View File

@ -0,0 +1,14 @@
# Summary
- [Introduction](./01-introduction/README.md)
- [Getting started](./02-getting-started/README.md)
- [Setting up the project](./02-getting-started/01-setup.md)
- [Define device spec](./02-getting-started/02-define-device-spec.md)
- [Reference Guide](./03-reference/README.md)
- [Device Properties](./03-reference/properties.md)
- [Device Actions](./03-reference/actions.md)
- [Advanced usage](./04-advanced/README.md)
- [Use latest dev build](./04-advanced/dev-build.md)
- [Work with c](./04-advanced/work-with-c.md)
- [Interoperability with Tango](./04-advanced/tango-interop.md)
- [Message API](./04-advanced/messages.md)