nec2++ 2.1.1
nec_ground.h
1/*
2 Copyright (C) 2004,2015 Timothy C.A. Molteno
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17*/
18#pragma once
19
20#include <ostream>
21#include "common.h"
22#include "math_util.h"
23#include "nec_output.h"
24#include "nec_debug.h"
25#include "nec_results.h"
26#include "c_ggrid.h"
27
28/*
29 \section{NEC Ground Specification}
30
31 \subsection{the GN Card}
32
33 The GN card specifies the relative dielectric constant and conductivity of ground in the vicinity of the antenna.
34 In addition, a second set of ground parameters for a second medium can be specified,
35 or a radial wire ground screen can be modeled using a reflection coefficient approximation.
36
37 The parameters of the second medium can also be specified on another data card whose mnemonic is GD.
38 With the GD card, the parameters of the second medium can be varied and only the radiated fields
39 need to be recalculated.
40 Furthermore, if a radial wire ground screen has been specified on the GN card,
41 the GD card is the only way to include a second medium.
42 See Section~\ref{sec_card_gd} for details.
43
44 \subsection{"gd" card: ground representation}
45 \label{sec_card_gd}
46
47 To specify the ground parameters of a second medium which is not in the immediate vicinity of the antenna.
48 This card may only be used if a GN card has also been used.
49 It does not affect the fields of surface patches.
50
51 <ground type=finite>
52 <dielectric_constant = 80/>
53 <conductivity = 4/>
54 <radial-wire>
55 <count=12>
56 <length=15 unit=cm>
57 <
58 </radial-wire>
59 </ground>
60
61*/
63{
64public:
65
66 nec_ground() {
67 _ggrid.initialize();
68 default_values();
69 }
70
71 nec_ground(const nec_ground& in_ground) {
72 iperf = in_ground.iperf;
73 ksymp = in_ground.ksymp;
74 epsr = in_ground.epsr; // relative dielectric constant
75 sig = in_ground.sig; // Conductivity
76
77 // radial wire ground
78 radial_wire_count = in_ground.radial_wire_count;
79 radial_wire_length = in_ground.radial_wire_length;
80 radial_wire_radius = in_ground.radial_wire_radius;
81
82 // second medium parameters
83 cliff_edge_distance = in_ground.cliff_edge_distance;
84 cliff_height = in_ground.cliff_height;
85 epsr2 = in_ground.epsr2; // Relative dielectric constant
86 sig2 = in_ground.sig2; // Conductivity in mhos/meter
87 }
88
89 void default_values() {
90 zrati=cplx_10();
91 ksymp=1;
92 radial_wire_count = 0;
93 radial_wire_length = 0.0;
94 radial_wire_radius = 0.0;
95 iperf=0;
96 /*22/09/2005 : added initialization for sig and epsr*/
97 epsr = 0;
98 sig = 0;
99 }
100 /*
101 Parse a GN card. The input parameters here are the fields of the
102 GN card.
103 */
104 void parse_gn(int itmp1, int itmp2,
105 nec_float tmp1, nec_float tmp2,
106 nec_float tmp3, nec_float tmp4,
107 nec_float tmp5, nec_float tmp6
108 );
109
110 /*
111 Setup a cliff (two medium ground)
112 */
113 void setup_cliff(nec_float in_eprs2,
114 nec_float in_sig2,
115 nec_float clt, nec_float cht);
116
117 nec_complex get_zrati2(nec_float _wavelength);
118
119
122 return this->epsr;
123 }
124
125
127 nec_float get_conductivity() const {
128 return this->sig;
129 }
130
131
134 return this->radial_wire_count;
135 }
136
137
139 nec_float get_radial_wire_length() const {
140 return this->radial_wire_length;
141 }
142
143
145 nec_float get_radial_wire_radius() const {
146 return this->radial_wire_radius;
147 }
148
149
152 return this->scrwl;
153 }
154
155
162 nec_float get_cliff_edge_distance() const {
163 return this->cliff_edge_distance;
164 }
165
166
168 nec_float get_cliff_height() const {
169 return this->cliff_height;
170 }
171
172
175 return this->epsr2;
176 }
177
178
180 nec_float get_conductivity2() const {
181 return this->sig2;
182 }
183
184
187 nec_float get_cl(nec_float _wavelength) const {
188 return cliff_edge_distance / _wavelength;
189 }
190
193 nec_float get_ch(nec_float _wavelength) const {
194 return cliff_height / _wavelength;
195 }
196
197 nec_complex get_zrati_sqr() const {
198 return zrati*zrati;
199 }
200
201 // accessors for the ground type
202 inline bool type_finite_reflection() { return (0 == iperf); }
203 inline bool type_perfect() { return (1 == iperf); }
204 inline bool type_sommerfeld_norton() { return (2 == iperf); }
205
206
207 bool is_valid() const {
208 if (iperf < 0) return false;
209 if (iperf > 2) return false;
210
211 if (ksymp < 1) return false;
212 if (ksymp > 2) return false;
213
214 return true;
215 }
216
218 bool present() const {
219 ASSERT(is_valid());
220
221 if (2 == ksymp)
222 return true;
223
224 return false;
225 }
226
227 void ggrid_interpolate( nec_float x, nec_float y,
228 nec_complex *f1, nec_complex *f2,
229 nec_complex *f3, nec_complex *f4 ) {
230 _ggrid.interpolate(x, y, f1, f2, f3, f4);
231 }
232
233 void write_to_file_aux(std::ostream& os, output_helper& oh, int _ifar);
234
235 void output_antenna_environment(nec_output_file& _output);
236 void calculate_antenna_environment(c_ground_wave& ground_wave, nec_float freq_mhz);
237
238
239 nec_complex zrati, frati;
240
241 nec_complex m_t1; // constants for the radial-wire ground-screen impedance
242 nec_float t2; // constants for the radial-wire ground-screen impedance
243
245 int ksymp;
246private:
247 /* iperf: Ground-type flag. The options are:
248 -1 - nullifies ground parameters previously used and sets free- space condition. The remainder of the card is left blank in this case.
249 O - finite ground, reflection-coefficient approximation.
250 1 - perfectly conducting ground.
251 2 - finite ground, Sommerfeld/Norton method.
252 */
253 int iperf;
254
255 c_ggrid _ggrid;
256
257 // first medium parameters
258 nec_float epsr; // relative dielectric constant
259 nec_float sig; // Conductivity
260
261 // radial wire ground
262 int radial_wire_count;
263 nec_float radial_wire_length;
264 nec_float radial_wire_radius;
265
266 // second medium parameters
267 nec_float cliff_edge_distance;
268 nec_float cliff_height;
269 nec_float epsr2; // Relative dielectric constant
270 nec_float sig2; // Conductivity in mhos/meter
271
272 nec_complex _epsc; // should be the same as _ggrid.m_epscf
273
274// MOVE THESE TO THE GROUND
275
276 nec_float scrwl; // length of wires in radial-wire ground-screen in wavelengths
277 nec_float scrwr; // radius of wires in radial-wire ground-screen in wavelengths
278
279
280};
Definition c_ggrid.h:34
void interpolate(nec_float x, nec_float y, nec_complex *f1, nec_complex *f2, nec_complex *f3, nec_complex *f4)
interpolate (was intrp) uses bivariate cubic interpolation to obtain the values of 4 functions at the...
Definition c_ggrid.cpp:38
Definition c_ggrid.h:77
Definition nec_ground.h:63
nec_float get_cliff_height() const
Definition nec_ground.h:168
int get_radial_wire_count() const
Returns the number of radial wires in the ground screen approximation. If it's zero then this approxi...
Definition nec_ground.h:133
nec_float get_radial_wire_length_wavelengths() const
Returns the length of radial wires used in the ground screen approximation - provided this approximat...
Definition nec_ground.h:151
int ksymp
Definition nec_ground.h:245
bool present() const
Return true if a ground is present.
Definition nec_ground.h:218
nec_float get_relative_dielectric_constant() const
Returns the relative dielectric constant (no units) of the ground medium 1.
Definition nec_ground.h:121
nec_float get_radial_wire_radius() const
Returns the radius of radial wires in the ground screen approximation - provided this approximation h...
Definition nec_ground.h:145
nec_float get_relative_dielectric_constant2() const
Definition nec_ground.h:174
nec_float get_cl(nec_float _wavelength) const
Cliff edge in wavelengths,.
Definition nec_ground.h:187
nec_float get_ch(nec_float _wavelength) const
Cliff Height in wavelengths.
Definition nec_ground.h:193
nec_float get_radial_wire_length() const
Returns the length of radial wires used in the ground screen approximation - provided this approximat...
Definition nec_ground.h:139
nec_float get_cliff_edge_distance() const
Return cliff edge distance (meters)
Definition nec_ground.h:162
nec_float get_conductivity2() const
Definition nec_ground.h:180
nec_float get_conductivity() const
Returns the conductivity in Siemens/meter of the ground medium 1.
Definition nec_ground.h:127
Definition nec_output.h:53
A class that handles various standard output functions for the results.
Definition nec_results.h:41