Propagation Parameter Calculation from PPL (from Pigeon) via PropagationParameterEngine
Implementation of PropagationParameterEngine (PPE) ProgationModules and PropgationParameters. Based on issue #1. The following class diagram was created from which most classes are implemented. Currently missing:
-
FrequncySpectrum class implementation of Biquads representation as well as both conversion functions. (#2) -
PropgationParamterEngine - exportPropgationParameters() function, as the polyscribe structure still has to be created. -
export_to_wav function. (#13) -
all Modules except the PropDelay Module are missing. -
The PropagationConfig with new updated polyscribe structure. -
The usage of units via AU in both the modules and the PropagationConfig. -
Unit Tests have to be written. (#12)
Diagram not really readable but one can copy the code. Else ping me and I can export and upload a .svg. Updated class diagram, date: 14/09/2024:
classDiagram
direction TB
namespace PropagationParameterEngineNamespace{
class PropagationParameterEngine{
<<class>>
%% if size = 1 static, else dynamic
- std::unordered_map~enum; std::shared_ptr~BaseModule~~ modules
- std::unordered_map~std::string; std::unordered_map~enum; std::unique_ptr~BasePropagationParameter~~~ propagation_parameters
%% internal run function. called by generate_....
- run(PPL propagation_path_list)
+ PropagationParameterEngine(std::unordered_map~std::string; std::shared_ptr~BaseModule~~ modules)
+ generate_frequency_spectrum(PPL ppl) std::valarray~std::complex~float~~
+ generate_frequency-spectrum(PPL ppl, optional PPl old_ppl) unordered_map~string, PropagationPathUpdate~
}
class PropagationConfig{
<<Singleton>>
+ au::hertz fs
+ au::velocity speed_of_sound
+ int bins
MANY MORE SIMU PARAMS
+ ModulesConfigs modules_config
+ get_instance()
+ get_instance(Path config_path)
+ load_config(Path config_path)
}
%% End Namespace PropagationParameterEngine
}
PropagationParameterEngine o-- BaseModule : Aggregation
PropagationParameterEngine o-- BasePropagationParameter : Aggregation
PropagationConfig <-- BaseModule : subclasses get config
PropagationConfig <-- BasePropagationParameter : subclasses get config
BaseModule o-- BasePropagationParameter : Aggregation
note for PropagationParameterEngine "Is instantiated and called by main application"
note for PropagationParameterEngineNamespace "Namespaces:\n PPE\nPPE::PropModules\n PPE::PropParams"
%% MODULE CLASSES, LIKE REFLECTION, DIFFRACTION, etc.----------
namespace PropModules {
class BaseModule {
<<abstract class>>
+ virtual compute(PPL: propagation_path_list) std::unordered_map~std::string; std::unique_ptr~BasePropagationParameter~~ *
+ virtual get_identifier()* enum
}
class AirAbsorption
class SpreadingLoss
class PropDelay
class Reflection
class Diffraction
class Factory {
<<static class>>
+ Factory() = deleted;
+ static registerModule(type_index type, CreateModuleFunction module_constructor)
+ static register~ModuleConfig, Module~ Module ()
+ static unregisterModule(type_index type)
+ static unregister~ModuleConfig~()
+ static BaseModule_ptr createModule(std::shared_ptr~BaseModuleConfig~)
+ static ModulesMap createPPEModules()
}
%% End Namespace PropagationModules
}
BaseModule <|-- AirAbsorption
BaseModule <|-- SpreadingLoss
BaseModule <|-- PropDelay
BaseModule <|-- Reflection
BaseModule <|-- Diffraction
Factory o-- BaseModule : Holds all Modules
Factory o-- PropagationParameterEngine : uses
%% OUTPUT CLASSE ----------------------------------------------
namespace PropParams {
class BasePropagationParameter {
<<abstract class>>
+ virtual get_format() enum*
}
class ValueData {
<<template class>>
+ T data
+ get() T
+ set(T data)
+ get_format() enum
}
class FrequencySpectrum {
<<class>>
- struct biquads[b0,b1,b2,a0,a1,a2]
- enum current_representation
- std::valarray~std::complex~double~~ mag_phase
- std::vector~struct biquad_coeffs~ iir
+ set_frequency_spectrum(std::valarray~std:.complex~double~~ magPhase)
+ set_IIR(std::vector~struct BiquadCoeffs~ inBiquads )
+ get_frequency_spectrum() std::valarray~std::complex~double~~
+ get_IIR() std::vector~struct biquad_coeffs~
- convert_IIR_to_spectrum()
- convert_spectrum_to_IIR()
+ get_format() enum
}
}
BasePropagationParameter <|-- ValueData
BasePropagationParameter <|-- FrequencySpectrum
%% alleinestehende funktionen
class export_to_wav {
<<function>>
std::valarray~std::complex~double~~
std::filesystem::path path
int sample_rate
int channels
}
class ppe_config_webidl {
<<.webidl and polyscribe>>
User config defined in .webidl document.
Autogenerated ppe_config.hpp is used by
PropagationConfig.
Polyscribe used for de-/serialization.
}
PropagationConfig o-- ppe_config_webidl : "Reads user config from .json"
Edited by Niklas Mika