HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
fppowersystem1bus.h File Reference

Fokker-Planck Model for 1-Bus Power System. More...

Go to the source code of this file.

Data Structures

struct  FPPowerSystem1Bus
 

Macros

#define _FP_POWER_SYSTEM_1BUS_   "fp-power-system-1bus"
 
#define _MODEL_NDIMS_   2
 
#define _MODEL_NVARS_   1
 
#define _XDIR_   0
 
#define _YDIR_   1
 

Functions

int FPPowerSystem1BusInitialize (void *, void *)
 
int FPPowerSystem1BusCleanup (void *)
 

Detailed Description

Fokker-Planck Model for 1-Bus Power System.

Author
Debojyoti Ghosh

Fokker-Planck Model for 1-Bus Power System

\begin{equation} \frac {\partial p} {\partial t} + \frac {\partial} {\partial x} \left[\mu\left(x,y\right)p\right] + \frac {\partial} {\partial y} \left[\nu\left(x,y\right)p\right] = D_{yx} \frac {\partial^2 p} {\partial y \partial x} + D_{yy} \frac {\partial^2 p} {\partial y^2} \end{equation}

where

\begin{eqnarray} \mu\left(x,y\right) &=& \omega_B\left(y-\omega_S\right) \\ \nu\left(x,y\right) &=& \frac{\omega_S}{2H}\left[\left<P_m\right> - P_{\rm max} \sin\left(x\right) - D\left(y-\omega_S\right)\right] \\ D_{yx} &=& \frac {\sigma^2\omega_S^2} {4H^2} \lambda^2 \omega_B \\ D_{yy} &=& \frac {\sigma^2 \omega_S^2} {4H^2} \lambda \left( 1 - \lambda \frac {D \omega_S} {2H} \right) \end{eqnarray}

Symbol Name --------------------—
\(p\) probability
\(x\) angle between axis of generator and the magnetic field ( \(\theta\) in paper)
\(y\) generator angular speed ( \(\omega\) in paper)
\(t\) time
\(\omega_B\) base speed
\(\omega_S\) synchronization speed
\(H\) generator inertia
\(D\) damping factor
\(\left<P_m\right>\) average power input
\(P_{\rm max}\) maximum power
\(\sigma\) square root of variance
\(\lambda\) correlation time

Reference:

  • Wang, P., Barajas-Solano, D. A., Constantinescu, E. M., Abhyankar, S., Ghosh, D., Smith, B. F., Huang, Z., Tartakovsky, A. M., "Probabilistic Density Function Method for Stochastic ODEs of Power Systems with Uncertain Power Input", SIAM/ASA Journal on Uncertainty Quantification, 3 (1), 2015, pp. 873-896, http://dx.doi.org/10.1137/130940050.

Definition in file fppowersystem1bus.h.


Data Structure Documentation

◆ FPPowerSystem1Bus

struct FPPowerSystem1Bus

Definition at line 80 of file fppowersystem1bus.h.

Data Fields
double omegaB
double omegaS
double H
double D
double Pm_avg
double Pmax
double sigma
double lambda
double pdf_integral

Macro Definition Documentation

◆ _FP_POWER_SYSTEM_1BUS_

#define _FP_POWER_SYSTEM_1BUS_   "fp-power-system-1bus"

Definition at line 68 of file fppowersystem1bus.h.

◆ _MODEL_NDIMS_

#define _MODEL_NDIMS_   2

Definition at line 73 of file fppowersystem1bus.h.

◆ _MODEL_NVARS_

#define _MODEL_NVARS_   1

Definition at line 74 of file fppowersystem1bus.h.

◆ _XDIR_

#define _XDIR_   0

Definition at line 77 of file fppowersystem1bus.h.

◆ _YDIR_

#define _YDIR_   1

Definition at line 78 of file fppowersystem1bus.h.

Function Documentation

◆ FPPowerSystem1BusInitialize()

int FPPowerSystem1BusInitialize ( void *  ,
void *   
)

Definition at line 21 of file FPPowerSystem1BusInitialize.c.

22 {
23  HyPar *solver = (HyPar*) s;
24  MPIVariables *mpi = (MPIVariables*) m;
25  FPPowerSystem1Bus *physics = (FPPowerSystem1Bus*) solver->physics;
26  int ferr;
28 
29  static int count = 0;
30 
31  if (solver->nvars != _MODEL_NVARS_) {
32  fprintf(stderr,"Error in FPPowerSystem1BusInitialize(): nvars has to be %d.\n",_MODEL_NVARS_);
33  return(1);
34  }
35  if (solver->ndims != _MODEL_NDIMS_) {
36  fprintf(stderr,"Error in FPPowerSystem1BusInitialize(): ndims has to be %d.\n",_MODEL_NDIMS_);
37  return(1);
38  }
39 
40  /* default values of model parameters */
41  physics->omegaS = 1.0;
42  physics->omegaB = 120 * (4.0 * atan(1.0));
43  physics->H = 5.0;
44  physics->D = 5.0;
45  physics->Pm_avg = 0.9;
46  physics->Pmax = 2.1;
47  physics->sigma = 0.2;
48  physics->lambda = 100.0 / physics->omegaB;
49 
50  /* reading physical model specific inputs */
51  if (!mpi->rank) {
52  FILE *in;
53  if (!count) printf("Reading physical model inputs from file \"physics.inp\".\n");
54  in = fopen("physics.inp","r");
55  if (!in) printf("Warning: File \"physics.inp\" not found. Using default values.\n");
56  else {
57  char word[_MAX_STRING_SIZE_];
58  ferr = fscanf(in,"%s",word); if (ferr != 1) return(1);
59  if (!strcmp(word, "begin")){
60  while (strcmp(word, "end")){
61  ferr = fscanf(in,"%s",word); if (ferr != 1) return(1);
62  if (!strcmp(word, "omegaS")) {ferr=fscanf(in,"%lf",&physics->omegaS);if(ferr!=1)return(1);}
63  else if (!strcmp(word, "omegaB")) {ferr=fscanf(in,"%lf",&physics->omegaB);if(ferr!=1)return(1);}
64  else if (!strcmp(word, "H" )) {ferr=fscanf(in,"%lf",&physics->H );if(ferr!=1)return(1);}
65  else if (!strcmp(word, "D" )) {ferr=fscanf(in,"%lf",&physics->D );if(ferr!=1)return(1);}
66  else if (!strcmp(word, "Pm_avg")) {ferr=fscanf(in,"%lf",&physics->Pm_avg);if(ferr!=1)return(1);}
67  else if (!strcmp(word, "Pmax" )) {ferr=fscanf(in,"%lf",&physics->Pmax );if(ferr!=1)return(1);}
68  else if (!strcmp(word, "sigma" )) {ferr=fscanf(in,"%lf",&physics->sigma );if(ferr!=1)return(1);}
69  else if (!strcmp(word, "lambda")) {ferr=fscanf(in,"%lf",&physics->lambda);if(ferr!=1)return(1);}
70  }
71  } else {
72  fprintf(stderr,"Error: Illegal format in file \"physics.inp\".\n");
73  return(1);
74  }
75  }
76  fclose(in);
77  }
78 
79 #ifndef serial
80  IERR MPIBroadcast_double(&physics->omegaS,1,0,&mpi->world); CHECKERR(ierr);
81  IERR MPIBroadcast_double(&physics->omegaB,1,0,&mpi->world); CHECKERR(ierr);
82  IERR MPIBroadcast_double(&physics->H ,1,0,&mpi->world); CHECKERR(ierr);
83  IERR MPIBroadcast_double(&physics->D ,1,0,&mpi->world); CHECKERR(ierr);
84  IERR MPIBroadcast_double(&physics->Pm_avg,1,0,&mpi->world); CHECKERR(ierr);
85  IERR MPIBroadcast_double(&physics->Pmax ,1,0,&mpi->world); CHECKERR(ierr);
86  IERR MPIBroadcast_double(&physics->sigma ,1,0,&mpi->world); CHECKERR(ierr);
87  IERR MPIBroadcast_double(&physics->lambda,1,0,&mpi->world); CHECKERR(ierr);
88 #endif
89 
90  if (!strcmp(solver->SplitHyperbolicFlux,"yes")) {
91  if (!mpi->rank) {
92  fprintf(stderr,"Error in FPPowerSystem1BusInitialize: This physical model does not have a splitting ");
93  fprintf(stderr,"of the hyperbolic term defined.\n");
94  }
95  return(1);
96  }
97 
98  /* initializing physical model-specific functions */
107 
108  /* check that solver is using the correct diffusion formulation */
109 /*
110  if ((strcmp(solver->spatial_type_par,_NC_2STAGE_)) && (strcmp(solver->spatial_type_par,_NC_1_5STAGE_))) {
111  if (!mpi->rank) {
112  fprintf(stderr,"Error in FPPowerSystem1BusInitialize(): Parabolic term spatial discretization must be ");
113  fprintf(stderr,"\"%s\" or \"%s\".\n",_NC_2STAGE_,_NC_1_5STAGE_);
114  }
115  return(1);
116  }
117 */
118 
119  count++;
120  return(0);
121 }
int(* PrintStep)(void *, void *, double)
Definition: hypar.h:344
int(* GFunction)(double *, double *, int, void *, double)
Definition: hypar.h:310
int nvars
Definition: hypar.h:29
#define IERR
Definition: basic.h:16
#define CHECKERR(ierr)
Definition: basic.h:18
int FPPowerSystem1BusUpwind(double *, double *, double *, double *, double *, double *, int, void *, double)
char SplitHyperbolicFlux[_MAX_STRING_SIZE_]
Definition: hypar.h:92
double FPPowerSystem1BusComputeDiffNumber(void *, void *, double, double)
int FPPowerSystem1BusPostStep(double *, void *, void *, double, int)
int(* HFunction)(double *, double *, int, int, void *, double)
Definition: hypar.h:313
int FPPowerSystem1BusDiffusionLaplacian(double *, double *, int, void *, double)
int(* Upwind)(double *, double *, double *, double *, double *, double *, int, void *, double)
Definition: hypar.h:295
int ndims
Definition: hypar.h:26
int(* FFunction)(double *, double *, int, void *, double)
Definition: hypar.h:276
int FPPowerSystem1BusDiffusionGeneral(double *, double *, int, int, void *, double)
int MPIBroadcast_double(double *, int, int, void *)
Definition: MPIBroadcast.c:9
double(* ComputeCFL)(void *, void *, double, double)
Definition: hypar.h:269
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
#define _MAX_STRING_SIZE_
Definition: basic.h:14
#define _MODEL_NDIMS_
Definition: euler1d.h:56
MPI_Comm world
int FPPowerSystem1BusPrintStep(void *, void *, double)
double(* ComputeDiffNumber)(void *, void *, double, double)
Definition: hypar.h:272
int(* PostStep)(double *, void *, void *, double, int)
Definition: hypar.h:341
void * physics
Definition: hypar.h:266
int FPPowerSystem1BusAdvection(double *, double *, int, void *, double)
Structure of MPI-related variables.
#define _MODEL_NVARS_
Definition: euler1d.h:58
#define _DECLARE_IERR_
Definition: basic.h:17
double FPPowerSystem1BusComputeCFL(void *, void *, double, double)

◆ FPPowerSystem1BusCleanup()

int FPPowerSystem1BusCleanup ( void *  )

Definition at line 4 of file FPPowerSystem1BusCleanup.c.

5 {
6  return(0);
7 }