From eda5bc26f44ee9a6f83dcf8c91f17296d7fc509d Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Mon, 12 Feb 2024 14:52:43 +0100 Subject: Move into version control --- src/control.h.old | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 src/control.h.old (limited to 'src/control.h.old') diff --git a/src/control.h.old b/src/control.h.old new file mode 100644 index 0000000..3a147fc --- /dev/null +++ b/src/control.h.old @@ -0,0 +1,104 @@ +#pragma once + +#include "Eigen/Dense" +#include + +#ifndef CONTROL_H +#define CONTROL_H + + +namespace ct +{ + // Fwd declarations + template struct SSModel; + template struct TransferFn; + + namespace math + { + template + Eigen::Vector convolve1d( + const Eigen::Ref>& x + const Eigen::Ref>& y) + { + Eigen::Vector out; + + return out; + } + + Eigen::VectorXd convolve1d( + const Eigen::Ref& x, + const Eigen::Ref& y) + { + + } + } + + /* Transfer Functions for SISO and frequency domain analysis */ + template + struct TransferFn + { + Eigen::Vector, z> zeros; + Eigen::Vector, p> poles; + + explicit operator SSModel() const + { + + } + }; + + typedef TransferFn, Eigen::Dynamic, Eigen::Dynamic> TransferFnXd; + + template> + struct FreqSeries + { + size_t nsamples; + T start, end; + Eigen::VectorX f; + Eigen::VectorX data; + }; + + typedef FreqSeries FreqSeriesD; + + /* State space modelling and time domain simulaiton */ + + template + struct SSModel + { + /* State space model with + * - n dimensional state x + * - m dimensional input u + * - k dimensional output y + */ + Eigen::Matrix A; + Eigen::Matrix B; + Eigen::Matrix C; + Eigen::Matrix D; + + // SSModel(Eigen::VectorX zeros, Eigen::VectorX poles); + }; + + typedef SSModel SSModelXd; + + template + struct TimeSeries + { + size_t nsamples; + T start, end; + Eigen::VectorX t; + Eigen::MatrixX u, x, y; + + template + explicit TimeSeries(size_t nsamples, T start, T end, const SSModel& ss); + }; + + typedef TimeSeries TimeSeriesD; + + template + void response(SSModel ss, TimeSeries& ts); + + template + void step(SSModel ss, TimeSeries& ts); +} + +#endif // CONTROL_H +// vim:ts=2 sw=2 noet: -- cgit v1.2.1