TyphoonTest Library documentation

What is the difference between TyphoonTest API and HIL API?

TyphoonTest API is meant to be easier to use and abstract away from HIL-specific details, meaning clearer tests that convey more effectively the intent and that could be used, in the future, for other targets than HIL simulation.

Traditional HIL API and TyphoonTest API can be used together in the same test code without problems. We recommend to use TyphoonTest API functions when possible and, if missing anything, use traditional HIL API.

How can I sequence and run my tests with TyphoonTest Framework?

TyphoonTest Framework uses the popular pytest python tool for running tests. It is fully supported in our TyphoonTest IDE and can also be used directly from the command line. For more information, check our TyphoonTest IDE documentation and also check pytest documentation. Typhoontest defines some new command line arguments which can be specified during pytest invocation. They are explained here Pytest command-line arguments added by TyphoonTest.

typhoon.test.capture Package

This package contains higher-level, simpler versions of functions already released HIL API.

Functions

get_capture_results([wait_capture])

Return capture results as a Pandas DataFrame.

merge_dataframes(left, right[, ...])

Merge two DataFrame objects with a database-style join.

read(name[, avg_reads])

Reads asynchronously a signal once (one time poll).

read_cff(file_path)

Reads cff file exported from typhoon capture.

read_csv(file_path)

Reads csv file exported from typhoon capture.

read_hdf(file_path)

Reads hdf file exported from typhoon capture.

read_mat(file_path)

Reads mat file exported from typhoon capture.

read_mdf(file_path)

Reads mdf file exported from typhoon capture.

read_tdms(file_path)

Reads tdms file exported from typhoon capture.

start_capture(duration[, offset_absolute, ...])

Sets up capture settings and start capture.

wait(secs)

Waits a defined amount of seconds.

wait_capture_finish([sleep])

Blocks until capture stops.

wait_until(name, region, value[, ...])

Waits until signal meets specified conditions.

typhoon.test.sources Package

This package contains high-level functions for dealing with power sources.

Functions

change_grid(gridname[, rms, frequency, phase])

Change grid characteristics.

get_phasor_3ph(gridsimname)

Reads a Phasor3ph out of the chosen GridSimulator.

get_pv_mpp(panel)

Get maximum power point information from a PV panel.

grid_fault(sources, fault_duration[, ...])

Generic function for creating grid faults.

typhoon.test.signals Package

This package contains high-level functions to analyze desired characteristics from time series signals.

Functions

assert_analysis(result, expectation)

Assertion helper for AnalysisResult objects, printing the result message in the AssertionError if raised.

assert_follows_reference(signal, ref_signal, tol)

Assertion helper for follows_reference function.

assert_is_constant(signal, at_value[, ...])

Assertion helper for is_constant function.

assert_is_first_order(signal, time_constant, ...)

Assertion helper for is_first_order function.

assert_is_ramp(signal, slope, tol[, during, ...])

Assertion helper for is_ramp function.

assert_is_step(signal, from_value, to_value, ...)

Assertion helper for is_step function.

find(signal, region, value[, from_region, ...])

Like the function typhoon.test.signals.find_all, it finds the desired characteristic on the signal.

find_all(signal, region, value[, ...])

Finds a desired characteristic on a signal.

find_edges(signal, value[, rising, falling, ...])

Find edges around a given value in a signal.

follows_reference(signal, ref_signal, tol[, ...])

Checks if signal follows a reference signal within given tolerances.

is_constant(signal, at_value[, during, ...])

Checks if signal is always inside defined range.

is_first_order(signal, time_constant, ...[, ...])

Checks if signal represents first order response.

is_ramp(signal, slope, tol[, during, ...])

Checks if signal is a ramp with desired slope.

is_step(signal, from_value, to_value, at_t)

Checks if signal is a step with specified characteristics.

pandas_3ph_sine([amplitude, frequency, ...])

Generates a pandas DataFrame with a set of three balanced sine waves with given characteristics.

pandas_first_order(tau, init, final[, ...])

Generates pandas Series as the first order response signal with given characteristics.

pandas_sine([amplitude, frequency, ...])

Generates a pandas Series with a sine wave with given characteristics.

stepinfo(signal[, settling_time_threshold, ...])

Calculates important step characteristics of a given signal: rise time, settling time, overshoot, and others.

typhoon.test.signals.filtering Package

This package contains function relevant to signal filtering

Functions

band_pass_filter(input_signal, N, Wn[, ...])

Wrapper around 'scipy.signal <https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.butter.html>' function that represents Butterworth digital and analog filter design.

band_stop_filter(input_signal, N, Wn[, ...])

Wrapper around 'scipy.signal <https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.butter.html>' function that represents Butterworth digital and analog filter design.

high_pass_filter(input_signal, N, Wn[, ...])

Wrapper around 'scipy.signal <https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.butter.html>' function that represents Butterworth digital and analog filter design.

low_pass_filter(input_signal, N, Wn[, ...])

Wrapper around 'scipy.signal <https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.butter.html>' function that represents Butterworth digital and analog filter design.

moving_average(signal, window_length[, ...])

Calculates average value of the provided signal by using moving window technique, similar to 'typhoon.test.rms.window_rms' function.

typhoon.test.signals.control Package

This module contains basic control blocks implementations

Functions

integrator(input, initial_value[, ...])

Integrates provided input signal.

signal_frequency_SOGI_pll(input, ...[, ...])

Measures the frequency of the signal using a SOGI PLL algorithm.

typhoon.test.ranges Module

This module contains useful shorthand functions for defining ranges (value and temporal), to better comunicate intent when writing test functions. Is to be typically used in the arguments of timeseries analysis functions (is_step, etc).

Check each function for usage examples.

Functions

after(t)

Defines a time range from t to latest possible value.

around(val[, tol, tol_p])

Defines range as a center value with a tolerance around it.

before(t)

Defines time range from earliest possible up to t.

typhoon.test.harmonic Package

This package contains functions for frequency-domain operations and transformations.

Functions

frequency_content(signal, max_frequency[, ...])

Calculates the list of harmonic components for a signal using FFT.

signal_frequency_zc(signal[, during, mode])

Calculates frequency of the signal.

thd(signal, fundamental, max_harmonic[, ...])

Calculates signal THD

Classes

FFTResult(signal, fft, freqs)

Result of frequency_content analysis.

typhoon.test.IEC61000 Package

This package contains measurement functions according to the IEC 61000 standard.

Functions

flickermeter(samples, reference_voltage, ...)

This is a digital flickermeter based on 61000-4-30 standard.

frequency(samples)

This method calculates the frequency of the grid voltage.

harmonic_content(samples, nominal_grid_freq, ...)

This method measures harmonics, interharmonics, and total harmonic distortion according to IEC 61000-4-7.

power_quantities(voltage_samples, ...[, ...])

This method measures power quantities in single-phase systems under non-sinusoidal conditions (general case) according to IEC 61000-1-7.

power_quantities_three_phase(...[, ...])

This method measures power quantities in Three-phase systems under non-sinusoidal conditions (general case) according to IEEE Std 1459-2010.

rms(samples, nominal_grid_freq[, ...])

Measures the root-mean-square (RMS) value for input samples according to the IEC 61000-4-30 standard.

sym_comp_voltage_unbalance(samples, ...[, ...])

Measures the Symmetrical components and Voltage Unbalance according to IEEE Std 1159-2019.

typhoon.test.rms Package

Functions

window_rms(signal[, window_length, ...])

Calculates RMS value of the signal using sliding window technique.

typhoon.test.power Package

This package is used for different electric power calculations.

Functions

three_phase_power(voltages, currents[, ...])

Calculates three phase power for three-phase systems with both three and four wires.

typhoon.test.transformations Package

Functions

abc_to_alphabetagamma(signals[, method, ...])

Calculates abc to alpha-beta-gamma trasformation, also known as Clarke's transformation.

abc_to_dq0(signals, theta[, method, alignment])

Implements abc_to_dq0 transformation, also known as Park trasformation.

abc_to_symmetrical_components(signals[, method])

Implements the Symmetrical transformation, also known as Fortescue transform.

alphabetagamma_to_abc(signals[, method, ...])

Calculates alpha-beta-gamma to abc transformation, also known as Clarke's inverse transformation.

alphabetagamma_to_dq0(signals, theta[, ...])

Implements the alpha-beta-gamma to dq0 transformation, also known as Clarke to Park angle transform.

complete_symmetrical_components(V0, V1, V2)

Calculates three three-phase "abc" sets from symmetrical components.

dq0_to_abc(signals, theta[, method, alignment])

Implements the dq0_to_abc transformation, also known as inverse Park transformation.

dq0_to_alphabetagamma(signals, theta[, ...])

Implements dq0 to alpha-beta-gamma angle transform, also known as Park to Clarke angle transform.

inv_symmetrical_components(V0, V1, V2)

Calculates the a, b and c phasors from symmetrical components.

symmetrical_components(Va, Vb, Vc)

Calculates symmetrical values abc phasors.

symmetrical_components_to_abc(signals[, method])

Implements the Inverse Symmetrical Transformation to abc coordinates.

typhoon.types.phasors Module

Classes

Phasor([number, mag, angle])

Class implement Phasors, which subclass complex numbers but adds:

Phasors3ph(phasor1, phasor2, phasor3[, ...])

Creates a Phasors3ph tuple.

typhoon.test.reporting.tables Package

This package contains functions used for attaching different types of html tables to allure report.

Functions

attach_table(df[, allure_title, caption, ...])

Adds HTML table with a simple CSS configuration to allure report. This type of table can be used to show:

attach_table_custom_colormap(df, threshold)

Adds HTML table with a specific colormap applied in the table's background to the allure report.

attach_table_custom_colormap_by_column(df, ...)

Adds html table to allure report in the same way as the attach_table_custom_colormap with only difference that the threshold value is unique for each column; the user can repeat the threshold values, but threshold value is needed for every column.

text_style(paragraph[, bold, italic, color])

Set a string to be a paragraph with specifics HTML tags.

typhoon.test.reporting.messages Package

This python package deals with logging of report messages to report, and with report organization in general.

Functions

report_message(message)

Logs message to the allure report.

report_step(message)

Adds message in allure report, like typhoon.test.reporting.messages.report_message function, but, in contrast to it, this function should be used to organize more functions and report messages in one logical group.

typhoon.test.reporting.figures Package

This packages contains functions for attachment of matplotlib figures to allure reports

Functions

attach_figure(dataframe_list, attachment_name)

Adds matplotlib figure of provided signals in the allure report as .png image attachment.

typhoon.types.timedelta Module

Classes

Timedelta(*args, **kwargs)

Represents a duration, the difference between two dates or times.

Pytest command-line arguments added by TyphoonTest

TyphoonTest plugin for pytest provides several command-line arguments for test run:

Allure report operations

  1. --open-allure - Automatically opens allure-report after test run, if specified;

  2. --remove-capture-plots - Remove allure plot attachments from typhoon.test.capture.get_capture_results function. This is good way to reduce allure report size

  3. --analysis-plot-type - Select which plot to add to the allure report for typhoontest analysis functions for whole test run. Supported functions:

    1. typhoon.test.signals.is_step,

    2. typhoon.test.signals.is_constant,

    3. typhoon.test.signals.is_ramp,

    4. typhoon.test.signals.is_first_order,

    5. typhoon.test.signals.follows_reference

    • There are 4 possible options:

      1. none - no plot will be attached

      2. static - matplotlib plot saved as .png image is attached. This is smaller in size, but there are no option for any kind of interaction with the image

      3. interactive - plot saved as html file with options to interact with signals on the plot. Much more suitable for debugging failing tests

      4. all - all of the supported plots are attached

    • The specified option applies for whole test run, but it can be overridden individually for every function call: report_plot dictionary and its key type is used for that.

  4. --analysis-plot-on-fail-only - Specifies if report plot of type specified with previous argument is plotted always or on fail only. If specified, plot is attached only when test fails. The specified option applies for whole test run, but it can be overridden individually for every function call: report_plot dictionary and its key when is used for that.

  5. --keep-history - Keeps result history from previous test sessions and adds a results history graph to the Allure report

  6. --env-params - Represents path of JSON file where additional environment parameters are located. File is loaded before the execution of the first test.

PDF reporting (beta features)

  1. --generate-pdf - If specified, pdf containing results of test session extracted from Allure report is generated at the end of test session.

  2. --pdf-path - Presents custom path of generated pdf report. If not specified, the pdf report is generated inside working directory with name {timestamp}_report.pdf.

  3. --pdf-title - Defines custom title on cover page in the pdf report. If not specified, default title name is Typhoon HIL Test session report.

  4. --pdf-title-color - Defines custom title color on cover page in the pdf report. If not specified, default title color is dark gray (hex value: #333333).

  5. --pdf-logo - Presents path of image that will be presented as custom logo on cover page in the pdf report. If not specified, default logo on the cover page is Typhoon HIL logo.

  6. --pdf-slogan - Presents custom slogan that will be presented next to the logo on cover page in pdf report. If not specified, default slogan Test. Design. Deploy. is shown on the cover page.

  7. --pdf-skip-trace - If specified, error traces of tests that failed or broke are omitted from the pdf report.

  8. --pdf-skip-steps - If specified, steps for each test case are omitted from the pdf report.

  9. --pdf-skip-plots - If specified, images containing plots are omitted from the pdf report.

Notice: Attaching HTML tables to PDF report requires Chrome/Chromium browser to be installed on device that is running test session. Otherwise, HTML tables are ignored.

HIL devices selection

  1. --vdev - Allows running tests on VHIL. Both –vdev and –vcfg need to be specified. E.g. –vdev=HIL402 –vcfg=1

  2. --vcfg - Defines VHIL configuration. Both –vdev and –vcfg need to be specified. E.g. –vdev=HIL402 –vcfg=1

  3. --ethdev - Allows defining the serial number of HILs on a network that is used for testing. E.g. –ethdev=”00604-00-00170, 00604-00-00171”

  4. --discovery-ip - Allows defining the IP addresses of HILs on a network. E.g. –discovery-ip=”192.168.0.xxx, 192.168.0.xxx”

  5. --fw - Allows defining the HIL firmware configuration. E.g. –fw=<cfg_number>

CSV Report Real-Time

  1. --simple-report - Generates a simplified report as a csv file. Supported values are: ‘all’, ‘setup’, ‘call’, ‘teardown’, ‘None’. E.g. –simple-report=all.

Miscellaneous options

  1. --gc-collect - Garbage collector is automatically called after each executed test.

Release Notes

Check the Release Notes of TyphoonTest API here: Release Notes

Indices and tables