#define OUTPUT_FILE "ctest.dat"
const double a1 = 1.0,
a2 = 3.25,
a3 = 16.5,
a4 = 17.5;
const double InpValue = 1.0;
const double StepPrn = 0.05;
class Filter : aContiBlock {
Integrator y2, y1, y;
public:
Filter(Input inp, double a1, double a2, double a3, double a4) :
y2((inp-a2*y2-a3*y1-a4*y)/a1),
y1(y2),
y(y1) {}
double Value() { return y.Value(); }
};
Filter
F(InpValue, a1, a2, a3, a4);
Print(
"%6.2f %.4g \n", T.
Value(),
F.Value());
}
Print(
"# CTEST -- step response of filter \n");
}
virtual double Value()=0
get block output value this method should be defined in classes derived from aContiBlock
void SetAccuracy(double _abserr, double _relerr)
set max.
void SetOutput(const char *name)
redirects Output(), Print() to file
void Run()
run simulation experiment
int Print(const char *fmt,...)
for Output methods, can be redirected
void Init(double t0, double t1=SIMLIB_MAXTIME)
Initialize simulator and model time.
const SIMLIB_statistics_t & SIMLIB_statistics
interface to internal run-time statistics structure
Main SIMLIB/C++ interface.
void Output() const
print run-time statistics to output