Skip to main content

A genetic algorithm optimization based Uda-Yagi antenna generator,

Project description

genuy

A genetic algorithm-based Uda-Yagi antenna optimizer. Uses PyGAD as the GA engine and pymininec for antenna simulation to evolve element lengths and spacings that maximise gain, front-to-back ratio, and VSWR across a specified bandwidth.

Features

  • Optimizes reflector, driven element, and an arbitrary number of director elements
  • Evaluates fitness across the full bandwidth (low edge, centre, high edge) to avoid narrow-band solutions
  • Adaptive mutation and tournament selection for robust multimodal search
  • Parallel fitness evaluation using all available CPU cores
  • Exports the best solution as an MMANA-GAL .maa file

Requirements

Installation

pip install genuy

Or from source:

git clone https://github.com/r2axz/genuy
cd genuy
pip install .

Usage

genuy [OPTIONS]

Key options

Option Default Description
-n, --num-elements 4 Total number of elements (reflector + driven + directors)
-f, --frequency 145.0 MHz Target centre frequency
-b, --bandwidth 10.0 MHz Bandwidth over which to optimise
-r, --element-radius 3.0 mm Physical radius of all elements
-z, --reference-impedance 50+0j Ω Reference impedance for VSWR calculation
--num-generations 1000 Maximum number of GA generations
--num-solutions 100 Population size
--percent-mating 10.0 Percentage of population selected as parents
--save-maa (none) Save best solution to an MMANA .maa file
--plot-fitness (off) Plot fitness vs. generation after the run

Run genuy --help for the full list of options including element length bounds, spacing bounds, mutation rates, VSWR penalty settings, and wire segmentation.

Examples

Optimize a 4-element 145 MHz antenna and save the result:

genuy -n 4 -f 145 -b 10 --save-maa antenna.maa

Optimize a 6-element antenna, plot convergence, and save:

genuy -n 6 -f 145 -b 10 --num-generations 1000 --num-solutions 150 --save-maa 6el.maa --plot-fitness

Fitness function

Each candidate solution is evaluated at three frequencies — lower band edge, centre, and upper band edge. The fitness score is:

$$F = \begin{cases} \dfrac{w_\text{vswr}}{\text{VSWR}\text{worst}} + w\text{gain} \cdot G_\text{worst} + w_\text{fb} \cdot \text{FB}\text{worst} & \text{if } \text{VSWR}\text{worst} < \text{threshold} \ p_\text{vswr} + w_\text{gain} \cdot G_\text{worst} + w_\text{fb} \cdot \text{FB}_\text{worst} & \text{otherwise} \end{cases}$$

Default weights: vswr_weight=100, gain_weight=1.0, fb_weight=2.0. The hard VSWR penalty (high_vswr_penalty=-100) discourages solutions that are badly mismatched anywhere in the band.

Output

After the run the best solution is printed to stdout:

Best solution :  [0.512 0.18 0.474 0.15 0.452 0.19 0.438]
Best solution fitness :  47.23
VSWR :  1.34
Impedance :  (42.1+3.2j)
Gain :  10.8
Front-to-Back Ratio :  18.4

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

genuy-0.1.0.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

genuy-0.1.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file genuy-0.1.0.tar.gz.

File metadata

  • Download URL: genuy-0.1.0.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for genuy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2aa1a545c99a2f3aa104fbb969f7ad5306d2324ce5325228aefcdc69d8f7fdae
MD5 c6b5a1aea89a31e2e2bc7d1076006345
BLAKE2b-256 9c9a221e14883b450be2c154d13c7a64994241c5f27ded648205586b9903bd72

See more details on using hashes here.

File details

Details for the file genuy-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: genuy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for genuy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a9ddee64d513d008f37194192bd309dd2c180326a22313a8b1f7de2544f7218d
MD5 c4854c7b8c2ce96482a9fed11fd0b284
BLAKE2b-256 e37d93c945dfcdb1ea8f6fd26d3fc6b76eda3b2104c982a49d5bbc89b11b5f6c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page