From 52a3691bcfd04443a8344389cfd0f3edd0e74af1 Mon Sep 17 00:00:00 2001 From: Mark Allyn Date: Thu, 21 May 2026 10:04:44 -0700 Subject: [PATCH] add particulars for traffic control and boat radar ppi --- CLAUDE.md | 286 +++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 263 insertions(+), 23 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index f60130d..10b399e 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -191,17 +191,21 @@ These are knobs on the panel once that is built. Keyboard keys until then overall sensitivity - keyboard q for lower; w for higher 4. STC Range - range to which sensitivity to closer targets is effective keyboard e for lower; r for higher -5. Radiogoniometer knob for Chain Home; keyboard t for left turn; y for right turn. -6. Maximum Range for all scopes except for chain home, which is fixed. This control +5. Noise filter for rain noise. This is for the ppi scopes. keyboard t for decrease filtering and y + to increase filtering +6. Radiogoniometer knob for Chain Home; keyboard u for left turn; i for right turn. +7. Maximum Range for all scopes except for chain home, which is fixed. This control will not operate for Chain Home. These maximum range selections will be defined for each scope; If you try to go beyond the stated maximum ranges, the control will have no effect; note that the default maximum range would - be the highest for that scope; keyboard u for lower; i for higher -7. Range Cursor (for ppi scopes, not for a scopes) keyboard o for lower; p for higher -8. Bearing Cursor (for all ppi scopes; not for a scopes) - keyboard a for counterclockwise s for clockwise -9. Bearing for Marine A Scope. This is not for a cursor, but this operates the motor - that revolves the antenna unit keyboard d for counterclockwise and f for clockwise + be the highest for that scope; keyboard o for lower; p for higher +8. Range Cursor (for ppi scopes, not for a scopes) keyboard a for lower; s for higher +9. Bearing Cursor (for all ppi scopes; not for a scopes) + keyboard d for counterclockwise f for clockwise +10. Bearing for Marine A Scope. This is not for a cursor, but this operates the motor + that revolves the antenna unit keyboard g for counterclockwise and h for clockwise +11. Noise filter for rain noise. This is for the ppi scopes. keyboard j for decrease filtering and k + to increase filtering Notes; I am maintaining control separation between radiogon, marine a scope bearing, and ppi bearing. However, when I make the control panel, those will be combined as one physical knob with three @@ -593,6 +597,150 @@ Individual scope informations 3. **Sweep Intersect Envelope:** Energy returns climb from the noise floor, achieve peak voltage at perfect cross-coincidence, and fade back down into the receiver noise as the sweep line passes the target. + Very important note on PPI radars: Definition of the 'top of the scope' and the graticule: + + For a marine traffic control center radar, the top of the scope or 0 degrees is true north. + It does not move sice the control center radar does not move. + + for a boat, the top of the scope is the bow of the boat (where are you heading). The zero + degrees on the graticule is still true north. The graticule is rotated by a small motor that + is tied to the boat's gyro compass. This allows the instinctive behavior of the skipper to + look forward by looking at the top of the scope. + + Another importand note. The circular sweep on the scopr is clockwise. The degree ticks on the + graticule count clockwise from true north. + + Note on blooming. If the signal on the grid of the crt is too great, the + brightness will no longer increase, but there will be a slight blooming of + the target. + + This is suggested example psudeo code for the target shader + for both the radar equation as well as the blooming + + Note that values will change depending on the scope being used (traffic control or boat) + + ------------------------------------------------------------------- + +// Fragment Shader snippet for a single radar return +uniform float user_gain; // 0.0 to 1.0 +uniform float selected_range; // e.g., 6.0 Nautical Miles + +// Target attributes passed in or looked up from a texture/buffer +struct RadarTarget { + float range; // Distance from radar center + float azimuth; // Angle in radians + float RCS; // Radar Cross Section +}; + +void main() { + // Current fragment coordinates in Polar space + float frag_range = current_fragment_range(); + float frag_azimuth = current_fragment_azimuth(); + + // 1. Calculate raw received power via Radar Equation + float R4 = pow(RadarTarget.range, 4.0); + float P_r = (Pt * G_squared * lambda_squared * RadarTarget.RCS) / (pow(4.0 * 3.14159, 3.0) * R4 * L); + + // 2. Apply the 1960s Logarithmic IF Amplifier compression + float V_echo = log(1.0 + P_r * 1000.0); + float V_total = user_gain * V_echo; + + // 3. Dynamic Blooming Coefficients + // As V_total exceeds 1.0 (saturation), expand the search/paint radius + float saturation = max(0.0, V_total - 1.0); + + float dynamic_range_width = baseline_pulse_width + (0.05 * saturation); + float dynamic_azimuth_width = baseline_beamwidth + (0.02 * pow(saturation, 2.0)); + + // 4. Compute Distance from current fragment to the true target center + float d_range = abs(frag_range - RadarTarget.range); + float d_azimuth = abs(frag_azimuth - RadarTarget.azimuth); + + // 5. Evaluate a Gaussian blur shape using the bloomed dimensions + float radial_paint = exp(-pow(d_range / dynamic_range_width, 2.0)); + float azimuth_paint = exp(-pow(d_azimuth / dynamic_azimuth_width, 2.0)); + + float final_intensity = V_total * radial_paint * azimuth_paint; + + // Clamp to CRT max brightness + gl_FragColor = vec4(final_intensity * phosphor_color, 1.0); +} + +------------------------------------------------------------------------------------ + +===================================================================================== + +PPI Radar Equiation + + =================================================================================== + For vessel traffic control radar: + + Transmitter Peak Power - float transmitter_peak; 25.0 KW + Frequency - float frequency; 9.375 GHZ + Wavelength - float wavelength; 0.032 meters + Receiver Noise Figure - float nf; 11 dB + System Losses - flost sl; 8 dB + Antenna Beam Width - float beamwidth; 0.7 degrees + Pulse width - float pulsewidth; 0.1 microsecond + Pulse Rep Rate lookup table based on selected maximum range - float prf; + 1.5 nm range PRF 3500. HZ + 6 nm range PRF 2000. HZ + 12 nm range 1000. HZ + Radar Antenna Rotation Rate float antenna_rpm; 15 RPM + + Receiver gain notes: + Raw gain is about 100 dB + However the gain is logarithmic. It compressed the massive dynamic range + of real-world echoes so that a giant ship and a small wooden fishing + boat could both be visible on the CRT at the same time without the operator + constantly riding the gain knob. + + The operator would turn the Gain knob up until the background + of the CRT just started to fill with a faint, shimmering, dancing + texture of fine static sparks (often called "grass" or "receiver noise"). + + If the gain was too low, weak echoes from distant targets or small + fiberglass boats in Bellingham Bay wouldn't have enough voltage + to overcome the CRT's grid cutoff, leaving them completely invisible. + If the gain was too high, the screen would "blossom" with solid white noise, + blinding the operator entirely. + + ====================================================================== + + For Polce or coast guard boat radar: + + Transmitter Peak Power - float transmitter_peak; 15.0 KW + Frequency - float frequency; 9.375 GHZ + Wavelength - float wavelength; 0.032 meters + Receiver Noise Figure - float nf; 11 dB + System Losses - flost sl; 8 dB + Antenna Beam Width - float beamwidth; 1.2 degrees + Pulse Rep Rate lookup table based on selected maximum range - float prf; + 1.0 nm range PRF 4000. HZ + 3 nm range PRF 3000. HZ + 6 nm range 1000. HZ + Pulse width - float pulsewidth; 0.1 microsecond + Radar Antenna Rotation Rate float antenna_rpm; 25 RPM + + Receiver gain notes: + Raw gain is about 100 dB + However the gain is logarithmic. It compressed the massive dynamic range + of real-world echoes so that a giant ship and a small wooden fishing + boat could both be visible on the CRT at the same time without the operator + constantly riding the gain knob. + + The operator would turn the Gain knob up until the background + of the CRT just started to fill with a faint, shimmering, dancing + texture of fine static sparks (often called "grass" or "receiver noise"). + + If the gain was too low, weak echoes from distant targets or small + fiberglass boats in Bellingham Bay wouldn't have enough voltage + to overcome the CRT's grid cutoff, leaving them completely invisible. + If the gain was too high, the screen would "blossom" with solid white noise, + blinding the operator entirely. + + ===================================================================== + Graticules - These are plastic overlays over the face of the scope. They are for the purposes of showing the bearing. They are calibrated in degrees; short line (1/8 inch) each degree; medium line (1/4 inch) for every 5 degrees; and a longer line (1/2 inch) for every @@ -600,29 +748,121 @@ Individual scope informations Notes that these graticule lines are lit by a #47 incandescent bulb #FFB347. + There are text numeric values for every 15 degreen + + There are two rings + The bearing ticks are on the inside of the outer ring. + The numeric degree values are between the outer and inner rings. + The innter ring is the boundry for active targets and the sweep. + + ======================================================================= ================================== +End of discussion + +================================== + settings.h file suggestions: -/* Radar Hardware Constants */ +/* + * MIT License + * * Copyright (c) 2026 Mark Allyn + * * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * * Author: Mark Allyn + */ + +#pragma once + +#include + +/* ========================================================================= + DEBUGGING AND SIMULATION SWITCHES + ========================================================================= */ +#define DEBUG_DISABLE_P7_PERSISTENCE 0 /* 1 = Bypass long persistence tracking for raw debugging */ +#define DEBUG_DISABLE_TERRAIN 0 /* 1 = Hide landMASS rendering to isolate target processing */ +#define GL_DEBUG_OUTPUT_ENABLED 1 /* 1 = Attach robust driver-level diagnostic callbacks */ + +/* ========================================================================= + HISTORICAL COLOR PALETTES (HEX EMBEDDINGS) + ========================================================================= */ +/* A-Scope Graticule Backlights & Incandescent Pilot Bulbs */ +#define HEX_COLOR_PILOT_LAMP 0xFFB347 /* #FFB347 - Warm Incandescent Glow */ + +/* A-Scope Mono-Phosphor Trace Colors */ +#define HEX_COLOR_ASCOPE_EXCITATION 0x39FF14 /* #39FF14 - Vibrant Phosphor Flash */ +#define HEX_COLOR_ASCOPE_AFTERGLOW 0x004400 /* #004400 - Darker Green Decay Base */ + +/* P7 Phosphor Color Pipeline States for PPI Radars */ +#define HEX_COLOR_P7_EXCITATION 0xA0CFFF /* #A0CFFF - Bright Blue Active Beam Flash */ +#define HEX_COLOR_P7_IMMEDIATE_BLUE 0x1010FF /* #1010FF - Post-Beam 1ms Decay Core */ +#define HEX_COLOR_P7_SHORT_TERM_YG 0xE2FF80 /* #E2FF80 - Yellow Green 1s Persistent State */ +#define HEX_COLOR_P7_LONG_TERM_AMBER 0xFFA040 /* #FFA040 - Amber 10s Deep Remembrance */ +#define HEX_COLOR_P7_EXPIRATION 0x050700 /* #050700 - Near-Black Expiration Threshold */ + +/* GUI Core Color Specifications */ +#define HEX_COLOR_TEXT_WHITE 0xFFFFFF +#define HEX_COLOR_TEXT_RED 0xFF0000 +#define HEX_COLOR_TEXT_PINK 0xFFC0CB +#define HEX_COLOR_TEXT_YELLOW 0xFFFF00 + +/* ========================================================================= + HARDWARE ENVIRONMENT MATRICES + ========================================================================= */ namespace ChainHome { - const float PEAK_POWER = 500000.0f; // 500 KW - const float WAVELENGTH = 12.0f; // 12 Meters - const float ANTENNA_GAIN = 3.16f; // 5 dB expressed as linear gain - const float PULSE_WIDTH = 0.000020f; // 20 microseconds - const float BEAM_WIDTH = 150.0f; // in degrees (large floodlight) - const float PRF = 25.0f; // pulse repetition rate in times per second + const float PEAK_POWER = 500000.0f; /* 500 KW */ + const float WAVELENGTH = 12.0f; /* 12 Meters */ + const float ANTENNA_GAIN = 3.16f; /* 5 dB expressed as linear gain */ + const float PULSE_WIDTH = 0.000020f; /* 20 microseconds */ + const float BEAM_WIDTH = 150.0f; /* floodlight sector in degrees */ + const float PRF = 25.0f; /* Pulse Repetition Frequency (Hz) */ + const float MAX_RANGE_METERS = 321868.0f; /* Fixed 200 Miles */ } namespace MarineAScope { - const float PEAK_POWER = 500000.0f; // 500 KW - const float WAVELENGTH = 0.10f; // 10 cm - const float ANTENNA_GAIN = 1000.0f; // 30 dB expressed as linear gain - const float PRF = 500.0f; // pulse repetition frequency - const float HORIZONTAL_BEAMWIDTH = 2.5f; // horizontal beamwidth - const float SYSTEM_TEMPERATURE = 290.0f; // system temperature - const float NOISE_FIGURE = 20.0f; // for period receivers; this is in Db - const float BOLTZMANN_CONSTANT = 1.38e-23f; + const float PEAK_POWER = 500000.0f; /* 500 KW */ + const float WAVELENGTH = 0.10f; /* 10 cm */ + const float ANTENNA_GAIN = 1000.0f; /* 30 dB linear gain conversion */ + const float PRF = 500.0f; /* 500 Hz pulse repetition */ + const float HORIZONTAL_BEAMWIDTH = 2.5f; /* degrees */ + const float SYSTEM_TEMPERATURE = 290.0f; /* Kelvins (Ts) */ + const float NOISE_FIGURE = 20.0f; /* Early receiver noise figure in dB */ + const float BOLTZMANN_CONSTANT = 1.38e-23f; /* (k) Joules/Kelvin */ +} + +namespace MarineTrafficPPI { + const float PEAK_POWER = 25000.0f; /* 25.0 KW */ + const float FREQUENCY_HZ = 9.375e9f; /* 9.375 GHz */ + const float WAVELENGTH = 0.032f; /* 0.032 meters (3.2 cm X-Band) */ + const float NOISE_FIGURE = 11.0f; /* 11 dB */ + const float SYSTEM_LOSSES = 8.0f; /* 8 dB */ + const float HORIZONTAL_BEAMWIDTH = 0.7f; /* 0.7 degrees razor-sharp */ + const float PULSE_WIDTH = 0.1e-6f; /* 0.1 microseconds */ + const float ANTENNA_RPM = 15.0f; /* 15 RPM mechanical rotation rate */ +} + +namespace MarineBoatPPI { + const float PEAK_POWER = 15000.0f; /* 15.0 KW tactical marine */ + const float FREQUENCY_HZ = 9.375e9f; /* 9.375 GHz */ + const float WAVELENGTH = 0.032f; /* 0.032 meters (3.2 cm X-Band) */ + const float NOISE_FIGURE = 11.0f; /* 11 dB */ + const float SYSTEM_LOSSES = 8.0f; /* 8 dB */ + const float HORIZONTAL_BEAMWIDTH = 1.2f; /* 1.2 degrees */ + const float PULSE_WIDTH = 0.1e-6f; /* 0.1 microseconds */ + const float ANTENNA_RPM = 25.0f; /* 25 RPM high-frequency sweep */ }