shepherd-core 2025.4.1__py3-none-any.whl → 2025.5.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- shepherd_core/calibration_hw_def.py +11 -11
- shepherd_core/commons.py +4 -4
- shepherd_core/data_models/__init__.py +2 -0
- shepherd_core/data_models/base/cal_measurement.py +10 -11
- shepherd_core/data_models/base/calibration.py +7 -6
- shepherd_core/data_models/base/content.py +1 -1
- shepherd_core/data_models/base/shepherd.py +6 -7
- shepherd_core/data_models/base/wrapper.py +2 -2
- shepherd_core/data_models/content/_external_fixtures.yaml +32 -32
- shepherd_core/data_models/content/energy_environment.py +6 -5
- shepherd_core/data_models/content/firmware.py +9 -7
- shepherd_core/data_models/content/virtual_harvester.py +34 -26
- shepherd_core/data_models/content/virtual_harvester_fixture.yaml +2 -2
- shepherd_core/data_models/content/virtual_source.py +20 -17
- shepherd_core/data_models/content/virtual_source_fixture.yaml +3 -3
- shepherd_core/data_models/experiment/experiment.py +15 -15
- shepherd_core/data_models/experiment/observer_features.py +109 -16
- shepherd_core/data_models/experiment/target_config.py +17 -12
- shepherd_core/data_models/task/__init__.py +11 -8
- shepherd_core/data_models/task/emulation.py +32 -17
- shepherd_core/data_models/task/firmware_mod.py +11 -11
- shepherd_core/data_models/task/harvest.py +7 -6
- shepherd_core/data_models/task/observer_tasks.py +7 -7
- shepherd_core/data_models/task/programming.py +13 -12
- shepherd_core/data_models/task/testbed_tasks.py +8 -8
- shepherd_core/data_models/testbed/cape.py +7 -6
- shepherd_core/data_models/testbed/gpio.py +8 -7
- shepherd_core/data_models/testbed/mcu.py +8 -7
- shepherd_core/data_models/testbed/mcu_fixture.yaml +4 -4
- shepherd_core/data_models/testbed/observer.py +9 -7
- shepherd_core/data_models/testbed/target.py +9 -7
- shepherd_core/data_models/testbed/testbed.py +11 -10
- shepherd_core/data_models/virtual_source_doc.txt +3 -3
- shepherd_core/decoder_waveform/uart.py +5 -5
- shepherd_core/fw_tools/converter.py +10 -6
- shepherd_core/fw_tools/patcher.py +14 -15
- shepherd_core/fw_tools/validation.py +11 -6
- shepherd_core/inventory/__init__.py +6 -6
- shepherd_core/inventory/python.py +1 -1
- shepherd_core/inventory/system.py +11 -8
- shepherd_core/inventory/target.py +3 -3
- shepherd_core/logger.py +2 -2
- shepherd_core/reader.py +105 -78
- shepherd_core/testbed_client/client_abc_fix.py +22 -16
- shepherd_core/testbed_client/client_web.py +18 -11
- shepherd_core/testbed_client/fixtures.py +21 -22
- shepherd_core/testbed_client/user_model.py +6 -5
- shepherd_core/version.py +1 -1
- shepherd_core/vsource/target_model.py +3 -3
- shepherd_core/vsource/virtual_converter_model.py +3 -3
- shepherd_core/vsource/virtual_harvester_model.py +7 -9
- shepherd_core/vsource/virtual_harvester_simulation.py +7 -6
- shepherd_core/vsource/virtual_source_model.py +6 -5
- shepherd_core/vsource/virtual_source_simulation.py +8 -7
- shepherd_core/writer.py +37 -39
- {shepherd_core-2025.4.1.dist-info → shepherd_core-2025.5.2.dist-info}/METADATA +2 -3
- shepherd_core-2025.5.2.dist-info/RECORD +81 -0
- {shepherd_core-2025.4.1.dist-info → shepherd_core-2025.5.2.dist-info}/WHEEL +1 -1
- shepherd_core-2025.4.1.dist-info/RECORD +0 -81
- {shepherd_core-2025.4.1.dist-info → shepherd_core-2025.5.2.dist-info}/top_level.txt +0 -0
- {shepherd_core-2025.4.1.dist-info → shepherd_core-2025.5.2.dist-info}/zip-safe +0 -0
|
@@ -4,15 +4,15 @@ These models import externally from all other model-modules!
|
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
6
|
from pathlib import Path
|
|
7
|
-
from typing import List
|
|
8
7
|
from typing import Optional
|
|
9
8
|
from typing import Union
|
|
10
9
|
|
|
11
10
|
import yaml
|
|
12
11
|
|
|
13
|
-
from
|
|
14
|
-
from
|
|
15
|
-
from
|
|
12
|
+
from shepherd_core.data_models.base.shepherd import ShpModel
|
|
13
|
+
from shepherd_core.data_models.base.wrapper import Wrapper
|
|
14
|
+
from shepherd_core.logger import logger
|
|
15
|
+
|
|
16
16
|
from .emulation import Compression
|
|
17
17
|
from .emulation import EmulationTask
|
|
18
18
|
from .firmware_mod import FirmwareModTask
|
|
@@ -54,7 +54,8 @@ def prepare_task(config: Union[ShpModel, Path, str], observer: Optional[str] = N
|
|
|
54
54
|
parameters=config.model_dump(),
|
|
55
55
|
)
|
|
56
56
|
else:
|
|
57
|
-
|
|
57
|
+
msg = f"had unknown input: {type(config)}"
|
|
58
|
+
raise TypeError(msg)
|
|
58
59
|
|
|
59
60
|
if shp_wrap.datatype == TestbedTasks.__name__:
|
|
60
61
|
if observer is None:
|
|
@@ -66,7 +67,8 @@ def prepare_task(config: Union[ShpModel, Path, str], observer: Optional[str] = N
|
|
|
66
67
|
logger.debug("Loading Testbed-Tasks %s for %s", tbt.name, observer)
|
|
67
68
|
obt = tbt.get_observer_tasks(observer)
|
|
68
69
|
if obt is None:
|
|
69
|
-
|
|
70
|
+
msg = f"Observer '{observer}' is not in TestbedTask-Set"
|
|
71
|
+
raise ValueError(msg)
|
|
70
72
|
shp_wrap = Wrapper(
|
|
71
73
|
datatype=type(obt).__name__,
|
|
72
74
|
parameters=obt.model_dump(),
|
|
@@ -74,7 +76,7 @@ def prepare_task(config: Union[ShpModel, Path, str], observer: Optional[str] = N
|
|
|
74
76
|
return shp_wrap
|
|
75
77
|
|
|
76
78
|
|
|
77
|
-
def extract_tasks(shp_wrap: Wrapper, *, no_task_sets: bool = True) ->
|
|
79
|
+
def extract_tasks(shp_wrap: Wrapper, *, no_task_sets: bool = True) -> list[ShpModel]:
|
|
78
80
|
"""Make the individual task-sets usable for each observer."""
|
|
79
81
|
if shp_wrap.datatype == ObserverTasks.__name__:
|
|
80
82
|
obt = ObserverTasks(**shp_wrap.parameters)
|
|
@@ -92,6 +94,7 @@ def extract_tasks(shp_wrap: Wrapper, *, no_task_sets: bool = True) -> List[ShpMo
|
|
|
92
94
|
raise ValueError("Model in Wrapper was TestbedTasks -> Task-Sets not allowed!")
|
|
93
95
|
content = [TestbedTasks(**shp_wrap.parameters)]
|
|
94
96
|
else:
|
|
95
|
-
|
|
97
|
+
msg = f"Extractor had unknown task: {shp_wrap.datatype}"
|
|
98
|
+
raise ValueError(msg)
|
|
96
99
|
|
|
97
100
|
return content
|
|
@@ -5,26 +5,28 @@ from datetime import datetime
|
|
|
5
5
|
from datetime import timedelta
|
|
6
6
|
from enum import Enum
|
|
7
7
|
from pathlib import Path
|
|
8
|
+
from typing import Annotated
|
|
8
9
|
from typing import Optional
|
|
9
10
|
from typing import Union
|
|
10
11
|
|
|
11
12
|
from pydantic import Field
|
|
12
13
|
from pydantic import model_validator
|
|
13
14
|
from pydantic import validate_call
|
|
14
|
-
from typing_extensions import Annotated
|
|
15
15
|
from typing_extensions import Self
|
|
16
16
|
|
|
17
|
-
from
|
|
18
|
-
from
|
|
19
|
-
from
|
|
20
|
-
from
|
|
21
|
-
from
|
|
22
|
-
from
|
|
23
|
-
from
|
|
24
|
-
from
|
|
25
|
-
from
|
|
26
|
-
from
|
|
27
|
-
from
|
|
17
|
+
from shepherd_core.data_models.base.content import IdInt
|
|
18
|
+
from shepherd_core.data_models.base.shepherd import ShpModel
|
|
19
|
+
from shepherd_core.data_models.base.timezone import local_tz
|
|
20
|
+
from shepherd_core.data_models.content.virtual_source import VirtualSourceConfig
|
|
21
|
+
from shepherd_core.data_models.experiment.experiment import Experiment
|
|
22
|
+
from shepherd_core.data_models.experiment.observer_features import GpioActuation
|
|
23
|
+
from shepherd_core.data_models.experiment.observer_features import GpioTracing
|
|
24
|
+
from shepherd_core.data_models.experiment.observer_features import PowerTracing
|
|
25
|
+
from shepherd_core.data_models.experiment.observer_features import SystemLogging
|
|
26
|
+
from shepherd_core.data_models.experiment.observer_features import UartTracing
|
|
27
|
+
from shepherd_core.data_models.testbed import Testbed
|
|
28
|
+
from shepherd_core.data_models.testbed.cape import TargetPort
|
|
29
|
+
from shepherd_core.logger import logger
|
|
28
30
|
|
|
29
31
|
|
|
30
32
|
class Compression(str, Enum):
|
|
@@ -67,10 +69,10 @@ class EmulationTask(ShpModel):
|
|
|
67
69
|
use_cal_default: bool = False
|
|
68
70
|
# ⤷ Use default calibration values, skip loading from EEPROM
|
|
69
71
|
|
|
70
|
-
enable_io: bool =
|
|
72
|
+
enable_io: bool = True
|
|
71
73
|
# TODO: add direction of pins! also it seems error-prone when only setting _tracing
|
|
72
74
|
# ⤷ Switch the GPIO level converter to targets on/off
|
|
73
|
-
# pre-req for sampling gpio,
|
|
75
|
+
# pre-req for sampling gpio / uart,
|
|
74
76
|
io_port: TargetPort = TargetPort.A
|
|
75
77
|
# ⤷ Either Port A or B that gets connected to IO
|
|
76
78
|
pwr_port: TargetPort = TargetPort.A
|
|
@@ -89,6 +91,7 @@ class EmulationTask(ShpModel):
|
|
|
89
91
|
|
|
90
92
|
power_tracing: Optional[PowerTracing] = PowerTracing()
|
|
91
93
|
gpio_tracing: Optional[GpioTracing] = GpioTracing()
|
|
94
|
+
uart_tracing: Optional[UartTracing] = UartTracing()
|
|
92
95
|
gpio_actuation: Optional[GpioActuation] = None
|
|
93
96
|
sys_logging: Optional[SystemLogging] = SystemLogging()
|
|
94
97
|
|
|
@@ -111,9 +114,8 @@ class EmulationTask(ShpModel):
|
|
|
111
114
|
@model_validator(mode="after")
|
|
112
115
|
def post_validation(self) -> Self:
|
|
113
116
|
# TODO: limit paths
|
|
114
|
-
has_time = self.time_start is not None
|
|
115
117
|
time_now = datetime.now().astimezone()
|
|
116
|
-
if
|
|
118
|
+
if self.time_start is not None and self.time_start < time_now:
|
|
117
119
|
msg = (
|
|
118
120
|
"Start-Time for Emulation can't be in the past "
|
|
119
121
|
f"('{self.time_start}' vs '{time_now}'."
|
|
@@ -128,6 +130,14 @@ class EmulationTask(ShpModel):
|
|
|
128
130
|
raise ValueError("Voltage Aux must be in float (0 - 4.5) or string 'main' / 'mid'.")
|
|
129
131
|
if self.gpio_actuation is not None:
|
|
130
132
|
raise ValueError("GPIO Actuation not yet implemented!")
|
|
133
|
+
|
|
134
|
+
io_requested = any(
|
|
135
|
+
_io is not None for _io in (self.gpio_actuation, self.gpio_tracing, self.uart_tracing)
|
|
136
|
+
)
|
|
137
|
+
if self.enable_io and not io_requested:
|
|
138
|
+
logger.warning("Target IO enabled, but no feature requested IO")
|
|
139
|
+
if not self.enable_io and io_requested:
|
|
140
|
+
logger.warning("Target IO not enabled, but a feature requested IO")
|
|
131
141
|
return self
|
|
132
142
|
|
|
133
143
|
@classmethod
|
|
@@ -135,6 +145,10 @@ class EmulationTask(ShpModel):
|
|
|
135
145
|
def from_xp(cls, xp: Experiment, tb: Testbed, tgt_id: IdInt, root_path: Path) -> Self:
|
|
136
146
|
obs = tb.get_observer(tgt_id)
|
|
137
147
|
tgt_cfg = xp.get_target_config(tgt_id)
|
|
148
|
+
io_requested = any(
|
|
149
|
+
_io is not None
|
|
150
|
+
for _io in (tgt_cfg.gpio_actuation, tgt_cfg.gpio_tracing, tgt_cfg.uart_tracing)
|
|
151
|
+
)
|
|
138
152
|
|
|
139
153
|
return cls(
|
|
140
154
|
input_path=tgt_cfg.energy_env.data_path,
|
|
@@ -142,12 +156,13 @@ class EmulationTask(ShpModel):
|
|
|
142
156
|
time_start=copy.copy(xp.time_start),
|
|
143
157
|
duration=xp.duration,
|
|
144
158
|
abort_on_error=xp.abort_on_error,
|
|
145
|
-
enable_io=
|
|
159
|
+
enable_io=io_requested,
|
|
146
160
|
io_port=obs.get_target_port(tgt_id),
|
|
147
161
|
pwr_port=obs.get_target_port(tgt_id),
|
|
148
162
|
virtual_source=tgt_cfg.virtual_source,
|
|
149
163
|
power_tracing=tgt_cfg.power_tracing,
|
|
150
164
|
gpio_tracing=tgt_cfg.gpio_tracing,
|
|
165
|
+
uart_tracing=tgt_cfg.uart_tracing,
|
|
151
166
|
gpio_actuation=tgt_cfg.gpio_actuation,
|
|
152
167
|
sys_logging=xp.sys_logging,
|
|
153
168
|
)
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import copy
|
|
4
4
|
from pathlib import Path
|
|
5
|
+
from typing import Annotated
|
|
5
6
|
from typing import Optional
|
|
6
7
|
from typing import TypedDict
|
|
7
8
|
from typing import Union
|
|
@@ -9,20 +10,19 @@ from typing import Union
|
|
|
9
10
|
from pydantic import Field
|
|
10
11
|
from pydantic import model_validator
|
|
11
12
|
from pydantic import validate_call
|
|
12
|
-
from typing_extensions import Annotated
|
|
13
13
|
from typing_extensions import Self
|
|
14
14
|
from typing_extensions import Unpack
|
|
15
15
|
|
|
16
|
-
from
|
|
17
|
-
from
|
|
18
|
-
from
|
|
19
|
-
from
|
|
20
|
-
from
|
|
21
|
-
from
|
|
22
|
-
from
|
|
23
|
-
from
|
|
24
|
-
from
|
|
25
|
-
from
|
|
16
|
+
from shepherd_core.data_models.base.content import IdInt
|
|
17
|
+
from shepherd_core.data_models.base.shepherd import ShpModel
|
|
18
|
+
from shepherd_core.data_models.content.firmware import Firmware
|
|
19
|
+
from shepherd_core.data_models.content.firmware import FirmwareDType
|
|
20
|
+
from shepherd_core.data_models.content.firmware import FirmwareStr
|
|
21
|
+
from shepherd_core.data_models.experiment.experiment import Experiment
|
|
22
|
+
from shepherd_core.data_models.testbed import Testbed
|
|
23
|
+
from shepherd_core.data_models.testbed.target import IdInt16
|
|
24
|
+
from shepherd_core.data_models.testbed.target import MCUPort
|
|
25
|
+
from shepherd_core.logger import logger
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
class FirmwareModTask(ShpModel):
|
|
@@ -3,18 +3,19 @@
|
|
|
3
3
|
from datetime import datetime
|
|
4
4
|
from datetime import timedelta
|
|
5
5
|
from pathlib import Path
|
|
6
|
+
from typing import Annotated
|
|
6
7
|
from typing import Optional
|
|
7
8
|
|
|
8
9
|
from pydantic import Field
|
|
9
10
|
from pydantic import model_validator
|
|
10
|
-
from typing_extensions import Annotated
|
|
11
11
|
from typing_extensions import Self
|
|
12
12
|
|
|
13
|
-
from
|
|
14
|
-
from
|
|
15
|
-
from
|
|
16
|
-
from
|
|
17
|
-
from
|
|
13
|
+
from shepherd_core.data_models.base.shepherd import ShpModel
|
|
14
|
+
from shepherd_core.data_models.base.timezone import local_tz
|
|
15
|
+
from shepherd_core.data_models.content.virtual_harvester import VirtualHarvesterConfig
|
|
16
|
+
from shepherd_core.data_models.experiment.observer_features import PowerTracing
|
|
17
|
+
from shepherd_core.data_models.experiment.observer_features import SystemLogging
|
|
18
|
+
|
|
18
19
|
from .emulation import Compression
|
|
19
20
|
|
|
20
21
|
|
|
@@ -3,17 +3,17 @@
|
|
|
3
3
|
from datetime import datetime
|
|
4
4
|
from datetime import timedelta
|
|
5
5
|
from pathlib import Path
|
|
6
|
-
from typing import List
|
|
7
6
|
from typing import Optional
|
|
8
7
|
|
|
9
8
|
from pydantic import validate_call
|
|
10
9
|
from typing_extensions import Self
|
|
11
10
|
|
|
12
|
-
from
|
|
13
|
-
from
|
|
14
|
-
from
|
|
15
|
-
from
|
|
16
|
-
from
|
|
11
|
+
from shepherd_core.data_models.base.content import IdInt
|
|
12
|
+
from shepherd_core.data_models.base.content import NameStr
|
|
13
|
+
from shepherd_core.data_models.base.shepherd import ShpModel
|
|
14
|
+
from shepherd_core.data_models.experiment.experiment import Experiment
|
|
15
|
+
from shepherd_core.data_models.testbed.testbed import Testbed
|
|
16
|
+
|
|
17
17
|
from .emulation import EmulationTask
|
|
18
18
|
from .firmware_mod import FirmwareModTask
|
|
19
19
|
from .programming import ProgrammingTask
|
|
@@ -78,7 +78,7 @@ class ObserverTasks(ShpModel):
|
|
|
78
78
|
emulation=EmulationTask.from_xp(xp, tb, tgt_id, root_path),
|
|
79
79
|
)
|
|
80
80
|
|
|
81
|
-
def get_tasks(self) ->
|
|
81
|
+
def get_tasks(self) -> list[ShpModel]:
|
|
82
82
|
task_names = ["fw1_mod", "fw2_mod", "fw1_prog", "fw2_prog", "emulation"]
|
|
83
83
|
tasks = []
|
|
84
84
|
|
|
@@ -2,24 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
import copy
|
|
4
4
|
from pathlib import Path
|
|
5
|
+
from typing import Annotated
|
|
5
6
|
from typing import Optional
|
|
6
7
|
|
|
7
8
|
from pydantic import Field
|
|
8
9
|
from pydantic import model_validator
|
|
9
10
|
from pydantic import validate_call
|
|
10
|
-
from typing_extensions import Annotated
|
|
11
11
|
from typing_extensions import Self
|
|
12
12
|
|
|
13
|
-
from
|
|
14
|
-
from
|
|
15
|
-
from
|
|
16
|
-
from
|
|
17
|
-
from
|
|
18
|
-
from
|
|
19
|
-
from
|
|
20
|
-
from
|
|
21
|
-
from
|
|
22
|
-
from
|
|
13
|
+
from shepherd_core.data_models.base.content import IdInt
|
|
14
|
+
from shepherd_core.data_models.base.content import SafeStr
|
|
15
|
+
from shepherd_core.data_models.base.shepherd import ShpModel
|
|
16
|
+
from shepherd_core.data_models.content.firmware import suffix_to_DType
|
|
17
|
+
from shepherd_core.data_models.content.firmware_datatype import FirmwareDType
|
|
18
|
+
from shepherd_core.data_models.experiment.experiment import Experiment
|
|
19
|
+
from shepherd_core.data_models.testbed.cape import TargetPort
|
|
20
|
+
from shepherd_core.data_models.testbed.mcu import ProgrammerProtocol
|
|
21
|
+
from shepherd_core.data_models.testbed.target import MCUPort
|
|
22
|
+
from shepherd_core.data_models.testbed.testbed import Testbed
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
class ProgrammingTask(ShpModel):
|
|
@@ -43,7 +43,8 @@ class ProgrammingTask(ShpModel):
|
|
|
43
43
|
def post_validation(self) -> Self:
|
|
44
44
|
d_type = suffix_to_DType.get(self.firmware_file.suffix.lower())
|
|
45
45
|
if d_type != FirmwareDType.base64_hex:
|
|
46
|
-
|
|
46
|
+
msg = (f"Firmware is not intel-hex ({self.firmware_file.as_posix()})",)
|
|
47
|
+
raise ValueError(msg)
|
|
47
48
|
return self
|
|
48
49
|
|
|
49
50
|
@classmethod
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"""Collection of tasks for all observers included in experiment."""
|
|
2
2
|
|
|
3
|
-
from typing import
|
|
3
|
+
from typing import Annotated
|
|
4
4
|
from typing import Optional
|
|
5
5
|
|
|
6
6
|
from pydantic import Field
|
|
7
7
|
from pydantic import validate_call
|
|
8
|
-
from typing_extensions import Annotated
|
|
9
8
|
from typing_extensions import Self
|
|
10
9
|
|
|
11
|
-
from
|
|
12
|
-
from
|
|
13
|
-
from
|
|
14
|
-
from
|
|
15
|
-
from
|
|
10
|
+
from shepherd_core.data_models.base.content import IdInt
|
|
11
|
+
from shepherd_core.data_models.base.content import NameStr
|
|
12
|
+
from shepherd_core.data_models.base.shepherd import ShpModel
|
|
13
|
+
from shepherd_core.data_models.experiment.experiment import Experiment
|
|
14
|
+
from shepherd_core.data_models.testbed.testbed import Testbed
|
|
15
|
+
|
|
16
16
|
from .observer_tasks import ObserverTasks
|
|
17
17
|
|
|
18
18
|
|
|
@@ -20,7 +20,7 @@ class TestbedTasks(ShpModel):
|
|
|
20
20
|
"""Collection of tasks for all observers included in experiment."""
|
|
21
21
|
|
|
22
22
|
name: NameStr
|
|
23
|
-
observer_tasks: Annotated[
|
|
23
|
+
observer_tasks: Annotated[list[ObserverTasks], Field(min_length=1, max_length=128)]
|
|
24
24
|
|
|
25
25
|
# POST PROCESS
|
|
26
26
|
email_results: bool = False
|
|
@@ -3,17 +3,18 @@
|
|
|
3
3
|
from datetime import date
|
|
4
4
|
from datetime import datetime
|
|
5
5
|
from enum import Enum
|
|
6
|
+
from typing import Any
|
|
6
7
|
from typing import Optional
|
|
7
8
|
from typing import Union
|
|
8
9
|
|
|
9
10
|
from pydantic import Field
|
|
10
11
|
from pydantic import model_validator
|
|
11
12
|
|
|
12
|
-
from
|
|
13
|
-
from
|
|
14
|
-
from
|
|
15
|
-
from
|
|
16
|
-
from
|
|
13
|
+
from shepherd_core.data_models.base.content import IdInt
|
|
14
|
+
from shepherd_core.data_models.base.content import NameStr
|
|
15
|
+
from shepherd_core.data_models.base.content import SafeStr
|
|
16
|
+
from shepherd_core.data_models.base.shepherd import ShpModel
|
|
17
|
+
from shepherd_core.testbed_client import tb_client
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
class TargetPort(str, Enum):
|
|
@@ -42,6 +43,6 @@ class Cape(ShpModel, title="Shepherd-Cape"):
|
|
|
42
43
|
|
|
43
44
|
@model_validator(mode="before")
|
|
44
45
|
@classmethod
|
|
45
|
-
def query_database(cls, values: dict) -> dict:
|
|
46
|
+
def query_database(cls, values: dict[str, Any]) -> dict[str, Any]:
|
|
46
47
|
values, _ = tb_client.try_completing_model(cls.__name__, values)
|
|
47
48
|
return values
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
"""meta-data representation of a testbed-component (physical object)."""
|
|
2
2
|
|
|
3
3
|
from enum import Enum
|
|
4
|
+
from typing import Annotated
|
|
5
|
+
from typing import Any
|
|
4
6
|
from typing import Optional
|
|
5
7
|
|
|
6
8
|
from pydantic import Field
|
|
7
9
|
from pydantic import StringConstraints
|
|
8
10
|
from pydantic import model_validator
|
|
9
|
-
from typing_extensions import Annotated
|
|
10
11
|
from typing_extensions import Self
|
|
11
12
|
|
|
12
|
-
from
|
|
13
|
-
from
|
|
14
|
-
from
|
|
15
|
-
from
|
|
16
|
-
from
|
|
13
|
+
from shepherd_core.data_models.base.content import IdInt
|
|
14
|
+
from shepherd_core.data_models.base.content import NameStr
|
|
15
|
+
from shepherd_core.data_models.base.content import SafeStr
|
|
16
|
+
from shepherd_core.data_models.base.shepherd import ShpModel
|
|
17
|
+
from shepherd_core.testbed_client import tb_client
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
class Direction(str, Enum):
|
|
@@ -45,7 +46,7 @@ class GPIO(ShpModel, title="GPIO of Observer Node"):
|
|
|
45
46
|
|
|
46
47
|
@model_validator(mode="before")
|
|
47
48
|
@classmethod
|
|
48
|
-
def query_database(cls, values: dict) -> dict:
|
|
49
|
+
def query_database(cls, values: dict[str, Any]) -> dict[str, Any]:
|
|
49
50
|
values, _ = tb_client.try_completing_model(cls.__name__, values)
|
|
50
51
|
return values
|
|
51
52
|
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
"""meta-data representation of a testbed-component (physical object)."""
|
|
2
2
|
|
|
3
3
|
from enum import Enum
|
|
4
|
+
from typing import Annotated
|
|
5
|
+
from typing import Any
|
|
4
6
|
from typing import Optional
|
|
5
7
|
|
|
6
8
|
from pydantic import Field
|
|
7
9
|
from pydantic import model_validator
|
|
8
|
-
from typing_extensions import Annotated
|
|
9
10
|
|
|
10
|
-
from
|
|
11
|
-
from
|
|
12
|
-
from
|
|
13
|
-
from
|
|
14
|
-
from
|
|
11
|
+
from shepherd_core.data_models.base.content import IdInt
|
|
12
|
+
from shepherd_core.data_models.base.content import NameStr
|
|
13
|
+
from shepherd_core.data_models.base.content import SafeStr
|
|
14
|
+
from shepherd_core.data_models.base.shepherd import ShpModel
|
|
15
|
+
from shepherd_core.testbed_client import tb_client
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
class ProgrammerProtocol(str, Enum):
|
|
@@ -45,6 +46,6 @@ class MCU(ShpModel, title="Microcontroller of the Target Node"):
|
|
|
45
46
|
|
|
46
47
|
@model_validator(mode="before")
|
|
47
48
|
@classmethod
|
|
48
|
-
def query_database(cls, values: dict) -> dict:
|
|
49
|
+
def query_database(cls, values: dict[str, Any]) -> dict[str, Any]:
|
|
49
50
|
values, _ = tb_client.try_completing_model(cls.__name__, values)
|
|
50
51
|
return values
|
|
@@ -3,17 +3,17 @@
|
|
|
3
3
|
parameters:
|
|
4
4
|
id: 1001
|
|
5
5
|
name: nRF52
|
|
6
|
-
description:
|
|
6
|
+
description: MCU with RF, 802.15.4, Bluetooth v5.0, 2.4GHz
|
|
7
7
|
platform: nRF52
|
|
8
8
|
core: nRF52840
|
|
9
9
|
prog_protocol: SWD
|
|
10
|
-
fw_name_default:
|
|
10
|
+
fw_name_default: nrf52_deep_sleep
|
|
11
11
|
- datatype: mcu
|
|
12
12
|
parameters:
|
|
13
13
|
id: 1002
|
|
14
14
|
name: MSP430FR
|
|
15
|
-
description: 16MHz Ultra-Low-Pwr MCU with
|
|
15
|
+
description: 16MHz Ultra-Low-Pwr MCU with 256 KB FRAM
|
|
16
16
|
platform: MSP430
|
|
17
|
-
core:
|
|
17
|
+
core: MSP430FR5994
|
|
18
18
|
prog_protocol: SBW
|
|
19
19
|
fw_name_default: msp430_deep_sleep
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
"""meta-data representation of a testbed-component (physical object)."""
|
|
2
2
|
|
|
3
3
|
from datetime import datetime
|
|
4
|
+
from typing import Annotated
|
|
5
|
+
from typing import Any
|
|
4
6
|
from typing import Optional
|
|
5
7
|
|
|
6
8
|
from pydantic import Field
|
|
7
9
|
from pydantic import IPvAnyAddress
|
|
8
10
|
from pydantic import StringConstraints
|
|
9
11
|
from pydantic import model_validator
|
|
10
|
-
from typing_extensions import Annotated
|
|
11
12
|
from typing_extensions import Self
|
|
12
13
|
|
|
13
|
-
from
|
|
14
|
-
from
|
|
15
|
-
from
|
|
16
|
-
from
|
|
17
|
-
from
|
|
14
|
+
from shepherd_core.data_models.base.content import IdInt
|
|
15
|
+
from shepherd_core.data_models.base.content import NameStr
|
|
16
|
+
from shepherd_core.data_models.base.content import SafeStr
|
|
17
|
+
from shepherd_core.data_models.base.shepherd import ShpModel
|
|
18
|
+
from shepherd_core.testbed_client import tb_client
|
|
19
|
+
|
|
18
20
|
from .cape import Cape
|
|
19
21
|
from .cape import TargetPort
|
|
20
22
|
from .target import Target
|
|
@@ -56,7 +58,7 @@ class Observer(ShpModel, title="Shepherd-Sheep"):
|
|
|
56
58
|
|
|
57
59
|
@model_validator(mode="before")
|
|
58
60
|
@classmethod
|
|
59
|
-
def query_database(cls, values: dict) -> dict:
|
|
61
|
+
def query_database(cls, values: dict[str, Any]) -> dict[str, Any]:
|
|
60
62
|
values, _ = tb_client.try_completing_model(cls.__name__, values)
|
|
61
63
|
return values
|
|
62
64
|
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
"""meta-data representation of a testbed-component (physical object)."""
|
|
2
2
|
|
|
3
3
|
from datetime import datetime
|
|
4
|
+
from typing import Annotated
|
|
5
|
+
from typing import Any
|
|
4
6
|
from typing import Optional
|
|
5
7
|
from typing import Union
|
|
6
8
|
|
|
7
9
|
from pydantic import Field
|
|
8
10
|
from pydantic import model_validator
|
|
9
|
-
from typing_extensions import Annotated
|
|
10
11
|
|
|
11
|
-
from
|
|
12
|
-
from
|
|
13
|
-
from
|
|
14
|
-
from
|
|
15
|
-
from
|
|
12
|
+
from shepherd_core.data_models.base.content import IdInt
|
|
13
|
+
from shepherd_core.data_models.base.content import NameStr
|
|
14
|
+
from shepherd_core.data_models.base.content import SafeStr
|
|
15
|
+
from shepherd_core.data_models.base.shepherd import ShpModel
|
|
16
|
+
from shepherd_core.testbed_client import tb_client
|
|
17
|
+
|
|
16
18
|
from .mcu import MCU
|
|
17
19
|
|
|
18
20
|
IdInt16 = Annotated[int, Field(ge=0, lt=2**16)]
|
|
@@ -45,7 +47,7 @@ class Target(ShpModel, title="Target Node (DuT)"):
|
|
|
45
47
|
|
|
46
48
|
@model_validator(mode="before")
|
|
47
49
|
@classmethod
|
|
48
|
-
def query_database(cls, values: dict) -> dict:
|
|
50
|
+
def query_database(cls, values: dict[str, Any]) -> dict[str, Any]:
|
|
49
51
|
values, _ = tb_client.try_completing_model(cls.__name__, values)
|
|
50
52
|
|
|
51
53
|
# post correction
|
|
@@ -2,21 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
from datetime import timedelta
|
|
4
4
|
from pathlib import Path
|
|
5
|
-
from typing import
|
|
5
|
+
from typing import Annotated
|
|
6
|
+
from typing import Any
|
|
6
7
|
from typing import Optional
|
|
7
8
|
|
|
8
9
|
from pydantic import Field
|
|
9
10
|
from pydantic import HttpUrl
|
|
10
11
|
from pydantic import model_validator
|
|
11
|
-
from typing_extensions import Annotated
|
|
12
12
|
from typing_extensions import Self
|
|
13
13
|
|
|
14
|
-
from
|
|
15
|
-
from
|
|
16
|
-
from
|
|
17
|
-
from
|
|
18
|
-
from
|
|
19
|
-
from
|
|
14
|
+
from shepherd_core.data_models.base.content import IdInt
|
|
15
|
+
from shepherd_core.data_models.base.content import NameStr
|
|
16
|
+
from shepherd_core.data_models.base.content import SafeStr
|
|
17
|
+
from shepherd_core.data_models.base.shepherd import ShpModel
|
|
18
|
+
from shepherd_core.logger import logger
|
|
19
|
+
from shepherd_core.testbed_client import tb_client
|
|
20
|
+
|
|
20
21
|
from .observer import Observer
|
|
21
22
|
|
|
22
23
|
|
|
@@ -30,7 +31,7 @@ class Testbed(ShpModel):
|
|
|
30
31
|
|
|
31
32
|
url: Optional[HttpUrl] = None
|
|
32
33
|
|
|
33
|
-
observers: Annotated[
|
|
34
|
+
observers: Annotated[list[Observer], Field(min_length=1, max_length=128)]
|
|
34
35
|
|
|
35
36
|
shared_storage: bool = True
|
|
36
37
|
data_on_server: Path
|
|
@@ -42,7 +43,7 @@ class Testbed(ShpModel):
|
|
|
42
43
|
|
|
43
44
|
@model_validator(mode="before")
|
|
44
45
|
@classmethod
|
|
45
|
-
def query_database(cls, values: dict) -> dict:
|
|
46
|
+
def query_database(cls, values: dict[str, Any]) -> dict[str, Any]:
|
|
46
47
|
# allow instantiating an empty Testbed
|
|
47
48
|
# -> query the first (and only) entry of client
|
|
48
49
|
if len(values) == 0:
|
|
@@ -35,14 +35,14 @@ class VirtualSourceDoc(ShpModel, title="Virtual Source (Documented, Testversion)
|
|
|
35
35
|
)
|
|
36
36
|
|
|
37
37
|
interval_startup_delay_drain_ms: float = Field(
|
|
38
|
-
description="Model begins running but Target is not draining the
|
|
38
|
+
description="Model begins running but Target is not draining the storage capacitor",
|
|
39
39
|
default=0,
|
|
40
40
|
ge=0,
|
|
41
41
|
le=10e3,
|
|
42
42
|
)
|
|
43
43
|
|
|
44
44
|
harvester: VirtualHarvesterConfig = Field(
|
|
45
|
-
description="Only active / needed if input is
|
|
45
|
+
description="Only active / needed if input is ivsurface / curves,
|
|
46
46
|
default=VirtualHarvesterConfig(name="mppt_opt"),
|
|
47
47
|
)
|
|
48
48
|
|
|
@@ -85,7 +85,7 @@ class VirtualSourceDoc(ShpModel, title="Virtual Source (Documented, Testversion)
|
|
|
85
85
|
le=10_000,
|
|
86
86
|
)
|
|
87
87
|
I_intermediate_leak_nA: float = Field(
|
|
88
|
-
description="Current leakage of intermediate
|
|
88
|
+
description="Current leakage of intermediate storage capacitor",
|
|
89
89
|
default=0,
|
|
90
90
|
ge=0,
|
|
91
91
|
le=4.29e9,
|
|
@@ -28,7 +28,7 @@ from typing import Union
|
|
|
28
28
|
|
|
29
29
|
import numpy as np
|
|
30
30
|
|
|
31
|
-
from
|
|
31
|
+
from shepherd_core.logger import logger
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
class Parity(str, Enum):
|
|
@@ -208,10 +208,10 @@ class Uart:
|
|
|
208
208
|
if self.events_symbols is not None:
|
|
209
209
|
return self.events_symbols
|
|
210
210
|
|
|
211
|
-
pos_df = None
|
|
212
|
-
symbol = 0
|
|
213
|
-
t_start = None
|
|
214
|
-
content = []
|
|
211
|
+
pos_df: Optional[int] = None
|
|
212
|
+
symbol: int = 0
|
|
213
|
+
t_start: Optional[float] = None
|
|
214
|
+
content: list = []
|
|
215
215
|
|
|
216
216
|
for time, value, steps in self.events_sig:
|
|
217
217
|
if steps > self.frame_length:
|