summaryrefslogtreecommitdiffstats
path: root/src/control.h
diff options
context:
space:
mode:
authorNao Pross <np@0hm.ch>2024-02-12 23:58:46 +0100
committerNao Pross <np@0hm.ch>2024-02-13 00:55:20 +0100
commit6449c4d7bba3f45274b78a51871f64d429d82f8b (patch)
tree26f964a5a0db1c6f6fe8ed443f1263bb9100df2c /src/control.h
parentRemove empty files (diff)
downloadfsisotool-6449c4d7bba3f45274b78a51871f64d429d82f8b.tar.gz
fsisotool-6449c4d7bba3f45274b78a51871f64d429d82f8b.zip
Make Nyquist and Bode workHEADmaster
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
{