Monitor for IT6800
This commit is contained in:
parent
8e1dfe19b4
commit
669766e816
@ -19,7 +19,7 @@ apply plugin: 'application'
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
||||||
if (!hasProperty('mainClass')) {
|
if (!hasProperty('mainClass')) {
|
||||||
ext.mainClass = 'inr.numass.control.magnet.fx.MagnetApp'
|
ext.mainClass = 'inr.numass.control.gun.EGunApplicationkt'
|
||||||
}
|
}
|
||||||
mainClassName = mainClass
|
mainClassName = mainClass
|
||||||
|
|
||||||
|
@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2018 Alexander Nozik.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package inr.numass.control.gun
|
||||||
|
|
||||||
|
import hep.dataforge.context.Context
|
||||||
|
import hep.dataforge.context.ContextAware
|
||||||
|
import hep.dataforge.control.devices.AbstractDevice
|
||||||
|
import hep.dataforge.control.devices.Device
|
||||||
|
import hep.dataforge.control.devices.DeviceHub
|
||||||
|
import hep.dataforge.meta.Meta
|
||||||
|
import hep.dataforge.meta.Metoid
|
||||||
|
import hep.dataforge.names.Name
|
||||||
|
import hep.dataforge.optional
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
class EGun(context: Context, meta: Meta) : AbstractDevice(context, meta), DeviceHub, ContextAware, Metoid {
|
||||||
|
val sources: List<IT6800Device> by lazy {
|
||||||
|
meta.getMetaList("source").map {IT6800Device(context, it) }
|
||||||
|
}
|
||||||
|
|
||||||
|
override val deviceNames: List<Name> by lazy{ sources.map { Name.of(it.name) }}
|
||||||
|
|
||||||
|
override fun optDevice(name: Name): Optional<Device> {
|
||||||
|
return sources.find { it.name == name.toString() }.optional
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2018 Alexander Nozik.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package inr.numass.control.gun
|
||||||
|
|
||||||
|
import hep.dataforge.context.Context
|
||||||
|
import hep.dataforge.control.devices.Device
|
||||||
|
import hep.dataforge.control.devices.DeviceFactory
|
||||||
|
import hep.dataforge.meta.Meta
|
||||||
|
import hep.dataforge.meta.MetaUtils
|
||||||
|
import inr.numass.control.NumassControlApplication
|
||||||
|
import javafx.stage.Stage
|
||||||
|
|
||||||
|
class EGunApplication: NumassControlApplication<EGun>() {
|
||||||
|
override val deviceFactory: DeviceFactory = object :DeviceFactory{
|
||||||
|
override val type: String = "numass.lambda"
|
||||||
|
|
||||||
|
override fun build(context: Context, meta: Meta): Device {
|
||||||
|
return EGun(context, meta)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun setupStage(stage: Stage, device: EGun) {
|
||||||
|
stage.title = "Numass gun control"
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getDeviceMeta(config: Meta): Meta {
|
||||||
|
return MetaUtils.findNode(config,"device"){it.getString("name") == "numass.gun"}.orElseThrow{RuntimeException("Gun configuration not found")}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2018 Alexander Nozik.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package inr.numass.control.gun
|
||||||
|
|
||||||
|
import hep.dataforge.fx.asDoubleProperty
|
||||||
|
import tornadofx.*
|
||||||
|
|
||||||
|
class EGunView(gun: EGun) : View() {
|
||||||
|
override val root = borderpane {
|
||||||
|
center {
|
||||||
|
vbox {
|
||||||
|
gun.sources.forEach { device ->
|
||||||
|
hbox {
|
||||||
|
label(device.name)
|
||||||
|
slider(range = 0.0..5.0, value = 0){
|
||||||
|
valueProperty().bindBidirectional(device.currentState.asDoubleProperty())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -18,7 +18,6 @@ import inr.numass.control.getDisplay
|
|||||||
import javafx.scene.Parent
|
import javafx.scene.Parent
|
||||||
import tornadofx.*
|
import tornadofx.*
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import java.util.stream.Stream
|
|
||||||
import kotlin.collections.ArrayList
|
import kotlin.collections.ArrayList
|
||||||
|
|
||||||
@StateDef(value = ValueDef(key = "address", type = arrayOf(ValueType.NUMBER), info = "Current active magnet"))
|
@StateDef(value = ValueDef(key = "address", type = arrayOf(ValueType.NUMBER), info = "Current active magnet"))
|
||||||
@ -78,8 +77,8 @@ class LambdaHub(context: Context, meta: Meta) : DeviceHub, AbstractDevice(contex
|
|||||||
override fun optDevice(name: Name): Optional<Device> =
|
override fun optDevice(name: Name): Optional<Device> =
|
||||||
magnets.stream().filter { it.name == name.unescaped }.map { it as Device }.findFirst()
|
magnets.stream().filter { it.name == name.unescaped }.map { it as Device }.findFirst()
|
||||||
|
|
||||||
override val deviceNames: Stream<Name>
|
override val deviceNames: List<Name>
|
||||||
get() = magnets.stream().map { Name.ofSingle(it.name) }
|
get() = magnets.map { Name.ofSingle(it.name) }
|
||||||
}
|
}
|
||||||
|
|
||||||
class LambdaHubDisplay : DeviceDisplayFX<LambdaHub>() {
|
class LambdaHubDisplay : DeviceDisplayFX<LambdaHub>() {
|
||||||
|
@ -17,6 +17,7 @@ package inr.numass.control.magnet
|
|||||||
|
|
||||||
import hep.dataforge.context.Context
|
import hep.dataforge.context.Context
|
||||||
import hep.dataforge.control.devices.AbstractDevice
|
import hep.dataforge.control.devices.AbstractDevice
|
||||||
|
import hep.dataforge.control.devices.notifyError
|
||||||
import hep.dataforge.control.ports.Port
|
import hep.dataforge.control.ports.Port
|
||||||
import hep.dataforge.control.ports.PortFactory
|
import hep.dataforge.control.ports.PortFactory
|
||||||
import hep.dataforge.description.ValueDef
|
import hep.dataforge.description.ValueDef
|
||||||
|
@ -17,7 +17,6 @@ class MagnetApp: NumassControlApplication<LambdaHub>() {
|
|||||||
override fun build(context: Context, meta: Meta): Device {
|
override fun build(context: Context, meta: Meta): Device {
|
||||||
return LambdaHub(context, meta)
|
return LambdaHub(context, meta)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setupStage(stage: Stage, device: LambdaHub) {
|
override fun setupStage(stage: Stage, device: LambdaHub) {
|
||||||
|
@ -36,7 +36,6 @@ import kotlinx.coroutines.time.delay
|
|||||||
import java.time.Duration
|
import java.time.Duration
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import java.util.stream.Stream
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author [Alexander Nozik](mailto:altavir@gmail.com)
|
* @author [Alexander Nozik](mailto:altavir@gmail.com)
|
||||||
@ -65,8 +64,8 @@ class VacCollectorDevice(context: Context, meta: Meta, val sensors: Collection<S
|
|||||||
override fun optDevice(name: Name): Optional<Device> =
|
override fun optDevice(name: Name): Optional<Device> =
|
||||||
Optional.ofNullable(sensors.find { it.name == name.unescaped })
|
Optional.ofNullable(sensors.find { it.name == name.unescaped })
|
||||||
|
|
||||||
override val deviceNames: Stream<Name>
|
override val deviceNames: List<Name>
|
||||||
get() = sensors.stream().map { Name.ofSingle(it.name) }
|
get() = sensors.map { Name.ofSingle(it.name) }
|
||||||
|
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
|
Loading…
Reference in New Issue
Block a user