From GridLAB-D Wiki
ETP Solver - Equivalent Thermal Parameters solver Template:NEW30
Synopsis
glsolver("etp") throw(const char*);
Description
The data structure for the ETP solver is as follows:
struct etp { double t; // the time solution to the ETP equation double a; // the a parameter double n; // the n parameter double b; // the b parameter double m; // the m parameter double c; // the c parameter double p; // the precision of the solution double *e; // the pointer to the error estimate };
To use the ETP solver in a module, you must define the macro USE_GLSOLVERS in each source file that will makes solver call, including the init.cpp file (which loads and initializes the solver):
#define USE_GLSOLVERS #include "gridlabd.h"
When the module is initialized, you must load the ETP solver (which will automatically initialize it).
glsolver *etp_solver; EXPORT CLASS *init(CALLBACKS *fntable, MODULE *module, int argc, char *argv[]) { if ( set_callback(fntable)==NULL ) return NULL; etp_solver = new glsolver("etp"); // ... return first_class; }
To set/get parameters for the ETP solver, use the set/get calls:
int iteration_limit; if ( etp_solver->get("max_iterations",&iteration_limit,NULL)==0 ) gl_error("unable to get iteration limit"); if ( etp_solver->set("max_iterations",iteration_limit,NULL)==0 ) gl_error("unable to set iteration limit");
To call the ETP solver, you must construct the ETP data structure required by the solver. For example:
struct { double t,a,n,b,m,c,p,*e; } etp = {0,0.1,-0.1,0.2,-0.2,0.3,1e-6,NULL}; if ( etp_solver->solve((void*)&etp)==0 || isnan(t) ) gl_error("no solution found");
max_iterations
- Use this set/get parameter to control the maximum number of iterations used by the solver.
Version
The general solvers library was introduced in Hassayampa (Version 3.0).