summaryrefslogtreecommitdiffstats
path: root/src/control.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/control.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/control.h b/src/control.h
index 587b80e..61dcd0f 100644
--- a/src/control.h
+++ b/src/control.h
@@ -13,7 +13,8 @@
#define CT_ASSERT(x) (assert(x))
#define CT_SMALL_TOL 1e-6
-#define CT_ASSERT_SMALL(x) (assert(std::abs(x) < CT_SMALL_TOL))
+#define CT_SMALL(x) (std::abs(x) < CT_SMALL_TOL)
+#define CT_ASSERT_SMALL(x) (assert(CT_SMALL))
namespace ct
{
@@ -98,12 +99,14 @@ namespace ct
struct TransferFn
{
- complex gain;
math::PolyCx num;
math::PolyCx den;
TransferFn(void);
TransferFn(math::PolyCx num, math::PolyCx den);
+ TransferFn(const TransferFn& other)
+ : num(other.num)
+ , den(other.den) {}
inline void add_pole(complex p) { den.add_root(p); }
inline void add_zero(complex z) { num.add_root(z); };
@@ -114,6 +117,8 @@ namespace ct
bool is_strictly_proper() const;
void canonicalize();
+
+ TransferFn& operator = (const TransferFn& other);
};
TransferFn operator + (const TransferFn& g, const TransferFn& h);
@@ -125,6 +130,7 @@ namespace ct
// inline TransferFn operator / (const TransferFn&
+ TransferFn cancel_zp(const TransferFn& tf, double tol = CT_SMALL_TOL);
TransferFn feedback(const TransferFn& tf, complex k = -1);
struct LocusSeries
@@ -139,7 +145,7 @@ namespace ct
};
void rlocus(const TransferFn& tf, LocusSeries& ls);
-
+ void nyquist(const TransferFn& tf, LocusSeries& ls);
struct SSModel
{