shepherd-core 2025.6.4__py3-none-any.whl → 2025.10.1__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.
Files changed (45) hide show
  1. shepherd_core/data_models/__init__.py +4 -2
  2. shepherd_core/data_models/base/content.py +2 -0
  3. shepherd_core/data_models/content/__init__.py +4 -2
  4. shepherd_core/data_models/content/{virtual_harvester.py → virtual_harvester_config.py} +3 -3
  5. shepherd_core/data_models/content/{virtual_source.py → virtual_source_config.py} +82 -58
  6. shepherd_core/data_models/content/virtual_source_fixture.yaml +24 -24
  7. shepherd_core/data_models/content/virtual_storage_config.py +426 -0
  8. shepherd_core/data_models/content/virtual_storage_fixture_creator.py +267 -0
  9. shepherd_core/data_models/content/virtual_storage_fixture_ideal.yaml +637 -0
  10. shepherd_core/data_models/content/virtual_storage_fixture_lead.yaml +49 -0
  11. shepherd_core/data_models/content/virtual_storage_fixture_lipo.yaml +735 -0
  12. shepherd_core/data_models/content/virtual_storage_fixture_mlcc.yaml +200 -0
  13. shepherd_core/data_models/content/virtual_storage_fixture_param_experiments.py +151 -0
  14. shepherd_core/data_models/content/virtual_storage_fixture_super.yaml +150 -0
  15. shepherd_core/data_models/content/virtual_storage_fixture_tantal.yaml +550 -0
  16. shepherd_core/data_models/experiment/observer_features.py +8 -2
  17. shepherd_core/data_models/experiment/target_config.py +1 -1
  18. shepherd_core/data_models/task/emulation.py +9 -6
  19. shepherd_core/data_models/task/firmware_mod.py +1 -0
  20. shepherd_core/data_models/task/harvest.py +4 -4
  21. shepherd_core/data_models/task/observer_tasks.py +5 -2
  22. shepherd_core/data_models/task/programming.py +1 -0
  23. shepherd_core/data_models/task/testbed_tasks.py +6 -1
  24. shepherd_core/decoder_waveform/uart.py +2 -1
  25. shepherd_core/fw_tools/patcher.py +60 -34
  26. shepherd_core/fw_tools/validation.py +7 -1
  27. shepherd_core/inventory/system.py +1 -1
  28. shepherd_core/reader.py +4 -3
  29. shepherd_core/version.py +1 -1
  30. shepherd_core/vsource/__init__.py +4 -0
  31. shepherd_core/vsource/virtual_converter_model.py +27 -26
  32. shepherd_core/vsource/virtual_harvester_model.py +27 -19
  33. shepherd_core/vsource/virtual_harvester_simulation.py +38 -39
  34. shepherd_core/vsource/virtual_source_model.py +17 -13
  35. shepherd_core/vsource/virtual_source_simulation.py +71 -73
  36. shepherd_core/vsource/virtual_storage_model.py +164 -0
  37. shepherd_core/vsource/virtual_storage_model_fixed_point_math.py +58 -0
  38. shepherd_core/vsource/virtual_storage_models_kibam.py +449 -0
  39. shepherd_core/vsource/virtual_storage_simulator.py +104 -0
  40. {shepherd_core-2025.6.4.dist-info → shepherd_core-2025.10.1.dist-info}/METADATA +4 -6
  41. {shepherd_core-2025.6.4.dist-info → shepherd_core-2025.10.1.dist-info}/RECORD +44 -32
  42. shepherd_core/data_models/virtual_source_doc.txt +0 -207
  43. {shepherd_core-2025.6.4.dist-info → shepherd_core-2025.10.1.dist-info}/WHEEL +0 -0
  44. {shepherd_core-2025.6.4.dist-info → shepherd_core-2025.10.1.dist-info}/top_level.txt +0 -0
  45. {shepherd_core-2025.6.4.dist-info → shepherd_core-2025.10.1.dist-info}/zip-safe +0 -0
@@ -22,8 +22,9 @@ from .content.energy_environment import EnergyDType
22
22
  from .content.energy_environment import EnergyEnvironment
23
23
  from .content.firmware import Firmware
24
24
  from .content.firmware import FirmwareDType
25
- from .content.virtual_harvester import VirtualHarvesterConfig
26
- from .content.virtual_source import VirtualSourceConfig
25
+ from .content.virtual_harvester_config import VirtualHarvesterConfig
26
+ from .content.virtual_source_config import VirtualSourceConfig
27
+ from .content.virtual_storage_config import VirtualStorageConfig
27
28
  from .experiment.experiment import Experiment
28
29
  from .experiment.observer_features import GpioActuation
29
30
  from .experiment.observer_features import GpioEvent
@@ -58,5 +59,6 @@ __all__ = [
58
59
  "UartLogging",
59
60
  "VirtualHarvesterConfig",
60
61
  "VirtualSourceConfig",
62
+ "VirtualStorageConfig",
61
63
  "Wrapper",
62
64
  ]
@@ -36,10 +36,12 @@ class ContentModel(ShpModel):
36
36
  default_factory=id_default,
37
37
  )
38
38
  name: NameStr
39
+ """ ⤷ name of virtual content, models can be queried by this slug."""
39
40
  description: Annotated[SafeStr | None, Field(description="Required when public")] = None
40
41
  comment: SafeStr | None = None
41
42
  created: datetime = Field(default_factory=datetime.now)
42
43
  updated_last: datetime = Field(default_factory=datetime.now)
44
+ # TODO: add dedicated 'inherit_from' field?
43
45
 
44
46
  # Ownership & Access
45
47
  # TODO: remove owner & group, only needed for DB
@@ -7,8 +7,9 @@ from .energy_environment import EnergyDType
7
7
  from .energy_environment import EnergyEnvironment
8
8
  from .firmware import Firmware
9
9
  from .firmware_datatype import FirmwareDType
10
- from .virtual_harvester import VirtualHarvesterConfig
11
- from .virtual_source import VirtualSourceConfig
10
+ from .virtual_harvester_config import VirtualHarvesterConfig
11
+ from .virtual_source_config import VirtualSourceConfig
12
+ from .virtual_storage_config import VirtualStorageConfig
12
13
 
13
14
  __all__ = [
14
15
  "EnergyDType",
@@ -17,4 +18,5 @@ __all__ = [
17
18
  "FirmwareDType",
18
19
  "VirtualHarvesterConfig",
19
20
  "VirtualSourceConfig",
21
+ "VirtualStorageConfig",
20
22
  ]
@@ -332,11 +332,11 @@ class VirtualHarvesterConfig(ContentModel, title="Config for the Harvester"):
332
332
  @model_validator(mode="after")
333
333
  def post_validation(self) -> Self:
334
334
  if self.voltage_min_mV > self.voltage_max_mV:
335
- raise ValueError("Voltage min > max")
335
+ raise ValueError("Voltage minimum > max")
336
336
  if self.voltage_mV < self.voltage_min_mV:
337
- raise ValueError("Voltage below min")
337
+ raise ValueError("Voltage below minimum")
338
338
  if self.voltage_mV > self.voltage_max_mV:
339
- raise ValueError("Voltage above max")
339
+ raise ValueError("Voltage above maximum")
340
340
 
341
341
  return self
342
342
 
@@ -14,8 +14,9 @@ from shepherd_core.logger import log
14
14
  from shepherd_core.testbed_client import tb_client
15
15
 
16
16
  from .energy_environment import EnergyDType
17
- from .virtual_harvester import HarvesterPRUConfig
18
- from .virtual_harvester import VirtualHarvesterConfig
17
+ from .virtual_harvester_config import HarvesterPRUConfig
18
+ from .virtual_harvester_config import VirtualHarvesterConfig
19
+ from .virtual_storage_config import VirtualStorageConfig
19
20
 
20
21
  # Custom Types
21
22
  LUT_SIZE: int = 12
@@ -48,35 +49,42 @@ class VirtualSourceConfig(ContentModel, title="Config for the virtual Source"):
48
49
  enable_buck: bool = False
49
50
  """ ⤷ if false -> v_output = v_intermediate"""
50
51
  enable_feedback_to_hrv: bool = False
51
- """ src can control a cv-harvester for ivcurve"""
52
+ """ Source can control a cv-harvester for ivsurface.
53
+ Feedback is essential for some harvesters, i.e. diode-circuitry.
54
+ """
52
55
 
53
56
  interval_startup_delay_drain_ms: Annotated[float, Field(ge=0, le=10_000)] = 0
57
+ """ ⤷ Model begins running, but Target is not draining the storage capacitor
58
+ until this delay is over.
59
+ """
54
60
 
55
61
  harvester: VirtualHarvesterConfig = vhrv_mppt_opt
62
+ """ ⤷ Only active / needed if input is ivsurface. """
56
63
 
57
64
  V_input_max_mV: Annotated[float, Field(ge=0, le=10_000)] = 10_000
65
+ """ ⤷ Maximum input Voltage [mV] -> will be clipped."""
58
66
  I_input_max_mA: Annotated[float, Field(ge=0, le=4.29e3)] = 4_200
67
+ """ ⤷ Maximum input Current [mA] -> will be clipped."""
59
68
  V_input_drop_mV: Annotated[float, Field(ge=0, le=4.29e6)] = 0
60
- """ ⤷ simulate input-diode"""
69
+ """ ⤷ simulate voltage drop for input-diode or LDO."""
61
70
  R_input_mOhm: Annotated[float, Field(ge=0, le=4.29e6)] = 0
62
71
  """ ⤷ resistance only active with disabled boost, range [1 mOhm; 1MOhm]"""
63
72
 
64
- # primary storage-Cap
65
- C_intermediate_uF: Annotated[float, Field(ge=0, le=100_000)] = 0
66
- V_intermediate_init_mV: Annotated[float, Field(ge=0, le=10_000)] = 3_000
67
- """ ⤷ allow a proper / fast startup"""
68
- I_intermediate_leak_nA: Annotated[float, Field(ge=0, le=4.29e9)] = 0
69
-
70
- V_intermediate_enable_threshold_mV: Annotated[float, Field(ge=0, le=10_000)] = 1
73
+ storage: VirtualStorageConfig | None = None
74
+ """ primary intermediate energy storage between boost- and buck-converter stage.
75
+ Selecting "None" disables the storage and directly connects input to output.
76
+ """
77
+ V_intermediate_enable_output_threshold_mV: Annotated[float, Field(ge=0, le=10_000)] = 1
71
78
  """ ⤷ target gets connected (hysteresis-combo with next value)"""
72
- V_intermediate_disable_threshold_mV: Annotated[float, Field(ge=0, le=10_000)] = 0
79
+ V_intermediate_disable_output_threshold_mV: Annotated[float, Field(ge=0, le=10_000)] = 0
73
80
  """ ⤷ target gets disconnected"""
74
81
  interval_check_thresholds_ms: Annotated[float, Field(ge=0, le=4.29e3)] = 0
75
82
  """ ⤷ some ICs (BQ) check every 64 ms if output should be disconnected"""
76
83
  # TODO: add intervals for input-disable, output-disable & power-good-signal
77
84
 
78
- # pwr-good: target is informed on output-pin (hysteresis) -> for intermediate voltage
79
85
  V_pwr_good_enable_threshold_mV: Annotated[float, Field(ge=0, le=10_000)] = 2_800
86
+ """ pwr-good: target is informed on output-pin (hysteresis)
87
+ -> reference is the intermediate voltage """
80
88
  V_pwr_good_disable_threshold_mV: Annotated[float, Field(ge=0, le=10_000)] = 2200
81
89
  immediate_pwr_good_signal: bool = True
82
90
  """ ⤷ 1: activate instant schmitt-trigger, 0: stay in interval for checking thresholds"""
@@ -93,13 +101,13 @@ class VirtualSourceConfig(ContentModel, title="Config for the virtual Source"):
93
101
 
94
102
  # Extra
95
103
  V_output_log_gpio_threshold_mV: Annotated[float, Field(ge=0, le=4.29e6)] = 1_400
96
- """ ⤷ min voltage needed to enable recording changes in gpio-bank"""
104
+ """ ⤷ minimum voltage threshold needed to enable recording changes in gpio-bank"""
97
105
 
98
106
  # Boost Converter
99
107
  V_input_boost_threshold_mV: Annotated[float, Field(ge=0, le=10_000)] = 0
100
- """ ⤷ min input-voltage for the boost converter to work"""
108
+ """ ⤷ minimum input-voltage for the boost converter to work"""
101
109
  V_intermediate_max_mV: Annotated[float, Field(ge=0, le=10_000)] = 10_000
102
- """ ⤷ boost converter shuts off"""
110
+ """ ⤷ threshold for shutting off boost converter """
103
111
 
104
112
  LUT_input_efficiency: LUT2D = 12 * [12 * [1.00]]
105
113
  """ ⤷ rows are current -> first row a[V=0][:]
@@ -115,13 +123,18 @@ class VirtualSourceConfig(ContentModel, title="Config for the virtual Source"):
115
123
 
116
124
  # Buck Converter
117
125
  V_output_mV: Annotated[float, Field(ge=0, le=5_000)] = 2_400
126
+ """ Fixed Voltage of Buck-Converter.
127
+ (as long as Input is > Output + Drop-Voltage)
128
+ """
118
129
  V_buck_drop_mV: Annotated[float, Field(ge=0, le=5_000)] = 0
119
- """ ⤷ simulate LDO / diode min voltage differential or output-diode"""
130
+ """ ⤷ simulate LDO / diode minimum voltage differential or output-diode"""
120
131
 
121
132
  LUT_output_efficiency: LUT1D = 12 * [1.00]
122
- """ ⤷ array[12] depending on output_current"""
133
+ """ ⤷ array[12] depending on output_current, In- & Output is linear."""
123
134
  LUT_output_I_min_log2_nA: Annotated[int, Field(ge=1, le=20)] = 1
124
- """ ⤷ 2^8 = 256 nA -> LUT[0] is for inputs < 256 nA, see notes on LUT_input for explanation"""
135
+ """ ⤷ i.e. 2^8 = 256 nA -> LUT[0] is for inputs < 256 nA,
136
+ see notes on LUT_input for explanation
137
+ """
125
138
 
126
139
  @model_validator(mode="before")
127
140
  @classmethod
@@ -129,12 +142,16 @@ class VirtualSourceConfig(ContentModel, title="Config for the virtual Source"):
129
142
  values, chain = tb_client.try_completing_model(cls.__name__, values)
130
143
  values = tb_client.fill_in_user_data(values)
131
144
  log.debug("VSrc-Inheritances: %s", chain)
145
+ # TODO: most "internal states" should be corrected here
146
+
132
147
  return values
133
148
 
134
149
  @model_validator(mode="after")
135
150
  def post_validation(self) -> Self:
136
151
  # trigger stricter test of harv-parameters
137
152
  HarvesterPRUConfig.from_vhrv(self.harvester, for_emu=True)
153
+ # TODO: enable threshold < mid_max
154
+ # TODO: mid_max < mid_soc1
138
155
  return self
139
156
 
140
157
  def calc_internal_states(self) -> dict:
@@ -164,11 +181,11 @@ class VirtualSourceConfig(ContentModel, title="Config for the virtual Source"):
164
181
  Note: dV values will be reversed (negated), because dV is always negative (Voltage drop)
165
182
  """
166
183
  values = {}
167
- if self.C_intermediate_uF > 0 and self.C_output_uF > 0:
184
+ if (self.storage is not None) and self.C_output_uF > 0:
168
185
  # first case: storage cap outside of en/dis-thresholds
169
- v_old = self.V_intermediate_enable_threshold_mV
186
+ v_old = self.V_intermediate_enable_output_threshold_mV
170
187
  v_out = self.V_output_mV
171
- c_store = self.C_intermediate_uF
188
+ c_store = self.storage.capacity_in_uF
172
189
  c_out = self.C_output_uF
173
190
  dV_output_en_thrs_mV = v_old - pow(
174
191
  pow(v_old, 2) - (c_out / c_store) * pow(v_out, 2),
@@ -183,6 +200,16 @@ class VirtualSourceConfig(ContentModel, title="Config for the virtual Source"):
183
200
  dV_output_en_thrs_mV = 0
184
201
  dV_output_imed_low_mV = 0
185
202
 
203
+ if self.enable_boost and self.storage is not None:
204
+ # TODO: storage could have maximum at a different SoC, is this needed at all?
205
+ values["V_mid_max_mV"] = min(
206
+ self.V_intermediate_max_mV,
207
+ 1e3 * self.storage.calc_V_OC(SoC=1.0),
208
+ 10_000,
209
+ )
210
+ else:
211
+ values["V_mid_max_mV"] = self.V_intermediate_max_mV
212
+
186
213
  # protect from complex solutions (non valid input combinations)
187
214
  if not (isinstance(dV_output_en_thrs_mV, (int, float)) and (dV_output_en_thrs_mV >= 0)):
188
215
  dV_output_en_thrs_mV = 0
@@ -194,25 +221,33 @@ class VirtualSourceConfig(ContentModel, title="Config for the virtual Source"):
194
221
  if self.enable_buck > 0:
195
222
  V_pre_output_mV = self.V_output_mV + self.V_buck_drop_mV
196
223
 
197
- if self.V_intermediate_enable_threshold_mV > V_pre_output_mV:
198
- values["dV_enable_output_mV"] = dV_output_en_thrs_mV
199
- values["V_enable_output_threshold_mV"] = self.V_intermediate_enable_threshold_mV
224
+ if self.V_intermediate_enable_output_threshold_mV > V_pre_output_mV:
225
+ values["dV_mid_enable_output_mV"] = dV_output_en_thrs_mV
226
+ values["V_mid_enable_output_threshold_mV"] = (
227
+ self.V_intermediate_enable_output_threshold_mV
228
+ )
200
229
 
201
230
  else:
202
- values["dV_enable_output_mV"] = dV_output_imed_low_mV
203
- values["V_enable_output_threshold_mV"] = (
204
- V_pre_output_mV + values["dV_enable_output_mV"]
231
+ values["dV_mid_enable_output_mV"] = dV_output_imed_low_mV
232
+ values["V_mid_enable_output_threshold_mV"] = (
233
+ V_pre_output_mV + values["dV_mid_enable_output_mV"]
205
234
  )
206
235
 
207
- if self.V_intermediate_disable_threshold_mV > V_pre_output_mV:
208
- values["V_disable_output_threshold_mV"] = self.V_intermediate_disable_threshold_mV
236
+ if self.V_intermediate_disable_output_threshold_mV > V_pre_output_mV:
237
+ values["V_mid_disable_output_threshold_mV"] = (
238
+ self.V_intermediate_disable_output_threshold_mV
239
+ )
209
240
  else:
210
- values["V_disable_output_threshold_mV"] = V_pre_output_mV
241
+ values["V_mid_disable_output_threshold_mV"] = V_pre_output_mV
211
242
 
212
243
  else:
213
- values["dV_enable_output_mV"] = dV_output_en_thrs_mV
214
- values["V_enable_output_threshold_mV"] = self.V_intermediate_enable_threshold_mV
215
- values["V_disable_output_threshold_mV"] = self.V_intermediate_disable_threshold_mV
244
+ values["dV_mid_enable_output_mV"] = dV_output_en_thrs_mV
245
+ values["V_mid_enable_output_threshold_mV"] = (
246
+ self.V_intermediate_enable_output_threshold_mV
247
+ )
248
+ values["V_mid_disable_output_threshold_mV"] = (
249
+ self.V_intermediate_disable_output_threshold_mV
250
+ )
216
251
  return values
217
252
 
218
253
  def calc_converter_mode(self, dtype_in: EnergyDType, *, log_intermediate_node: bool) -> int:
@@ -221,7 +256,7 @@ class VirtualSourceConfig(ContentModel, title="Config for the virtual Source"):
221
256
  log_intermediate_node: record / log virtual intermediate (cap-)voltage and
222
257
  -current (out) instead of output-voltage and -current
223
258
  """
224
- enable_storage = self.C_intermediate_uF > 0
259
+ enable_storage = self.storage is not None
225
260
  enable_boost = self.enable_boost and enable_storage
226
261
  if enable_boost != self.enable_boost:
227
262
  log.warning("VSrc - boost was disabled due to missing storage capacitor!")
@@ -244,14 +279,6 @@ class VirtualSourceConfig(ContentModel, title="Config for the virtual Source"):
244
279
  + 16 * int(enable_feedback)
245
280
  )
246
281
 
247
- def calc_cap_constant_us_per_nF_n28(self) -> int:
248
- """Calc constant to convert capacitor-current to Voltage-delta.
249
-
250
- dV[uV] = constant[us/nF] * current[nA] = constant[us*V/nAs] * current[nA]
251
- """
252
- C_cap_uF = max(self.C_intermediate_uF, 0.001)
253
- return int((10**3 * (2**28)) // (C_cap_uF * config.SAMPLERATE_SPS))
254
-
255
282
 
256
283
  u32 = Annotated[int, Field(ge=0, lt=2**32)]
257
284
  u8 = Annotated[int, Field(ge=0, lt=2**8)]
@@ -283,13 +310,9 @@ class ConverterPRUConfig(ShpModel):
283
310
  R_input_kOhm_n22: u32
284
311
  # ⤷ TODO: possible optimization: n32 (range 1uOhm to 1 kOhm) is easier to calc in pru
285
312
 
286
- Constant_us_per_nF_n28: u32
287
- V_intermediate_init_uV: u32
288
- I_intermediate_leak_nA: u32
289
-
290
- V_enable_output_threshold_uV: u32
291
- V_disable_output_threshold_uV: u32
292
- dV_enable_output_uV: u32
313
+ V_mid_enable_output_threshold_uV: u32
314
+ V_mid_disable_output_threshold_uV: u32
315
+ dV_mid_enable_output_uV: u32
293
316
  interval_check_thresholds_n: u32
294
317
 
295
318
  V_pwr_good_enable_threshold_uV: u32
@@ -299,7 +322,7 @@ class ConverterPRUConfig(ShpModel):
299
322
  V_output_log_gpio_threshold_uV: u32
300
323
 
301
324
  V_input_boost_threshold_uV: u32
302
- V_intermediate_max_uV: u32
325
+ V_mid_max_uV: u32
303
326
 
304
327
  V_output_uV: u32
305
328
  V_buck_drop_uV: u32
@@ -331,12 +354,13 @@ class ConverterPRUConfig(ShpModel):
331
354
  I_input_max_nA=round(data.I_input_max_mA * 1e6),
332
355
  V_input_drop_uV=round(data.V_input_drop_mV * 1e3),
333
356
  R_input_kOhm_n22=round(data.R_input_mOhm * (1e-6 * 2**22)),
334
- Constant_us_per_nF_n28=data.calc_cap_constant_us_per_nF_n28(),
335
- V_intermediate_init_uV=round(data.V_intermediate_init_mV * 1e3),
336
- I_intermediate_leak_nA=round(data.I_intermediate_leak_nA),
337
- V_enable_output_threshold_uV=round(states["V_enable_output_threshold_mV"] * 1e3),
338
- V_disable_output_threshold_uV=round(states["V_disable_output_threshold_mV"] * 1e3),
339
- dV_enable_output_uV=round(states["dV_enable_output_mV"] * 1e3),
357
+ V_mid_enable_output_threshold_uV=round(
358
+ states["V_mid_enable_output_threshold_mV"] * 1e3
359
+ ),
360
+ V_mid_disable_output_threshold_uV=round(
361
+ states["V_mid_disable_output_threshold_mV"] * 1e3
362
+ ),
363
+ dV_mid_enable_output_uV=round(states["dV_mid_enable_output_mV"] * 1e3),
340
364
  interval_check_thresholds_n=round(
341
365
  data.interval_check_thresholds_ms * config.SAMPLERATE_SPS * 1e-3
342
366
  ),
@@ -346,7 +370,7 @@ class ConverterPRUConfig(ShpModel):
346
370
  V_output_log_gpio_threshold_uV=round(data.V_output_log_gpio_threshold_mV * 1e3),
347
371
  # Boost-Converter
348
372
  V_input_boost_threshold_uV=round(data.V_input_boost_threshold_mV * 1e3),
349
- V_intermediate_max_uV=round(data.V_intermediate_max_mV * 1e3),
373
+ V_mid_max_uV=round(states["V_mid_max_mV"] * 1e3),
350
374
  # Buck-Converter
351
375
  V_output_uV=round(data.V_output_mV * 1e3),
352
376
  V_buck_drop_uV=round(data.V_buck_drop_mV * 1e3),
@@ -23,13 +23,11 @@
23
23
  V_input_drop_mV: 0.0 # simulate input-diode
24
24
  R_input_mOhm: 0.0 # resistance only active with disabled boost, range [1 mOhm; 1MOhm]
25
25
 
26
- C_intermediate_uF: 0.0 # primary storage-Cap
27
- V_intermediate_init_mV: 3000 # allow a proper / fast startup
28
- I_intermediate_leak_nA: 0.0
26
+ storage: null # so storage is disabled (null is None in YAML)
29
27
 
30
28
  # Output-Switch with comparator and hysteresis
31
- V_intermediate_enable_threshold_mV: 1 # -> target gets connected (hysteresis-combo with next value)
32
- V_intermediate_disable_threshold_mV: 0 # -> target gets disconnected
29
+ V_intermediate_enable_output_threshold_mV: 1 # -> target gets connected (hysteresis-combo with next value)
30
+ V_intermediate_disable_output_threshold_mV: 0 # -> target gets disconnected
33
31
  interval_check_thresholds_ms: 0.0 # some BQs check every 64 ms if output should be disconnected
34
32
 
35
33
  # Power-Good signal from comparator and hysteresis
@@ -40,11 +38,11 @@
40
38
  C_output_uF: 1.0 # final (always last) stage to compensate transient current spikes when enabling power for target
41
39
 
42
40
  # Extra
43
- V_output_log_gpio_threshold_mV: 1400 # min voltage needed to enable recording changes in gpio-bank
41
+ V_output_log_gpio_threshold_mV: 1400 # minimum voltage needed to enable recording changes in gpio-bank
44
42
  # TODO: actually disable gpio below that
45
43
 
46
44
  # Boost Converter
47
- V_input_boost_threshold_mV: 0.0 # min input-voltage for the boost converter to work
45
+ V_input_boost_threshold_mV: 0.0 # minimum input-voltage for the boost converter to work
48
46
  V_intermediate_max_mV: 10000 # -> boost converter shuts off
49
47
 
50
48
  LUT_input_efficiency: [
@@ -68,7 +66,7 @@
68
66
 
69
67
  # Buck-converter
70
68
  V_output_mV: 2400
71
- V_buck_drop_mV: 0.0 # simulate LDO min voltage differential or output-diode
69
+ V_buck_drop_mV: 0.0 # simulate LDO minimum voltage differential or output-diode
72
70
 
73
71
  LUT_output_efficiency: [ 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00 ] # array[12] depending on output_current
74
72
  LUT_output_I_min_log2_nA: 1 # 2^8 = 256 nA -> array[0] is for inputs < 256 nA, see notes on LUT_input for explanation
@@ -96,12 +94,13 @@
96
94
  description: Simple Converter based on diode and storage capacitor
97
95
  inherit_from: neutral
98
96
  V_input_drop_mV: 300 # simulate input-diode
99
- C_intermediate_uF: 47 # primary storage-Cap
97
+ storage:
98
+ name: Capacitor_47uF_6.3V
100
99
  harvester:
101
100
  name: cv20
102
101
  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
102
+ V_intermediate_enable_output_threshold_mV: 2000
103
+ V_intermediate_disable_output_threshold_mV: 1800 # nRF draw ~0.5 mA below that point
105
104
  # TODO: put switch-output into special nRF Version
106
105
 
107
106
  - datatype: VirtualSourceConfig
@@ -138,12 +137,13 @@
138
137
  V_input_max_mV: 3000
139
138
  I_input_max_mA: 100
140
139
 
141
- C_intermediate_uF: 100.0 # primary storage-Cap
142
- V_intermediate_init_mV: 3000 # allow a proper / fast startup
143
- I_intermediate_leak_nA: 330
140
+ storage:
141
+ name: Capacitor_100uF_6.3V
142
+ SoC_init: 0.66 # allow a proper / fast startup
143
+ R_leak_Ohm: 19.0e6 # ~ 330 nA leakage at 6.3 V
144
144
 
145
- V_intermediate_enable_threshold_mV: 1000 # -> target gets connected (hysteresis-combo with next value)
146
- V_intermediate_disable_threshold_mV: 0 # -> target gets disconnected
145
+ V_intermediate_enable_output_threshold_mV: 1000 # -> target gets connected (hysteresis-combo with next value)
146
+ V_intermediate_disable_output_threshold_mV: 0 # -> target gets disconnected
147
147
  interval_check_thresholds_ms: 64.0 # some BQs check every 64 ms if output should be disconnected
148
148
 
149
149
  V_pwr_good_enable_threshold_mV: 2800 # target is informed by pwr-good on output-pin (hysteresis) -> for intermediate voltage
@@ -151,7 +151,7 @@
151
151
  immediate_pwr_good_signal: false # 1: activate instant schmitt-trigger, 0: stay in interval for checking thresholds
152
152
 
153
153
  # Boost Converter
154
- V_input_boost_threshold_mV: 130 # min input-voltage for the boost converter to work
154
+ V_input_boost_threshold_mV: 130 # minimum input-voltage for the boost converter to work
155
155
  V_intermediate_max_mV: 3600 # -> boost converter shuts off
156
156
 
157
157
  LUT_input_efficiency: [
@@ -198,12 +198,12 @@
198
198
  V_input_max_mV: 5100
199
199
  I_input_max_mA: 100
200
200
 
201
- C_intermediate_uF: 33.0 # primary storage-Cap
202
- V_intermediate_init_mV: 3400 # allow a proper / fast startup
203
- I_intermediate_leak_nA: 0.0
201
+ storage:
202
+ name: Capacitor_100uF_6.3V
203
+ SoC_init: 0.66 # allow a proper / fast startup
204
204
 
205
- V_intermediate_enable_threshold_mV: 3000 # -> target gets connected (hysteresis-combo with next value)
206
- V_intermediate_disable_threshold_mV: 2400 # -> target gets disconnected
205
+ V_intermediate_enable_output_threshold_mV: 3000 # -> target gets connected (hysteresis-combo with next value)
206
+ V_intermediate_disable_output_threshold_mV: 2400 # -> target gets disconnected
207
207
  interval_check_thresholds_ms: 64.0 # some BQs check every 64 ms if output should be disconnected
208
208
 
209
209
  V_pwr_good_enable_threshold_mV: 3000 # target is informed by pwr-good on output-pin (hysteresis) -> for intermediate voltage
@@ -213,12 +213,12 @@
213
213
  C_output_uF: 1.0 # final (always last) stage to compensate undetectable current spikes when enabling power for target
214
214
 
215
215
  # Boost Converter
216
- V_input_boost_threshold_mV: 100.0 # min input-voltage for the boost converter to work
216
+ V_input_boost_threshold_mV: 100.0 # minimum input-voltage for the boost converter to work
217
217
  V_intermediate_max_mV: 5500 # -> boost converter shuts off
218
218
 
219
219
  # Buck Converter
220
220
  V_output_mV: 2200
221
- V_buck_drop_mV: 200.0 # simulate LDO min voltage differential or output-diode
221
+ V_buck_drop_mV: 200.0 # simulate LDO minimum voltage differential or output-diode
222
222
 
223
223
  # <1u 1u 2u 4u 8u 16u 32u 64u 128u 256u 512u >1m
224
224
  LUT_output_efficiency: [ 0.40, 0.50, 0.60, 0.73, 0.82, 0.86, 0.88, 0.90, 0.91, 0.92, 0.93, 0.92] # array[12] depending on output_current