PHP Classes

File: digital_circuit_dsp-el.md

Recommend this page to a friend!
  Packages of Christos Drogidis   Ascoos OS Digital Circuit DSP   digital_circuit_dsp-el.md   Download  
File: digital_circuit_dsp-el.md
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: Ascoos OS Digital Circuit DSP
Simulate a digital signal processing circuit
Author: By
Last change: Digital Signal Processing Pipeline
Date: 2 months ago
Size: 9,859 bytes
 

Contents

Class file image Download

Digital Signal Processing Pipeline ? DSP Case Study

> Case Study Code: ASCOOS-OS-CASESTUDY-SEC02786

???? ? ?????? ?????????? ??????????? ??? ?? Ascoos OS ??? ? ????? TDigitalCircuitHandler ????????? ???? ????? ????? ???????? ???????????? ??????? (DSP) ?? ?????? PHP, ????? ?????????? ???????????.

?? case study ????????????:

  • ?????????? ??????? ??? ?????????? ???????
  • Gaussian ? Uniform noise injection
  • FIR & IIR low?pass filtering
  • Hann?windowed FFT
  • SNR, THD, SINAD, ENOB estimation
  • latency estimation
  • JSON & CSV export
  • logging ??? debugging

?? ?????????? ????? ??? ??????, ???????????? ??? ?????????? ????????? DSP, ????????? ??? IoT, embedded simulation, audio pipelines ??? ???????????? ?????.

??????

  • ?????????? ??????? ????????????? ??????? 440 Hz
  • ???????? ??????? (Gaussian ? Uniform)
  • ???????? FIR & IIR low?pass ???????
  • ???????? FFT ?? ???????? Hann
  • ?????????? ??????? ??????????
  • ???????????: - SNR (input, FIR, IIR) - SNR improvement (gain) - THD (Total Harmonic Distortion) - SINAD (Signal?to?Noise And Distortion) - ENOB (Effective Number Of Bits)
  • ??????? ????????????? ?? JSON & CSV
  • ????????? (logging) ???? ??? ????????

?????? ??????? ??? Ascoos OS

DSP Core

  • TDigitalCircuitHandler ???????? ????? DSP: ??????, FFT, SNR, Gaussian noise, THD/SINAD/ENOB.

DSP Utilities

  • gaussianNoise() ???????? Gaussian ??????? ?? Box?Muller + caching
  • findClosestBin() ?????? ???????????? FFT bin ?? ?????
  • estimateThdSinadEnob() ??????????? THD, SINAD, ENOB ??? FFT

Export & Logging

  • toJSONFile() ??????? ??????? DSP pipeline ?? JSON
  • toCSVFile() ??????? FFT spectrum & time?domain signals
  • Logger ????????? ???? ??? ???????? ??? paths

???? ???????

? ????????? ????????? ??? ??????:

?? ?????? ????????????:

  • ?????????? ???????
  • ??????? (Gaussian/Uniform)
  • FIR/IIR filtering
  • FFT ?? Hann
  • SNR, THD, SINAD, ENOB
  • latency
  • JSON/CSV export
  • logging

????????? ??????????????

????????????????????????????????????????????????????????????????????????????????
?                              ASCOOS OS KERNEL                                ?
?                     (Electronics ? DSP ? Math Engine)                        ?
????????????????????????????????????????????????????????????????????????????????
                                      ?
                                      ?
                    ????????????????????????????????????????
                    ?      TDigitalCircuitHandler          ?
                    ?  (Filters ? FFT ? Noise ? Metrics)   ?
                    ????????????????????????????????????????
                                      ?
                                      ?
         ????????????????????????????????????????????????????????????????????
         ?                         DSP Pipeline                             ?
         ????????????????????????????????????????????????????????????????????
                                      ?
                                      ?
         ????????????????????????????????????????????????????????????????????
         ? 1. Signal Generation (Clean + Noise)                             ?
         ? 2. FIR Filtering                                                 ?
         ? 3. IIR Filtering                                                 ?
         ? 4. Hann Window                                                   ?
         ? 5. FFT (Magnitude Spectrum)                                      ?
         ? 6. SNR / THD / SINAD / ENOB                                      ?
         ? 7. Latency Estimation                                            ?
         ? 8. JSON / CSV Export                                             ?
         ? 9. Logging                                                       ?
         ????????????????????????????????????????????????????????????????????
                                      ?
                                      ?
????????????????????????????????????????????????????????????????????????????????
?                           Unified DSP Output Renderer                        ?
?      (Console Summary ? JSON Data ? CSV Files ? Logs)                        ?
????????????????????????????????????????????????????????????????????????????????

??????????????

  1. PHP ? 8.3
  2. ????????????? ?? Ascoos OS ? ?? AWES 26 Pro
  3. ??????????????? ?? ??????? `TDigitalCircuitHandler`, `TCircuitHandler` ??? `TElectronicsHandler` ???? ??? ????????? `Extras Classes Manager`.
  4. ???????? ??? paths: - `$AOS_TMP_DATA_PATH` - `$AOS_LOGS_PATH`

??? ?????????

  1. ???????????? ??? DSP Handler ?????????? ? `TDigitalCircuitHandler` ?? logging.
  2. ?????????? ??????? ??????? ???????????? 440 Hz, 1024 samples.
  3. ???????? ??????? - Gaussian (Box?Muller) - ? Uniform
  4. ???????? FIR ??????? 3?tap moving average.
  5. ???????? IIR biquad Butterworth 2?? ?????, cutoff 1800 Hz.
  6. ???????? Hann window ?????? spectral leakage.
  7. FFT ??????? ??????????? magnitude spectrum.
  8. ?????????? ??????? ?????????? Peak detection.
  9. ??????????? SNR Input, FIR, IIR + SNR gain.
  10. ??????????? THD, SINAD, ENOB ?? ????? tolerance ??? leakage.
  11. ??????? JSON ?????? dataset + metadata.
  12. ??????? CSV FFT spectrum + time?domain signals.
  13. Logging ????????? ???? ??? ????????.

?????????? ??????

$dsp = new TDigitalCircuitHandler([], $properties);

$noise = $dsp->gaussianNoise(0.03);
$fir   = $dsp->applyFIRFilter($firCoeffs, $noisySignal);
$iir   = $dsp->applyBiquadFilter($biquadCoeffs, $noisySignal);

$fft   = $dsp->fft($windowed, true);
$mag   = array_map([$dsp, 'complexMagnitude'], $fft);

$metrics = $dsp->estimateThdSinadEnob($fftFreqs, $fftMags, 440.0);

??????????? ??????????

=== DSP Simulation Results ===

Peak frequency (FFT): 440.0 Hz
Max FFT magnitude   : 0.9981

SNR (input noisy)   : 29.52 dB
SNR (after FIR)     : 33.87 dB
SNR (after IIR)     : 35.12 dB

THD (approx)        : -42.1 dB
SINAD (approx)      : 33.5 dB
ENOB (approx)       : 5.27 bits

JSON exported to: /tmp/signal_dsp_demo.json
FFT CSV exported to: /tmp/signal_dsp_fft_spectrum.csv
Time CSV exported to: /tmp/signal_dsp_time_signals.csv

?????

????? ??????

???? ? ?????? ?????????? ??? ??? Ascoos General License (AGL). ????? ?? LICENSE.md.