You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
1.9 KiB
69 lines
1.9 KiB
//VerilogA for amp,soa,veriloga
|
|
|
|
`include "constants.vams"
|
|
`include "disciplines.vams"
|
|
|
|
module soa(Ipow,Iphase,Ilam,Opow,Ophase,Olam,Vinj,Gnd);
|
|
parameter real length = 500e-6 from (0:1e-3];
|
|
parameter real width = 3e-6 from (0:50e-6];
|
|
parameter real height = 80e-9 from (0:5e-6];
|
|
parameter real gamma = 0.15 from (0:1];
|
|
parameter real alpha_s = 4000 from (0:5e4];
|
|
parameter real dg = 2.78e-20 from (0:50e-20];
|
|
parameter real Ntr = 1.4e24 from (0:5e25];
|
|
parameter real alpha = 5.0 from [-20:20];
|
|
parameter real A = 1.43e8 from [0:1e11];
|
|
parameter real B = 1e-16 from (0:1e-13];
|
|
parameter real C = 3e-41 from (0:1e-37];
|
|
|
|
input Ipow,Iphase,Ilam,Vinj;
|
|
output Opow,Ophase,Olam;
|
|
inout Gnd;
|
|
electrical Ipow,Iphase,Ilam,Vinj,Opow,Ophase,Olam,Gnd;
|
|
electrical Na;
|
|
|
|
real eir,eii,soar,soai,eor,eoi;
|
|
real E_in,ph_in;
|
|
real g,gtot,Pav,N;
|
|
real Vsoa;
|
|
real freq;
|
|
|
|
branch(Gnd,Na) Iin;
|
|
branch(Na,Gnd) C1,Ra,Ib,Ic,Iav;
|
|
|
|
analog initial begin
|
|
N=3e24;
|
|
end
|
|
|
|
analog begin
|
|
freq=`P_C/V(Ilam);
|
|
Vsoa=length*width*height;
|
|
|
|
N=V(Na)/(`P_Q*Vsoa);
|
|
g=dg*(N-Ntr);
|
|
gtot=gamma*g-alpha_s;
|
|
Pav=V(Ipow)*(exp(gtot*length)-1)/(gtot*length);
|
|
|
|
I(Iin) <+ I(Vinj);
|
|
I(C1) <+ ddt(V(C1));
|
|
I(Ra) <+ A*V(Ra);
|
|
I(Ib) <+ `P_Q*Vsoa*B*pow(N,2);
|
|
I(Ic) <+ `P_Q*Vsoa*C*pow(N,3);
|
|
I(Iav) <+ `P_Q*gamma*g*Pav*length/(`P_H*freq);
|
|
|
|
E_in=sqrt(V(Ipow));
|
|
ph_in=V(Iphase)/360*2*`M_PI;
|
|
eir=E_in*cos(ph_in);
|
|
eii=E_in*sin(ph_in);
|
|
soar=exp((gamma*g*length-alpha_s*length)/2)*cos(alpha*gamma*g*length/2);
|
|
soai=exp((gamma*g*length-alpha_s*length)/2)*sin(alpha*gamma*g*length/2);
|
|
eor=soar*eir-soai*eii;
|
|
eoi=soai*eir+soar*eii;
|
|
|
|
V(Opow) <+ eor**2+eoi**2;
|
|
V(Ophase) <+ atan2(eoi,eor)*360/(2*`M_PI);
|
|
V(Olam) <+ V(Ilam);
|
|
end
|
|
|
|
|
|
endmodule
|
|
|