Scripts and User Functions Center

User function to build a corrugated horn antenna that depends on working frequencies and gain

The following function generates a corrugated horn antenna.

The input parameters are the minimum and maximum operating frequencies, the aperture diameter, and the flare angle. The result is a script that generates a horn that operates between the frequencies set with the desired gain.

The user can also change the horn profile type. The function has 7 different profiles, although the user can establish their own profiles. The variables to take into account are:

Profile_index: defines the type of profile to be used from among the following available:

1 - linear profile

2 - sinusoid profile

3 - tangential profile

4 - x^rho profile

5 - exponential profile

6 - hyperbolic profile

7 - polynomial profile

A: Between 0 (linear) and 1; it affects profiles 2,3 and 4 and establishes the degree of curvature that the profile will take

rho: Parameter affecting profiles 2,3,4 and 7; Typically it is worth 2 although it can take values between 0.5 and 5

Below are the graphs with which we can get the 'D' and 'alfa' parameters for the desired gain

Thumb gain Thumb gain2
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter; 

	// 'fmin' and 'fmax' are the lowest and the highest operating frequencies (GHz)
	// 'alfa' is the flare angle
	// 'D'  is the aperture diameter

void corrugated_horn_gain(double fmin, double fmax, double alfa, double D) {


	// Number of slots in the mode converter
	int Nmc = 5; // tipically between 5 and 7

	// Parameters that can be modified
	double Lg = 3.5; // Length of waveguide (x*lambda_fmin)
	double p = 0.125; // slot pitch -- usually chosen between lambda_c/10 (broadband) and lambda_c/5 (narrowband)
	double delta = 0.8; // Slot pitch-to-width ratio; normally between 0.7 and 0.9
	double d = 0.25; // Depth of the slots, normally lambda_c/4

	// Profile type parameters
	int profile_index = 1; // 1 - linear ; 2 - sinusoid ; 3 - tangential ; 4 - x^rho ; 5 - exponential ; 6 - hyperbolic ; 7 - polynomial
	double A = 0.9; // between 0 and 1; affects only 2,3 and 4 profiles
	double rho = 2; // usually between 0.5 and 5 but normally rho=2

// Name of generated script
	String ScriptName ="script_corrugated_horn_gain";
	

	double alfa_rad = (alfa*Math.PI)/(180);

	// Mode converter parameters
	double[] dj=new double[Nmc];
	double sigma = 0.5;
	double kcaj = 20;
	double k = Math.exp(1/(2.114*Math.pow(kcaj,1.134)));

	double fc = Math.sqrt(fmin*fmax); // Center frequency
	double f0 = 1.02*fc;
	double lambda_c  = 300/fc; // Center frequency wavelength
	double ai  = (3*lambda_c)/(2*PI); // input radius (mm)
	double ao  = (D*lambda_c)/2;  // output radius (mm) -- usually 1*lambda_c to 2.5*lambda_c
	p  = lambda_c*p; // slot pitch -- usually chosen between lambda_c/10 (broadband) and lambda_c/5 (narrowband)
	double w  = delta*p; // Slot width
	double a  = p-w; // Teeth width
	
	double l = ao/Math.sin(alfa_rad);
	double Lp = ai/(Math.tan(alfa_rad));
	double L = l*Math.cos(alfa_rad)-Lp;
	double N = Math.ceil(L/p+1); // Total number of slots
	Lg = Lg*(300/fmin); // Length of waveguide

	double[] az=new double[N+1];

	d = lambda_c*d; // Depth of the slots

	int i, j;

	String EOL = "\r\n";
	String separator ="\t";

	BufferedWriter bw = null;
	try {
		bw = new BufferedWriter(new FileWriter("./mydatafiles/" + ScriptName + ".nfs"));

		bw.write("#" + EOL);
		bw.write("#	 newFASANT script file" + EOL);
		bw.write("#" + EOL);

		// Corrugated surface profile formulations
		if(profile_index==1) { // z=i*p
			for(i=0;i<=N;i++) {
				az[i]=ai+(ao-ai)*(i*p/L); // linear
			}
		} else if(profile_index==2) {
			for(i=0;i<=N;i++) {
				az[i]=ai+(ao-ai)*((1-A)*i*p/L+A*Math.pow(Math.sin(Math.PI*i*p/(2*L)),rho));  // sinusoid
			}
		} else if(profile_index==3) {
			for(i=0;i<=N;i++) {
				az[i]=ai+(ao-ai)*((1-A)*i*p/L+A*Math.pow(Math.tan(Math.PI*i*p/(4*L)),rho));  // tangential
			}
		} else if(profile_index==4) {
			for(i=0;i<=N;i++) {
				az[i]=ai+(ao-ai)*((1-A)*i*p/L+A*Math.pow(i*p/(L),rho));  // x^rho
			}
		} else if(profile_index==5) {
			for(i=0;i<=N;i++) {
				az[i]=ai*Math.exp(Math.log(ao/ai)*i*p/L);  // Exponential
			}
		} else if(profile_index==6) {
			for(i=0;i<=N;i++) {
				az[i]=Math.sqrt(Math.pow(ai,2)+(Math.pow(i*p,2)*(Math.pow(ao,2)-Math.pow(ai,2)))/(Math.pow(L,2)));  // Hyperbolic
			}
		} else if(profile_index==7) {
			for(i=0;i<=N;i++) {
				az[i]=ai+(rho+1)*(ao-ai)*(1-(rho*i*p)/((rho+1)*L))*Math.pow(i*p/L,rho);  // Polynomial
			}
		} else if(profile_index==8) { // User profile 1
			for(i=0;i<=N;i++) {
				az[i]= 0;  
			}
		} else if(profile_index==9) { // User profile 2
			for(i=0;i<=N;i++) {
				az[i]= 0;  
			}
		} else if (profile_index<1 || profile_index>9) {
			for(i=0;i<=N;i++) { // linear
				az[i]=ai+(ao-ai)*(i*p/L); 
			}
		}

		// Mode converter
		for(i=0;i<Nmc;i++) { 
			
			dj[i] = (sigma-((1.0*i/Nmc)*(sigma-0.25*k)))*lambda_c;

			bw.write("line -n line" + (i+100000) + " -p " + az[i] + " 0.0 " + (p*i) + " " + (az[i]+dj[i]) + " 0.0 " + (p*i) + EOL);
			bw.write("line -n line" + (i+200000) + " -p " + (az[i]+dj[i]) + " 0.0 " + (p*i) + " " + (az[i]+dj[i]) + " 0.0 " + (p*i+w) + EOL);
			bw.write("line -n line" + (i+300000) + " -p " + (az[i]+dj[i]) + " 0.0 " + (p*i+w) + " " + (az[i+1]) + " 0.0 " + (p*i+w) + EOL);
			bw.write("line -n line" + (i+400000) + " -p " + (az[i+1]) + " 0.0 " + (p*i+w) + " " + (az[i+1]) + " 0.0 " + (p*i+w+a) + EOL);
			
		}

		// Corrugated horn
		for(i=Nmc;i<N-1;i++) {

			bw.write("line -n line" + (4*i) + " -p " + az[i] + " 0.0 " + (p*i) + " " + (az[i]+d) + " 0.0 " + (p*i) + EOL);
			bw.write("line -n line" + (4*i+1) + " -p " + (az[i]+d) + " 0.0 " + (p*i) + " " + (az[i]+d) + " 0.0 " + (p*i+w) + EOL);
			bw.write("line -n line" + (4*i+2) + " -p " + (az[i]+d) + " 0.0 " + (p*i+w) + " " + (az[i+1]) + " 0.0 " + (p*i+w) + EOL);
			bw.write("line -n line" + (4*i+3) + " -p " + (az[i+1]) + " 0.0 " + (p*i+w) + " " + (az[i+1]) + " 0.0 " + (p*i+w+a) + EOL);
			
		}

		bw.write("line -n guideline -p " + ai + " 0.0 0.0 " + ai + " 0.0 -" + Lg + EOL);

// revolve 180º
		bw.write("revolve -s ");
		for(i=1;i<=(Nmc-1);i++) {
			for(j=0;j<Nmc;j++) {
				bw.write("line" + (i) + "0000" + j + separator);
			}
		}
		for(i=(4*(Nmc+1)-4);i<=((N-1)*4-1);i++) {
			bw.write("line" + i + separator);
		}
		bw.write(" guideline -p 0.0 0.0 0.0 0.0 0.0 1.0 0.0 180.0" + EOL);
// revolve -180º
		bw.write("revolve -s ");
		for(i=1;i<=(Nmc-1);i++) {
			for(j=0;j<Nmc;j++) {
				bw.write("line" + (i) + "0000" + j + separator);
			}
		}
		for(i=(4*(Nmc+1)-4);i<=((N-1)*4-1);i++) {
			bw.write("line" + i + separator);
		}
		bw.write(" guideline -p 0.0 0.0 0.0 0.0 0.0 -1.0 0.0 180.0" + EOL);

// delete lines
		bw.write("delete -s ");
		for(i=1;i<=(Nmc-1);i++) {
			for(j=0;j<Nmc;j++) {
				bw.write("line" + (i) + "0000" + j + separator);
			}
		}
		for(i=(4*(Nmc+1)-4);i<=((N-1)*4-1);i++) {
			bw.write("line" + i + separator);
		}
		bw.write(" guideline" + EOL);

// disc
		bw.write("disk -n tapa -p 0.0 0.0 -" + Lg + " " + ai + EOL);
		
 bw.close();
		} catch(Exception e){
			System.out.println("Cannot write file " + EOL);
		} finally {
	            if (bw != null) {
	               try {
	                    bw.close();
	                } catch (IOException ex) {
	                    Logger.getLogger(NewMain.class.getName()).log(Level.SEVERE, null, ex);
	                }
	            }
        	}

}

Did you find this information useful?

We use cookies on this website to improve your navigation experience on this site. By using this site, you agree to our cookie policy.

I agree