Some NEC questions - Canadian TV, Computing and Home Theatre Forums

 
LinkBack Thread Tools Search this Thread Display Modes

post #1 of 6 (permalink) Old 2017-11-22, 09:01 PM Thread Starter
Rookie
 
Join Date: Nov 2017
Posts: 23
Some NEC questions

Hey folks! Got a few questions about the nikiml NEC program for simulating antennas that I hope I can get some answers for from the members at this site.
If this is not posted in the proper section, my apologies and hopefully a moderator/admin will place it in the more appropriate section.


I have recently started trying to learn the ins & outs of simulating antenna builds in the NEC program and of course I am having some questions.


1) I have ran a few different nec files through the optimization and I have witnesed some files are created with the name of 'bestx_xxx' & other nec files are created with the name of best-x.xxx'. all f the files that are created seem to decrease in the 'x_xxx' values, but I am wondering why some are positive values & others are negative values? Does the positive/negative naming convention indicate that something is inherently wrong with the results with one or the other named files? Will the 'bestx_xxx' named files eventually reduce to 'best-x_xxx' as they improve? Is the NEC program designed to stop running after it figures that there can be no more improvements or will it just keep running until it hits the default of 10k iterations? Is there a file name that would be created when NEC believes it has acheived the maximum potential of the simulation?


2) AGT correction - I have noticed that if I adjust an nec file wire size to show an AGT of 0.95 - 1.05 in 4nec2, after I run the optimization in NEC, the AGT in 4nec2 is no longer within the range of 0.95 - 1.05. Well normally I would just adjust the wire size again and repeat, today I can't adjust the wire size any more to get the AGT into the acceptable range of 0.95 - 1.05. Is there anything else that I can adjust to get the AGT back to the acceptable range? I think I recall that the 'EX' card is tied into it somehow, but I haven't seen what all of the 'EX' settings are for.


3) The '-F TARGET_FUNCTION, --target-function=TARGET_FUNCTION'. The 'formulas' for this I have seen, appear to try and do a smarter optimiztion. I am confused on where the numbers are coming from and what the formulas attempt to do:


For Example:


CMD--OPT --target-function=-.5*min_net_gain-.5*ave_net_gain - I have tested this one and it appears to create a gain plot that attempts to have a similar lowest/highest frequency value & in the middle of the range it is a higher value, in other words it slopes up to the middle of the frequency range & then slopes back down to the end of the frequency range.


I have also seen the following which I am confused as to where the values are coming from and what the formulas are attempting to achieve as far as plotting goes:



CMD--OPT --target-function=(2*max_ml+8*max_gain_diff)/10
CMD--OPT --target-function=5+.5*ave_max_gain_diff-.5*ave_net_gain
CMD--OPT --target-function=.2*ave_max_gain_diff+.8*ave_gain_diff


Sorry for the abundance of questions, they have been building up & I haven't been able to solve them on my own thus far.


Thank you in advance for any members that attempt to weed through those barrage of questions!
jandrcbrt is offline  
Sponsored Links
Advertisement
 
post #2 of 6 (permalink) Old 2017-11-23, 04:49 AM Thread Starter
Rookie
 
Join Date: Nov 2017
Posts: 23
I guess I answered one of my questions. I just had a nec file while being optimized in NEC save files in the range of 'bestx_xxx' and then continue on to files being saved as 'best-x_xxx'. Weeee! Like I said, I am not sure if that is good or bad yet.
jandrcbrt is offline  
post #3 of 6 (permalink) Old 2017-11-23, 05:50 AM
 
Join Date: May 2017
Posts: 57
nikiml's Antenna pages - Nec optimization scripts

Default target is max(max_gain_diff, max_swr_diff)

(2*max_ml+8*max_gain_diff)/10 mean:
- convert SWR figure to dB of mismatch loss
- apply 20% weight for mismatch loss and 80% for gain_diff (the difference between the target net gain and the achieved net gain)

Last edited by Yurii Pylypenko; 2017-11-23 at 06:06 AM.
Yurii Pylypenko is offline  
 
post #4 of 6 (permalink) Old 2017-11-24, 04:05 PM Thread Starter
Rookie
 
Join Date: Nov 2017
Posts: 23
Thank you again Yurii.


So, would the


Quote:
CMD--OPT --target-function=.2*ave_max_gain_diff+.8*ave_gain_diff

mean apply 20% weight for ave_max_gain_diff and 80% for ave_gain_diff ?
jandrcbrt is offline  
post #5 of 6 (permalink) Old 2017-11-24, 09:07 PM
Veteran
 
Join Date: Nov 2008
Location: San Diego, CA
Posts: 3,059
Quote:
Originally Posted by jandrcbrt View Post
Hey folks! Got a few questions about the nikiml NEC program for simulating antennas that I hope I can get some answers for from the members at this site.
If this is not posted in the proper section, my apologies and hopefully a moderator/admin will place it in the more appropriate section.


I have recently started trying to learn the ins & outs of simulating antenna builds in the NEC program and of course I am having some questions.


1) I have ran a few different nec files through the optimization and I have witnessed some files are created with the name of 'bestx_xxx' & other nec files are created with the name of best-x.xxx'. all f the files that are created seem to decrease in the 'x_xxx' values, but I am wondering why some are positive values & others are negative values? Does the positive/negative naming convention indicate that something is inherently wrong with the results with one or the other named files? Will the 'bestx_xxx' named files eventually reduce to 'best-x_xxx' as they improve? Is the NEC program designed to stop running after it figures that there can be no more improvements or will it just keep running until it hits the default of 10k iterations? Is there a file name that would be created when NEC believes it has achieved the maximum potential of the simulation?

A1: The "best" file number indicates the monotonically decreasing "goodness" of the Optimization....there is nothing significant about negative numbers other than it reflects the effect of various WEIGHTINGS (you show use of fractional weights). FWIW: Although NOT required, I normalize MY Weightings....I also use Mismatch Loss (in dB) vice SWR (a non-linear scalar number), since it allows a more meaningful Apples-to-Apples Tradeoff vs other performance factors that are also in dB. I have found that fol. CMD Statements work VERY WELL, although Gain and SWR Weights frequently need to be changed based on Preliminary Results, depending on whether you want to higher "importance" Weightings for some performance parameter (e.g. SWR) versus the other parameter(s)....there is nearly ALWAYS a tradeoff of SWR vs Raw Gain. [And I ALWAYS calculate Hi-VHF EVAL performance for UHF Antennas....just in case someone asks.] IF you want a Joint Hi-VHF and UHF Optimization, add a separate line for Hi-VHF targets and adjust relative number of SAMPLE FREQS [higher or lower Freq Increments] for Hi-VHF vs UHF to adjust relative IMPORTANCE of one versus the other....since they each can feed a DIFFERENT Total number of Data Points into the single Target Function Calculation. BTW: I've never seen a problem if num-cores is higher than ACTUAL number of Hyper-Threads:

IF NO REFLECTOR:
CMD--OPT -s(470,12,20) -t(9,11) --swr-target=2.7
CMD--OPT --target-function=(max_ml+8*max_gain_diff)/9
CMD--OPT --de-np=100 -r restart.log
CMD--OPT --auto-segmentation=13 --char-impedance=300 --num-cores=12
CMD--EVAL --auto-segmentation=0 --char-impedance=300 --num-cores=12
CMD--EVAL -s(174,6,8) -s(470,12,29) --total-gain --publish

IF REFLECTOR:
CMD--OPT -s(470,12,20) -t(13,16) --swr-target=2.7 --f2r-target=20 --f2b-target=20
CMD--OPT --target-function=(4*max_ml+8*max_gain_diff+4*max_f2r_diff+max_f2b_di ff)/27
CMD--OPT --de-np=150 -r restart.log
CMD--OPT --auto-segmentation=11 --char-impedance=300 --num-cores=12
CMD--EVAL --auto-segmentation=0 --char-impedance=300 --num-cores=12
CMD--EVAL -s(174,1.5,29) -s(470,12,29) --total-gain --publish


2) AGT correction - I have noticed that if I adjust an nec file wire size to show an AGT of 0.95 - 1.05 in 4nec2, after I run the optimization in NEC, the AGT in 4nec2 is no longer within the range of 0.95 - 1.05. Well normally I would just adjust the wire size again and repeat, today I can't adjust the wire size any more to get the AGT into the acceptable range of 0.95 - 1.05. Is there anything else that I can adjust to get the AGT back to the acceptable range? I think I recall that the 'EX' card is tied into it somehow, but I haven't seen what all of the 'EX' settings are for.

A2) AGT is also dependent on selection of number of Segments in the Simulated Balun SOURCE Wire (i.e. Wire number in EX Statement) and overall Segmentation. I frequently use MANUAL Segmentation where I set number of segments in SOURCE Wire to ONE, and then adjust all other Wire Segmentations are ABOUT = Wire-Length/SOURCE-Wire-Length, hence all SEGMENTS are roughly EQUAL. 4nec2 also has AUTOSEG Feature, but you have to GUESS a Segmentation value (start with 7 and increase to say 11, 15, 21, 31, 41, etc until no more AGT "convergence" problems". The EASIEST is to TRY choosing 1 (or 3 or 5) for the number of Segments in the SOURCE and then let nikiml's OPT do the Segmentation (labeled as PythonSeg in my 4nec2 Files). When OPT completes, I usually open the "Output*.nec" file and Copy/Paste the GW Segmentations (one-by-one), EX Statement changes [if any] and COMMENTS into the ORIGINAL 4nec2 File (cuz OPT kills all of my Comments and Formatting Tabs). It is also possible that the 4nec2 model is more complicated (too many SMALL Wires) than it needs to be and can benefit from DELETING extraneous wires (e.g. 91XG model) and/or try something DIFFERENT...and try to KEEP IT SIMPLE....don't try to use NEC2 Engine to do what NEC4 Engine was designed to do. FAT Wire Models fall into this category....try to minimize the WARNINGS (and NO ERRORS)....and frequently will NOT work with excessively SMALL Simulated SOURCE Wire Sizes....so you might have to simply accept residual Errors on the order of (if you are lucky) under 0.5 dB.]


3) The '-F TARGET_FUNCTION, --target-function=TARGET_FUNCTION'. The 'formulas' for this I have seen, appear to try and do a smarter optimization. I am confused on where the numbers are coming from and what the formulas attempt to do:

A3: It would take me quite some time to dig up what nikiml has to say about HIS Target Functions.....mine are MUCH BETTER...."believe me"....and I have posted literally HUNDREDS of SUCCESSFULLY Optimized Antennas to prove it. When SWR is excessive, I reduce the "Weighting" of "max_gain" relative to "max_ml" where ml=SWR mismatch loss. And if I want to see if I can squeeze out a bit higher F/B and/or F/R Ratio at the expense of SWR and/or Gain, I can increase their "Weightings". It is all an ITERATIVE Process that typically takes 4-10+ runs before I'm convinced I have truly stumbled onto the "BEST" Optimized Tradeoff between various performance parameters.

For Example:


CMD--OPT --target-function=-.5*min_net_gain-.5*ave_net_gain - I have tested this one and it appears to create a gain plot that attempts to have a similar lowest/highest frequency value & in the middle of the range it is a higher value, in other words it slopes up to the middle of the frequency range & then slopes back down to the end of the frequency range.


I have also seen the following which I am confused as to where the values are coming from and what the formulas are attempting to achieve as far as plotting goes:



CMD--OPT --target-function=(2*max_ml+8*max_gain_diff)/10
CMD--OPT --target-function=5+.5*ave_max_gain_diff-.5*ave_net_gain
CMD--OPT --target-function=.2*ave_max_gain_diff+.8*ave_gain_diff


Sorry for the abundance of questions, they have been building up & I haven't been able to solve them on my own thus far.


Thank you in advance for any members that attempt to weed through those barrage of questions!
See embedded comments.

Antenna Simulations, Overload Calculations, etc: http://imageevent.com/holl_ands

Last edited by holl_ands; 2017-11-24 at 09:22 PM.
holl_ands is offline  
post #6 of 6 (permalink) Old 2017-11-25, 01:50 AM
 
Join Date: Dec 2008
Location: mississauga, ON
Posts: 1,241
I think that one should come up with a function based on the antenna.
Canned functions are generally good only for initial optimizations.

Lately I like to start with a simple -F "-ave_net_gain" (see the tutorial) for an antenna with a single sweep.
Generally one cannot achieve more gain than that. and it already minimizes the SWR because high SWR leads to gain losses which reduce the net gain. But...

If I don't like the curve this produces, I would try to control it by putting a target curve (with -t(target_gain1,target_gain2,...))
and a target function of the kind -F "w1*max_gain_diff+w2*ave_gain_diff" (here w1,w2 are weights of importance between 0 and 1 with sum 1)
if I don't like the SWR I would add a token in the function controlling it --swr-target=2 -F "w1*max_gain_diff+w2*ave_gain_diff + w3*max_swr_diff" .
If the F/B is insufficient I'd add a target and a function token for it, etc

And again, forcing things numerically closer to desired targets will produce lower average net gain compared to the simple -F -ave_net_gain

For multiple sweeps things are more complicated and more experimentation is needed. But the relative performance of the multiple sweeps is controlled with different target curves and using target dependent function tokens (***_gain_diff)

The initial runs can be done with relatively small --de-np, autosegmentation and sweep sampling, sacrificing accuracy for speed. Once there is a good feel for how the antenna behaves those can be increased.

I know this is too general explanation, but the generality allows flexibility.
nikiml is offline  
Reply

Quick Reply
Message:
Options

Register Now



In order to be able to post messages on the Canadian TV, Computing and Home Theatre Forums forums, you must first register.
Please enter your desired user name, your email address and other required details in the form below.

User Name:
Password
Please enter a password for your user account. Note that passwords are case-sensitive.

Password:


Confirm Password:
Email Address
Please enter a valid email address for yourself.

Email Address:
OR

Log-in









Human Verification

In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.



Thread Tools Search this Thread
Show Printable Version Show Printable Version
Email this Page Email this Page
Search this Thread:

Advanced Search
Display Modes
Linear Mode Linear Mode



Posting Rules  
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

 
For the best viewing experience please update your browser to Google Chrome