mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
DP hook: fix if that is never reached and check config in check()
Signed-off-by: Niklas Eiling <niklas.eiling@eonerc.rwth-aachen.de>
This commit is contained in:
parent
1e0bfa9b73
commit
08a26bf324
1 changed files with 22 additions and 2 deletions
|
@ -196,9 +196,11 @@ public:
|
|||
assert(state != State::STARTED);
|
||||
|
||||
if (signal_name) {
|
||||
signal_index = signals->getIndexByName(signal_name);
|
||||
if (signal_index < 0)
|
||||
int si = signals->getIndexByName(signal_name);
|
||||
if (si < 0) {
|
||||
throw RuntimeError("Failed to find signal: {}", signal_name);
|
||||
}
|
||||
signal_index = si;
|
||||
}
|
||||
|
||||
if (inverse) {
|
||||
|
@ -245,6 +247,24 @@ public:
|
|||
state = State::PREPARED;
|
||||
}
|
||||
|
||||
virtual void check() {
|
||||
assert(state == State::PARSED);
|
||||
|
||||
if (signal_index < 0)
|
||||
throw RuntimeError("Signal index not set");
|
||||
|
||||
if (fharmonics_len <= 0)
|
||||
throw RuntimeError("No harmonics given");
|
||||
|
||||
if (timestep <= 0)
|
||||
throw RuntimeError("Invalid timestep");
|
||||
|
||||
if (f0 <= 0)
|
||||
throw RuntimeError("Invalid fundamental frequency");
|
||||
|
||||
state = State::CHECKED;
|
||||
}
|
||||
|
||||
virtual Hook::Reason process(struct Sample *smp) {
|
||||
if (signal_index >= smp->length)
|
||||
return Hook::Reason::ERROR;
|
||||
|
|
Loading…
Add table
Reference in a new issue