SIMLIB/C++
3.09
Toggle main menu visibility
Loading...
Searching...
No Matches
src
delay.h
Go to the documentation of this file.
1
/////////////////////////////////////////////////////////////////////////////
2
//! \file delay.h Simple delay block interface
3
//
4
// Copyright (c) 1998-2016 Petr Peringer
5
//
6
// This library is licensed under GNU Library GPL. See the file COPYING.
7
//
8
9
//
10
// This is the interface for delay blocks
11
//
12
// TODO: WARNING: needs some testing --- this is the prototype
13
//
14
15
#ifndef __SIMLIB__
16
# error "delay.h: 16: you should include simlib.h first"
17
#endif
18
#if __SIMLIB__ < 0x0213
19
# error "delay.h: 19: requires SIMLIB version 2.13 and higher"
20
#endif
21
22
namespace
simlib3
{
23
24
////////////////////////////////////////////////////////////////////////////
25
/// continuous signal delay block
26
class
Delay
:
public
aContiBlock1
{
27
Delay
(
const
Delay
&);
// disable copy ctor
28
void
operator=
(
const
Delay
&);
// disable assignment
29
protected
:
// status
30
public
:
//TODO:## repair
31
#ifdef SIMLIB_public_Delay_Buffer
32
/// abstract base class: memory for delayed signal samples
33
struct
Buffer
{
34
virtual
void
put
(
double
value,
double
time) = 0;
//!< sample
35
virtual
double
get
(
double
time) = 0;
//!< get interpolated value
36
virtual
void
clear
() = 0;
//!< initialize buffer
37
virtual
~Buffer
() {};
38
};
39
#else
40
struct
Buffer;
//!< memory for delayed signal samples
41
#endif
42
protected
:
//TODO:## repair
43
double
last_time
;
//!< last output time (for optimization)
44
double
last_value
;
//!< last output value
45
Buffer
*
buffer
;
//!< memory for past values
46
protected
:
// parameters
47
double
dt
;
//!< Parameter: delay time (should be > MaxStep)
48
double
initval
;
//!< initial value (used at start)
49
public
:
// interface
50
Delay
(
Input
i,
double
dt
,
double
initvalue=0);
// dt > MaxStep
51
~Delay
();
52
void
Init
();
//!< initialize delay block
53
void
Sample
();
//!< sample input (called automatically)
54
double
Value
()
override
;
//!< output of continuous delay block
55
double
Set
(
double
newDT);
//!< change delay time (EXPERIMENTAL)
56
};
// class Delay
57
58
}
// namespace
59
simlib3::Delay::Delay
Delay(const Delay &)
simlib3::Delay::operator=
void operator=(const Delay &)
simlib3::Delay::Value
double Value() override
output of continuous delay block
Definition
delay.cc:223
simlib3::Delay::last_time
double last_time
memory for delayed signal samples
Definition
delay.h:43
simlib3::Delay::Init
void Init()
initialize delay block
Definition
delay.cc:207
simlib3::Delay::Set
double Set(double newDT)
change delay time (EXPERIMENTAL)
Definition
delay.cc:239
simlib3::Delay::last_value
double last_value
last output value
Definition
delay.h:44
simlib3::Delay::Sample
void Sample()
sample input (called automatically)
Definition
delay.cc:215
simlib3::Delay::initval
double initval
initial value (used at start)
Definition
delay.h:48
simlib3::Delay::dt
double dt
Parameter: delay time (should be > MaxStep).
Definition
delay.h:47
simlib3::Delay::buffer
Buffer * buffer
memory for past values
Definition
delay.h:45
simlib3::Input
continuous block connection (transparent reference) wrapper for pointer to objects of aContiBlock der...
Definition
simlib.h:900
simlib3::aContiBlock1::aContiBlock1
aContiBlock1(Input i)
constructor for blocks with single input
Definition
continuous.cc:61
simlib3
Implementation of class CalendarList interface is static - using global functions in SQS namespace.
Definition
algloop.cc:32
simlib3::Delay::Buffer
abstract base class for delayed signal samples storage
Definition
delay.cc:91
simlib3::Delay::Buffer::put
virtual void put(double value, double time)=0
store value
simlib3::Delay::Buffer::clear
virtual void clear()=0
initialize buffer
simlib3::Delay::Buffer::get
virtual double get(double time)=0
read interpolated value
Generated on
for SIMLIB/C++ by
1.18.0