Atomic Types#
ANDES contains three fundamental types of atom classes for building DAE models: parameters, variables, and services. These atom classes share common interfaces that enable interoperability and composability when defining model equations.
Value Provider (v-provider)#
A value provider class (or v-provider for short) is any class with a member
attribute named v, which should be a list or a 1-dimensional NumPy array of values.
The v attribute contains the numerical values that will be substituted into equations
during computation.
Note
All atom classes are v-providers. Every parameter, variable, and service instance
must contain values accessible through the v attribute.
How v-providers Work#
When you define parameters in a model:
self.v0 = NumParam(default=1.0, info='Initial voltage')
self.b = NumParam(default=10.0, info='Susceptance')
# At runtime, these might contain:
# self.v0.v = np.array([1.0, 1.05, 1.1])
# self.b.v = np.array([10., 10., 10.])
When these parameters are used in an equation string:
self.v = ExtAlgeb(model='Bus', src='v',
indexer=self.bus,
e_str='v0 ** 2 * b')
During equation evaluation, v0 and b are substituted with their respective
v arrays (self.v0.v and self.b.v). The symbolic expression v0 ** 2 * b
becomes a vectorized numerical computation.
Interoperability Through the v Interface#
The shared v interface enables seamless substitution between different atom types.
Consider this parameter definition:
self.v0 = NumParam(default=1.0)
You could replace it with a service that computes the value:
self.v0 = ConstService(v_str='1.0')
Equations using v0 continue to work without modification, because both
NumParam and ConstService provide values through the same v attribute.
This design pattern allows:
Parameters to be replaced by computed services
Services to reference other services or parameters
Variables to be used in place of parameters in equation strings
Equation Provider (e-provider)#
An equation provider class (or e-provider) is any class with a member
attribute named e, which should be a 1-dimensional array. The e array stores
equation evaluation results that are accumulated into the numerical DAE system
at addresses specified by the a attribute.
Note
Currently, only variables (differential and algebraic) are e-providers. Parameters and services provide values but do not contribute equations to the DAE.
How e-providers Work#
When you define an external variable that links to bus voltage:
self.v = ExtAlgeb(model='Bus', src='v',
indexer=self.bus,
e_str='v0 ** 2 * b')
Three things happen:
Address retrieval: The addresses of the corresponding voltage variables are retrieved into
self.v.aEquation evaluation: The expression
v0 ** 2 * bis evaluated and stored inself.v.eDAE assembly: Values in
self.v.eare summed into the system DAE array at the addresses inself.v.a
The v-e-a Triad for Variables#
Variables have three key attributes that work together:
Attribute |
Purpose |
Description |
|---|---|---|
|
Values |
Current values of the variable (solution) |
|
Equations |
Equation contributions (residuals) |
|
Addresses |
Indices into the system DAE arrays |
This triad enables the numerical integration scheme:
vholds the current state/algebraic values being solvedeaccumulates equation right-hand-sides from this modelaspecifies where in the global DAE this variable lives
Summary#
Atom Type |
v-provider |
e-provider |
Purpose |
|---|---|---|---|
Parameter |
Yes |
No |
Input data for models |
Service |
Yes |
No |
Intermediate calculations |
Variable |
Yes |
Yes |
DAE unknowns and equations |
The v-provider interface creates a uniform way to access values, enabling:
Symbolic equation processing that works with any value source
Easy substitution between parameters, services, and variables
Clean separation between data definition and equation evaluation
See Also#
Parameters - Parameter types and usage
Variables - Variable types and the v-e-a attributes
Services - Service types for intermediate calculations