Added derive units to core

Derive units are now available in the core and has their relevant input
values routed and outputs are looped back into the core router

Fixed the dlpak manifest which had no signal descriptors
This commit is contained in:
h3cx committed 2026-09-09 16:09:02 +02:00
1 parent f0638788fc
commit c67316dd90
8 files changed
+176 -23

No files matched your search

+30
View File
@@ -1,9 +1,13 @@
import logging
from pathlib import Path
from time import sleep
from uuid import UUID, uuid4
from rich.logging import RichHandler
from dynalab_core import Core
from dynalab_core.config import CoreConfig
from dynalab_core.protocols.packets.handshake import SignalDescriptor
logging.basicConfig(
level=logging.DEBUG,
@@ -14,13 +18,39 @@ logging.basicConfig(
)
log = logging.getLogger(__name__)
processing_str = Path(
"/home/hector/projects/Exergie/dynalab-core/test/manual/process.py"
).read_text(encoding="utf-8")
signal_id_1: UUID = UUID("3f32cea3-d872-4c16-a0a2-54b57171aeb2")
signal_id_2: UUID = UUID("6578ac37-99d1-410c-b3f7-d049339919b2")
config = CoreConfig(port=8765)
log.info("Configured manual core on %s", config.bind_str())
dl_core = Core(config)
dl_core.start()
dl_core.start_recording()
for i in range(2):
dl_core.wait(1)
values = dl_core.get_all_live_values()
log.debug(f"Core values: {values}")
unit_id = dl_core.bind_derive_unit(
processing_str,
[
SignalDescriptor(
id=signal_id_1, name="Dummy signal 1", type="number", timeout_ms=5000
),
SignalDescriptor(
id=signal_id_2, name="Dummy signal 2", type="number", timeout_ms=5000
),
],
SignalDescriptor(id=uuid4(), name="Dummy sum", type="number", timeout_ms=5000),
)
try:
while True:
dl_core.wait(1)