1 /*****************************************************************************/
2 /* 8888888 88888888 88888888 */
5 /* 8 88888888 88888888 */
8 /* 888888 888888888 888888888 */
10 /* A Two-Dimensional General Purpose Semiconductor Simulator. */
13 /* Last update: Nov 29, 2005 */
17 /* NINT, No.69 P.O.Box, Xi'an City, China */
19 /*****************************************************************************/
20 //sevel types of light source are defined here
21 //reference: spice vsource model
30 enum LSOURCE_CARD_ERROR
33 LSOURCE_UNKNOW_PARAMETER
40 virtual double currentft(double t
)=0;
45 class LSource_UNIFORM
: public LSource
51 LSource_UNIFORM(double t1
,double p1
): td(t1
), power(p1
){};
52 double currentft(double t
)
53 { return t
>=td
? power
:0;};
57 class LSource_PULSE
: public LSource
65 double powerlo
,powerhi
;
67 LSource_PULSE(double t1
,double t2
,double t3
,double t4
, double t5
,double plo
,double phi
):
68 td(t1
),tr(t2
),tf(t3
),pw(t4
),pr(t5
),powerlo(plo
),powerhi(phi
){};
69 double currentft(double t
)
78 return powerlo
+t
*(powerhi
-powerlo
)/tr
;
82 return powerhi
-(t
-tr
-pw
)*(powerhi
-powerlo
)/tf
;
89 //just for single pulse
90 class LSource_GAUSSIAN
: public LSource
97 LSource_GAUSSIAN(double t1
,double t2
,double p1
):
98 tp(t1
),tb(t2
),power(p1
){};
99 double currentft(double t
)
101 return power
*2*exp(-(t
-tp
)*(t
-tp
)/tb
)/(tb
*sqrt(PI
)*erfc(tp
/tb
));
107 class LSource_SHELL
: public LSource
111 double (*Lsource_Shell
)(double);
114 LSource_SHELL(void * dp
, void * fp
, double s_t
)
117 Lsource_Shell
= (double (*)(double)) fp
;
120 double currentft(double t
)
122 return Lsource_Shell(t
/scale_t
);
124 ~LSource_SHELL() {dlclose(dll
);}