RadioBanter

RadioBanter (https://www.radiobanter.com/)
-   Antenna (https://www.radiobanter.com/antenna/)
-   -   Antenna programming tool/language/compiler/preprocessor? (https://www.radiobanter.com/antenna/120608-antenna-programming-tool-language-compiler-preprocessor.html)

[email protected] June 16th 07 12:11 AM

Antenna programming tool/language/compiler/preprocessor?
 
Hello everybody,

I am searching for an antenna programming tool/compiler/preprocessor/
language. To finilize my work with similar subject (based on NEC2/
NEC4, especially on 4NEC2 from Arie Voors), I want to catch some good
ideas for this. Are you knowing some good tools, that provide to model
your antenna with a program code?
It should look like a program source code (like Basic, C or else) with
mathematical equations, variables, etc. It should not a GUI-Program,
where antenna parameters can be given in edit windows. (I hate this.)

So far, I am able to create construction models of antenna, so antenna
parameters can be optimized via 4NEC2. The complete output NEC file
has symbolic parameters instead of hard coded numbers. It supports
many features, that makes antenna modeling easy for you and me.
Especially for old "C"-programmers like me. With this work, it will be
soon able to model very complex antennas.

Please help me, to make a new standard of antenna modeling tool/
language. You will be get an advantage of this soon.

Regards,
Aziz

Some cut of source code (from offset parabolic reflector generator):
....snipped..
//--- Intermediate Symbols ---
P_y0 = -P_W/2 // Starting y position

#if (P_Type==3)
P_z0 = -P_Tp // Starting z position for offset parabola
#else //--if (P_Type==3)
P_z0 = -P_Hp/2 // Starting z position for center parabola
#endif //--if (P_Type==3)

P_dy = P_W/P_nsegw // Step width (y)
P_dz = P_Hp/P_nsegh // Step height (z)

//--- Generate Surface Patches or wires ---
for (z=0; z P_nsegh; z=z+1)
{
for (y=0; y P_nsegw; y=y+1)
{
// Elliptischer Test, wenn aktiv
#if ( (P_Shape == 1) || (sq(%%z+0.5-P_nsegh/2)/sq(P_nsegh/2) +
sq(%%y+0.5-P_nsegw/2)/sq(P_nsegw/2) = 1) ) //-- y=%%y, z=%%z

// if model is constructed with wires, correct wire flags must
be set.
P_wrflags = %%(_P1P2|_P2P3)

#if ( (z == P_nsegh-1) || ( (P_Shape == 2) && (sq(%%(z+1)+0.5-
P_nsegh/2)/sq(P_nsegh/2) + sq(%%y+0.5-P_nsegw/2)/sq(P_nsegw/2)
1)) )
P_wrflags = %%(P_wrflags | _P3P4)
#endif

#if ( (y == 0) || ( (P_Shape == 2) && (sq(%%z+0.5-P_nsegh/2)/
sq(P_nsegh/2) + sq(%%(y-1)+0.5-P_nsegw/2)/sq(P_nsegw/2) 1)) )
P_wrflags = %%(P_wrflags | _P4P1)
#endif

#SP4 1 1 P_a*(P_y0+%%y*P_dy)*(P_y0+%%y*P_dy)+P_a*(P_z0+%
%z*P_dz)*(P_z0+%%z*P_dz) P_y0+%%y*P_dy P_z0+%%z*P_dz P_a*(P_y0+%%(y
+1)*P_dy)*(P_y0+%%(y+1)*P_dy)+P_a*(P_z0+%%z*P_dz)* (P_z0+%%z*P_dz) P_y0+
%%(y+1)*P_dy P_z0+%%z*P_dz P_a*(P_y0+%%(y+1)*P_dy)*(P_y0+%%(y+1)*P_dy)
+P_a*(P_z0+%%(z+1)*P_dz)*(P_z0+%%(z+1)*P_dz) P_y0+%%(y+1)*P_dy P_z0+%%
(z+1)*P_dz P_a*(P_y0+%%y*P_dy)*(P_y0+%%y*P_dy)+P_a*(P_z0+%%(z
+1)*P_dz)*(P_z0+%%(z+1)*P_dz) P_y0+%%y*P_dy P_z0+%%(z+1)*P_dz
P_wrflags

#endif

} // for y

} // for z

.........
This source code must be compiled and you get some output code like
below...
(note: _8 is not a number but an intermediate variable (symbol))

Some cut off output code of other example:
....snipped..
SY _8 = (0+(BQ_RW)/2-(0+(BQ_RW)/2))/8
SY _9 = (0+(BQ_RH)/2-(0-(BQ_RH)/2))/8
SP 0 3 0+0*_1-0*(_7+0*(_1+_4)/8) 0+(BQ_RW)/2+0*_2-0*(_8+0*(_2+_5)/8)
0+(BQ_RH)/2+0*_3-0*(_9+0*(_3+_6)/8) 0+1*_1-0*(_7+1*(_1+_4)/8) 0+
(BQ_RW)/2+1*_2-0*(_8+1*(_2+_5)/8) 0+(BQ_RH)/2+1*_3-0*(_9+1*(_3+_6)/8)
SC 0 3 0+1*_1-1*(_7+1*(_1+_4)/8) 0+(BQ_RW)/2+1*_2-1*(_8+1*(_2+_5)/8)
0+(BQ_RH)/2+1*_3-1*(_9+1*(_3+_6)/8) 0+0*_1-1*(_7+0*(_1+_4)/8) 0+
(BQ_RW)/2+0*_2-1*(_8+0*(_2+_5)/8) 0+(BQ_RH)/2+0*_3-1*(_9+0*(_3+_6)/8)
....
SP 0 3 P_a*(P_y0+29*P_dy)*(P_y0+29*P_dy)
+P_a*(P_z0+20*P_dz)*(P_z0+20*P_dz) P_y0+29*P_dy P_z0+20*P_dz
P_a*(P_y0+30*P_dy)*(P_y0+30*P_dy)+P_a*(P_z0+20*P_d z)*(P_z0+20*P_dz)
P_y0+30*P_dy P_z0+20*P_dz
SC 0 3 P_a*(P_y0+30*P_dy)*(P_y0+30*P_dy)
+P_a*(P_z0+21*P_dz)*(P_z0+21*P_dz) P_y0+30*P_dy P_z0+21*P_dz
P_a*(P_y0+29*P_dy)*(P_y0+29*P_dy)+P_a*(P_z0+21*P_d z)*(P_z0+21*P_dz)
P_y0+29*P_dy P_z0+21*P_dz
....
etc... generates very complex output NEC files...
I am still wondering, that 4NEC2 can handle such complex NEC files.
But it works well.


Dave Platt June 16th 07 12:36 AM

Antenna programming tool/language/compiler/preprocessor?
 
In article om,
wrote:
Hello everybody,

I am searching for an antenna programming tool/compiler/preprocessor/
language. To finilize my work with similar subject (based on NEC2/
NEC4, especially on 4NEC2 from Arie Voors), I want to catch some good
ideas for this. Are you knowing some good tools, that provide to model
your antenna with a program code?


I've used a PERL pre-processing script which allows the embedding of
PERL expressions/calculations into a NEC input file, and substitution
of the results of these calculations into the statements in the deck.

It's somewhat simple-minded and doesn't have all of the flexibility
that you seem to be shooting for, but it might get you started.

Google for nec_param_util.Z - it's in most of the NEC2 archive
repositories, I believe.

--
Dave Platt AE6EO
Friends of Jade Warrior home page: http://www.radagast.org/jade-warrior
I do _not_ wish to receive unsolicited commercial email, and I will
boycott any company which has the gall to send me such ads!

Richard Clark June 16th 07 01:14 AM

Antenna programming tool/language/compiler/preprocessor?
 
On Fri, 15 Jun 2007 16:11:24 -0700, wrote:
from
I am searching for an antenna programming tool/compiler/preprocessor/
language.

to
Especially for old "C"-programmers like me.

suggests defining your language using BNF and building the compiler
with YACC. Anyway, how I've done similar projects for 30 years. You
could gussy it up with Prolog, but who wants to go down that path (at
least if you want it distributable)?

73's
Richard Clark, KB7QHC

[email protected] June 16th 07 01:34 AM

Antenna programming tool/language/compiler/preprocessor?
 
Hello Dave,

thanks for your hint. I know the problem with perl scripts. What I am
searching is, that no text or symbol replacement or calculating
symbols is done on your source nec file. I am searching for a compiler/
pre-processor, that makes from source file (antenna model) a
compatible nec file (still left in symbolic 4nec2-format).
I am sick off, to code many symbolic lines of nec code. It is boring
and difficult, when your model gets complex and has much more
segments.
Therefore I started with my pre-processor few month ago, that makes
the code for me automatically. It supports primitive object and
complex structures. It also let you "to program" your antenna model.
But the most advantage of letting the nec file symbolic, you can
optimize the antenna parameters.
I tried and constructed many antenna models and wont miss the
optimizer tool from 4nec2.

I am wondering, that nobody made such a tool till now.

Aziz


Tom Ring June 16th 07 01:49 AM

Antenna programming tool/language/compiler/preprocessor?
 
Richard Clark wrote:
On Fri, 15 Jun 2007 16:11:24 -0700, wrote:
from
I am searching for an antenna programming tool/compiler/preprocessor/
language.

to
Especially for old "C"-programmers like me.

suggests defining your language using BNF and building the compiler
with YACC. Anyway, how I've done similar projects for 30 years. You
could gussy it up with Prolog, but who wants to go down that path (at
least if you want it distributable)?

73's
Richard Clark, KB7QHC


Prolog.

Been a long while since I heard that. I thought it was long buried.

tom
K0TAR

[email protected] June 16th 07 01:54 AM

Antenna programming tool/language/compiler/preprocessor?
 
On 16 Jun., 02:14, Richard Clark wrote:
On Fri, 15 Jun 2007 16:11:24 -0700, wrote:

fromI am searching for an antenna programming tool/compiler/preprocessor/
language.

to
Especially for old "C"-programmers like me.


suggests defining your language using BNF and building the compiler
with YACC. Anyway, how I've done similar projects for 30 years. You
could gussy it up with Prolog, but who wants to go down that path (at
least if you want it distributable)?

73's
Richard Clark, KB7QHC


Due to the similarity to 4nec2 and nec2 format, I implemented a very
simple line based parser. Of course, it looks like C, but the pre-
processer has limitations. It is kept left simple except the
expression parser for calculation (fully c compatible). I started with
very simple one and the implementation growed up till now. It is not
finished yet - a big mile stone for documentation must be realized.
Also testing is not finished. And I found new bugs, when I implemented
a regression test model. But it is a good time now, to implement some
usefull features or ideas.

Regard,
Aziz


Richard Clark June 16th 07 07:35 AM

Antenna programming tool/language/compiler/preprocessor?
 
On Fri, 15 Jun 2007 17:54:02 -0700, wrote:

Of course, it looks like C, but the pre-
processer has limitations.


Hi Aziz,

A syntax looking like C for the purpose of describing an antenna
design engine meta-language is not a particularly good match. The
difference is between it being procedural whereas the meta-language
would, in my estimation, be more useful if it was declarative. BNF is
very simple to implement either, so it would seem the effort should be
invested in a tool that was oriented towards the user rather than a
programmer. Besides, C is a pretty crummy language with even more
horrid library syntaxes (assembler is far more elegant).

73's
Richard Clark, KB7QHC

Richard Clark June 16th 07 07:37 AM

Antenna programming tool/language/compiler/preprocessor?
 
On Fri, 15 Jun 2007 19:49:41 -0500, Tom Ring
wrote:

Prolog.

Been a long while since I heard that. I thought it was long buried.


Hi Tom,

The current iteration is so vastly removed from the early days as to
be unrecognizable.

73's
Richard Clark, KB7QHC

John Smith I June 16th 07 08:13 AM

Antenna programming tool/language/compiler/preprocessor?
 
Richard Clark wrote:

...
programmer. Besides, C is a pretty crummy language with even more
horrid library syntaxes (assembler is far more elegant).

73's
Richard Clark, KB7QHC


A lot of people like to think themselves programmers, real programmers
use C/C++. (Weekend programmers use visual basic)

C is simply a macro language which calls assembler procedures and
functions--Dennis Richie was a real assembly language programmer, he
simply designed a "shorthand" language for using assembler--C itself was
written in assembler--nowadays C can compile and link itself ... a real
C programmer will add to the C libraries and include files using
assembler definitions, procedures and functions. While every subroutine
of a C program is a function, they can be written as procedures which
are only cloaked as functions. Example:

#include iostream

void helloworldprocedure(void)
{
cout "hello world!" endl;
}

void main(void)
{
helloworldprocedure();
}

.... takes no parameters, returns none ...

I think most C programmers prefer to program in assembly (but with
windows allowing NO direct access of devices, peripherals, memory or
disk--why bother, assembly can only be used as a wrapper to call windows
libs/dlls/activex/scripts/etc., or custom ones--linux can be made to
allow direct access), however, C adds a productivity factor of
magnitudes over assembly.

No other language offers the efficiency of program "character text"
(source code) to actual binary code compiled/linked by C. Indeed, any C
compiler I have ever seen gives a option to spit out assembler source
.... and the assembler source so generated is quite capable of being
assembled/linked by an assembler/linker for the platform in question.

C simply has no rules which cannot be broken, even if it breaks all
programming rules, and you want to override them, go ahead! (bill gates
won't let you break windows rules though :-( )--C is only structured if
you program in a structured style. For that reason alone, it is not a
good language for newbie programmers ...

JS

Tom Ring June 16th 07 03:43 PM

Antenna programming tool/language/compiler/preprocessor?
 
Richard Clark wrote:
On Fri, 15 Jun 2007 19:49:41 -0500, Tom Ring
wrote:

Prolog.

Been a long while since I heard that. I thought it was long buried.


Hi Tom,

The current iteration is so vastly removed from the early days as to
be unrecognizable.

73's
Richard Clark, KB7QHC


Any open source version(s) you would recommend? I may have to have a
look again.

Thanks.

tom
K0TAR

Richard Clark June 16th 07 04:54 PM

Antenna programming tool/language/compiler/preprocessor?
 
On Sat, 16 Jun 2007 09:43:00 -0500, Tom Ring
wrote:

Any open source version(s) you would recommend? I may have to have a
look again.


Hi Tom,

I would like to say Trilogy, which is also a declarative language, but
long gone by nearly 20 years.

On the active front, there is XPCE/Prolog (google this) out of
Amsterdam. It appears to be the product of a one-man show and to my
mind suffers from what he thinks the language should be (and not what
it was). I suppose my attitude would be better if I could have read
the users manual which, unfortunately, mimics all the poorly written
user manuals that have come down the pike since PL/M.

73's
Richard Clark, KB7QHC

Richard Clark June 16th 07 05:31 PM

Antenna programming tool/language/compiler/preprocessor?
 
On Sat, 16 Jun 2007 00:13:37 -0700, John Smith I
wrote:
Example:

#include iostream

void helloworldprocedure(void)
{
cout "hello world!" endl;
}

void main(void)
{
helloworldprocedure();
}

... takes no parameters, returns none ...


Horrid examples of language, these are like the proverbial turds in
the punch bowl at a party.

I think most C programmers prefer to program in assembly (but with
windows allowing NO direct access of devices, peripherals, memory or
disk--why bother, assembly can only be used as a wrapper to call windows
libs/dlls/activex/scripts/etc., or custom ones--linux can be made to
allow direct access),


Most C programmers are Neanderthals with their skills frozen in the
70s. There is at least one Windows Assembler out there, it's free and
has been available for years from Steve Gibson at:
http://www.grc.com/smgassembly.htm
His executables perform network connections in file sizes of barely
more than 5K up to a massive 22K.

however, C adds a productivity factor of
magnitudes over assembly.


Bull Looney. This kind of syrupy rationale was composed to sooth the
nerves of Dilbert's pointy haired boss. It merely reveals that many
coders need training wheels to allow them to ride faster when
designers could have walked there in half the time.

C is NOT a user language.

73's
Richard Clark, KB7QHC

John Smith I June 16th 07 09:46 PM

Antenna programming tool/language/compiler/preprocessor?
 
Richard Clark wrote:

...
C is NOT a user language.

73's
Richard Clark, KB7QHC


Quite obviously, you are not a software engineer ... even is someone is
willing to pay you for such.

JS

Richard Clark June 16th 07 10:50 PM

Antenna programming tool/language/compiler/preprocessor?
 
On Sat, 16 Jun 2007 13:46:59 -0700, John Smith I
wrote:
C is NOT a user language.


Quite obviously, you are not a software engineer ... even is someone is
willing to pay you for such.


:-)

73's
Richard Clark, KB7QHC

John Smith I June 16th 07 11:40 PM

Antenna programming tool/language/compiler/preprocessor?
 
Richard Clark wrote:
On Sat, 16 Jun 2007 13:46:59 -0700, John Smith I
wrote:
C is NOT a user language.

Quite obviously, you are not a software engineer ... even is someone is
willing to pay you for such.


:-)

73's
Richard Clark, KB7QHC


Richard:

Ahhh, to wise to take the bait, huh? grin

Well, you are right, anyone who programs deserves respect, no matter the
language--sure beats being to lazy to learn something new ... a
scripting language is best for what was first implied--I lied. :-(

We only need steer the app ... I am like y'all, I prefer the command
line to the gui.

Warm regards,
JS

John Smith I June 16th 07 11:45 PM

Antenna programming tool/language/compiler/preprocessor?
 
John Smith I wrote:

[stuff]


.... err, just for today, to = too :-)

JS

Tom Ring June 17th 07 03:19 AM

Antenna programming tool/language/compiler/preprocessor?
 
Richard Clark wrote:
On Sat, 16 Jun 2007 00:13:37 -0700, John Smith I
wrote:
Example:

#include iostream

void helloworldprocedure(void)
{
cout "hello world!" endl;
}

void main(void)
{
helloworldprocedure();
}

... takes no parameters, returns none ...


Horrid examples of language, these are like the proverbial turds in
the punch bowl at a party.

I think most C programmers prefer to program in assembly (but with
windows allowing NO direct access of devices, peripherals, memory or
disk--why bother, assembly can only be used as a wrapper to call windows
libs/dlls/activex/scripts/etc., or custom ones--linux can be made to
allow direct access),


Most C programmers are Neanderthals with their skills frozen in the
70s. There is at least one Windows Assembler out there, it's free and
has been available for years from Steve Gibson at:
http://www.grc.com/smgassembly.htm
His executables perform network connections in file sizes of barely
more than 5K up to a massive 22K.

however, C adds a productivity factor of
magnitudes over assembly.


Bull Looney. This kind of syrupy rationale was composed to sooth the
nerves of Dilbert's pointy haired boss. It merely reveals that many
coders need training wheels to allow them to ride faster when
designers could have walked there in half the time.

C is NOT a user language.

73's
Richard Clark, KB7QHC


Richard

You may not like C programmers in general. However, some of us document
our code (my "code" is probably 80% comments) and don't declare
(assuming they declare at all) our functions as void. Unless they
really are. Sorry about the sentence structure there, I am very tired,
and also watching F1 qualifying at the same time. CPU idle time
nonexistent. ;)

tom
K0TAR



John Smith I June 17th 07 04:32 AM

Antenna programming tool/language/compiler/preprocessor?
 
Tom Ring wrote:

...
our code (my "code" is probably 80% comments) and don't declare
(assuming they declare at all) our functions as void. Unless they
...
tom
K0TAR


I certainly would not go about bragging in that style, dead sign of lack
of structure/logic in the code leading to obfuscation and requiring
extraordinary effort of documentation ...

The comments in source are only meant for other programmers, they
already know how to program, you don't have to teach 'em, nor attempt to
impress them with your brilliance--if such is present--they'll know.

With the proper use of significant names for variables, structs,
defines, etc. and programming for a "logical flow" of code, few comments
are needed (approx. 10-20% comments should be more than sufficient--if
the source is structured and non-obfuscated.)

Krist, they pay me to engineer software, not write books ... (if
management had their way--they'd screw that up ...)

SIMPLIFIED EXAMPLE:
// call at any point to debug/check variables
(void) debug_printout_of_variables_used(float whip_self-capacitance_pf,
float coil_self-capacitance_pf,
float coil_inductance_uh,
...)
{
cout "Whip self capacitance (pf): " whip_self-capacitance_pf
endl;
cout ...
...
}

JS


Richard Clark June 17th 07 05:18 AM

Antenna programming tool/language/compiler/preprocessor?
 
On Sat, 16 Jun 2007 21:19:57 -0500, Tom Ring
wrote:

You may not like C programmers in general. However, some of us document
our code (my "code" is probably 80% comments) and don't declare
(assuming they declare at all) our functions as void. Unless they
really are. Sorry about the sentence structure there, I am very tired,
and also watching F1 qualifying at the same time. CPU idle time
nonexistent. ;)


Hi Tom,

Documenting code (any language, and even more so for "self
documenting" languages) is a necessary talent, and the first casualty
often abandoned to schedule.

This has nothing to do with "liking" C programmers in general;
however, C as a language is wholly inappropriate for a user's
interface to antenna design engines. The intersection of C
programmers and Antenna designers is so marginal that the focus on C
is six sigma to the left of the bell curve (and, of course, these
comments can be extended to assembler).

I've designed parsers and compilers - no easy chore certainly - and I
have enough experience in the matter to know that expressing the
user's need in BNF and pushing it through YACC would present something
vastly better than C; with the libraries stripped out, is nothing more
than simple conditionals and loops (and again, since the assembler set
for the 80x86, ASM could do that just as well). C programmers'
fluency through brute force attention does not elevate these opaque
libraries' troglodyte style.

With the advent of C++, things only got worse. I was doing that in
the late 80s and when Java came along, I jettisoned that baggage.

73's
Richard Clark, KB7QHC

John Smith I June 17th 07 05:29 AM

Antenna programming tool/language/compiler/preprocessor?
 
Richard Clark wrote:

[stuff]


Richard Clark, KB7QHC


Richard,

Yes, a simplified script language to feed the logic in the app from the
commandline and a backup gui for those desiring it would be most
appreciated by those having to learn it and use the app ...

C programmers will participate by writing the app ... :-)

Regards,
JS

[email protected] June 17th 07 01:06 PM

Antenna programming tool/language/compiler/preprocessor?
 
Again,

my intention is, not to re-invent the programming language "C". My
intention is, to describe in a prooven language an antenne. I decided
the programming language C, because it is most used language on the
world.

I have not given any name for my language to the pre-processor. Lets
call this as SNEC - just for "Symbolic NEC". The commands for the pre-
processor has similar syntax to the programming language C. But not
exactly the same. It has many limitations.

As an example, I show you one of the source code of a horn antenna for
WLAN. It has three modules. As you can see, the language is as
superset of NEC2 and 4NEC2. It can be adapted easily to any other
antenne defining formats. If the pre-processor detects an unknowing
command, it will do nothing. Just taking the line of code and writing
to output file. A special set of commands will be interpreted by the
pre-processor. It will translate it into the 4NEC2/NEC2 commands.
That is all. It is a very simple language, but you can design very
complex antenna model with few lines of "code".
The output file has a lot of kilobytes of code! It will split surface
patches into many segments or wires. The main module is Horn1.txt.

Aziz

--------------- File: Horn1.txt -------------------------
CM Horn Antenna Model at 2.437 GHz (C) 2007 by Aziz Oeguet
CE

#include "Common.txt"
#include "PP4NEC2Defs.txt"

#ifndef H_wrmode
H_wrmode = 0 // Drahtmodus (0=Surface-Path, 1=Wire-Modus)
#endif

#if (H_wrmode)
// Parameter für Wire-Modus
#pragma mode = _MODE_WR, wrnumseg = 1, wrtagstart=5000, wrtaginc =
1, wrradius = 0.00075
#pragma symode = _SYMODE_REUSE
#else
#pragma mode= _MODE_SP
#pragma symode = _SYMODE_REUSE
#endif

//--- Biquad-Parameter definieren ---
BQ_nsegw = 8 // Number of segments for width
BQ_nsegh = 8 // Number of segments for height
BQ_RW = 0.10 // Reflector width (y-axis)
BQ_RH = 0.10 // Reflector height (z-axis)

// Erreger-Antenne einfügen
#include "FeedBiQ.txt"

refdist = 0.014617 // Reflector distance to antenna


// Box parameters
B_Px = -refdist // Position of box (x-Axis)
B_Py = 0 // Position of box (y-Axis)
B_Pz = 0 // Position of box (z-Axis)

#if (H_wrmode)
B_lseg = 25 // Number of segments for length (x-axis)
B_wseg = 21 // Number of segments for width 2 (y-axis)
B_hseg = 18 // Number of segments for height 2 (z-axis)
#else
B_lseg = 30 // Number of segments for length (x-axis)
B_wseg = 24 // Number of segments for width 2 (y-axis)
B_hseg = 20 // Number of segments for height 2 (z-axis)
#endif

B_W1 = BQ_RW // Box width 1 (y-axis)
B_H1 = BQ_RH // Box height 1 (z-axis)

// Opt. simuliert
B_L = 0.385216 // 0.398 // Box length (x-axis)
B_W2 = 0.40 // Box width 2 (y-axis)
B_H2 = 0.291 // Box height 2 (z-axis)


#if (H_wrmode)
B_nBox = 1 // Number of box divisions for a better
segmentation
#else
B_nBox = 10 // Number of box divisions for a better
segmentation
#endif

#if B_nBox == 1
B_wseg1 = B_wseg // Number of segments for width 1 (y-axis)
B_hseg1 = B_hseg // Number of segments for height 1 (z-axis)
#else
B_wseg1 = 2+B_W1/(B_W2/B_wseg) // Number of segments for width 1 (y-
axis)
B_hseg1 = 2+B_H1/(B_H2/B_hseg) // Number of segments for height 1 (z-
axis)
#endif

// Deltas for box divisions
B_DH = (B_H2-B_H1)/B_nBox
B_DW = (B_W2-B_W1)/B_nBox
B_DL = B_L/B_nBox

//--- Horn Reflektor ---

B_dws = (B_wseg - B_wseg1)/B_nBox
B_dhs = (B_hseg - B_hseg1)/B_nBox

for (i=0; i B_nBox; i=i+1)
{
#if i==0
#Box %%(B_wseg1+i*B_dws) %%(B_hseg1+i*B_dhs) %%(B_lseg/B_nBox)
(B_Px+%%i*B_DL) B_Py B_Pz (B_W1+%%i*B_DW) (B_W1+%%(i+1)*B_DW) (B_H1+%
%i*B_DH) (B_H1+%%(i+1)*B_DH) B_DL BLRUD _8ALL
#else
#Box %%(B_wseg1+i*B_dws) %%(B_hseg1+i*B_dhs) %%(B_lseg/B_nBox)
(B_Px+%%i*B_DL) B_Py B_Pz (B_W1+%%i*B_DW) (B_W1+%%(i+1)*B_DW) (B_H1+%
%i*B_DH) (B_H1+%%(i+1)*B_DH) B_DL LRUD _8ALL-_4ALL
#endif

} // for i

ofsx = -B_L-B_Px // Offset structure


// Achsen-Transformation (verschieben, um aus dem Nahfeld
rauszukommen)
GM 0 0 0 0 0 ofsx 0 0 0


// End-Of-Geometry
GE 0

//--- Wire-Load (HF-Speisung) ---
EX 0 Ant_Feed_Tagnr Ant_Feed_Segnr 0 1.0 0.0
LD 5 0 0 0 62900000

// Extended-Wire-Kernel einschalten
EK 1

//--- Frequency Parameter and Execute ---
FR 0 1 0 0 freq 1
EN
-------------------File: Common.txt ----------------------
CM
CM File: Common.txt
CM
CM Antenna Model at 2.437 GHz (C) 2007 by Aziz Oeguet
CM
CM --- General parameters ---
CE

freq = 2437.0 // Operating frequency in MHz
pi = 3.14159265358979 // famous pi
c0 = 299792.458 // Light speed km/s
lambda = c0/freq/1000 // One wave length in m
lambda2= lambda/2 // Half wave length in m
lambda4= lambda/4 // Fourth wave length in m

CM End of File Common.txt
CE
-----------------File: PP4NECDefs.txt ----------------------
CM
CM File: PP4NEC2Defs.txt
CM
CM PP4NEC2 Constant Definitions (C) 2007 by Aziz Oeguet
CM

//--- Modus-Arten definition (Bit-Flag, Number-Codes) ---
_MODE_SP = 0 // #pragma mode=_MODE_SP - Surface Patch Modus
(Metallflächen)
_MODE_WR = 1 // #pragma mode=_MODE_WR - Wire Modus
(Drahtmodell)

_SYMODE_UNIQUE = 1 // #pragma symode = _SYMODE_UNIQUE - interne
Symbole einzigartig (keine Mehrfachverwendung)
_SYMODE_REUSE = 0 // #pragma symode = _SYMODE_REUSE - interne
Symbole mehrfach verwenden (durch Neuzuweisung)

_HS_OUTSIDE = 0 // Struktur nur ausserhalb zulassen (innerhalb des
Hotspots keine Objekte)
_HS_INSIDE = 1 // Struktur nur innerhalb zulassen (ausserhalb des
Hotspots keine Objekte)


//--- Edge definitions (Bit-Flags) (#Sp3 only) ---
_P1P2 = 1 // Kante P1-P2 mit Draht verbinden (nur bei Wire Modus)
_P2P3 = 2 // Kante P2-P3 mit Draht verbinden (nur bei Wire Modus)
_P3P1 = 4 // Kante P3-P1 mit Draht verbinden (nur bei Wire Modus)
_3ALL = 7 // alle Kanten des Dreiecks mit Draht verbinden (nur bei
Wire Modus)

//--- Edge definitions (Bit-Flags) (#Sp4 plus #Sp3) ---
_P3P4 = 4 // Kante P3-P4 mit Draht verbinden (nur bei Wire Modus)
_P4P1 = 8 // Kante P4-P1 mit Draht verbinden (nur bei Wire Modus)
_4ALL = 15 // alle Kanten des Vierecks mit Draht verbinden (nur bei
Wire Modus)

//--- Edge definitions (Bit-Flags) (#Box, #Horn plus #Sp4) ---
_P5P6 = 16 // Kante P5-P6 mit Draht verbinden (nur bei Wire Modus)
_P6P7 = 32 // Kante P6-P7 mit Draht verbinden (nur bei Wire Modus)
_P7P8 = 64 // Kante P7-P8 mit Draht verbinden (nur bei Wire Modus)
_P8P5 = 128 // Kante P8-P5 mit Draht verbinden (nur bei Wire Modus)
_P1P5 = 256 // Kante P1-P5 mit Draht verbinden (nur bei Wire Modus)
_P2P6 = 512 // Kante P2-P6 mit Draht verbinden (nur bei Wire Modus)
_P3P7 = 1024 // Kante P3-P7 mit Draht verbinden (nur bei Wire Modus)
_P4P8 = 2048 // Kante P4-P8 mit Draht verbinden (nur bei Wire Modus)
_8ALL = 4095 // alle Kanten des Objekts mit Draht verbinden (nur bei
Wire Modus)

//--- Edge definitions (Bit-Flags) (#SpArc and #Tube only) ---
_A1 = 1 // Kante Alpha1 (Startwinkel)
_A2 = 2 // Kante Alpha2 (Endwinkel)
_R1 = 4 // Kante Radius 1 (Startradius)
_R2 = 8 // Kante Radius 2 (Endradius)
_RALL = 15 // alle Kanten des Objekts mit Draht verbinden (nur bei
Wire Modus)

//--- Konvex definition (Bit-Flag) (für Metallflächen (Surface
Patches)) ---
_CONVEX = 65536 // Objekt ist Konvex, alle Normalenvektoren zeigen
nach aussen

CM End of File PP4NEC2Defs.txt
CE
----------------File: FeedBiQ.txt------------
CM
CM File: FeedBiQ.txt
CM
CM BiQuad-Feeder Antenna Model at 2.437 GHz (C) 2007 by Aziz Oeguet
CM
CE

//--- Antenne parameters ---

#ifndef BQ_sgap
BQ_sgap = 0.003 // Soldering gap distance
#endif

#ifndef BQ_wr
BQ_wr = 0.00075 // Wire radius
#endif

#ifndef BQ_wrseg
BQ_wrseg = 5 // Number of segments on partial
antenne wire part
#endif

#ifndef BQ_tagwr
BQ_tagwr = 1000 // Antenna Tag-Start
#endif

BQ_elemlen = lambda/4 // Antenna element length
BQ_ea = BQ_elemlen/sqr(2) // Projected axis length of antenna
element


//--- Antenne (BiQuad) ---

GW BQ_tagwr 1 0 0 BQ_sgap/2 0 0 -
BQ_sgap/2 BQ_sgap/6
GW BQ_tagwr+1 BQ_wrseg 0 0 BQ_sgap/2 0 BQ_ea
BQ_ea BQ_wr
GW BQ_tagwr+2 BQ_wrseg 0 BQ_ea BQ_ea 0 2*BQ_ea
0 BQ_wr
GW BQ_tagwr+3 BQ_wrseg 0 2*BQ_ea 0 0 BQ_ea -
BQ_ea BQ_wr
GW BQ_tagwr+4 BQ_wrseg 0 BQ_ea -BQ_ea 0 0 -
BQ_sgap/2 BQ_wr
GW BQ_tagwr+5 BQ_wrseg 0 0 -BQ_sgap/2 0 -BQ_ea -
BQ_ea BQ_wr
GW BQ_tagwr+6 BQ_wrseg 0 -BQ_ea -BQ_ea 0 -2*BQ_ea
0 BQ_wr
GW BQ_tagwr+7 BQ_wrseg 0 -2*BQ_ea 0 0 -BQ_ea
BQ_ea BQ_wr
GW BQ_tagwr+8 BQ_wrseg 0 -BQ_ea BQ_ea 0 0
BQ_sgap/2 BQ_wr


//--- Wire-Load Punkt definieren (HF-Speisepunkt) ---

Ant_Feed_Tagnr = BQ_tagwr
Ant_Feed_Segnr = 1

CM End of File FeedBiQ.txt
CE

-------------------END----------------


Richard Clark June 17th 07 04:29 PM

Antenna programming tool/language/compiler/preprocessor?
 
On Sun, 17 Jun 2007 05:06:25 -0700, wrote:

Again,

my intention is, not to re-invent the programming language "C".


Hi Aziz,

Unfortunately that is exactly what you have done, re-invent C. The
source you provide makes sense mostly to the C programming community,
not antenna designers.

MY intention is, to describe in a prooven language an antenne. I decided
the programming language C, because it is most used language on the
world.


Antenna designers are not C programmers, usually. As this post proves
through your contribution, English is far more universal - hence
designing an antenna pre-processing language with a natural language
interface makes far more sense.

You don't know BNF or YACC, do you?

I have not given any name for my language to the pre-processor. Lets
call this as SNEC - just for "Symbolic NEC". The commands for the pre-
processor has similar syntax to the programming language C. But not
exactly the same. It has many limitations.


The first limitation is the source you provide is not a symbolic
language, it is a procedural language. Just giving it the name
symbolic does not make it one.

Please reference SNOBOL for symbolic languages, or Pascal records, or
if you insist C, then C's structs (I notice you don't use structs).

Mainstream symbolic languages still in use are AWK and Perl. Either
of these languages could be implemented in C, but neither look like C.

Do you know AWK? Perl?

Professional software C programmers have skills with the UNIX toolkit
since C was designed in BNF created by YACC and its product used to
build AWK.

As an example, I show you one of the source code of a horn antenna for
WLAN. It has three modules. As you can see, the language is as
superset of NEC2 and 4NEC2. It can be adapted easily to any other
antenne defining formats. If the pre-processor detects an unknowing
command, it will do nothing.


This is called a "silent failure" and YACC can easily provide a not so
silent warning. "Silent failures" are very poor design.

Just taking the line of code and writing
to output file. A special set of commands will be interpreted by the
pre-processor. It will translate it into the 4NEC2/NEC2 commands.
That is all. It is a very simple language, but you can design very
complex antenna model with few lines of "code".
The output file has a lot of kilobytes of code! It will split surface
patches into many segments or wires. The main module is Horn1.txt.


You should also consult (by googling the term) XLZIZL.zip.

You have done a lot of work. You obviously know what you want from
your code. You clearly know what the product is going to be. To be
useful, you need to wrap it in a truly symbolic language of your own
design.

Using the appropriate tools, LEX and YACC, you can preserve your
investment with the code you have written, and build a natural
language (or symbolic) interface to it.

Research the term BNF (Backus Naur Form). BNF is the ultimate
symbolic code and has stood the test of time in some version for 50
years.

73's
Richard Clark, KB7QHC

[email protected] June 18th 07 10:27 AM

Antenna programming tool/language/compiler/preprocessor?
 
Sorry Richard,

no source code will be available for anybody. Only binaries and
antenna models.
But the expression-syntax is shown below:
(you must convert the text below to courier font, to see the diagram
right).

// Level1 : ---+---(Level2)---+---
// | |
// +-----[||]-----+

// Level2 : ---+---(Level3)---+---
// | |
// +-----[&&]-----+

// Level3 : ---(Level4)---+------------------------+---
// | +--[!=]--+ |
// +--+ +--(Level4)--+
// +--[==]--+

// Level4 : ---(Level5)---+------------------------+---
// | +--[ ]--+ |
// | | | |
// | +--[=]--+ |
// +--+ +--(Level5)--+
// +--[ ]--+
// | |
// +--[=]--+

// Level5 : ---+---(Level6)---+---
// | |
// | +--[+]--+ |
// +--+ +---+
// +--[-]--+

// Level6 : ---+---(Level7)---+---
// | |
// | +--[^]---+ |
// | +--[|]---+ |
// | +--[&]---+ |
// | +--[*]---+ |
// +--+--[/]---+--+
// +--[%]---+

// Level7 : ---+-------------+---(Level8)---
// | +--[+]--+ |
// +--+--[-]--+--+
// +--[!]--+
// +--[~]--+

// Level8 : ---(Level9)---+-----------------+---
// disabled (// +--[^]--(Level8)--+)

// Level9 : +---[(]---(Level1)---[)]----------------+
// | |
// +---(Zahl)------------------------------+
// ---+ +---
// +---(Funktion)---[(]---(Level1)---[)]---+
// | |
// +---(Funktion2)--[(](Level1),(Level1)[)]
+ // , or ; allowed
// | |
// +---(Variable)--------------------------+

// Zahl: +[.]+(Ziffer)+------------+
// | +--------+ |
// ---+ +-+--------------------+---
// | | |+[e]++[+]+ |
// ++(Ziffer)++-------------++ ++ ++---++(Ziffer)++
// +--------++[.]+(Ziffer)++ +[E]++[-]++--------+
// +--------+

// Variable: +------[_]------+
// ---+ +---+-----------------------+---
// +--(Buchstabe)--+ | +------[_]------+ |
// +-+-+--(Buchstabe)--+-+-+
// | +----(Ziffer)---+ |
// +-------------------+

// Ziffer: [0] .. [9]

// Buchstabe: [a] .. [z], [A] .. [Z]

// Funktion: [sin], [cos], [tan], [asin], [acos], [atan], [sqrt],
// [ln], [exp], [sinh], [cosh], [tanh], [abs], [ceil],
[floor] and more


John Smith I June 18th 07 01:51 PM

Antenna programming tool/language/compiler/preprocessor?
 
wrote:
Sorry Richard,

no source code will be available for anybody. Only binaries and
antenna models.
...


Keep it, I'll write my own ... :-)

Regards,
JS

Richard Clark June 18th 07 03:47 PM

Antenna programming tool/language/compiler/preprocessor?
 
On Mon, 18 Jun 2007 02:27:28 -0700, wrote:

Sorry Richard,

no source code will be available for anybody. Only binaries and
antenna models.
But the expression-syntax is shown below:
(you must convert the text below to courier font, to see the diagram
right).


Hi Aziz,

OK, all pretty conventional stuff 30 years ago. So what is the
problem with abstracting a symbolic wrapper to level 1 to make it
generally useful?

As I said, there's no reason why your work can't survive, my question
was why do you simply re-invent C, a language as dead to antenna
designers as Sanskrit?

73's
Richard Clark, KB7QHC

Richard Clark June 18th 07 04:29 PM

Antenna programming tool/language/compiler/preprocessor?
 
On Mon, 18 Jun 2007 07:47:37 -0700, Richard Clark
wrote:

As I said, there's no reason why your work can't survive, my question
was why do you simply re-invent C, a language as dead to antenna
designers as Sanskrit?


For instance. Even C programmers (some) enjoy the benefit of structs
as a layer of abstraction. This is a pretty thin difference, but
certainly within furthering the scheme of antenna design. Why I say
that is that the NEC card deck is already a struct. To ignore the
card deck is a step backwards from antenna design to simply conform to
a programmer's model.

Further, taking the deck, you stand a better model with Pascal and
records. This gives the antenna designer a way to more fluently
describe and access segments, wires, or elements. It is a natural
progression. However, Pascal is hardly a symbolic language, except by
some of its own elements (the record). Abstracting further, LISP (a
decidedly intense symbolic language) is a chained and recursive
language (you say you've licked recursion) that mimics not only the
linear connections of wires, but the regress of arrays. However, I
wouldn't wish LISP on anyone as an antenna design language, but it is
certainly far more suitable than C.

All-in-all, each of these variants can still contain exactly what
you've offered in BNF.

In short, your expression syntax is not a language at all (not even
C). It is incomplete being only the phrase particles of many
languages. Phrases need to aggregate into clauses and then sentences.
You exhibit none of that.

73's
Richard Clark, KB7QHC

Jim Lux June 18th 07 06:47 PM

Antenna programming tool/language/compiler/preprocessor?
 
wrote:
Hello Dave,

thanks for your hint. I know the problem with perl scripts. What I am
searching is, that no text or symbol replacement or calculating
symbols is done on your source nec file. I am searching for a compiler/
pre-processor, that makes from source file (antenna model) a
compatible nec file (still left in symbolic 4nec2-format).
I am sick off, to code many symbolic lines of nec code. It is boring
and difficult, when your model gets complex and has much more
segments.
Therefore I started with my pre-processor few month ago, that makes
the code for me automatically. It supports primitive object and
complex structures. It also let you "to program" your antenna model.
But the most advantage of letting the nec file symbolic, you can
optimize the antenna parameters.
I tried and constructed many antenna models and wont miss the
optimizer tool from 4nec2.

I am wondering, that nobody made such a tool till now.

Aziz


What you are looking for is essentially a way to specify a mechanical
design, which would then be processed into an appropriate description
for a modeling code to use.

For trivial antennas, it would be pretty easy to have a text language to
describe things. You could have macros and such. However, at a basic
level, all you're doing is exchanging the somewhat cryptic NEC cards for
something more readable.

As soon as it gets more complex, you're looking at defining your own
shape/geometry definition language, and that's quite a chore.. and has
been done to boot.

A better approach is to use an off the shelf drawing package of some
sort, and build a parser that takes the mechanical drawing and turns it
into a EM model. In the commercial world, there's a lot of activity for
this sort of gridding process.

Typically you'd start with something like an IGES or DXF file.




[email protected] June 19th 07 01:02 AM

Antenna programming tool/language/compiler/preprocessor?
 
Keep it, I'll write my own ... :-)

Regards,
JS

Ok, I will wait for your ones and save time and effort.
;-)
Aziz


[email protected] June 19th 07 01:41 AM

Antenna programming tool/language/compiler/preprocessor?
 
Hi Richard,

I am really not happy with old stuff like NEC-Cards. And I do not want
do a lot of work. But a minimum of command set must be interpreted.
For the translation of primitive objects (#SP3, #SP4, #Horn, #Box,
#Tube, #Pipe, #SPArc), I am only using simple CM, CE, GW, SP, SC and
GM cards.
For symbols (variables) I am using only the extension SY of 4nec2.
Any other cards, that can not be detected from the parser, they are
simply passed through without changing. Of course, some comment line
transformation must also be done. Thats all.
Complex data type structures would explode the amount of work. I want
to keep the pre-processor as simple as possible. The pre-processor is
a NEC-processor and not a compiler.

However, there are some good ideas built in:
- fully symbolic (SY abc=..) NEC-code generation or hard wired
(calculated) NEC-code
- SP3 (triangle), SP4 (quadrilateral) can be divided into more small
peaces (segmentation)
- easy to use primitive objects
- complex (hierarchical) object transformation (move, rotation,
scaling does not work due to NEC limitation)
- surface-patch or wire-mode support, without changing the model
- hotspots, where parts of structures or locations can be masked out
(-----!)
- generator modules (parabolic reflector, helix, etc.)
- program control commands
- programable antenna models

Again, I am not re-inventing C. I am only using the syntax whenever
possible. That is the difference.

Now, many old neglected deposits from the pre-processor must be
redesigned and improved. I am doing this step by step. Of course, a
good BNF notation and implementation would simplfy many things. I will
do this for the future version may be.

Regards,
Aziz


John Smith I June 19th 07 04:07 AM

Antenna programming tool/language/compiler/preprocessor?
 
wrote:
Keep it, I'll write my own ... :-)

Regards,
JS

Ok, I will wait for your ones and save time and effort.
;-)
Aziz


LOL!

You flatter me, however, if I don't have to provide user support ... OK!

Regards,
JS

John Smith I June 19th 07 04:08 AM

Antenna programming tool/language/compiler/preprocessor?
 
Richard Clark wrote:
On Mon, 18 Jun 2007 02:27:28 -0700, wrote:

Sorry Richard,

no source code will be available for anybody. Only binaries and
antenna models.
But the expression-syntax is shown below:
(you must convert the text below to courier font, to see the diagram
right).


Hi Aziz,

OK, all pretty conventional stuff 30 years ago. So what is the
problem with abstracting a symbolic wrapper to level 1 to make it
generally useful?

As I said, there's no reason why your work can't survive, my question
was why do you simply re-invent C, a language as dead to antenna
designers as Sanskrit?

73's
Richard Clark, KB7QHC


Richard, I'd like you a whole lot more if you would just pick up the "C"
syntax and quit your complaining grin!

Regards,
JS

Richard Clark June 19th 07 07:40 AM

Antenna programming tool/language/compiler/preprocessor?
 
On Mon, 18 Jun 2007 20:08:49 -0700, John Smith I
wrote:

Richard, I'd like you a whole lot more if you would just pick up the "C"


Nutz! And I thought I had the bathing suit competition in the palm of
my hand.

73's
Richard Clark, KB7QHC

John Smith I June 19th 07 04:08 PM

Antenna programming tool/language/compiler/preprocessor?
 
Richard Clark wrote:

...
Nutz! And I thought I had the bathing suit competition in the palm of
my hand.

73's
Richard Clark, KB7QHC


ROFLOL!

Regards,
JS


All times are GMT +1. The time now is 08:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
RadioBanter.com