class andes.core.model.ModelData(*args, three_params=True, **kwargs)[source]#

Class for holding parameter data for a model.

This class is designed to hold the parameter data separately from model equations. Models should inherit this class to define the parameters from input files.

Inherit this class to create the specific class for holding input parameters for a new model. The recommended name for the derived class is the model name with Data. For example, data for GENROU should be named GENROUData.

Parameters should be defined in the __init__ function of the derived class.

Refer to andes.core.param for available parameter types.


Three default parameters are pre-defined in ModelData and will be inherited by all models. They are

In rare cases one does not want to define these three parameters, one can pass three_params=True to the constructor of ModelData.


If we want to build a class PQData (for static PQ load) with three parameters, Vn, p0 and q0, we can use the following

from andes.core.model import ModelData, Model
from andes.core.param import IdxParam, NumParam

class PQData(ModelData):
    self.Vn = NumParam(default=110,
                       info="AC voltage rating",
                       unit='kV', non_zero=True,
    self.p0 = NumParam(default=0,
                       info='active power load in system base',
                       tex_name=r'p_0', unit='p.u.')
    self.q0 = NumParam(default=0,
                       info='reactive power load in system base',
                       tex_name=r'q_0', unit='p.u.')

In this example, all the three parameters are defined as andes.core.param.NumParam. In the full PQData class, other types of parameters also exist. For example, to store the idx of owner, PQData uses

self.owner = IdxParam(model='Owner', info="owner idx")

A cache instance for different views of the internal data.


Flags to control the routine and functions that get called. If the model is using user-defined numerical calls, set f_num, g_num and j_num properly.

__init__(*args, three_params=True, **kwargs)[source]#



Add a device (an instance) to this model.


Export all parameters as a pandas.DataFrame object.


Export local variable values and services to a DataFrame.


Export all parameters as a dict.

find_idx(keys, values[, allow_none, default])

Find idx of devices whose values match the given pattern.


Find params with the given property and return in an OrderedDict.

update_from_df(df[, vin])

Update parameter values from a DataFrame.