RadioPlan Antenna Service

From Maria GDK Wiki
Revision as of 10:16, 19 October 2026 by Oaa (talk | contribs) (some adjustments to the text)
Jump to navigation Jump to search

AntennaService

AntennaService is a .NET service that loads antenna definition files from disk, builds an in-memory cache, and makes antenna housing types and 2D radiation patterns available to clients over gRPC. It also provides a separate gRPC API for browsing and maintaining the underlying files.

What the service provides

  • Antenna housing type information: antenna type names, elements, ports, frequency ranges, and radiation-pattern specifications.
  • 2D radiation patterns: metadata and horizontal and vertical gain values for a pattern requested by name.
  • File maintenance tool: listing, paging, saving, removing, and renaming antenna files, plus a cache-reload operation.
  • Health checks: HTTP liveness and readiness endpoints.

Normal read requests use the in-memory cache rather than parsing files for every request.

Antenna file formats

The standard folder layout uses two related kinds of text file under antenna folder as defined in app.settings "AntennaFolder"/ element: a 2D radiation-pattern file and a housing-type (model) file that references one or more patterns.

2D radiation-pattern files

The loader uses the Planet DMS antenna pattern format. They are typically extensionless. A file has header fields such as FREQUENCY and GAIN, followed by HORIZONTAL and VERTICAL sections containing angle and relative-gain pairs. The reader requires frequency, gain, and data in both planes.

FREQUENCY 1850
GAIN 15.5 dBd
HORIZONTAL
0   0
90  12
180 20
270 12
VERTICAL
0   0
90  12
180 20
270 12

This is an illustrative excerpt, not a complete measured pattern. Frequencies are represented internally in MHz; the reader also accepts a GHz suffix. If GAIN is marked dBd, the reader adds 2.15 to express the maximum gain in dBi. The angle/gain samples represent relative loss from that maximum. The service interpolates samples into arrays at 0.1-degree resolution for each 360-degree plane; it can calculate a half-power beam width when one is not supplied.

Housing-type (model) files

Files ending in .aht or .AntennaHousingType define a housing type. Its name comes from the file name without the extension. Each pattern-reference line names a pattern file, gives its lower and upper frequency boundaries, and can include electrical tilt and port ID:

.ELEMENT 1700 2700 Y1
example_1800_4T 1700 2000 4 Y1

.ELEMENT lines describe antenna elements; the parser also recognizes .DEFAULT_RET, .SMART_ANTENNA, and .BEAM_FORMING_GAIN. A housing file can reference several patterns for different frequency bands, tilts, or ports. Referenced pattern names must match loaded pattern-file names.

In example above, example_1800_4T is the name of the antenna pattern in the folder, 1700 and 2000 is lowest and highest frequency applicable, 4 is the electrical tilt (optional) and Y1 is the port Id on the antenna housing (optional)

Standardization note: “Planet DMS” is the format name used by this codebase, while the housing-file directives describe the format this service accepts. Neither the reader nor the repository documentation establishes conformance to a particular published antenna-file standard. For interoperability, use the supplied parser and example files as the compatibility reference rather than assuming that every file labelled “Planet DMS” has identical semantics.

Reading antenna data

The read API is defined in Source\AntennaService.Contracts\Protos\antennaservice.v1.proto, in package antennaservice.contracts.v1.

RPC Use
GetAntennaServiceInfo Get the service version, configured antenna folder, request host, and last cache-refresh time.
GetAllAntennaHousingTypeInfos Get all housing types in one response.
GetAllAntennaHousingTypeInfosStream Stream housing types individually.
GetAntennaRadiationPattern2DInfo Get a 2D pattern by its antenna2DPatternName.

A typical client workflow is to fetch the housing types, select a pattern name from a housing type's AntennaRadiationPattern2DSpecInfos, then request its full horizontal and vertical gain arrays with GetAntennaRadiationPattern2DInfo. The protobuf files are the authoritative request and response definitions; the repository also contains the TPG.AntennaService.Contracts package for shared contracts.

Maintaining antenna files

The maintenance API is defined in Source\AntennaService.Contracts\Protos\antennaservice.maintenance.v1.proto. It provides file counts and lists (including paged lists), SaveAntennaFileContent, SaveAntennaHousingTypeFile, RemoveAntennaTypeFile, RenameFile, and ReloadAntennaCache. Paging requests use a page number and page size; the included Windows AntennaService.FolderMaintenance client starts at page 1.

The WPF maintenance client connects to the address configured as AppSettings:GrpcServerAddress in its own settings. In the standard folder layout, replaced or removed files are moved into an element\.backup folder. After changing files, request a cache reload and confirm the new data through the read API; do not assume a reload request waits for the refresh to finish.

Important: PatternsInSubFolders is an alternative read layout, but file-writing maintenance is not supported there by the current file-manager wiring. Avoid using maintenance write operations in that mode.

Installing and running the service

Before you start

Have these ready:

  • A release package for your operating system and architecture. Keep the entire extracted folder, including configuration files and native libraries.
  • A read- and writable location for antenna files and logs.
  • An HTTPS certificate for the hostname clients will use, unless a trusted proxy terminates TLS.

Install and configure

  1. Extract the whole release package to its intended application directory.
  2. Open appsettings.json and, if present, appsettings.Production.json in the extracted folder. The Production file overrides the shared file when the environment is Production. Replace the sample machine paths, ports, and service addresses. Do not use the sample Development settings on a deployed service.
  3. Configure the listening addresses and HTTPS certificate as described below. The bundled Production example is for local development, not a public deployment.
  4. Start the executable TPG.AntennaService.exe (or use your normal Windows service/service-hoster deployment), then check /health and /ready.

For a console start on Windows, open PowerShell in the extracted application folder and run:

.\TPG.AntennaService.exe

If you install it as a Windows service, ensure its service account has access to the application files, certificate private key, map data, ITU data, and writable prediction and log directories. Environment-variable settings must be available to the service process, not just your interactive terminal.


Configuration and deployment

Setting Purpose
AntennaFolder Required root folder containing antenna data; the folder must exist at startup.
AntennaFilesFolderMode Standard (default) or PatternsInSubFolders.
CreateHousingsDefinedBySinglePatternOnly Controls creation of housing entries derived from individual patterns.
Load3dCsvFiles Controls CSV-based 3D loading in the standard layout.
MaxAntennaPatternFileNameLength Maximum pattern filename length used by the loader.
Kestrel:EndPoints Listening addresses and HTTP/HTTPS configuration.

The service can run as a Windows service or in a container. The repository's .devops\podman.caddy.ps1 development setup starts the API and a Caddy HTTPS proxy; the documented local proxy address is https://antennaservice.tpg:26443 after configuring the local DNS alias and deployment settings.

Troubleshooting

  • If startup fails, verify that AntennaFolder exists and has the expected layout, then inspect the configured Serilog output.
  • If /ready is not healthy, antenna-file initialization is still running or has failed; its JSON response includes individual check results.
  • If a pattern lookup fails, verify its name against the housing-type specifications and confirm that the cache has refreshed after any file changes.
  • If a local HTTPS client cannot connect, check the listening address and development-certificate trust.

Deployment Strategies

For deployment strategies, see RadioPlan Service Deployment Strategies