HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
FPPowerSystem1BusFunctions.c
Go to the documentation of this file.
1 #include <math.h>
3 
4 double FPPowerSystem1BusDriftFunction(int dir,void *p,double x,double y, double t)
5 {
7 
8  double drift = 0;
9  if (dir == _XDIR_) {
10  drift = params->omegaB * (y - params->omegaS);
11  } else if (dir == _YDIR_) {
12  drift = (params->omegaS/(2*params->H))
13  * (params->Pm_avg - params->Pmax*sin(x) - params->D*(y-params->omegaS));
14  }
15 
16  return drift;
17 }
18 
19 double FPPowerSystem1BusDissipationFunction(int dir1,int dir2,void *p,double t)
20 {
21  FPPowerSystem1Bus *params = (FPPowerSystem1Bus*) p;
22 
23  double sigma = params->sigma;
24  double omegaS = params->omegaS;
25  double omegaB = params->omegaB;
26  double lambda = params->lambda;
27  double H = params->H;
28  double D = params->D;
29 
30  double dissp = 0;
31  if (dir1 == _YDIR_) {
32 
33  double term = (sigma*sigma*omegaS*omegaS) / (4.0*H*H);
34  double expterm = exp(-t/lambda);
35 
36  if (dir2 == _XDIR_) {
37  dissp = term * (lambda*omegaB) * (lambda*(1-expterm) - t*expterm);
38  /* dissp = term * lambda*omegaB*lambda; */
39  } else if (dir2 == _YDIR_) {
40  double gamma = D*omegaS / (2.0*H);
41  dissp = term * (lambda*(1-expterm) + (gamma*lambda*(t*expterm-lambda*(1-expterm))) );
42  /* dissp = term * params->lambda * (1 - params->lambda*gamma); */
43  }
44 
45  }
46 
47  return(dissp);
48 }
#define _YDIR_
Definition: euler2d.h:41
#define drift(x)
Definition: fpdoublewell.h:31
double FPPowerSystem1BusDissipationFunction(int, int, void *, double)
double FPPowerSystem1BusDriftFunction(int, void *, double, double, double)
Fokker-Planck Model for 1-Bus Power System.
#define _XDIR_
Definition: euler1d.h:75