37#ifndef SBL_DSP_PM_LOAD_JUNCTION_HPP_
38#define SBL_DSP_PM_LOAD_JUNCTION_HPP_
56template<
typename Load>
58 static_assert(is_load_v<Load>,
"LoadJunction needs a Load (physical-modeling.md §4.1)");
75 const float g = load_.admittance();
76 const float h = load_.history();
77 const float zg = impedance_ * g;
78 const float v_load = (TWO * zg * incoming + h) / (1.0f + zg);
79 force_ = impedance_ * (TWO * incoming - v_load);
80 v_load_ = load_.commit(force_);
81 return v_load_ - incoming;
88 float force()
const {
return force_; }
90 Load&
load() {
return load_; }
91 const Load&
load()
const {
return load_; }
94 float energy()
const {
return load_.energy(); }
120 static constexpr float TWO = 2.0f;
123 float impedance_ = 1.0f;
124 float v_load_ = 0.0f;
uint8_t add_group(const char *name, uint8_t parent=NO_GROUP)
Open a group (a component); returns its id. Nodes added with it belong to it.
void add_edge(uint8_t from, uint8_t to, Wave wave)
uint8_t add_node(Kind kind, const char *name, uint8_t group, float value=0.0f, float value2=0.0f)
The scattering junction between a waveguide and a lumped load.
float force() const
The force the string put into the body this sample.
void set_impedance(float z)
float energy() const
The junction stores nothing itself; what is behind it does.
float reflect(float incoming)
Scatter one sample: the wave arriving at the bridge in, the reflection out.
float load_velocity() const
The body's velocity at the junction this sample — what it radiates, to first order.
diagram::Ports describe(diagram::Graph &g, uint8_t parent) const
The junction and its load, wired: force into the load, velocity back.
const Load & load() const
What a load, an exciter, a termination and a friction law provide (Physical modeling — cross-cutting)
A model's wiring, as data (AP-037)
@ Junction
where waves scatter or a source meets the string
Physical modeling: laws, bows, junctions, loads, resonators, strings (docs/conventions/physical-model...
The ports a component exposes after describing itself, so an owner can wire them.
void add(const char *name, uint8_t node)
Add a named port; a ninth is refused and find() answers NO_NODE for it.
uint8_t in
where a wave enters (the junction, the load)
uint8_t out
where a wave leaves (the pickup, the reflection)