shepherd-core 2024.8.2__tar.gz → 2024.9.1__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.
Files changed (147) hide show
  1. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/PKG-INFO +8 -7
  2. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/README.md +6 -6
  3. shepherd_core-2024.9.1/examples/simulate_vsource.py +72 -0
  4. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/pyproject.toml +2 -1
  5. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/content/energy_environment.py +3 -0
  6. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/content/virtual_harvester.py +8 -3
  7. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/content/virtual_harvester_fixture.yaml +27 -16
  8. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/content/virtual_source.py +22 -2
  9. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/content/virtual_source_fixture.yaml +15 -2
  10. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/task/emulation.py +2 -1
  11. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/reader.py +3 -3
  12. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/version.py +1 -1
  13. shepherd_core-2024.9.1/shepherd_core/vsource/target_model.py +140 -0
  14. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/vsource/virtual_converter_model.py +35 -30
  15. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/vsource/virtual_harvester_model.py +34 -3
  16. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/vsource/virtual_source_model.py +7 -1
  17. shepherd_core-2024.9.1/shepherd_core/vsource/virtual_source_simulation.py +144 -0
  18. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core.egg-info/PKG-INFO +8 -7
  19. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/conftest.py +1 -1
  20. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/data_models/test_content_fixtures.py +13 -4
  21. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/data_models/test_content_models.py +16 -16
  22. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/decoder_waveform/test_decoder.py +1 -1
  23. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/fw_tools/test_converter.py +12 -12
  24. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/fw_tools/test_patcher.py +5 -5
  25. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/fw_tools/test_validation.py +8 -8
  26. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/test_examples.py +3 -3
  27. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/test_writer.py +2 -2
  28. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/vsource/conftest.py +5 -5
  29. shepherd_core-2024.8.2/examples/simulate_vsource.py +0 -55
  30. shepherd_core-2024.8.2/shepherd_core/vsource/target_model.py +0 -62
  31. shepherd_core-2024.8.2/shepherd_core/vsource/virtual_source_simulation.py +0 -78
  32. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/examples/eenv_generator.py +0 -0
  33. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/examples/experiment_from_yaml.yaml +0 -0
  34. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/examples/experiment_generic_var1.py +0 -0
  35. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/examples/experiment_generic_var2.py +0 -0
  36. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/examples/experiment_models.py +0 -0
  37. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/examples/firmware_model.py +0 -0
  38. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/examples/firmware_modification.py +0 -0
  39. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/examples/inventory.py +0 -0
  40. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/examples/simulate_vharvester.py +0 -0
  41. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/examples/uart_decode_waveform.py +0 -0
  42. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/examples/uart_raw2.csv +0 -0
  43. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/examples/vsource_debug_sim.py +0 -0
  44. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/setup.cfg +0 -0
  45. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/__init__.py +0 -0
  46. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/calibration_hw_def.py +0 -0
  47. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/commons.py +0 -0
  48. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/__init__.py +0 -0
  49. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/base/__init__.py +0 -0
  50. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/base/cal_measurement.py +0 -0
  51. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/base/calibration.py +0 -0
  52. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/base/content.py +0 -0
  53. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/base/shepherd.py +0 -0
  54. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/base/timezone.py +0 -0
  55. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/base/wrapper.py +0 -0
  56. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/content/__init__.py +0 -0
  57. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/content/_external_fixtures.yaml +0 -0
  58. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/content/energy_environment_fixture.yaml +0 -0
  59. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/content/firmware.py +0 -0
  60. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/content/firmware_datatype.py +0 -0
  61. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/experiment/__init__.py +0 -0
  62. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/experiment/experiment.py +0 -0
  63. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/experiment/observer_features.py +0 -0
  64. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/experiment/target_config.py +0 -0
  65. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/readme.md +0 -0
  66. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/task/__init__.py +0 -0
  67. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/task/firmware_mod.py +0 -0
  68. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/task/harvest.py +0 -0
  69. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/task/observer_tasks.py +0 -0
  70. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/task/programming.py +0 -0
  71. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/task/testbed_tasks.py +0 -0
  72. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/testbed/__init__.py +0 -0
  73. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/testbed/cape.py +0 -0
  74. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/testbed/cape_fixture.yaml +0 -0
  75. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/testbed/gpio.py +0 -0
  76. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/testbed/gpio_fixture.yaml +0 -0
  77. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/testbed/mcu.py +0 -0
  78. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/testbed/mcu_fixture.yaml +0 -0
  79. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/testbed/observer.py +0 -0
  80. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/testbed/observer_fixture.yaml +0 -0
  81. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/testbed/target.py +0 -0
  82. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/testbed/target_fixture.yaml +0 -0
  83. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/testbed/testbed.py +0 -0
  84. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/testbed/testbed_fixture.yaml +0 -0
  85. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/data_models/virtual_source_doc.txt +0 -0
  86. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/decoder_waveform/__init__.py +0 -0
  87. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/decoder_waveform/uart.py +0 -0
  88. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/fw_tools/__init__.py +0 -0
  89. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/fw_tools/converter.py +0 -0
  90. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/fw_tools/converter_elf.py +0 -0
  91. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/fw_tools/patcher.py +0 -0
  92. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/fw_tools/validation.py +0 -0
  93. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/inventory/__init__.py +0 -0
  94. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/inventory/python.py +0 -0
  95. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/inventory/system.py +0 -0
  96. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/inventory/target.py +0 -0
  97. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/logger.py +0 -0
  98. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/testbed_client/__init__.py +0 -0
  99. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/testbed_client/cache_path.py +0 -0
  100. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/testbed_client/client_abc_fix.py +0 -0
  101. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/testbed_client/client_web.py +0 -0
  102. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/testbed_client/fixtures.py +0 -0
  103. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/testbed_client/user_model.py +0 -0
  104. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/vsource/__init__.py +0 -0
  105. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/vsource/virtual_harvester_simulation.py +0 -0
  106. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core/writer.py +0 -0
  107. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core.egg-info/SOURCES.txt +0 -0
  108. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core.egg-info/dependency_links.txt +0 -0
  109. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core.egg-info/requires.txt +0 -0
  110. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core.egg-info/top_level.txt +0 -0
  111. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/shepherd_core.egg-info/zip-safe +0 -0
  112. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/__init__.py +0 -0
  113. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/data_models/__init__.py +0 -0
  114. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/data_models/conftest.py +0 -0
  115. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/data_models/example_cal_data.yaml +0 -0
  116. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/data_models/example_cal_data_faulty.yaml +0 -0
  117. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/data_models/example_cal_meas.yaml +0 -0
  118. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/data_models/example_cal_meas_faulty1.yaml +0 -0
  119. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/data_models/example_cal_meas_faulty2.yaml +0 -0
  120. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/data_models/example_config_emulator.yaml +0 -0
  121. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/data_models/example_config_experiment.yaml +0 -0
  122. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/data_models/example_config_experiment_alternative.yaml +0 -0
  123. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/data_models/example_config_harvester.yaml +0 -0
  124. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/data_models/example_config_testbed.yaml +0 -0
  125. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/data_models/example_config_virtsource.yaml +0 -0
  126. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/data_models/test_base_models.py +0 -0
  127. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/data_models/test_examples.py +0 -0
  128. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/data_models/test_experiment_models.py +0 -0
  129. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/data_models/test_task_generation.py +0 -0
  130. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/data_models/test_task_models.py +0 -0
  131. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/data_models/test_testbed_fixtures.py +0 -0
  132. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/data_models/test_testbed_models.py +0 -0
  133. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/decoder_waveform/__init__.py +0 -0
  134. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/fw_tools/__init__.py +0 -0
  135. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/fw_tools/build_msp.elf +0 -0
  136. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/fw_tools/build_nrf.elf +0 -0
  137. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/fw_tools/conftest.py +0 -0
  138. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/inventory/__init__.py +0 -0
  139. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/inventory/test_inventory.py +0 -0
  140. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/test_cal_hw.py +0 -0
  141. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/test_logger.py +0 -0
  142. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/test_reader.py +0 -0
  143. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/testbed_client/__init__.py +0 -0
  144. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/vsource/__init__.py +0 -0
  145. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/vsource/test_converter.py +0 -0
  146. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/vsource/test_harvester.py +0 -0
  147. {shepherd_core-2024.8.2 → shepherd_core-2024.9.1}/tests/vsource/test_z.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: shepherd_core
3
- Version: 2024.8.2
3
+ Version: 2024.9.1
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>
@@ -23,6 +23,7 @@ Classifier: Programming Language :: Python :: 3.9
23
23
  Classifier: Programming Language :: Python :: 3.10
24
24
  Classifier: Programming Language :: Python :: 3.11
25
25
  Classifier: Programming Language :: Python :: 3.12
26
+ Classifier: Programming Language :: Python :: 3.13
26
27
  Classifier: License :: OSI Approved :: MIT License
27
28
  Classifier: Operating System :: OS Independent
28
29
  Classifier: Natural Language :: English
@@ -119,11 +120,11 @@ These pydantic data-models are used throughout all shepherd interfaces. Users ca
119
120
 
120
121
  ## Compatibility
121
122
 
122
- | OS | PyVersion | Comment |
123
- |---------|--------------|--------------------------------------------|
124
- | Ubuntu | 3.8 - 3.12 | |
125
- | Windows | 3.8 - 3.12 | no support for elf and hex-conversions yet |
126
- | MacOS | 3.8 - 3.12 | hex-conversion missing |
123
+ | OS | PyVersion | Comment |
124
+ |---------|------------|--------------------------------------------|
125
+ | Ubuntu | 3.8 - 3.13 | |
126
+ | Windows | 3.8 - 3.13 | no support for elf and hex-conversions yet |
127
+ | MacOS | 3.8 - 3.13 | hex-conversion missing |
127
128
 
128
129
  Notes:
129
130
  - hex-conversion needs a working and accessible objcopy
@@ -147,7 +148,7 @@ For bleeding-edge-features or dev-work it is possible to install directly from G
147
148
  ```Shell
148
149
  pip install git+https://github.com/orgua/shepherd-datalib.git@dev#subdirectory=shepherd_core -U
149
150
  # and on sheep with newer debian
150
- pip install git+https://github.com/orgua/shepherd-datalib.git@dev#subdirectory=shepherd_core -U --break-system-packages
151
+ sudo pip install git+https://github.com/orgua/shepherd-datalib.git@dev#subdirectory=shepherd_core -U --break-system-packages
151
152
  ```
152
153
 
153
154
  If you are working with ``.elf``-files (embedding into experiments) you make "objcopy" accessible to python. In Ubuntu, you can either install ``build-essential`` or ``binutils-$ARCH`` with arch being ``msp430`` or ``arm-none-eabi`` for the nRF52.
@@ -63,11 +63,11 @@ These pydantic data-models are used throughout all shepherd interfaces. Users ca
63
63
 
64
64
  ## Compatibility
65
65
 
66
- | OS | PyVersion | Comment |
67
- |---------|--------------|--------------------------------------------|
68
- | Ubuntu | 3.8 - 3.12 | |
69
- | Windows | 3.8 - 3.12 | no support for elf and hex-conversions yet |
70
- | MacOS | 3.8 - 3.12 | hex-conversion missing |
66
+ | OS | PyVersion | Comment |
67
+ |---------|------------|--------------------------------------------|
68
+ | Ubuntu | 3.8 - 3.13 | |
69
+ | Windows | 3.8 - 3.13 | no support for elf and hex-conversions yet |
70
+ | MacOS | 3.8 - 3.13 | hex-conversion missing |
71
71
 
72
72
  Notes:
73
73
  - hex-conversion needs a working and accessible objcopy
@@ -91,7 +91,7 @@ For bleeding-edge-features or dev-work it is possible to install directly from G
91
91
  ```Shell
92
92
  pip install git+https://github.com/orgua/shepherd-datalib.git@dev#subdirectory=shepherd_core -U
93
93
  # and on sheep with newer debian
94
- pip install git+https://github.com/orgua/shepherd-datalib.git@dev#subdirectory=shepherd_core -U --break-system-packages
94
+ sudo pip install git+https://github.com/orgua/shepherd-datalib.git@dev#subdirectory=shepherd_core -U --break-system-packages
95
95
  ```
96
96
 
97
97
  If you are working with ``.elf``-files (embedding into experiments) you make "objcopy" accessible to python. In Ubuntu, you can either install ``build-essential`` or ``binutils-$ARCH`` with arch being ``msp430`` or ``arm-none-eabi`` for the nRF52.
@@ -0,0 +1,72 @@
1
+ """Demonstrate behavior of Virtual Source Algorithms.
2
+
3
+ The emulation recreates an observer-cape, the virtual Source and a virtual target
4
+ - input = hdf5-file with a harvest-recording
5
+ - output = hdf5-file
6
+ - config is currently hardcoded, but it could be an emulation-task
7
+ - target is currently a simple resistor
8
+
9
+ The output file can be analyzed and plotted with shepherds tool suite.
10
+
11
+ Output:
12
+ E_out = 220.001 mWs -> direct (no current-limit)
13
+ E_out = 13.142 mWs -> diode+capacitor
14
+ E_out = 13.066 mWs -> diode+resistor+capacitor
15
+ E_out = 15.045 mWs -> BQ25504
16
+ E_out = 14.962 mWs -> BQ25504s
17
+ E_out = 14.397 mWs -> BQ25570
18
+ E_out = 14.232 mWs -> BQ25570s
19
+
20
+ """
21
+
22
+ from pathlib import Path
23
+
24
+ from shepherd_core.data_models import VirtualSourceConfig
25
+ from shepherd_core.vsource import ResistiveTarget
26
+ from shepherd_core.vsource import simulate_source
27
+ from shepherd_data import Reader
28
+
29
+ # config simulation
30
+ file_input = Path(__file__).parent / "jogging_ivcurve.h5"
31
+
32
+ src_list = [
33
+ "direct",
34
+ "diode+capacitor",
35
+ "diode+resistor+capacitor",
36
+ "BQ25504",
37
+ "BQ25504s",
38
+ "BQ25570",
39
+ "BQ25570s",
40
+ ]
41
+ tgt = ResistiveTarget(R_Ohm=1_000, controlled=True)
42
+ save_files = True
43
+
44
+ for src_name in src_list:
45
+ file_output = (
46
+ file_input.with_name(file_input.stem + "_emu_" + src_name + file_input.suffix)
47
+ if save_files
48
+ else None
49
+ )
50
+
51
+ e_out_Ws = simulate_source(
52
+ config=VirtualSourceConfig(
53
+ name=src_name,
54
+ C_output_uF=0,
55
+ V_intermediate_enable_threshold_mV=1,
56
+ V_intermediate_disable_threshold_mV=0,
57
+ # jogging-dataset has max VOC of ~1.6 V -> lower set-point for non-boost
58
+ C_intermediate_uF=100 if "direct" not in src_name else 0,
59
+ V_pwr_good_enable_threshold_mV=1300 if "dio" in src_name else 2800,
60
+ V_pwr_good_disable_threshold_mV=1000 if "dio" in src_name else 2400,
61
+ V_input_drop_mV=150 if "dio" in src_name else 0,
62
+ ),
63
+ target=tgt,
64
+ path_input=file_input,
65
+ path_output=file_output,
66
+ monitor_internals=True,
67
+ )
68
+ print(f"E_out = {e_out_Ws * 1e3:.3f} mWs -> {src_name}")
69
+
70
+ with Reader(file_output, verbose=False) as reader:
71
+ reader.plot_to_file()
72
+ reader.plot_to_file(start_s=1, end_s=1.1)
@@ -19,6 +19,7 @@ classifiers = [
19
19
  "Programming Language :: Python :: 3.10",
20
20
  "Programming Language :: Python :: 3.11",
21
21
  "Programming Language :: Python :: 3.12",
22
+ "Programming Language :: Python :: 3.13",
22
23
  "License :: OSI Approved :: MIT License",
23
24
  "Operating System :: OS Independent",
24
25
  "Natural Language :: English",
@@ -30,7 +31,7 @@ dependencies = [
30
31
  "numpy",
31
32
  "pyYAML",
32
33
  "chromalog",
33
- "pydantic[email]>2.0.0",
34
+ "pydantic[email]>2.0.0", # not compatible with prior versions
34
35
  "tqdm",
35
36
  "intelhex",
36
37
  "requests",
@@ -34,6 +34,9 @@ class EnergyEnvironment(ContentModel):
34
34
  valid: bool = False
35
35
 
36
36
  # TODO: scale up/down voltage/current
37
+ # TODO: multiple files for one env
38
+ # TODO: mean power as energy/duration
39
+ # TODO: harvester, transducer
37
40
 
38
41
  # additional descriptive metadata, TODO: these are very solar-centered -> generalize
39
42
  light_source: Optional[str] = None
@@ -21,6 +21,7 @@ from .energy_environment import EnergyDType
21
21
  class AlgorithmDType(str, Enum):
22
22
  """Options for choosing a harvesting algorithm."""
23
23
 
24
+ direct = disable = neutral = "neutral"
24
25
  isc_voc = "isc_voc"
25
26
  ivcurve = ivcurves = ("ivcurve",)
26
27
  constant = cv = "cv"
@@ -62,6 +63,9 @@ class VirtualHarvesterConfig(ContentModel, title="Config for the Harvester"):
62
63
  # ⤷ of (open voltage) measurement
63
64
  rising: bool = True
64
65
  # ⤷ direction of sawtooth
66
+ enable_linear_extrapolation: bool = True
67
+ # ⤷ improves slow cv-algo that is base of most ivcurve-harvesters
68
+ # (update-freq dependent on window-size)
65
69
 
66
70
  # Underlying recorder
67
71
  wait_cycles: Annotated[int, Field(ge=0, le=100)] = 1
@@ -107,7 +111,7 @@ class VirtualHarvesterConfig(ContentModel, title="Config for the Harvester"):
107
111
  return self
108
112
 
109
113
  def calc_hrv_mode(self, *, for_emu: bool) -> int:
110
- return 1 * int(for_emu) + 2 * self.rising
114
+ return 1 * int(for_emu) + 2 * self.rising + 4 * self.enable_linear_extrapolation
111
115
 
112
116
  def calc_algorithm_num(self, *, for_emu: bool) -> int:
113
117
  num = algo_to_num.get(self.algorithm)
@@ -117,7 +121,7 @@ class VirtualHarvesterConfig(ContentModel, title="Config for the Harvester"):
117
121
  f"current usage = {self.algorithm}"
118
122
  )
119
123
  raise ValueError(msg)
120
- if num < algo_to_num["isc_voc"]:
124
+ if not for_emu and num < algo_to_num["isc_voc"]:
121
125
  msg = (
122
126
  f"[{self.name}] Select valid harvest-algorithm for harvester, "
123
127
  f"current usage = {self.algorithm}"
@@ -177,7 +181,7 @@ u32 = Annotated[int, Field(ge=0, lt=2**32)]
177
181
 
178
182
  # Currently implemented harvesters
179
183
  # NOTE: numbers have meaning and will be tested ->
180
- # - harvesting on "neutral" is not possible
184
+ # - harvesting on "neutral" is not possible - direct pass-through
181
185
  # - emulation with "ivcurve" or lower is also resulting in Error
182
186
  # - "_opt" has its own algo for emulation, but is only a fast mppt_po for harvesting
183
187
  algo_to_num = {
@@ -192,6 +196,7 @@ algo_to_num = {
192
196
  }
193
197
 
194
198
  algo_to_dtype = {
199
+ "neutral": EnergyDType.ivsample,
195
200
  "isc_voc": EnergyDType.isc_voc,
196
201
  "ivcurve": EnergyDType.ivcurve,
197
202
  "cv": EnergyDType.ivsample,
@@ -3,10 +3,13 @@
3
3
  # - look into the implementation to see which parameters are used
4
4
  # - base for neutral fallback values if provided yml is sparse
5
5
  # - -> it is encouraged to omit redundant parameters in your own implementation
6
+ # - general rule: 0<id<2000 harvest from transducers, 2000<=id harvest from ivcurve
7
+
6
8
  - datatype: VirtualHarvesterConfig
7
9
  parameters:
8
10
  id: 1000
9
11
  name: neutral
12
+ enable_linear_extrapolation: true
10
13
  owner: Ingmar
11
14
  group: NES Lab
12
15
  visible2group: true
@@ -16,7 +19,7 @@
16
19
 
17
20
  - datatype: VirtualHarvesterConfig
18
21
  parameters:
19
- id: 1010
22
+ id: 1100
20
23
  name: ivcurve
21
24
  description: Postpone harvesting by sampling ivcurves (voltage stepped as sawtooth-wave)
22
25
  comment: ~110 Hz, Between 50 & 60 Hz line-frequency to avoid standing waves
@@ -32,19 +35,19 @@
32
35
 
33
36
  - datatype: VirtualHarvesterConfig
34
37
  parameters:
35
- id: 1011
38
+ id: 1101
36
39
  name: ivcurves # synonym
37
40
  inherit_from: ivcurve
38
41
 
39
42
  - datatype: VirtualHarvesterConfig
40
43
  parameters:
41
- id: 1013
44
+ id: 1103
42
45
  name: iv110 # synonym
43
46
  inherit_from: ivcurve
44
47
 
45
48
  - datatype: VirtualHarvesterConfig
46
49
  parameters:
47
- id: 1012
50
+ id: 1102
48
51
  name: iv1000
49
52
  comment: Name relates to curves per second
50
53
  inherit_from: ivcurve
@@ -53,7 +56,7 @@
53
56
 
54
57
  - datatype: VirtualHarvesterConfig
55
58
  parameters:
56
- id: 1020
59
+ id: 1200
57
60
  name: isc_voc
58
61
  description: Postpone harvesting by sampling short circuit current & open circuit voltage
59
62
  inherit_from: neutral
@@ -62,7 +65,7 @@
62
65
 
63
66
  - datatype: VirtualHarvesterConfig
64
67
  parameters:
65
- id: 1030
68
+ id: 2100
66
69
  name: cv20
67
70
  description: Harvesting with constant Voltage
68
71
  inherit_from: neutral
@@ -71,28 +74,28 @@
71
74
 
72
75
  - datatype: VirtualHarvesterConfig
73
76
  parameters:
74
- id: 1031
77
+ id: 2101
75
78
  name: cv24
76
79
  inherit_from: cv20
77
80
  voltage_mV: 2400
78
81
 
79
82
  - datatype: VirtualHarvesterConfig
80
83
  parameters:
81
- id: 1032
84
+ id: 2102
82
85
  name: cv33
83
86
  inherit_from: cv20
84
87
  voltage_mV: 3300
85
88
 
86
89
  - datatype: VirtualHarvesterConfig
87
90
  parameters:
88
- id: 1032
91
+ id: 2102
89
92
  name: cv10
90
93
  inherit_from: cv20
91
94
  voltage_mV: 1000
92
95
 
93
96
  - datatype: VirtualHarvesterConfig
94
97
  parameters:
95
- id: 1040
98
+ id: 2200
96
99
  name: mppt_voc
97
100
  description: MPPT based on open circuit voltage for solar
98
101
  inherit_from: neutral
@@ -104,7 +107,7 @@
104
107
 
105
108
  - datatype: VirtualHarvesterConfig
106
109
  parameters:
107
- id: 1041
110
+ id: 2201
108
111
  name: mppt_bq
109
112
  description: MPPT of TI BQ-Converters for solar
110
113
  inherit_from: mppt_voc
@@ -114,7 +117,7 @@
114
117
 
115
118
  - datatype: VirtualHarvesterConfig
116
119
  parameters:
117
- id: 1042
120
+ id: 2202
118
121
  name: mppt_bqt
119
122
  description: MPPT of TI BQ-Converters for thermoelectric
120
123
  inherit_from: mppt_voc
@@ -124,19 +127,19 @@
124
127
 
125
128
  - datatype: VirtualHarvesterConfig
126
129
  parameters:
127
- id: 1043
130
+ id: 2203
128
131
  name: mppt_bq_solar # explicit naming
129
132
  inherit_from: mppt_bq
130
133
 
131
134
  - datatype: VirtualHarvesterConfig
132
135
  parameters:
133
- id: 1044
136
+ id: 2204
134
137
  name: mppt_bq_thermoelectric # explicit naming
135
138
  inherit_from: mppt_bqt
136
139
 
137
140
  - datatype: VirtualHarvesterConfig
138
141
  parameters:
139
- id: 1045
142
+ id: 2205
140
143
  name: mppt_po
141
144
  description: MPPT based on perturb & observe algorithm
142
145
  inherit_from: neutral
@@ -148,10 +151,18 @@
148
151
 
149
152
  - datatype: VirtualHarvesterConfig
150
153
  parameters:
151
- id: 1046
154
+ id: 2206
152
155
  name: mppt_opt
153
156
  description: Power-Optimum with very fast PO-Variant (harvesting) or special max-pwr-picker (emulator / ivcurve)
154
157
  inherit_from: mppt_po
155
158
  algorithm: mppt_opt
156
159
  voltage_step_mV: 1
157
160
  interval_ms: 0.01
161
+
162
+ - datatype: VirtualHarvesterConfig
163
+ parameters:
164
+ id: 3000
165
+ name: direct
166
+ description: Disables harvesting, even for ivcurve-input
167
+ inherit_from: neutral
168
+ algorithm: neutral
@@ -12,6 +12,7 @@ from ...logger import logger
12
12
  from ...testbed_client import tb_client
13
13
  from ..base.content import ContentModel
14
14
  from ..base.shepherd import ShpModel
15
+ from .energy_environment import EnergyDType
15
16
  from .virtual_harvester import HarvesterPRUConfig
16
17
  from .virtual_harvester import VirtualHarvesterConfig
17
18
 
@@ -42,6 +43,8 @@ class VirtualSourceConfig(ContentModel, title="Config for the virtual Source"):
42
43
  # ⤷ if false -> v_intermediate = v_input, output-switch-hysteresis is still usable
43
44
  enable_buck: bool = False
44
45
  # ⤷ if false -> v_output = v_intermediate
46
+ enable_feedback_to_hrv: bool = False
47
+ # src can control a cv-harvester for ivcurve
45
48
 
46
49
  interval_startup_delay_drain_ms: Annotated[float, Field(ge=0, le=10_000)] = 0
47
50
 
@@ -200,7 +203,7 @@ class VirtualSourceConfig(ContentModel, title="Config for the virtual Source"):
200
203
  values["V_disable_output_threshold_mV"] = self.V_intermediate_disable_threshold_mV
201
204
  return values
202
205
 
203
- def calc_converter_mode(self, *, log_intermediate_node: bool) -> int:
206
+ def calc_converter_mode(self, dtype_in: EnergyDType, *, log_intermediate_node: bool) -> int:
204
207
  """Assembles bitmask from discrete values.
205
208
 
206
209
  log_intermediate_node: record / log virtual intermediate (cap-)voltage and
@@ -208,11 +211,25 @@ class VirtualSourceConfig(ContentModel, title="Config for the virtual Source"):
208
211
  """
209
212
  enable_storage = self.C_intermediate_uF > 0
210
213
  enable_boost = self.enable_boost and enable_storage
214
+ if enable_boost != self.enable_boost:
215
+ logger.warning("VSrc - boost was disabled due to missing storage capacitor!")
216
+ enable_feedback = (
217
+ self.enable_feedback_to_hrv
218
+ and enable_storage
219
+ and not enable_boost
220
+ and dtype_in == EnergyDType.ivcurve
221
+ )
222
+ if enable_feedback != self.enable_feedback_to_hrv:
223
+ reason = "enabled boost, " if enable_boost else ""
224
+ reason += "" if dtype_in == EnergyDType.ivcurve else "input not ivcurve, "
225
+ reason += "" if enable_storage else "no storage capacitor"
226
+ logger.warning("VSRC - feedback to harvester was disabled! Reasons: %s", reason)
211
227
  return (
212
228
  1 * int(enable_storage)
213
229
  + 2 * int(enable_boost)
214
230
  + 4 * int(self.enable_buck)
215
231
  + 8 * int(log_intermediate_node)
232
+ + 16 * int(enable_feedback)
216
233
  )
217
234
 
218
235
  def calc_cap_constant_us_per_nF_n28(self) -> int:
@@ -285,13 +302,16 @@ class ConverterPRUConfig(ShpModel):
285
302
  def from_vsrc(
286
303
  cls,
287
304
  data: VirtualSourceConfig,
305
+ dtype_in: EnergyDType = EnergyDType.ivsample,
288
306
  *,
289
307
  log_intermediate_node: bool = False,
290
308
  ) -> Self:
291
309
  states = data.calc_internal_states()
292
310
  return cls(
293
311
  # General
294
- converter_mode=data.calc_converter_mode(log_intermediate_node=log_intermediate_node),
312
+ converter_mode=data.calc_converter_mode(
313
+ dtype_in, log_intermediate_node=log_intermediate_node
314
+ ),
295
315
  interval_startup_delay_drain_n=round(
296
316
  data.interval_startup_delay_drain_ms * samplerate_sps_default * 1e-3
297
317
  ),
@@ -11,6 +11,7 @@
11
11
  # General Config
12
12
  enable_boost: false # if false -> v_intermediate = v_input, output-switch-hysteresis is still usable
13
13
  enable_buck: false # if false -> v_output = v_intermediate
14
+ enable_feedback_to_hrv: false # src can control a cv-harvester for ivcurve
14
15
 
15
16
  interval_startup_delay_drain_ms: 0
16
17
 
@@ -26,18 +27,21 @@
26
27
  V_intermediate_init_mV: 3000 # allow a proper / fast startup
27
28
  I_intermediate_leak_nA: 0.0
28
29
 
30
+ # Output-Switch with comparator and hysteresis
29
31
  V_intermediate_enable_threshold_mV: 1 # -> target gets connected (hysteresis-combo with next value)
30
32
  V_intermediate_disable_threshold_mV: 0 # -> target gets disconnected
31
33
  interval_check_thresholds_ms: 0.0 # some BQs check every 64 ms if output should be disconnected
32
34
 
35
+ # Power-Good signal from comparator and hysteresis
33
36
  V_pwr_good_enable_threshold_mV: 2800 # target is informed by pwr-good on output-pin (hysteresis) -> for intermediate voltage
34
37
  V_pwr_good_disable_threshold_mV: 2200
35
38
  immediate_pwr_good_signal: true # 1: activate instant schmitt-trigger, 0: stay in interval for checking thresholds
36
39
 
37
- C_output_uF: 1.0 # final (always last) stage to compensate undetectable current spikes when enabling power for target
40
+ C_output_uF: 1.0 # final (always last) stage to compensate transient current spikes when enabling power for target
38
41
 
39
42
  # Extra
40
43
  V_output_log_gpio_threshold_mV: 1400 # min voltage needed to enable recording changes in gpio-bank
44
+ # TODO: actually disable gpio below that
41
45
 
42
46
  # Boost Converter
43
47
  V_input_boost_threshold_mV: 0.0 # min input-voltage for the boost converter to work
@@ -81,6 +85,8 @@
81
85
  id: 1010
82
86
  name: direct
83
87
  inherit_from: neutral
88
+ harvester:
89
+ name: direct # even disables harvesting of ivcurve
84
90
  # Note: current input has no influence
85
91
 
86
92
  - datatype: VirtualSourceConfig
@@ -90,7 +96,12 @@
90
96
  description: Simple Converter based on diode and buffer capacitor
91
97
  inherit_from: neutral
92
98
  V_input_drop_mV: 300 # simulate input-diode
93
- C_intermediate_uF: 10 # primary storage-Cap
99
+ C_intermediate_uF: 47 # primary storage-Cap
100
+ harvester:
101
+ name: cv20
102
+ enable_feedback_to_hrv: true # src can control a cv-harvester for ivcurve
103
+ V_intermediate_enable_threshold_mV: 2000
104
+ V_intermediate_disable_threshold_mV: 1800 # nRF draw ~0.5 mA below that point
94
105
 
95
106
  - datatype: VirtualSourceConfig
96
107
  parameters:
@@ -230,3 +241,5 @@
230
241
  id: 1033
231
242
  name: default
232
243
  inherit_from: BQ25570s
244
+
245
+ # TODO: add some generic boost-converters with mppt_po, _voc and more
@@ -33,7 +33,8 @@ class Compression(str, Enum):
33
33
  lzf = default = "lzf" # not native hdf5
34
34
  gzip1 = gzip = 1 # higher compr & load
35
35
  null = None
36
- # NOTE: changed to lzf as BBB needs every straw it can get
36
+ # NOTE: lzf & external file-compression (xz or zstd) work better than gzip
37
+ # -> even with additional compression
37
38
 
38
39
 
39
40
  compressions_allowed: list = [None, "lzf", 1]
@@ -76,7 +76,7 @@ class Reader:
76
76
 
77
77
  if not hasattr(self, "samplerate_sps"):
78
78
  self.samplerate_sps: int = samplerate_sps_default
79
- self.sample_interval_ns: int = int(10**9 // self.samplerate_sps)
79
+ self.sample_interval_ns: int = round(10**9 // self.samplerate_sps)
80
80
  self.sample_interval_s: float = 1 / self.samplerate_sps
81
81
 
82
82
  self.max_elements: int = 40 * self.samplerate_sps
@@ -177,8 +177,8 @@ class Reader:
177
177
  # this assumes iso-chronous sampling
178
178
  duration_s = self._cal.time.raw_to_si(duration_raw)
179
179
  self.sample_interval_s = duration_s / sample_count
180
- self.sample_interval_ns = int(10**9 * self.sample_interval_s)
181
- self.samplerate_sps = max(int((sample_count - 1) / duration_s), 1)
180
+ self.sample_interval_ns = round(10**9 * self.sample_interval_s)
181
+ self.samplerate_sps = max(round((sample_count - 1) / duration_s), 1)
182
182
  self.runtime_s = round(self.ds_voltage.shape[0] / self.samplerate_sps, 1)
183
183
  self.buffers_n = int(self.ds_voltage.shape[0] // self.samples_per_buffer)
184
184
  if isinstance(self.file_path, Path):
@@ -1,3 +1,3 @@
1
1
  """Separated string avoids circular imports."""
2
2
 
3
- version: str = "2024.8.2"
3
+ version: str = "2024.9.1"