andes.core.param.BaseParam#

class andes.core.param.BaseParam(default: float | str | int | None = None, name: str | None = None, tex_name: str | None = None, info: str | None = None, unit: str | None = None, mandatory: bool = False, export: bool = True, iconvert: Callable | None = None, oconvert: Callable | None = None)[source]#

The base parameter class.

This class provides the basic data structure and interfaces for all types of parameters. Parameters are from input files and in general constant once initialized.

Subclasses should overload the n() method for the total count of elements in the value array.

Parameters:
defaultstr or float, optional

The default value of this parameter if None is provided

namestr, optional

Parameter name. If not provided, it will be automatically set to the attribute name defined in the owner model.

tex_namestr, optional

LaTeX-formatted parameter name. If not provided, tex_name will be assigned the same as name.

infostr, optional

Descriptive information of parameter

mandatorybool

True if this parameter is mandatory

exportbool

True if the parameter will be exported when dumping data into files. True for most parameters. False for BackRef.

Other Parameters:
iconvertCallable

Converter to be applied to input data when a device is being added.

oconvertcallable

Converter to be applied to internal data when outputting.

Warning

The most distinct feature of BaseParam, DataParam and IdxParam is that values are stored in a list without conversion to array. BaseParam, DataParam or IdxParam are not allowed in equations.

Attributes:
vlist

A list holding all the values. The BaseParam class does not convert the v attribute into NumPy arrays.

propertydict

A dict containing the truth values of the model properties.

__init__(default: float | str | int | None = None, name: str | None = None, tex_name: str | None = None, info: str | None = None, unit: str | None = None, mandatory: bool = False, export: bool = True, iconvert: Callable | None = None, oconvert: Callable | None = None)[source]#

Methods

add([value])

Add a new parameter value (from a new device of the owner model) to the v list.

get_names()

Return self.name in a list.

get_property(property_name)

Check the boolean value of the given property.

set(pos, attr, value)

Set attributes of the BaseParam class to new values at the given positions.

set_all(attr, value)

Set attributes of the BaseParam class to new values for all positions.

Attributes

class_name

Return the class name.

n

Return the count of elements in the value array.