Documentation

The DatabaseManager class

class transistordatabase.database_manager.DatabaseManager(housing_types_file_path: str | None = None, module_manufacturers_file_path: str | None = None)

Bases: object

Base class of the transistordatabase.

After creation, a operation mode must be set (either JSON or MongoDB) and then from the DatabaseManager the Transistor data can be accessed.

__init__(housing_types_file_path: str | None = None, module_manufacturers_file_path: str | None = None)
operation_mode: OperationMode
tdb_directory: str
housing_types_file_path: str
housing_types: List[str]
module_manufacturers_file_path: str
module_manufacturers: List[str]
set_operation_mode_json(json_folder_path: str = '/home/runner/work/transistordatabase/transistordatabase/database') None

Set the database operation mode to json.

Another operation mode is using mongodb as a database.

In order to function properly it is necessary that the given folder path is empty and is only used by this database. If no path is given the transistordatabase will be created in the package folder.

Parameters:

json_folder_path (str) – Path to json folder.

set_operation_mode_mongodb(collection: str = 'local') None

Set the database operation mode to mongodb database.

Parameters:

collection (str) – By default, local database is selected and “local” is provided as value

save_transistor(transistor: Transistor, overwrite: bool | None = None) None

Save the transistor object to the desired database depending on the set operation mode.

Receives the execution instructions from update_from_fileexchange(..).

Parameters:
  • transistor – The transistor object which shall be stored in the database.

  • overwrite (bool or None) – Indicates whether to overwrite the existing transistor object in the local database if a match is found

delete_transistor(transistor_name: str) None

Delete the transistor with the given id from the database.

Parameters:

transistor_name (str) – Name of the transistor

load_transistor(transistor_name: str) Transistor

Load a transistor from the database. The database is determined by the operation mode.

Parameters:

transistor_name (str) – Name of the transistor

Returns:

Desired Transistor object

Return type:

Transistor

get_transistor_names_list() List[str]

Return a list containing every transistor name.

Returns:

List containing the names.

Return type:

List[str]

print_tdb(filters: List[str] | None = None) List[str]

Print all transistor elements stored in the local database.

Parameters:

filters (List[str]) – filters for searching the database, e.g. ‘name’ or ‘type’

Returns:

Return a list with all transistor objects fitting to the search-filter

Return type:

List

update_from_fileexchange(overwrite: bool = True, index_url: str = 'https://raw.githubusercontent.com/upb-lea/transistordatabase_File_Exchange/main/index.txt', module_manufacturers_url: str = 'https://raw.githubusercontent.com/upb-lea/transistordatabase_File_Exchange/main/module_manufacturers.txt', housing_types_url: str = 'https://raw.githubusercontent.com/upb-lea/transistordatabase_File_Exchange/main/housing_types.txt') None

Update your local transistor database from transistordatabase-fileexchange from given index-file url.

Also updates module manufacturers and housing types. If no index_url or module_manufacturers_url or housing_types_url is given the default Transistordatabase Fileexchange URLs are taken.

Parameters:
  • index_url (str) – URL to the index file which contains the links to all the transistor files (json formatted).

  • overwrite (bool) – True to overwrite existing transistor objects in local database, False to not overwrite existing transistor objects in local database.

  • module_manufacturers_url (str) – URL to the module manufacturers file

  • housing_types_url (str) – URL to the housing type file

Returns:

None

Return type:

None

compare_with_fileexchange(index_url: str, output_file: str)

Compare the current database with the given database from the fileexchange.

Writes the difference in the given output_file.

Parameters:
  • index_url (str) – URL to the index file containing links to the Transistors of the Database.

  • output_file (str) – File path to the file where the diff is written

export_all_datasheets(filter_list: list | None = None)

Export all the available transistor data present in the local mongoDB database.

Parameters:

filter_list (list) – a list of transistor names that needs to be exported in specific

Returns:

None

convert_dict_to_transistor_object(transistor_dict: dict) Transistor

Convert a dictionary to a transistor object.

This is a helper function of the following functions: - parallel_transistors() - load() - import_json()

Parameters:

transistor_dict (dict) – transistor dictionary

Returns:

Transistor object

Return type:

Transistor object

parallel_transistors(transistor: Transistor, count_parallels: int = 2) Transistor

Connect [count_parallels] transistors in parallel.

The returned transistor object behaves like a single transistor.

  • name will be modified by adding _[count_parallels]_parallel

  • channel characteristics will be modified

  • e_on/e_off/e_rr characteristics will be modified

  • thermal behaviour will be modified

Parameters:
  • transistor (Transistor) – transistor object to paralize

  • count_parallels (int) – count of parallel transistors of same type, default = 2

Returns:

transistor object with parallel transistors

Return type:

Transistor

Example:

>>> import transistordatabase as tdb
>>> transistor = tdb.load('Infineon_FF200R12KE3')
>>> parallel_transistorobject = transistor.parallel_transistors(3)
static import_xml_data(files: Dict) Transistor

Import switch and diode characteristics in plecs xml file format.

Parameters:

files – dictionary holding switch and diode xml file names

Rtype files:

dict

Raises:

ImportError – raised when file format is not valid or not found

Returns:

Transistor object creating using information extracted from the provided files

Return type:

Transistor

static export_single_transistor_to_json(transistor: Transistor, file_path: str | None = None)

Export a single transistor object to a json file.

Parameters:
  • transistor (Transistor) – transistor name

  • file_path (Optional[str]) – Specify a directory or a file path.

static dpt_save_data(measurement_dict: Dict) Dict

Import double pulse measurements and calculates switching losses to each given working point.

Note: This function brings the measurement data to a dictionary. It does not store the data to the transistor!

[1] options for the integration interval are based on following paper: Link: https://ieeexplore.ieee.org/document/8515553

Parameters:

measurement_dict (dict) – dictionary with above mentioned parameters

example to call this function:

>>> dpt_save_dict = {
>>>     'path': 'C:/Users/.../GaN-Systems/400V/*.csv',
>>>     'dataset_type': 'graph_i_e',
>>>     'comment': '',
>>>     'load_inductance': 750e-6,
>>>     'commutation_inductance': 15.63e-9,
>>>     'commutation_device': 'IDH06G65C6',
>>>     'measurement_date': None,
>>>     'measurement_testbench': 'LEA-UPB Testbench',
>>>     'v_g': 12,
>>>     'v_g_off': 0,
>>>     'energies': 'both',
>>>     'r_g_off': 1.8,
>>>     'integration_interval': 'IEC 60747-8',
>>>     'mode': 'analyze'}
>>> import transistordatabase as tdb
>>> dpt_energies_dict = tdb.dpt_save_data(dpt_save_dict)

The Transistor class

class transistordatabase.transistor.Transistor(transistor_args: dict, switch_args: dict, diode_args: dict, possible_housing_types: List[str], possible_module_manufacturers: List[str])

Bases: object

Transistor object which is the core class of transistordatabase module.

Contains subclasses like Switch, Diode, FosterThermalModel etc, and other child classes using which all the features and functionalities of this module are based and developed.

Todo

  • Groups data of all other classes for a single transistor. Methods are specified in such a way that only user-interaction with this class is necessary

  • Documentation on how to add or extract a transistor-object to/from the database can be found in

__init__(transistor_args: dict, switch_args: dict, diode_args: dict, possible_housing_types: List[str], possible_module_manufacturers: List[str]) None

Create a transistor element.

Takes in the following dictionary arguments for creating and initializing the transistor object. isvalid_dict() method is applied on transistor_args object to validate the argument. Else TypeError exception is raised. Module manufacturer type and housing type data validations are performed for matching the given values to the pre-existed types stored in the form of ‘housing.txt’ and ‘module_manufacturer.txt’ files.

Parameters:
  • transistor_args (dict) – transistor argument object

  • switch_args (dict) – switch argument object

  • diode_args (dict) – diode argument object

  • possible_housing_types (List[str]) – List of housing types which are valid

  • possible_module_manufacturers (List[str]) – List of module manufacturers which are valid

Raises:
  • TypeError – Raised if isvalid_dict() return false

  • ValueError – Raised if index based search for module_manufacturer or housing_type values fails

name: str

Name of the transistor. Choose as specific as possible. (Mandatory key)

type: str

Specifies the type of module either e.g IGBT, MOSFET, SiC MOSFET etc. (Mandatory key)

author: str

The author of the module specific object. Usually added when creating and adding a new datasheet module using template.py. (Mandatory key)

template_version: str

Specifies the template version using which a new datasheet module is created. (Mandatory/Automatic)

template_date: datetime

Specifies the date and time at which the template in created. (Mandatory/Automatic)

creation_date: datetime

Specifies the date and time of the new transistor module that is created using template. (Mandatory/Automatic)

comment: str | None

Any user specific comment created when adding a new datasheet module. (Optional key)

As the name specifies, provides the hyperlink of the datasheet that is being referred to.

datasheet_date: datetime | None

pymongo cannot encode date => always save as datetime. (Optional key)

datasheet_version: str | None

Specifies the version of the module manufacturer datasheet. (Optional key)

housing_area: float

Housing area extracted from datasheet. Units in m^2. (Mandatory key)

cooling_area: float

Housing area extracted from datasheet. Units in m^2. (Mandatory key)

t_c_max: float

Module specific maximum junction temperature. Units in °C (Optional key)

r_g_int: float

Internal gate resistance. Units in Ohm (Mandatory key)

Recommended turn on gate resistance of switch (Optional key)

Recommended turn off gate resistance of switch (Optional key)

c_oss_fix: float | None

Parasitic constant capacitance. Units in F (Optional key)

c_iss_fix: float | None

Parasitic constant capacitance. Units in F (Optional key)

c_rss_fix: float | None

Parasitic constant capacitance. Units in F (Optional key)

housing_type: str

e.g. TO-220, etc. Must be from a list of specific strings. (Mandatory key)

manufacturer: str

Provides information of the module manufacturer. (Mandatory key)

r_th_cs: float | None

Module specific case to sink thermal resistance. Units in K/W (Mandatory key)

r_th_switch_cs: float | None

Switch specific case to sink thermal resistance. Units in K/W (Mandatory key)

r_th_diode_cs: float | None

Diode specific case to sink thermal resistance. Units in K/W (Mandatory key)

v_abs_max: float

Absolute maximum voltage rating. Units in V (Mandatory key)

i_abs_max: float

Absolute maximum current rating. Units in A (Mandatory key)

i_cont: float | None

Module specific continuous current. Units in A e.g. Fuji = I_c, Semikron = I_c,nom (Mandatory key)

c_oss: List[VoltageDependentCapacitance] | None

List of VoltageDependentCapacitance. (Optional key)

c_iss: List[VoltageDependentCapacitance] | None

List of VoltageDependentCapacitance. (Optional key)

c_rss: List[VoltageDependentCapacitance] | None

List of VoltageDependentCapacitance. (Optional key)

raw_measurement_data: List[RawMeasurementData] | None

Member instance for class type RawMeasurementData

graph_v_ecoss: ndarray[tuple[int, ...], dtype[float64]] | None

Member instance for storing voltage dependant capacitance graph in the form of 2D numpy array.

c_oss_er: EffectiveOutputCapacitance | None

Energy related effective output capacitance. Units in F (Optional key)

c_oss_tr: EffectiveOutputCapacitance | None

Time related effective output capacitance. Units in F (Optional key)

diode: Diode

Member instance for class type Diode (Mandatory key)

switch: Switch

Member instance for class type Switch (Mandatory key)

convert_raw_measurement_data(input: List | Dict, name: str | None = None) List[RawMeasurementData]

Convert input (list or dict) to list of raw_measurement_data.

Parameters:
  • input (List | Dict) – Input data

  • name (str, optional) – Name of variable, only used for error message, optional

Returns:

List of RawMeasurementData objects

Return type:

List[RawMeasurementData]

convert_voltage_dependent_capacitance(input: List | Dict, name: str | None = None) List[VoltageDependentCapacitance]

Convert input (list or dict) to list of raw_measurement_data.

Parameters:
  • input (List | Dict) – Input data

  • name (str, optional) – Name of variable, only used for error message, optional

Returns:

List of VoltageDependentCapacitance objects

Return type:

List[VoltageDependentCapacitance]

convert_to_dict() Dict

Convert the transistor object in scope to a dictionary datatype.

Returns:

Transistor object in dict type

Return type:

dict

update_wp(t_j: float, v_g: float, i_channel: float, switch_or_diode: str = 'both', normalize_t_to_v=10) None

Fill the .wp-class, a temporary storage for self-written user-programs.

Searches for the input values and fills the .wp-class with data next to this points.

Parameters:
  • t_j (float) – junction temperature

  • v_g (float) – gate voltage

  • i_channel (float) – channel current for linearization

  • switch_or_diode (str) – ‘switch’ or ‘diode’ or ‘both’

  • normalize_t_to_v (float) – ratio between t_j and v_g. e.g. 10 means 10°C is same difference as 1V

Returns:

None

Return type:

None

init_loss_matrices()

Experimental.

init_switch_channel_matrix()

Experimental function.

quickstart_wp() None

Fill out the .wp-class by just one command ‘quickstart_wp()’.

Uses typical working points
  • channel linearization next to v_g = 15V, i_cont and t_j = t_j_abs_max - 25 degree

  • switching loss curves next to t_j = t_j_abs_max - 25 degree

Returns:

None

calc_v_eoss() array

Calculate e_oss stored in c_oss depend on the voltage. Uses transistor.c_oss[0].graph_v_coss.

Returns:

e_oss numpy array

Return type:

np.array

calc_v_qoss() array

Calculate q_oss stored in c_oss depend on the voltage. Uses transistor.c_oss[0].graph_v_coss.

Returns:

q_oss numpy array

Return type:

np.array

plot_v_eoss(buffer_req: bool = False)

Plot v_eoss with method calc_v_eoss.

Parameters:

buffer_req (bool) – Internally required for generating virtual datasheets

Returns:

Respective plots are displayed

plot_v_qoss(buffer_req: bool = False)

Plot v_qoss with method calc_v_qoss.

Parameters:

buffer_req (bool) – Internally required for generating virtual datasheets

Returns:

Respective plots are displayed

plot_v_coss(buffer_req: bool = False)

Plot the output capacitance C_oss.

Parameters:

buffer_req (bool) – Internally required for generating virtual datasheets

Returns:

Respective plots are displayed

plot_half_bridge_equivalent_coss(v_dc: float, figure_size_mm: Tuple | None = None, buffer_req: bool = False)

Plot the half-bridge equivalent output capacitance C_oss.

Parameters:
  • v_dc (float) – DC voltage for the half-bridge

  • buffer_req (bool) – Internally required for generating virtual datasheets

  • figure_size_mm (Tuple) – figure size in mm as a tuple (x mm, y mm)

Returns:

Respective plots are displayed

plot_half_bridge_equivalent_eoss(v_dc: float, figure_size_mm: Tuple | None = None, buffer_req: bool = False, yunits: str = 'J')

Plot the half-bridge equivalent output capacitance C_oss.

Parameters:
  • v_dc (float) – DC voltage for the half-bridge

  • buffer_req (bool) – Internally required for generating virtual datasheets

  • figure_size_mm (Tuple) – figure size in mm as a tuple (x mm, y mm)

  • yunits (str) – Unit for the y-axis, e.g. “J”

Returns:

Respective plots are displayed

static calc_energy_object_voltage_correction(energy_object: SwitchEnergyData, v_op: float)

Calculate the switch loss energy for a different output voltage.

Parameters:
  • energy_object (SwitchEnergyData) – Energy object (e.g. turn-on)

  • v_op (float) – Operating voltage in V

calc_real_on_off_loss(e_on: SwitchEnergyData, e_off: SwitchEnergyData, v_op: float)

Correct the turn-on and turn-off energy by the energy stored in C_oss.

Parameters:
  • e_on (SwitchEnergyData) – e_on object

  • e_off (SwitchEnergyData) – e_off object

  • v_op (float) – voltage of interest

static plot_energy_objects(*energy_objects: SwitchEnergyData, energy_scale: str = 'µJ', figure_size: Tuple | None = None, figure_directory: str | None = None, additional_label: List | None = None, line_style: List | None = None, color: List | None = None)

Plot multiple energy objects into one plot.

Parameters:
  • energy_objects (SwitchEnergyData) – SwitchEnergyData

  • energy_scale (str) – Choose y-label, e.g. ‘µJ’ or ‘mJ’ or ‘nJ’

  • figure_size (Tuple) – figures size in mm (width, height)

  • figure_directory (str) – Directory to store the figure

get_object_v_i(switch_or_diode: str, t_j: float, v_g: float) List

Get a channel curve including boundary conditions.

Parameters:
  • switch_or_diode (float) – ‘switch’ or ‘diode’

  • t_j (float) – junction temperature

  • v_g (float) – gate voltage

Raises:

ValueError – When no data is available

Returns:

v_i-object (channel curve including boundary conditions)

Return type:

list

get_object_i_e(e_on_off_rr: str, t_j: float, v_g: float, v_supply: float, r_g: float) List

Get the loss graphs out of the transistor class.

Parameters:
  • e_on_off_rr (str) – can be the following: ‘e_on’, ‘e_off’ or ‘e_rr’

  • t_j (float) – junction temperature

  • v_g (float) – gate voltage at turn-on / turn-off

  • v_supply (float) – dc link voltage

  • r_g (float) – gate resistor

Returns:

e_on.graph_i_e or e_off.graph_i_e or e_rr.graph_i_e

Return type:

list

get_object_i_e_simplified(e_on_off_rr: str, t_j: float)

Get the loss graphs out of the transistor class, simplified version.

Parameters:
  • e_on_off_rr (str) – can be the following: ‘e_on’, ‘e_off’ or ‘e_rr’

  • t_j (float) – junction temperature

Raises:

ValueError – Raised when no graph_i_e information is available at the given operating point

Returns:

e_on.graph_i_e or e_off.graph_i_e or e_rr.graph_i_e, e_on.graph_r_e or e_off.graph_r_e or e_rr.graph_r_e

Return type:

list, list or None

get_object_r_e_simplified(e_on_off_rr: str, t_j: float, v_g: float, v_supply: float, normalize_t_to_v: float) List

Get the loss graphs out of the transistor class, simplified version.

Parameters:
  • e_on_off_rr (str) – can be the following: ‘e_on’, ‘e_off’ or ‘e_rr’

  • t_j (float) – junction temperature

  • v_g (float) – gate voltage

  • normalize_t_to_v (float) – factor t:v (junction-temperature divided by gate voltage)

  • v_supply (float) – supply voltage

Returns:

e_on.graph_r_e or e_off.graph_r_e or e_rr.graph_r_e

Return type:

list

calc_object_i_e(e_on_off_rr: str, r_g: float, t_j: float, v_supply: float, normalize_t_to_v: float) SwitchEnergyData

Calculate loss curves for other gate resistor than the standard one.

This function uses i_e loss curve in combination with r_e loss curve, to calculate a new i_e loss curve for a chosen gate resistor. Also voltage correction is implemented (e.g. half voltage compared to datasheet means half losses)

Parameters:
  • e_on_off_rr (str) – ‘e_on’, ‘e_off’, ‘e_rr’

  • r_g (float) – gate resistor of interest

  • t_j (float) – junction temperature of interest

  • v_supply (float) – supply voltage of interest

  • normalize_t_to_v (float) – a normalize value used to evaluate cartesian distance

Raises:

Exception – When given gate resistance exceeds the existing maximum

Returns:

object with corrected i_e curves due to r_g and v_supply at given t_j

Return type:

list

Note

r_e_object may has not same voltage as i_e_object.

Todo

r_e_object may has not same voltage as i_e_object.

calc_i_e_curve_using_r_e_curve(i_e_object: SwitchEnergyData, r_e_object: SwitchEnergyData, r_g: float, v_supply_chosen: float) array

Calculate the loss energy curve at the provided gate resistance value based on the r_e_graph data.

Parameters:
  • i_e_object (Transistor.SwitchEnergyData) – selected loss energy curve object of datatype = ‘graph_i_e’

  • r_e_object (Transistor.SwitchEnergyData) – associated loss energy curve object of datatype = ‘graph_r_e’

  • r_g (int) – selected gate resistance for curve re-estimation

  • v_supply_chosen (int) – selected supply voltage for curve re-estimation

Returns:

numpy 2d data representing loss energy of datatype = ‘graph_i_e’

Return type:

np.array

calc_lin_channel(t_j: float, v_g: float, i_channel: float, switch_or_diode: str) Tuple[float, float]

Get interpolated channel parameters.

This function searches for ui_graphs with the chosen t_j and v_g. At the desired current, the equivalent parameters for u_channel and r_channel are returned

Parameters:
  • t_j (float) – junction temperature

  • v_g (float) – gate voltage

  • i_channel (float) – current to linearize the channel

  • switch_or_diode (str) – ‘switch’ or ‘diode’

Raises:

ValueError – Raised when the given arguments either exceed the maximum values or not the expected values

Returns:

Linearized parameters for v_channel, r_channel

Return type:

tuple[float, float]

Todo

  • rethink method name. May include switch or diode as a parameter and use one global function

  • check if this function works for all types of transistors

  • Error handling

  • Unittest for this method

calc_thermal_params(input_type: str | None = None, order: int = 4, plotbit: bool = False) None

Generate thermal parameters like Rth_total, tau_total, Cth_total and vectors like Rth_vector, tau_vector, Cth_vector.

Based on data availability passed by the user while creating a new transistor object.

Cases

Vectors

Total

To be computed

Only curve available

R_th, C_th, tau

R_th, C_th, tau

Compute all parameters

Curve and R_th_total available

R_th, C_th, tau

C_th, tau

No overwrite of R_th_total

Total values available, no curve available

C_th

None

Compute only C_th_total

Vectors available AND/OR Curve available

Cth

Cth

  • No curve fitting necessary

  • Do not overwrite R_th_total

Parameters:
  • order (int) – The length of the polynomial to be used for curve fitting based parameters extraction. (cannot be more than 5)

  • input_type (str) – The type of object for which the thermal parameters need to computed. Can be either ‘switch’ or ‘diode’ type

  • plotbit (bool) – A boolean flag to visualize the fitted curve using matplotlib plotting features

Returns:

Foster object filled with missing parameters within the input_type object of transistor object

Return type:

None

compare_channel_linearized(i_channel: float, t_j: float = 150, v_g: float = 15) None

Show channel plots for switch and diode comparing the linearized graph and the original graph.

This function searches for the closest available curves for given arguments t_j and v_g

Parameters:
  • i_channel (float) – current to linearize the channel

  • t_j (float) – junction temperature of interest, default set to 150 degree

  • v_g (float) – gate voltage of interest, default set to 15V

Returns:

Plot, showing original channel data and linearized channel data

Return type:

None

raw_measurement_data_plots() list

Plot raw measurement data.

Take the raw measurement data attribute and traverses through the list for each present method and loads the ids and vds data for in 3 separate lists. The three lists are used as input for plot_curves function which returns the combined and scaled plots for the data. The combined plots are returned in img bytes format using the get_img_raw_data function. The img plots are then stored in plots_vds_id_t list. The test conditions of the data are then also added in a list form to the plots_vds_id_t.

return plots in img form along test conditions in a list rtype list of img plots along test conditions

plot_curves(time_array, vds_values, ids_values, buffer_req: bool = False)

Take three lists of time, vds and id values and generates a combined plot.

Calls the get_img_raw_data function for returning img form of the plot and returns the images.

:param time_array : time values in the raw measurement data :param vds_values : vds values in the raw measurement data :param id_values : id values in the raw measurement data return image form of the plot rtype decoded raw image data to utf-8

export_datasheet(build_collection=False) str | None

Generate and export the virtual datasheet in form of a pdf-file.

Returns:

pdf file is created in the current working directory

Return type:

None

Example:

>>> import transistordatabase as tdb
>>> transistor = tdb.load('Fuji_2MBI100XAA120-50')
>>> transistor.export_datasheet()

Todo

Instead of html file, generating a pdf file without third party requirements is a better option

Export a simulation model for simulink inverter loss models.

See also: https://de.mathworks.com/help/physmod/sps/ug/loss-calculation-in-a-three-phase-3-level-inverter.html

Parameters:
  • r_g_on (float) – gate turn on resistance, optional

  • r_g_off (float) – gate turn off resistance, optional

  • v_supply (float) – switch supply voltage, optional

  • normalize_t_to_v (float) – a normalize value used in computing cartesian distance

Raises:
  • Exception – Re-raised excception by calling calc_object_i_e(..)

  • ValueError – Raised when the switch type is other than IGBT

Returns:

.mat file for import in matlab/simulink

Return type:

None

Example:

>>> import transistordatabase as tdb
>>> transistor = tdb.load('Infineon_FF200R12KE3')
>>> transistor.export_simulink_loss_model()

Note

  • temperature next to 25 and 150 degree at 15V gate voltage will be used for channel and switching loss

  • in case of just one temperature curve, the upper temperature will increased (+1K) to bring a small temperature change in the curves.

  • only necessary data from tdb will be exported to simulink

  • Simulink model need switching energy loss in ‘mJ’

  • in case of no complete curve (e.g. not starting from zero), this tool will interpolate the curve

Todo

C_th is fixed at the moment to 1e-6 for switch an diode. Needs to be calculated from ohter data

export_matlab() None

Export a transistor dictionary to a matlab dictionary.

Returns:

File stored in current working path

Return type:

None

Example:

>>> import transistordatabase as tdb
>>> transistor = tdb.load('Fuji_2MBI100XAA120-50')
>>> transistor.export_matlab()
collect_i_e_and_r_e_combination(switch_type: str, loss_type: str) Tuple[List, List]

Gather the i_e and r_e graph combinations from the available energy curves which are further used in gecko circuit exporter function.

Parameters:
  • switch_type (str) – argument to specify if either ‘switch’ or ‘diode’ energy curve to be considered

  • loss_type (str) – loss type ‘e_on’ and ‘e_off’ for switch type and ‘e_rr’ for diode type applicable

Returns:

i_e, r_e indexes referencing to list[SwitchEnergyData] from the chosen switch_type

Return type:

list, list

export_geckocircuits(recheck: bool = True, v_supply: float | None = None, v_g_on: float | None = None, v_g_off: float | None = None, r_g_on: float | None = None, r_g_off: float | None = None) None

Export transistor data to GeckoCIRCUITS.

Parameters:
  • recheck (bool) – Default to set to true, to enable the neighbouring select feature of the exporter

  • v_supply (float) – supply voltage for turn-on/off losses

  • v_g_on (float) – gate turn-on voltage

  • v_g_off (float) – gate turn-off voltage

  • r_g_on (float) – gate resistor for turn-on

  • r_g_off (float) – gate resistor for turn-off

Returns:

Two output files: ‘Transistor.name’_Switch.scl and ‘Transistor.name’_Diode.scl created in the current working directory

Return type:

None

Example:

>>> import transistordatabase as tdb
>>> transistor = tdb.load('Fuji_2MBI100XAA120-50')
>>> transistor.export_geckocircuits(True, v_supply=600, v_g_on=15, v_g_off=-4, r_g_on=2.5, r_g_off=2.5)

Note

These .scl files are then imported as semiconductor characteristics inside geckoCIRCUITS

export_geckocircuits_coss(filepath: str | None = None, margin_factor: float = 1.2) None

Export a nonlinear C_oss file for GeckoCIRCUITS.

Parameters:
  • filepath (str) – directory to save the .ncl file. CWD is used in case of None.

  • margin_factor (float) – factor for margin. [1.0 = no margin], [1.2 = 20 % margin: DEFAULT]

export_plecs(recheck: bool = True, gate_voltages=None) None

Generate and export the switch and diode .xmls files to be imported into plecs simulator.

Parameters:
  • recheck (bool) – enables the selection of gate voltages near to the provided values if not found

  • gate_voltages – gate voltage like v_g_on, v_g_off, v_d_on, v_d_off

Returns:

Two output files: ‘Transistor.name’_Switch.xml and ‘Transistor.name’_Diode.xml created in the current working directory

Return type:

None

Example:

>>> import transistordatabase as tdb
>>> transistor = tdb.load('Fuji_2MBI200XAA065-50')
>>> transistor.export_plecs(recheck=True, gate_voltages=[15, -15, 15, 0])
class WP

Bases: object

WP class is intended for user calculations in Python. It is used to access transistor data in user-written programs.

It allows the user to linearize the channel and store the result in transistor.wp. Switching loss curves can be stored for specific boundary conditions, so that the same variable is always accessed in the self-written program, regardless of the transistor.

The class WP…

  • Always initialized as None.

  • Is always exported as None to .json or to the database.

  • Is a temporary workspace.

graph_v_coss: ndarray[tuple[int, ...], dtype[float64]] | None

V; Row 2: F

Type:

Units

Type:

Row 1

__init__()
switch_v_channel: float | None
switch_r_channel: float | None
diode_v_channel: float | None
diode_r_channel: float | None
switch_channel: float | None
diode_channel: float | None
e_on: ndarray[tuple[int, ...], dtype[float64]] | None

A; Row 2: J

Type:

Units

Type:

Row 1

e_off: ndarray[tuple[int, ...], dtype[float64]] | None

A; Row 2: J

Type:

Units

Type:

Row 1

e_rr: ndarray[tuple[int, ...], dtype[float64]] | None

A; Row 2: J

Type:

Units

Type:

Row 1

v_switching_ref: float | None

V

Type:

Unit

graph_v_eoss: ndarray[tuple[int, ...], dtype[float64]] | None

V; Row 2: J

Type:

Units

Type:

Row 1

graph_v_qoss: ndarray[tuple[int, ...], dtype[float64]] | None

V; Row 2: C

Type:

Units

Type:

Row 1

parallel_transistors: float | None

Number

Type:

Unit

validate_transistor() Dict

Check the transistor object if it is valid for plecs exporter.

Checks if curve characteristics and thermal network parameters of both switch and diode to be None or empty Appends corresponding codes for further verification in get_curve_data(..) method

Returns:

Availability codes

Return type:

dict

get_curve_data(channel_recheck: bool, gate_voltages: List) Dict

Prepare data for the PLECS exporter.

Collect the available information of switch and diode from transistor object and passes it to plecs_exporter(..) for generating the diode and switch .xml files

Parameters:
  • channel_recheck (bool) – if True, collect the channel and energy curve characteristics at nearest gate voltage if the given gate voltages are not found

  • gate_voltages (list) – turn on and off gate voltages for selecting the curves of switch and diode

Raises:

MissingDataError – If any information of switch or diode is missing completely

Returns:

Switch and diode objects

Return type:

dict

add_dpt_measurement(measurement_data)

Add new measurement data to the transistor object.

Parameters:

measurement_data (dict) – Dict of data you want to add to given attribute.

add_soa_data(soa_data: Dict | List, switch_type: str, clear: bool = False)

Add the SOA class object to the loaded transistor.switch.soa or transistor.diode.soa attribute.

Parameters:
  • soa_data (dict or list) – argument represents the soa dictionaries objects that needs to be added to transistor switch or diode object

  • switch_type (str) – either switch or diode object on which the provided soa_data needed to be appended

  • clear (bool) – set to true if to clear the existing soa curves on the selected transistor switch or diode object

Returns:

updated transistor switch or diode object with added soa characteristics

add_gate_charge_data(charge_data: Dict | List, clear: bool = False)

Add the GateChargeCurve class objects to the loaded transistor.switch.charge_curve attribute.

Note

Transistor object must be loaded first before calling this method

Parameters:
  • charge_data (dict or list) – argument represents the gatechargecurve dictionaries objects that needs to be added to transistor object

  • clear (bool) – set to true if to clear the existing gatechargecurve curves on the transistor object

Returns:

updated transistor object with added gate charge characteristics

add_temp_depend_resistor_data(r_channel_data: Dict | List, clear: bool = False)

Add the TemperatureDependResistance class objects to the loaded transistor.switch.r_channel_th attribute.

Note

Transistor object must be loaded first before calling this method

Parameters:
  • r_channel_data (dict or list) – TemperatureDependResistance dictionary object that needs to be added to transistor.switch.r_channel_th object

  • clear (bool) – set to true if to clear the existing r_channel_th curves on the transistor object

Returns:

updated transistor object with added gate charge characteristics

compare_measurement_datasheet()

Compare measurements to datasheet.

General methods

Helper functions.

transistordatabase.helper_functions.merge_curve(curve: array, curve_detail: array) array

Merge two equal curves, one of which contains an enlarged section of the first curve.

Use case is the merging of capacity curves, here often two curves (normal and zoom) are given in the data sheets.

Parameters:
  • curve (np.array) – full curve

  • curve_detail (np.array) – curve with zoom on x-axis

Returns:

merged curve

Return type:

np.array

Example:

(e.g. merges c_oss curve from 0-200V and from 0-1000V)

>>> import transistordatabase as tdb
>>> c_oss_normal = tdb.csv2array('transistor_c_oss.csv', first_x_to_0=True)
>>> c_oss_detail = tdb.csv2array('transistor_c_oss_detail.csv', first_x_to_0=True)
>>> c_oss_merged = tdb.merge_curve(c_oss_normal, c_oss_detail)
transistordatabase.helper_functions.r_g_max_rapid_channel_turn_off(v_gsth: float, c_ds: float, c_gd: float, i_off: float | List[float], v_driver_off: float) float

Calculate the maximum gate resistor to achieve no turn-off losses when working with MOSFETs ‘rapid channel turn-off’ (rcto).

Parameters:
  • v_gsth (float) – gate threshold voltage

  • c_ds (float) – equivalent drain-source capacitance

  • c_gd (float) – equivalent gate-drain capacitance

  • i_off (float or List[float]) – turn-off current

  • v_driver_off (float) – Driver voltage during turn-off

Returns:

r_g_max_rcto maximum gate resistor to achieve rapid channel turn-off

Return type:

float

Note

Input (e.g. i_off can also be a vector)

See also

D. Kubrick, T. Dürbaum, A. Bucher ‘Investigation of Turn-Off Behaviour under the Assumption of Linear Capacitances’ International Conference of Power Electronics Intelligent Motion Power Quality 2006, PCIM 2006, p. 239 –244

Different type checkers, adapted to the needs of the transistor database.

transistordatabase.checker_functions.csv2array(csv_filename: str, first_xy_to_00: bool = False, second_y_to_0: bool = False, first_x_to_0: bool = False, mirror_xy_data: bool = False) array

Import a .csv file and extracts its input to a numpy array.

Delimiter in .csv file must be ‘;’. Both ‘,’ or ‘.’ are supported as decimal separators. .csv file can generated from a 2D-graph for example via https://apps.automeris.io/wpd/

Parameters:
  • csv_filename (str) – Insert .csv filename, e.g. “switch_channel_25_15v”

  • first_xy_to_00 (bool) – Set ‘True’ to change the first value pair to zero. This is necessary in case of webplotdigitizer returns the first value pair e.g. as -0,13; 0,00349.

  • second_y_to_0 (bool) – Set ‘True’ to set the second y-value to zero. This is interesting in case of diode / igbt forward channel characteristic, if you want to make sure to set the point where the ui-graph leaves the u axis on the u-point to zero. Otherwise there might be a very small (and negative) value of u.

  • first_x_to_0 (bool) – Set ‘True’ to set the first x-value to zero. This is interesting in case of nonlinear input/output capacities, e.g. c_oss, c_iss, c_rss

  • mirror_xy_data (bool) – Takes the absolute() of both axis. Used for given mirrored data, e.g. some datasheet show diode data in the 3rd quadrant instead of the 1st quadrant

Returns:

1d array, ready to use in the transistor database

Return type:

np.array