Tutorial 05.2 - PrimitiveConfig, primitive_config_wrapper, DeviceConfig, calculate_minimum_definitive_differences#

Step 0: Setup the project and prepare the data#

[1]:
from pathlib import Path

import pydpeet as eet

We will use “ERROR” as the logging style for better readability of the notebook

[2]:
eet.set_logging_style("ERROR")
[3]:
standardized_data = eet.read(
    input_path=str(Path.cwd().parent.parent / "res" / "raw_data_from_cyclers" / "Cal_Ageing_Checkup1.xlsx"),
    config=eet.ReadConfig.Neware_8_0_0_516,
)

Step 1: Creating a custom PrimitiveConfig#

A PrimitiveConfig contains the following parameters used by add_primitive_segments:

Hint: You can type in “eet.PrimitiveConfig.” to see all other availiable PrimitiveConfig in most IDEs

[4]:
default_config = eet.PrimitiveConfig.DEFAULT

Hint: Use primitive_config_wrapper to create your own custom PrimitiveConfig that overwrites the standard values

[5]:
primitive_config = eet.primitive_config_wrapper(
    segments_to_detect_config=[("Voltage[V]", 0.01), ("Current[A]", 0.01), ("Power[W]", 0.01)]
)
[6]:
default_config.segments_to_detect_config
[6]:
[('Voltage[V]', 0.0025), ('Current[A]', 0.0015), ('Power[W]', 0.004)]
[7]:
primitive_config.segments_to_detect_config
[7]:
[('Voltage[V]', 0.01), ('Current[A]', 0.01), ('Power[W]', 0.01)]

Step 2: Using a device config to create a custom PrimitiveConfig#

Instead of setting the segments_to_detect_config directly you’re also able to use a device config with the following parameters:

[8]:
# BASYTEC_CTS (list[float])
#    0.002,  # ACCURACY_VOLTAGE_SIGNAL
#    0.003,  # ACCURACY_CURRENT_SIGNAL
#    0.002,  # ACCURACY_VOLTAGE_MEASUREMENT
#    0.003,  # ACCURACY_CURRENT_MEASUREMENT
#    6,  # FS_VOLTAGE
#    5,  # FS_CURRENT

You can use calculate_minimum_definitive_differences to get the values calculated internally per standard

[9]:
eet.calculate_minimum_definitive_differences(*eet.DeviceConfig.BASYTEC_CTS)
[9]:
(0.024, 0.03)

Hint: You can type in “eet.DeviceConfig.” to see all other availiable DeviceConfig in most IDEs

[10]:
primitive_config = eet.primitive_config_wrapper(
    threshold_dict=eet.DeviceConfig.BASYTEC_CTS,
    segments_to_detect_config=None,
    adjust_segments_config=None,
    thresholds_primitive_annotation=None,
)
[11]:
primitive_config.segments_to_detect_config  # uses per standard half the calculate_minimum_definitive_differences to increase the sensitivity
[11]:
[('Voltage[V]', 0.012), ('Current[A]', 0.015), ('Power[W]', 0.027)]
[12]:
primitive_config.adjust_segments_config
[12]:
[('Voltage[V]', 0.024), ('Current[A]', 0.03), ('Power[W]', 0.054)]
[13]:
primitive_config.thresholds_primitive_annotation
[13]:
{'V': 0.024, 'I': 0.03, 'P': 0.054}