Skip to content

Commit ba51188

Browse files
authored
Merge pull request #15 from upb-lea/develop
Fix voltage limit issue and some refactoring
2 parents ea09a46 + 555c439 commit ba51188

58 files changed

Lines changed: 188 additions & 75 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ jobs:
3939
4040
pip install types-requests
4141
pip install mypy
42+
pip install scipy-stubs pandas-stubs
4243
mypy $(git ls-files '*.py')
4344
- name: Install packages for spell check and perform spell check
4445
run: |

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@ dist/
2323
gpgit/
2424
trial/
2525
trial.py
26-
foil_downloads/
27-
ceramic_downloads/
26+
film_downloads/
27+
ceramic_downloads/
28+
results_*.csv

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
## [0.1.0] - 2025-11-05
1515
### Added
16-
- Initial release featuring foil capacitor selection for power electronics applications
16+
- Initial release featuring film capacitor selection for power electronics applications
1717

1818
[unreleased]: https://github.com/upb-lea/capacitor_selection_toolbox/compare/0.1.1...HEAD
1919
[0.1.1]: https://github.com/upb-lea/capacitor_selection_toolbox/compare/0.1.0...0.1.1

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Power Electronics Capacitor Selection Toolbox (PE-CST)
44
=========================================================================
5-
Toolbox to select suitable foil capacitors for power electronics applications.
5+
Toolbox to select suitable film capacitors for power electronics applications.
66

77

88
Installation
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# 3rd party libraries
77
import numpy as np
8-
from matplotlib import pyplot as plt
8+
from matplotlib import pyplot as plt # type: ignore
99

1010
# own libraries
1111
import pecst
@@ -32,7 +32,7 @@
3232
)
3333

3434
# capacitor pareto plane calculation
35-
c_name_list, c_db_list = pecst.foil.select_foil_capacitors(capacitor_requirements)
35+
c_name_list, c_db_list = pecst.film.select_film_capacitors(capacitor_requirements)
3636
c_name_list[1] = c_name_list[1].replace("B3272*AGT", "B3272*A/G/T")
3737
color_list = [pecst.gnome_colors["black"], pecst.gnome_colors["red"], pecst.gnome_colors["blue"]]
3838

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
# configure logging to show femmt terminal output
99
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO)
1010

11-
pecst.foil.download_esr_csv_files()
11+
pecst.film.download_esr_csv_files()

examples/technology_comparison.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# 3rd party libraries
77
import numpy as np
8-
from matplotlib import pyplot as plt
8+
from matplotlib import pyplot as plt # type: ignore
99

1010
# own libraries
1111
import pecst

pecst/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
from pecst.selection import select_capacitors as select_capacitors
1212

1313
# capacitor specific types
14-
from pecst.foil import *
14+
from pecst.film import *
1515
from pecst.ceramic import *
1616
from pecst.electrolytic import *

pecst/ceramic/selection.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# 3rd party libraries
88
import numpy as np
99
import pandas as pd
10-
from matplotlib import pyplot as plt
10+
from matplotlib import pyplot as plt # type: ignore
1111

1212
# own libraries
1313
from pecst.cst_dataclasses import CapacitorRequirements
@@ -112,7 +112,7 @@ def select_ceramic_capacitors(c_requirements: CapacitorRequirements) -> tuple[li
112112

113113
# sort out all capacitors where to many series capacitors are required (more than maximum in series allowed)
114114
ceramic_df["number_min_capacitors_in_series"] = np.ceil(
115-
c_requirements.v_dc_for_op_max_voltage / (ceramic_df["voltage"] * (1 + c_requirements.voltage_safety_margin_percentage / 100)))
115+
c_requirements.v_dc_for_op_max_voltage / (ceramic_df["voltage"] * (1 - c_requirements.voltage_safety_margin_percentage / 100)))
116116
logger.info(f"Initial ceramic dataframe shape: {ceramic_df.shape}")
117117
ceramic_df = ceramic_df.drop(ceramic_df[ceramic_df["number_min_capacitors_in_series"] > c_requirements.maximum_number_series_capacitors].index)
118118
logger.info(f"Ceramic dataframe shape after dropping number_min_capacitors_in_series > maximum_number_series_capacitors: {ceramic_df.shape}")
@@ -129,7 +129,7 @@ def select_ceramic_capacitors(c_requirements: CapacitorRequirements) -> tuple[li
129129
x["ordering code"], x["capacitance"], v_dc_max, x["number_min_capacitors_in_series"], n_max_c, c_min_req), axis=1)
130130

131131
# drop capacitors with no bias curve data given
132-
# leads to drop all values ... but works with the foil capacitors
132+
# leads to drop all values ... but works with the film capacitors
133133
# ceramic_df = ceramic_df.drop(ceramic_df[np.isnan(ceramic_df["in_series_needed"])].index)
134134
logger.info(f"Ceramic dataframe shape after dropping NaNs with in_series_needed: {ceramic_df.shape}")
135135
# loss calculation per capacitor

pecst/constants.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,16 @@
3131
TEMPERATURE_125 = 125
3232

3333
# folder names
34-
FOIL_CAPACITOR_ESR_OVER_FREQUENCY_DIRECTORY = "foil_downloads"
35-
FOIL_CAPACITOR_DATA_DIRECTORY = "foil_capacitor_data"
34+
FILM_CAPACITOR_ESR_OVER_FREQUENCY_DIRECTORY = "film_downloads"
35+
FILM_CAPACITOR_DATA_DIRECTORY = "film_capacitor_data"
3636
ELECTROLYTIC_CAPACITOR_DATA_DIRECTORY = "electrolytic_capacitor_data"
3737
ELECTROLYTIC_CAPACITOR_DOWNLOAD_DIRECTORY = "electrolytic_downloads"
3838
CERAMIC_CAPACITOR_DOWNLOAD_DIRECTORY = "ceramic_downloads"
3939

40-
# foil capacitor settings
41-
FOIL_CAPACITOR_SERIES_NAME_LIST = ["B3271*P", "B3272*AGT", "B3277*P"]
42-
FOIL_CAPACITOR_SERIES_VALUES = "series_values"
40+
# film capacitor settings
41+
FILM_CAPACITOR_SERIES_NAME_LIST = ["B3271*P", "B3272*AGT", "B3277*P"]
42+
FILM_CAPACITOR_SERIES_VALUES = "series_values"
43+
FILM_CAPACITOR_RESONANCE_FREQUENCY_FACTOR = 1
4344

4445
# electrolytic capacitor settings
4546
ELECTROLYTIC_CAPACITOR_SERIES_NAME_LIST = ["056057psmsi", "058059pllsi"]
@@ -80,3 +81,7 @@
8081
"M": 0.2}
8182

8283
MATERIAL_KEMET_DICT = {"G": "C0G"}
84+
85+
86+
# resistor
87+
E12_BASIC_LIST = [1, 1.2, 1.5, 1.8, 2.2, 2.7, 3.3, 3.9, 4.7, 5.6, 6.8, 8.2]

0 commit comments

Comments
 (0)