shepherd-core 2025.5.2__tar.gz → 2025.5.3__tar.gz
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-2025.5.2 → shepherd_core-2025.5.3}/PKG-INFO +1 -1
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/examples/experiment_generic_var1.py +1 -1
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/__init__.py +2 -2
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/base/content.py +4 -13
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/content/_external_fixtures.yaml +11 -11
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/content/virtual_harvester.py +246 -17
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/content/virtual_source.py +1 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/experiment/experiment.py +6 -6
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/experiment/observer_features.py +34 -17
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/experiment/target_config.py +2 -2
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/task/emulation.py +7 -7
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/task/harvest.py +3 -2
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/task/observer_tasks.py +5 -4
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/task/programming.py +1 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/task/testbed_tasks.py +3 -2
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/testbed/cape_fixture.yaml +8 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/testbed/gpio.py +7 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/testbed/observer_fixture.yaml +17 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/testbed/target_fixture.yaml +13 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/testbed/testbed_fixture.yaml +11 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/reader.py +6 -5
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/testbed_client/fixtures.py +13 -11
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/testbed_client/user_model.py +3 -6
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/version.py +1 -1
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core.egg-info/PKG-INFO +1 -1
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/data_models/example_config_emulator.yaml +1 -1
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/data_models/test_task_models.py +0 -1
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/README.md +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/examples/eenv_generator.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/examples/experiment_from_yaml.yaml +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/examples/experiment_generic_var2.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/examples/experiment_models.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/examples/firmware_model.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/examples/firmware_modification.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/examples/inventory.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/examples/simulate_vharvester.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/examples/simulate_vsource.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/examples/uart_decode_waveform.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/examples/uart_raw2.csv +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/examples/vsource_debug_sim.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/pyproject.toml +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/setup.cfg +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/__init__.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/calibration_hw_def.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/commons.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/base/__init__.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/base/cal_measurement.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/base/calibration.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/base/shepherd.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/base/timezone.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/base/wrapper.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/content/__init__.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/content/energy_environment.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/content/energy_environment_fixture.yaml +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/content/firmware.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/content/firmware_datatype.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/content/virtual_harvester_fixture.yaml +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/content/virtual_source_fixture.yaml +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/experiment/__init__.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/readme.md +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/task/__init__.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/task/firmware_mod.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/testbed/__init__.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/testbed/cape.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/testbed/gpio_fixture.yaml +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/testbed/mcu.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/testbed/mcu_fixture.yaml +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/testbed/observer.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/testbed/target.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/testbed/target_fixture.old1 +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/testbed/testbed.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/virtual_source_doc.txt +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/decoder_waveform/__init__.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/decoder_waveform/uart.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/fw_tools/__init__.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/fw_tools/converter.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/fw_tools/converter_elf.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/fw_tools/patcher.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/fw_tools/validation.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/inventory/__init__.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/inventory/python.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/inventory/system.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/inventory/target.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/logger.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/testbed_client/__init__.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/testbed_client/cache_path.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/testbed_client/client_abc_fix.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/testbed_client/client_web.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/vsource/__init__.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/vsource/target_model.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/vsource/virtual_converter_model.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/vsource/virtual_harvester_model.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/vsource/virtual_harvester_simulation.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/vsource/virtual_source_model.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/vsource/virtual_source_simulation.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/writer.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core.egg-info/SOURCES.txt +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core.egg-info/dependency_links.txt +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core.egg-info/requires.txt +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core.egg-info/top_level.txt +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core.egg-info/zip-safe +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/__init__.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/conftest.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/data_models/__init__.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/data_models/conftest.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/data_models/example_cal_data.yaml +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/data_models/example_cal_data_faulty.yaml +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/data_models/example_cal_meas.yaml +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/data_models/example_cal_meas_faulty1.yaml +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/data_models/example_cal_meas_faulty2.yaml +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/data_models/example_config_experiment.yaml +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/data_models/example_config_experiment_alternative.yaml +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/data_models/example_config_harvester.yaml +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/data_models/example_config_testbed.yaml +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/data_models/example_config_virtsource.yaml +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/data_models/test_base_models.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/data_models/test_content_fixtures.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/data_models/test_content_models.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/data_models/test_examples.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/data_models/test_experiment_models.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/data_models/test_task_generation.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/data_models/test_testbed_fixtures.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/data_models/test_testbed_models.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/decoder_waveform/__init__.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/decoder_waveform/test_decoder.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/fw_tools/__init__.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/fw_tools/build_msp.elf +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/fw_tools/build_nrf.elf +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/fw_tools/conftest.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/fw_tools/test_converter.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/fw_tools/test_patcher.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/fw_tools/test_validation.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/inventory/__init__.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/inventory/test_inventory.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/test_cal_hw.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/test_examples.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/test_logger.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/test_reader.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/test_writer.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/testbed_client/__init__.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/vsource/__init__.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/vsource/conftest.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/vsource/test_converter.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/vsource/test_harvester.py +0 -0
- {shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/tests/vsource/test_z.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: shepherd_core
|
|
3
|
-
Version: 2025.5.
|
|
3
|
+
Version: 2025.5.3
|
|
4
4
|
Summary: Programming- and CLI-Interface for the h5-dataformat of the Shepherd-Testbed
|
|
5
5
|
Author-email: Ingmar Splitt <ingmar.splitt@tu-dresden.de>
|
|
6
6
|
Maintainer-email: Ingmar Splitt <ingmar.splitt@tu-dresden.de>
|
|
@@ -31,7 +31,7 @@ from .experiment.observer_features import GpioLevel
|
|
|
31
31
|
from .experiment.observer_features import GpioTracing
|
|
32
32
|
from .experiment.observer_features import PowerTracing
|
|
33
33
|
from .experiment.observer_features import SystemLogging
|
|
34
|
-
from .experiment.observer_features import
|
|
34
|
+
from .experiment.observer_features import UartLogging
|
|
35
35
|
from .experiment.target_config import TargetConfig
|
|
36
36
|
|
|
37
37
|
__all__ = [
|
|
@@ -55,7 +55,7 @@ __all__ = [
|
|
|
55
55
|
"ShpModel",
|
|
56
56
|
"SystemLogging",
|
|
57
57
|
"TargetConfig",
|
|
58
|
-
"
|
|
58
|
+
"UartLogging",
|
|
59
59
|
"VirtualHarvesterConfig",
|
|
60
60
|
"VirtualSourceConfig",
|
|
61
61
|
"Wrapper",
|
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
"""Base-Model for all content."""
|
|
2
2
|
|
|
3
|
-
import hashlib
|
|
4
3
|
from datetime import datetime
|
|
5
4
|
from typing import Annotated
|
|
6
5
|
from typing import Optional
|
|
7
|
-
from typing import Union
|
|
8
6
|
from uuid import uuid4
|
|
9
7
|
|
|
10
|
-
from pydantic import UUID4
|
|
11
8
|
from pydantic import Field
|
|
12
9
|
from pydantic import StringConstraints
|
|
13
10
|
from pydantic import model_validator
|
|
14
11
|
from typing_extensions import Self
|
|
15
|
-
from typing_extensions import deprecated
|
|
16
12
|
|
|
17
13
|
from .shepherd import ShpModel
|
|
18
|
-
from .timezone import local_now
|
|
19
14
|
|
|
20
15
|
# constr -> to_lower=True, max_length=16, regex=r"^[\w]+$"
|
|
21
16
|
# ⤷ Regex = AlphaNum
|
|
@@ -26,24 +21,20 @@ SafeStr = Annotated[str, StringConstraints(pattern=r"^[ -~]+$")]
|
|
|
26
21
|
# ⤷ Regex = All Printable ASCII-Characters with Space
|
|
27
22
|
|
|
28
23
|
|
|
29
|
-
@deprecated("use UUID4 instead")
|
|
30
24
|
def id_default() -> int:
|
|
31
25
|
"""Generate a unique ID - usable as default value.
|
|
32
26
|
|
|
33
|
-
Note: IdInt
|
|
27
|
+
Note: IdInt in mongoDB can currently handle 8 bytes (16 hex-values)
|
|
34
28
|
"""
|
|
35
|
-
|
|
36
|
-
time_hash = hashlib.sha3_224(time_stamp).hexdigest()[-32:]
|
|
37
|
-
return int(time_hash, 16)
|
|
29
|
+
return int(uuid4().hex[-15:], 16)
|
|
38
30
|
|
|
39
31
|
|
|
40
32
|
class ContentModel(ShpModel):
|
|
41
33
|
"""Base-Model for content with generalized properties."""
|
|
42
34
|
|
|
43
|
-
|
|
44
|
-
id: Union[UUID4, int] = Field(
|
|
35
|
+
id: int = Field(
|
|
45
36
|
description="Unique ID",
|
|
46
|
-
default_factory=
|
|
37
|
+
default_factory=id_default,
|
|
47
38
|
)
|
|
48
39
|
name: NameStr
|
|
49
40
|
description: Annotated[Optional[SafeStr], Field(description="Required when public")] = None
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
- datatype: EnergyEnvironment
|
|
2
2
|
created: 2025-05-12 17:28:39.756999+02:00
|
|
3
3
|
parameters:
|
|
4
|
-
id:
|
|
4
|
+
id: 263956097252422
|
|
5
5
|
name: eenv_static_2000mV_10mA_3600s
|
|
6
6
|
description: Artificial static Energy Environment, 2000mV, 10mA, 3600s
|
|
7
7
|
comment: null
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
- datatype: EnergyEnvironment
|
|
25
25
|
created: 2025-05-12 17:28:39.764595+02:00
|
|
26
26
|
parameters:
|
|
27
|
-
id:
|
|
27
|
+
id: 98233941059
|
|
28
28
|
name: eenv_static_2000mV_1mA_3600s
|
|
29
29
|
description: Artificial static Energy Environment, 2000mV, 1mA, 3600s
|
|
30
30
|
comment: null
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
- datatype: EnergyEnvironment
|
|
48
48
|
created: 2025-05-12 17:28:39.772144+02:00
|
|
49
49
|
parameters:
|
|
50
|
-
id:
|
|
50
|
+
id: 39006156751
|
|
51
51
|
name: eenv_static_2000mV_50mA_3600s
|
|
52
52
|
description: Artificial static Energy Environment, 2000mV, 50mA, 3600s
|
|
53
53
|
comment: null
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
- datatype: EnergyEnvironment
|
|
71
71
|
created: 2025-05-12 17:28:39.779737+02:00
|
|
72
72
|
parameters:
|
|
73
|
-
id:
|
|
73
|
+
id: 1479667372943113
|
|
74
74
|
name: eenv_static_2000mV_5mA_3600s
|
|
75
75
|
description: Artificial static Energy Environment, 2000mV, 5mA, 3600s
|
|
76
76
|
comment: null
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
- datatype: EnergyEnvironment
|
|
94
94
|
created: 2025-05-12 17:28:39.787329+02:00
|
|
95
95
|
parameters:
|
|
96
|
-
id:
|
|
96
|
+
id: 664848260660744
|
|
97
97
|
name: eenv_static_3000mV_10mA_3600s
|
|
98
98
|
description: Artificial static Energy Environment, 3000mV, 10mA, 3600s
|
|
99
99
|
comment: null
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
- datatype: EnergyEnvironment
|
|
117
117
|
created: 2025-05-12 17:28:39.794922+02:00
|
|
118
118
|
parameters:
|
|
119
|
-
id:
|
|
119
|
+
id: 1356600095104317
|
|
120
120
|
name: eenv_static_3000mV_1mA_3600s
|
|
121
121
|
description: Artificial static Energy Environment, 3000mV, 1mA, 3600s
|
|
122
122
|
comment: null
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
- datatype: EnergyEnvironment
|
|
140
140
|
created: 2025-05-12 17:28:39.802410+02:00
|
|
141
141
|
parameters:
|
|
142
|
-
id:
|
|
142
|
+
id: 797777832715661
|
|
143
143
|
name: eenv_static_3000mV_50mA_3600s
|
|
144
144
|
description: Artificial static Energy Environment, 3000mV, 50mA, 3600s
|
|
145
145
|
comment: null
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
- datatype: EnergyEnvironment
|
|
163
163
|
created: 2025-05-12 17:28:39.810147+02:00
|
|
164
164
|
parameters:
|
|
165
|
-
id:
|
|
165
|
+
id: 490016297899923
|
|
166
166
|
name: eenv_static_3000mV_5mA_3600s
|
|
167
167
|
description: Artificial static Energy Environment, 3000mV, 5mA, 3600s
|
|
168
168
|
comment: null
|
|
@@ -269,7 +269,7 @@
|
|
|
269
269
|
- datatype: Firmware
|
|
270
270
|
created: 2025-05-12 17:28:39.851412+02:00
|
|
271
271
|
parameters:
|
|
272
|
-
id:
|
|
272
|
+
id: 716391782544988
|
|
273
273
|
name: nrf52_deep_sleep
|
|
274
274
|
description: practically turned off MCU with the lowest possible consumption
|
|
275
275
|
comment: null
|
|
@@ -325,7 +325,7 @@
|
|
|
325
325
|
- datatype: Firmware
|
|
326
326
|
created: 2025-05-12 17:28:39.868340+02:00
|
|
327
327
|
parameters:
|
|
328
|
-
id:
|
|
328
|
+
id: 317443073305817
|
|
329
329
|
name: nrf52_rf_survey
|
|
330
330
|
description: Link Matrix Generator - TX-Unit - sends packet with every possible
|
|
331
331
|
P_TX, loops until stopped
|
|
@@ -354,7 +354,7 @@
|
|
|
354
354
|
- datatype: Firmware
|
|
355
355
|
created: 2025-05-12 17:28:39.876819+02:00
|
|
356
356
|
parameters:
|
|
357
|
-
id:
|
|
357
|
+
id: 1638193658072458
|
|
358
358
|
name: nrf52_rf_test
|
|
359
359
|
description: sends out 1 BLE-Packet per second (verify with an app like 'RaMBLE')
|
|
360
360
|
comment: null
|
|
@@ -23,54 +23,283 @@ from .energy_environment import EnergyDType
|
|
|
23
23
|
class AlgorithmDType(str, Enum):
|
|
24
24
|
"""Options for choosing a harvesting algorithm."""
|
|
25
25
|
|
|
26
|
-
direct = disable = neutral = "neutral"
|
|
27
|
-
|
|
26
|
+
direct = disable = neutral = "neutral"
|
|
27
|
+
"""
|
|
28
|
+
Reads an energy environment as is without selecting a harvesting
|
|
29
|
+
voltage.
|
|
30
|
+
|
|
31
|
+
Used to play "constant-power" energy environments or simple
|
|
32
|
+
"on-off-patterns". Generally, not useful for virtual source
|
|
33
|
+
emulation.
|
|
34
|
+
|
|
35
|
+
Not applicable to real harvesting, only emulation with IVTrace / samples.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
isc_voc = "isc_voc"
|
|
39
|
+
"""
|
|
40
|
+
Short Circuit Current, Open Circuit Voltage.
|
|
41
|
+
|
|
42
|
+
This is not relevant for emulation, but used to configure recording of
|
|
43
|
+
energy environments.
|
|
44
|
+
|
|
45
|
+
This mode samples the two extremes of an IV curve, which may be
|
|
46
|
+
interesting to characterize a transducer/energy environment.
|
|
47
|
+
|
|
48
|
+
Not applicable to emulation - only recordable during harvest-recording ATM.
|
|
49
|
+
"""
|
|
50
|
+
|
|
28
51
|
ivcurve = ivcurves = ivsurface = "ivcurve"
|
|
52
|
+
"""
|
|
53
|
+
Used during harvesting to record the full IV surface.
|
|
54
|
+
|
|
55
|
+
When configuring the energy environment recording, this algorithm
|
|
56
|
+
records the IV surface by repeatedly recording voltage and current
|
|
57
|
+
while ramping the voltage.
|
|
58
|
+
|
|
59
|
+
Cannot be used as output of emulation.
|
|
60
|
+
"""
|
|
61
|
+
|
|
29
62
|
constant = cv = "cv"
|
|
63
|
+
"""
|
|
64
|
+
Harvest energy at a fixed predefined voltage ('voltage_mV').
|
|
65
|
+
|
|
66
|
+
For harvesting, this records the IV samples at the specified voltage.
|
|
67
|
+
For emulation, this virtually harvests the IV surface at the specified voltage.
|
|
68
|
+
|
|
69
|
+
In addition to constant voltage harvesting, this can be used together
|
|
70
|
+
with the 'feedback_to_hrv' flag to implement a "Capacitor and Diode"
|
|
71
|
+
topology, where the harvesting voltage depends dynamically on the
|
|
72
|
+
capacitor voltage.
|
|
73
|
+
"""
|
|
74
|
+
|
|
30
75
|
# ci .. constant current -> is this desired?
|
|
76
|
+
|
|
31
77
|
mppt_voc = "mppt_voc"
|
|
78
|
+
"""
|
|
79
|
+
Emulate a harvester with maximum power point (MPP) tracking based on
|
|
80
|
+
open circuit voltage measurements.
|
|
81
|
+
|
|
82
|
+
This MPPT heuristic estimates the MPP as a constant ratio of the open
|
|
83
|
+
circuit voltage.
|
|
84
|
+
|
|
85
|
+
Used in conjunction with 'setpoint_n', 'interval_ms', and 'duration_ms'.
|
|
86
|
+
"""
|
|
87
|
+
|
|
32
88
|
mppt_po = perturb_observe = "mppt_po"
|
|
89
|
+
"""
|
|
90
|
+
Emulate a harvester with perturb and observe maximum power point
|
|
91
|
+
tracking.
|
|
92
|
+
|
|
93
|
+
This MPPT heuristic adjusts the harvesting voltage by small amounts and
|
|
94
|
+
checks if the power increases. Eventually, the tracking changes the
|
|
95
|
+
direction of adjustments and oscillates around the MPP.
|
|
96
|
+
"""
|
|
97
|
+
|
|
33
98
|
mppt_opt = optimal = "mppt_opt"
|
|
99
|
+
"""
|
|
100
|
+
A theoretical harvester that identifies the MPP by reading it from the
|
|
101
|
+
IV curve during emulation.
|
|
34
102
|
|
|
103
|
+
Note that this is not possible for real-world harvesting as the system would
|
|
104
|
+
not know the entire IV curve. In that case a very fast and detailed mppt_po is
|
|
105
|
+
used.
|
|
106
|
+
"""
|
|
35
107
|
|
|
36
|
-
class VirtualHarvesterConfig(ContentModel, title="Config for the Harvester"):
|
|
37
|
-
"""A vHrv makes a source-characterization (i.e. ivcurve) usable for the vSrc.
|
|
38
108
|
|
|
39
|
-
|
|
40
|
-
|
|
109
|
+
class VirtualHarvesterConfig(ContentModel, title="Config for the Harvester"):
|
|
110
|
+
"""The virtual harvester configuration characterizes usage of an energy environment.
|
|
111
|
+
|
|
112
|
+
It is used to both harvesting during emulation and to record
|
|
113
|
+
energy environments (sometimes referred to as "harvesting traces").
|
|
114
|
+
|
|
115
|
+
For emulation:
|
|
116
|
+
|
|
117
|
+
The virtual harvester configuration describes how energy from a recorded
|
|
118
|
+
energy environment is harvested. Typically, the energy environment provides
|
|
119
|
+
an IV-surface, which is a continuous function in three dimensions: voltage,
|
|
120
|
+
current, and time. Based on this surface, the emulation can derive the
|
|
121
|
+
available IV-curve at each point in time. The harvester looks up the current
|
|
122
|
+
that is available (according to the energy environment) from a given
|
|
123
|
+
harvesting voltage. The harvesting voltage may be dynamically chosen by the
|
|
124
|
+
harvester based on the implemented harvesting algorithm, which models
|
|
125
|
+
different real-world harvesters. For example, a maximum power point tracking
|
|
126
|
+
harvester may choose a harvesting voltage as a ratio of the open circuit
|
|
127
|
+
voltage available from the energy environment (or transducer in practice).
|
|
128
|
+
|
|
129
|
+
The energy environments are encoded not as a three-dimensional function, but
|
|
130
|
+
as IV tuples over time (sampled at a constant frequency). This originates
|
|
131
|
+
from the technical implementation when recording the IV-surface, where the
|
|
132
|
+
recorder provides the IV-curve by measuring the current for a given voltage
|
|
133
|
+
and ramping the voltage from minimal to maximum.
|
|
134
|
+
|
|
135
|
+
For harvest-recordings:
|
|
136
|
+
|
|
137
|
+
An energy environment is fully described by the IV surface, which are IV
|
|
138
|
+
curves over time. Shepherd approximates this by sampling the current at
|
|
139
|
+
equidistant steps of a voltage ramp. The VirtualHarvesterConfig is also used
|
|
140
|
+
to parameterize the recording process, typically, it should be configured to
|
|
141
|
+
record a full IV surface, as this contains the full information of the energy
|
|
142
|
+
environment. The postponed harvesting is then performed during emulation.
|
|
143
|
+
|
|
144
|
+
However, it is also possible to record a "pre-harvested" energy environment
|
|
145
|
+
by performing the harvesting during recording. This results in a recording
|
|
146
|
+
containing IV samples over time that represent the harvesting voltage
|
|
147
|
+
(chosen by the virtual harvester during recording) and the current available
|
|
148
|
+
from the energy environment for that voltage. Together, these represent the
|
|
149
|
+
power available for harvesting at the time, and during emulation, this power
|
|
150
|
+
can be converted by the input stage (boost converter) to charge the energy
|
|
151
|
+
storage.
|
|
41
152
|
"""
|
|
42
153
|
|
|
43
154
|
# General Metadata & Ownership -> ContentModel
|
|
44
155
|
|
|
45
156
|
algorithm: AlgorithmDType
|
|
46
|
-
|
|
157
|
+
"""The algorithm determines how the harvester chooses the harvesting voltage.
|
|
158
|
+
"""
|
|
47
159
|
|
|
48
160
|
samples_n: Annotated[int, Field(ge=8, le=2_000)] = 8
|
|
49
|
-
|
|
161
|
+
"""How many IV samples are measured for one IV curve.
|
|
162
|
+
|
|
163
|
+
The curve is recorded by measuring the el. current available from the
|
|
164
|
+
transducer at equidistant voltage intervals. These voltages are
|
|
165
|
+
probed by ramping between `voltage_min_mV` and `voltage_max_mV` at
|
|
166
|
+
`samples_n` points equally distributed over the voltage range. After
|
|
167
|
+
setting the voltage, the recorder waits for a short period - allowing
|
|
168
|
+
the analog frontend and transducer to settle - before recording the
|
|
169
|
+
harvesting current. This wait duration is influenced by
|
|
170
|
+
`wait_cycles`.
|
|
171
|
+
|
|
172
|
+
Selecting all these parameters is a tradeoff between accuracy of the IV
|
|
173
|
+
curve (density of IV samples) and measurement duration, hence the time
|
|
174
|
+
accuracy (density of points) of the IV-surface.
|
|
175
|
+
|
|
176
|
+
Only applicable to recording, not used in emulation.
|
|
177
|
+
|
|
178
|
+
Used together with `voltage_min_mV`, `voltage_max_mV`, `rising`, and
|
|
179
|
+
`wait_cycles`.
|
|
180
|
+
"""
|
|
50
181
|
|
|
51
182
|
voltage_mV: Annotated[float, Field(ge=0, le=5_000)] = 2_500
|
|
52
|
-
|
|
183
|
+
"""The harvesting voltage for constant voltage harvesting.
|
|
184
|
+
|
|
185
|
+
Additionally, for Perturb-and-Observe MPPT, this defines the voltage at
|
|
186
|
+
startup.
|
|
187
|
+
"""
|
|
188
|
+
|
|
53
189
|
voltage_min_mV: Annotated[float, Field(ge=0, le=5_000)] = 0
|
|
190
|
+
"""Minimum voltage recorded for the IV curve.
|
|
191
|
+
|
|
192
|
+
See `samples_n` for further details.
|
|
193
|
+
|
|
194
|
+
In emulation, this can be used to "block" parts of the recorded IV curve
|
|
195
|
+
and not utilize them in the virtual source. However, this is generally
|
|
196
|
+
discouraged as it can result in discontinuities in the curve and is not
|
|
197
|
+
well tested.
|
|
198
|
+
For emulation, this value ideally corresponds to the value of the
|
|
199
|
+
recorded energy environment.
|
|
200
|
+
"""
|
|
201
|
+
|
|
54
202
|
voltage_max_mV: Annotated[float, Field(ge=0, le=5_000)] = 5_000
|
|
203
|
+
"""Maximum voltage sampled for the curve.
|
|
204
|
+
|
|
205
|
+
See `voltage_min_mV` and `samples_n`.
|
|
206
|
+
"""
|
|
207
|
+
|
|
55
208
|
current_limit_uA: Annotated[float, Field(ge=1, le=50_000)] = 50_000
|
|
56
|
-
|
|
57
|
-
|
|
209
|
+
"""
|
|
210
|
+
For MPPT VOC, the open circuit voltage is identified as the el. current
|
|
211
|
+
crosses below this threshold.
|
|
212
|
+
|
|
213
|
+
During recording it allows to keep trajectory in special region
|
|
214
|
+
(constant current tracking).
|
|
215
|
+
"""
|
|
216
|
+
|
|
58
217
|
voltage_step_mV: Optional[Annotated[float, Field(ge=1, le=1_000_000)]] = None
|
|
218
|
+
"""The difference between two adjacent voltage samples.
|
|
219
|
+
|
|
220
|
+
This value is implicitly derived from the other ramp parameters:
|
|
221
|
+
(voltage_max_mV - voltage_min_mV) / (samples_n - 1)
|
|
222
|
+
"""
|
|
59
223
|
|
|
60
224
|
setpoint_n: Annotated[float, Field(ge=0, le=1.0)] = 0.70
|
|
61
|
-
|
|
225
|
+
"""
|
|
226
|
+
The "Open Circuit Voltage Maximum Power Point Tracker" estimates the MPP
|
|
227
|
+
by taking a constant fraction defined by this parameter of the open
|
|
228
|
+
circuit voltage. For example, if the IV curve shows an open circuit
|
|
229
|
+
voltage of 2V and the setpoint is 0.75, then the harvester selects
|
|
230
|
+
1.5 volts as the harvesting voltage.
|
|
231
|
+
|
|
232
|
+
This value is only relevant when 'algorithm == mppt_voc'.
|
|
233
|
+
"""
|
|
234
|
+
|
|
62
235
|
interval_ms: Annotated[float, Field(ge=0.01, le=1_000_000)] = 100
|
|
63
|
-
|
|
236
|
+
"""The MPP is repeatedly estimated at fixed intervals defined by this duration.
|
|
237
|
+
|
|
238
|
+
Note that the energy environment can still change in between MPP
|
|
239
|
+
estimations, but the harvesting voltage is not updated in between.
|
|
240
|
+
|
|
241
|
+
This value is relevant for all MPP algorithms.
|
|
242
|
+
For Perturb and Observe, this value is the wait interval between steps.
|
|
243
|
+
|
|
244
|
+
When an energy environment is recorded with `mppt_opt`, the optimal
|
|
245
|
+
harvester is approximated with a very fast Perturb-Observe algorithm,
|
|
246
|
+
where this interval should be set to a very small value.
|
|
247
|
+
When emulating with `mppt_opt`, this value is not relevant as the
|
|
248
|
+
emulation simply picks the maximum power point from the IV-curve.
|
|
249
|
+
"""
|
|
250
|
+
|
|
64
251
|
duration_ms: Annotated[float, Field(ge=0.01, le=1_000_000)] = 0.1
|
|
65
|
-
|
|
252
|
+
"""The duration of MPP sampling.
|
|
253
|
+
|
|
254
|
+
While performing an MPP sampling every 'interval_ms', the input is
|
|
255
|
+
disconnected to accurately measure the open circuit voltage.
|
|
256
|
+
|
|
257
|
+
This value is only relevant for `mppt_voc`.
|
|
258
|
+
"""
|
|
259
|
+
|
|
66
260
|
rising: bool = True
|
|
67
|
-
|
|
261
|
+
"""Ramp direction for sampling the IV curve.
|
|
262
|
+
|
|
263
|
+
When set to true, sampling starts at the minimum voltage and ramps up to
|
|
264
|
+
the maximum.
|
|
265
|
+
|
|
266
|
+
See `samples_n` for further details.
|
|
267
|
+
Not relevant for emulation.
|
|
268
|
+
"""
|
|
269
|
+
|
|
68
270
|
enable_linear_extrapolation: bool = True
|
|
69
|
-
|
|
70
|
-
|
|
271
|
+
"""
|
|
272
|
+
Because the IV curve is not stored fully in PRU memory but streamed
|
|
273
|
+
sequentially to the PRU, looking up any IV value at any time is not
|
|
274
|
+
possible. However, because the precision of the emulation degrades
|
|
275
|
+
until the relevant IV sample passes by, it can extrapolate the available data
|
|
276
|
+
to estimate the required IV sample.
|
|
277
|
+
|
|
278
|
+
Enabling extrapolation can yield a better numeric simulation, especially
|
|
279
|
+
if the harvesting voltage changes rapidly or the IV surface is steep in
|
|
280
|
+
relevant regions. For example, when emulating a capacitor diode
|
|
281
|
+
setup and the current falls at high voltages.
|
|
282
|
+
|
|
283
|
+
This value is only relevant for emulation.
|
|
284
|
+
"""
|
|
71
285
|
|
|
72
286
|
# Underlying recorder
|
|
73
287
|
wait_cycles: Annotated[int, Field(ge=0, le=100)] = 1
|
|
288
|
+
"""
|
|
289
|
+
The wait duration to let the analog frontend settle before taking a
|
|
290
|
+
measurement.
|
|
291
|
+
|
|
292
|
+
When recording the energy environment, the voltage is set by the
|
|
293
|
+
digital-to-analog-converter. This parameter delays the current
|
|
294
|
+
measurement performed by the analog-to-digital converter to allow the
|
|
295
|
+
harvesting transducer to settle at the defined voltage.
|
|
296
|
+
|
|
297
|
+
When recording with `IscVoc`, wait cycles should be added as the analog
|
|
298
|
+
changes are more significant.
|
|
299
|
+
|
|
300
|
+
Not relevant for emulation.
|
|
301
|
+
"""
|
|
302
|
+
|
|
74
303
|
# ⤷ first cycle: ADC-Sampling & DAC-Writing, further steps: waiting
|
|
75
304
|
|
|
76
305
|
@model_validator(mode="before")
|
|
@@ -70,6 +70,7 @@ class VirtualSourceConfig(ContentModel, title="Config for the virtual Source"):
|
|
|
70
70
|
# ⤷ target gets disconnected
|
|
71
71
|
interval_check_thresholds_ms: Annotated[float, Field(ge=0, le=4.29e3)] = 0
|
|
72
72
|
# ⤷ some ICs (BQ) check every 64 ms if output should be disconnected
|
|
73
|
+
# TODO: add intervals for input-disable, output-disable & power-good-signal
|
|
73
74
|
|
|
74
75
|
# pwr-good: target is informed on output-pin (hysteresis) -> for intermediate voltage
|
|
75
76
|
V_pwr_good_enable_threshold_mV: Annotated[float, Field(ge=0, le=10_000)] = 2_800
|
{shepherd_core-2025.5.2 → shepherd_core-2025.5.3}/shepherd_core/data_models/experiment/experiment.py
RENAMED
|
@@ -5,17 +5,16 @@ from datetime import datetime
|
|
|
5
5
|
from datetime import timedelta
|
|
6
6
|
from typing import Annotated
|
|
7
7
|
from typing import Optional
|
|
8
|
-
from typing import Union
|
|
9
|
-
from uuid import uuid4
|
|
10
8
|
|
|
11
|
-
from pydantic import UUID4
|
|
12
9
|
from pydantic import Field
|
|
13
10
|
from pydantic import model_validator
|
|
14
11
|
from typing_extensions import Self
|
|
12
|
+
from typing_extensions import deprecated
|
|
15
13
|
|
|
16
14
|
from shepherd_core.data_models.base.content import IdInt
|
|
17
15
|
from shepherd_core.data_models.base.content import NameStr
|
|
18
16
|
from shepherd_core.data_models.base.content import SafeStr
|
|
17
|
+
from shepherd_core.data_models.base.content import id_default
|
|
19
18
|
from shepherd_core.data_models.base.shepherd import ShpModel
|
|
20
19
|
from shepherd_core.data_models.testbed.target import Target
|
|
21
20
|
from shepherd_core.data_models.testbed.testbed import Testbed
|
|
@@ -29,8 +28,7 @@ class Experiment(ShpModel, title="Config of an Experiment"):
|
|
|
29
28
|
"""Config for experiments on the testbed emulating energy environments for target nodes."""
|
|
30
29
|
|
|
31
30
|
# General Properties
|
|
32
|
-
|
|
33
|
-
id: Union[UUID4, int] = Field(default_factory=uuid4)
|
|
31
|
+
id: int = Field(description="Unique ID", default_factory=id_default)
|
|
34
32
|
# ⤷ TODO: automatic ID is problematic for identification by hash
|
|
35
33
|
|
|
36
34
|
name: NameStr
|
|
@@ -51,7 +49,7 @@ class Experiment(ShpModel, title="Config of an Experiment"):
|
|
|
51
49
|
# schedule
|
|
52
50
|
time_start: Optional[datetime] = None # = ASAP
|
|
53
51
|
duration: Optional[timedelta] = None # = till EOF
|
|
54
|
-
abort_on_error: bool = False
|
|
52
|
+
abort_on_error: Annotated[bool, deprecated("has no effect")] = False
|
|
55
53
|
|
|
56
54
|
# targets
|
|
57
55
|
target_configs: Annotated[list[TargetConfig], Field(min_length=1, max_length=128)]
|
|
@@ -61,6 +59,8 @@ class Experiment(ShpModel, title="Config of an Experiment"):
|
|
|
61
59
|
|
|
62
60
|
@model_validator(mode="after")
|
|
63
61
|
def post_validation(self) -> Self:
|
|
62
|
+
# TODO: only do deep validation with active connection to TB-client
|
|
63
|
+
# or with cached fixtures
|
|
64
64
|
testbed = Testbed() # this will query the first (and only) entry of client
|
|
65
65
|
self._validate_targets(self.target_configs)
|
|
66
66
|
self._validate_observers(self.target_configs, testbed)
|
|
@@ -6,12 +6,14 @@ from typing import Annotated
|
|
|
6
6
|
from typing import Optional
|
|
7
7
|
|
|
8
8
|
import numpy as np
|
|
9
|
+
from annotated_types import Interval
|
|
9
10
|
from pydantic import Field
|
|
10
11
|
from pydantic import PositiveFloat
|
|
11
12
|
from pydantic import model_validator
|
|
12
13
|
from typing_extensions import Self
|
|
13
14
|
from typing_extensions import deprecated
|
|
14
15
|
|
|
16
|
+
from shepherd_core import logger
|
|
15
17
|
from shepherd_core.data_models.base.shepherd import ShpModel
|
|
16
18
|
from shepherd_core.data_models.testbed.gpio import GPIO
|
|
17
19
|
|
|
@@ -105,7 +107,7 @@ STOPBITS_ONE, STOPBITS_ONE_POINT_FIVE, STOPBITS_TWO = (1, 1.5, 2)
|
|
|
105
107
|
STOPBITS = (STOPBITS_ONE, STOPBITS_ONE_POINT_FIVE, STOPBITS_TWO)
|
|
106
108
|
|
|
107
109
|
|
|
108
|
-
class
|
|
110
|
+
class UartLogging(ShpModel, title="Config for UART Logging"):
|
|
109
111
|
"""Configuration for recording UART-Output of the Target Nodes.
|
|
110
112
|
|
|
111
113
|
Note that the Communication has to be on a specific port that
|
|
@@ -132,17 +134,33 @@ class UartTracing(ShpModel, title="Config for UART Tracing"):
|
|
|
132
134
|
return self
|
|
133
135
|
|
|
134
136
|
|
|
137
|
+
GpioInt = Annotated[int, Interval(ge=0, le=17)]
|
|
138
|
+
GpioList = Annotated[list[GpioInt], Field(min_length=1, max_length=18)]
|
|
139
|
+
all_gpio = list(range(18))
|
|
140
|
+
|
|
141
|
+
|
|
135
142
|
class GpioTracing(ShpModel, title="Config for GPIO-Tracing"):
|
|
136
143
|
"""Configuration for recording the GPIO-Output of the Target Nodes.
|
|
137
144
|
|
|
138
145
|
TODO: postprocessing not implemented ATM
|
|
139
146
|
"""
|
|
140
147
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
148
|
+
gpios: GpioList = all_gpio
|
|
149
|
+
"""List of GPIO to record.
|
|
150
|
+
|
|
151
|
+
This feature allows to remove unwanted pins from recording,
|
|
152
|
+
i.e. for chatty pins with separate UART Logging enabled.
|
|
153
|
+
Numbering is based on the Target-Port and its 16x GPIO and two PwrGood-Signals.
|
|
154
|
+
See doc for nRF_FRAM_Target_v1.3+ to see mapping of target port.
|
|
155
|
+
|
|
156
|
+
Example for skipping UART (pin 0 & 1):
|
|
157
|
+
.gpio = range(2,18)
|
|
158
|
+
|
|
159
|
+
Note:
|
|
160
|
+
- Cape 2.4 (2023) and lower only has 9x GPIO + 1x PwrGood
|
|
161
|
+
- Cape 2.5 (2025) has first 12 GPIO & both PwrGood
|
|
162
|
+
- this will be mapped accordingly by the observer
|
|
163
|
+
"""
|
|
146
164
|
|
|
147
165
|
# time
|
|
148
166
|
delay: timedelta = timedelta(seconds=0)
|
|
@@ -150,31 +168,30 @@ class GpioTracing(ShpModel, title="Config for GPIO-Tracing"):
|
|
|
150
168
|
|
|
151
169
|
# post-processing,
|
|
152
170
|
uart_decode: bool = False
|
|
153
|
-
# TODO: quickfix - uart-log currently done online in userspace
|
|
154
|
-
# NOTE: gpio-tracing currently shows rather big - but rare - "blind" windows (~1-4us)
|
|
155
171
|
uart_pin: GPIO = GPIO(name="GPIO8")
|
|
156
172
|
uart_baudrate: Annotated[int, Field(ge=2_400, le=1_152_000)] = 115_200
|
|
157
|
-
# TODO: add a "discard_gpio" (if only uart is wanted)
|
|
158
173
|
|
|
159
174
|
@model_validator(mode="after")
|
|
160
175
|
def post_validation(self) -> Self:
|
|
161
|
-
if self.mask == 0:
|
|
162
|
-
raise ValueError("Error in config -> tracing enabled but mask is 0")
|
|
163
176
|
if self.delay and self.delay.total_seconds() < 0:
|
|
164
177
|
raise ValueError("Delay can't be negative.")
|
|
165
178
|
if self.duration and self.duration.total_seconds() < 0:
|
|
166
179
|
raise ValueError("Duration can't be negative.")
|
|
167
|
-
if self.mask != 0b11_1111_1111: # GpioTracing.mask
|
|
168
|
-
raise NotImplementedError("Feature GpioTracing.mask reserved for future use.")
|
|
169
|
-
if self.gpios is not None:
|
|
170
|
-
raise NotImplementedError("Feature GpioTracing.gpios reserved for future use.")
|
|
171
180
|
if self.uart_decode:
|
|
172
|
-
|
|
181
|
+
logger.error(
|
|
173
182
|
"Feature GpioTracing.uart_decode reserved for future use. "
|
|
174
|
-
"Use
|
|
183
|
+
"Use UartLogging or manually decode serial with the provided waveform decoder."
|
|
175
184
|
)
|
|
176
185
|
return self
|
|
177
186
|
|
|
187
|
+
@property
|
|
188
|
+
def gpio_mask(self) -> int:
|
|
189
|
+
# valid for cape v2.5
|
|
190
|
+
mask = 0
|
|
191
|
+
for gpio in set(self.gpios):
|
|
192
|
+
mask |= 2**gpio
|
|
193
|
+
return mask
|
|
194
|
+
|
|
178
195
|
|
|
179
196
|
class GpioLevel(str, Enum):
|
|
180
197
|
"""Options for setting the gpio-level or state."""
|
|
@@ -18,7 +18,7 @@ from shepherd_core.data_models.testbed.target import Target
|
|
|
18
18
|
from .observer_features import GpioActuation
|
|
19
19
|
from .observer_features import GpioTracing
|
|
20
20
|
from .observer_features import PowerTracing
|
|
21
|
-
from .observer_features import
|
|
21
|
+
from .observer_features import UartLogging
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
class TargetConfig(ShpModel, title="Target Config"):
|
|
@@ -43,8 +43,8 @@ class TargetConfig(ShpModel, title="Target Config"):
|
|
|
43
43
|
|
|
44
44
|
power_tracing: Optional[PowerTracing] = None
|
|
45
45
|
gpio_tracing: Optional[GpioTracing] = None
|
|
46
|
-
uart_tracing: Optional[UartTracing] = None
|
|
47
46
|
gpio_actuation: Optional[GpioActuation] = None
|
|
47
|
+
uart_logging: Optional[UartLogging] = None
|
|
48
48
|
|
|
49
49
|
@model_validator(mode="after")
|
|
50
50
|
def post_validation(self) -> Self:
|