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 now that Test Executor is superseded by 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 TyphoonTest also can run old Test Executor tests. Please refer to running-test-executor.

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, alias])

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, ...])

Change grid characteristics.

get_phasor_3ph(gridsimname[, alias])

Reads a Phasor3ph out of the chosen GridSimulator.

get_pv_mpp(panel[, alias])

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.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.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.

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.

typhoon.types.phasors Module

Classes

Phasor([number, mag, angle, alias])

Class implement Phasors, which subclass complex numbers but adds:

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

Creates a Phasor3ph 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: - Numbers - Strings - HTML Paragraph code (See typhoon.test.reporting.tables.text_style function).

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.

Pytest command-line arguments added by TyphoonTest

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

  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.

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.

Indices and tables