CADETProcess.dynamicEvents.Section#

class CADETProcess.dynamicEvents.Section(coeffs)[source]#

Bases: Structure

Helper class to store parameter states between events.

Attributes:
startfloat

Start time of section

endfloat

End time of section.

coeffsint or float or array_like

Polynomial coefficients of state in order of increasing degree.

n_entriesint

Number of entries (e.g. components, output_states)

degreeint

Degree of polynomial to represent state.

Notes

if coeffs is int: Set constant value for for all entries if coeffs is list: Set value per component (check length!) if coeffs is ndarray (or list of lists): set polynomial coefficients

coefficients(offset: float = 0.0) ndarray[source]#

Get coefficients at (time) offset.

Parameters:
offsetfloat

(Time) offset to be evaluated.

Returns:
coeffsnp.ndarray

Coefficients at offset.

coeffs#

Dependently sized polynomial for n entries.

This descriptor represents a polynomial whose size or dimensions may depend on other instance attributes. The polynomial can also be thought of as a 2D array, where each row represents a polynomial of a certain degree.

Important: Use [entries x n_coeff] for dependencies.

Parameters:
n_entriesint, optional

Number of polynomials or rows. Default is None.

n_coeffint, optional

Number of coefficients for each polynomial or columns. Default is None.

Attributes:
sizetuple

The shape of the polynomial array, determined from n_entries and n_coeff.

Methods

fill_values(dims, value) -> np.ndarray:

Fills values to generate the polynomial matrix of the desired size.

_prepare(instance, value, recursive=False) -> np.ndarray:

Prepare the given polynomial matrix s.t. it adheres to the expected size.

Notes

Currently, NdPolynomial is implemented as SizedNdArray. Consequently, no default values can be set since their size would depend on the dependent variables. In theory, this could be split into NdPolynomial and SizedNdPolynomial, but there is currently no use for this distinction.

derivative(t: float, order: int | None = 1) ndarray[source]#

Return derivative of parameter section at time t.

Parameters:
tfloat

Time at which function is evaluated.

orderint, default=1

Order of deriviation. @TODO: Not yet implemented.

Returns:
y_dotfloat

Derivative of parameter state at time t.

Raises:
ValueError

If t is lower than start or larger than end of section time.

ValueError

If order is larger than polynomial degree

integral(start: float | None = None, end: float | None = None) ndarray[source]#

Return integral of function in interval [start, end].

Parameters:
startfloat, optional

Lower integration bound.

endfloat, optional

Upper integration bound.

Returns:
Ynp.ndarray

Value of definite integral between start and end.

Raises:
ValueError

If integration bounds exceed section times.

property is_polynomial: bool#

bool: True if Section represents polynomial parameter. False otherwise.

property is_single_entry: bool#

bool: True if Section contains single entry. False otherwise.

property n_poly_coeffs: int#

int: Number of polynomial coefficients.

value(t: float) float[source]#

Return value of parameter section at time t.

Parameters:
tfloat

Time at which function is evaluated.

Returns:
yfloat

Value of parameter state at time t.

Raises:
ValueError

If t is lower than start or larger than end of section time.