From 412ddd0fa4a6e32651619897c8606d4cbaaa1ffa Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Thu, 4 May 2017 17:03:19 -0300 Subject: Control solver class created Just the basics methods implemented --- Project/ControlElement.h | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'Project/ControlElement.h') diff --git a/Project/ControlElement.h b/Project/ControlElement.h index 1cf4e0b..8e377b2 100644 --- a/Project/ControlElement.h +++ b/Project/ControlElement.h @@ -5,7 +5,7 @@ class Node { -public: + public: enum NodeType { NODE_IN = 0, NODE_OUT }; Node(wxPoint2DDouble position = wxPoint2DDouble(0, 0), NodeType nodeType = NODE_IN, double borderSize = 0.0); @@ -13,39 +13,33 @@ public: wxRect2DDouble GetRect() const { return m_rect; } void SetRect(wxRect2DDouble rect) { m_rect = rect; } - wxPoint2DDouble GetPosition() const; void SetPosition(wxPoint2DDouble position); NodeType GetNodeType() const { return m_nodeType; } void SetNodeType(NodeType nodeType) { m_nodeType = nodeType; } - double GetRadius() const { return m_radius; } std::vector GetInTrianglePts() const { return m_triPts; } - double GetAngle() const { return m_angle; } void SetAngle(double angle) { m_angle = angle; } - void Rotate(bool clockwise = true); - + void RotateTriPt(double angle); void StartMove(wxPoint2DDouble position); void Move(wxPoint2DDouble position); bool Contains(wxPoint2DDouble position) const; - + bool IsConnected() const { return m_connected; } void SetConnected(bool connected = true) { m_connected = connected; } - int GetID() const { return m_id; } void SetID(int id) { m_id = id; } - -protected: + protected: int m_id = -1; - + wxRect2DDouble m_rect; NodeType m_nodeType; - + bool m_connected = false; wxPoint2DDouble m_moveStartPt; @@ -58,7 +52,7 @@ protected: class ControlElement : public Element { -public: + public: ControlElement(int id); ~ControlElement(); @@ -67,11 +61,17 @@ public: void SetNodeList(std::vector nodeList) { m_nodeList = nodeList; } std::vector GetNodeList() const { return m_nodeList; } - virtual void DrawNodes() const; -protected: + void SetInput(double input) { m_input = input; } + double GetInput() const { return m_input; } + double GetOutput() const { return m_output; } + virtual bool Solve() { return false; } + protected: std::vector m_nodeList; + + double m_input = 0.0; + double m_output = 0.0; }; -#endif // CONTROLELEMENT_H +#endif // CONTROLELEMENT_H -- cgit From 74d795cb074b6ae9aa93bcfacee8995d7e6d5945 Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Sat, 6 May 2017 18:28:23 -0300 Subject: Streight control solver implemented Buggy, running 2x... Why?? --- Project/ControlElement.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'Project/ControlElement.h') diff --git a/Project/ControlElement.h b/Project/ControlElement.h index 8e377b2..e2b9a29 100644 --- a/Project/ControlElement.h +++ b/Project/ControlElement.h @@ -63,14 +63,13 @@ class ControlElement : public Element std::vector GetNodeList() const { return m_nodeList; } virtual void DrawNodes() const; - void SetInput(double input) { m_input = input; } - double GetInput() const { return m_input; } - double GetOutput() const { return m_output; } - virtual bool Solve() { return false; } + virtual bool IsSolved() const { return m_solved; } + virtual void SetSolved(bool solved = true) { m_solved = solved; } + virtual bool Solve(double input) { return true; } + virtual double GetOutput() const { return m_output; } protected: std::vector m_nodeList; - - double m_input = 0.0; + bool m_solved = false; double m_output = 0.0; }; -- cgit From 9fb33a91aa22fbce6d0b74529e07af9f7781b916 Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Mon, 8 May 2017 21:43:17 -0300 Subject: Secondary branch, TF and limiter solution much work, such results --- Project/ControlElement.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Project/ControlElement.h') diff --git a/Project/ControlElement.h b/Project/ControlElement.h index e2b9a29..3744c6f 100644 --- a/Project/ControlElement.h +++ b/Project/ControlElement.h @@ -65,8 +65,13 @@ class ControlElement : public Element virtual bool IsSolved() const { return m_solved; } virtual void SetSolved(bool solved = true) { m_solved = solved; } - virtual bool Solve(double input) { return true; } + virtual bool Solve(double input) + { + m_output = input * 2.0; + return true; + } virtual double GetOutput() const { return m_output; } + virtual void SetOutput(double output) { m_output = output; } protected: std::vector m_nodeList; bool m_solved = false; -- cgit From 2ef7d2bdf1ca4a6b9ee207e4a43f3116f55c0274 Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Tue, 9 May 2017 19:23:52 -0300 Subject: Several solutions implemented --- Project/ControlElement.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'Project/ControlElement.h') diff --git a/Project/ControlElement.h b/Project/ControlElement.h index 3744c6f..cce739a 100644 --- a/Project/ControlElement.h +++ b/Project/ControlElement.h @@ -65,11 +65,7 @@ class ControlElement : public Element virtual bool IsSolved() const { return m_solved; } virtual void SetSolved(bool solved = true) { m_solved = solved; } - virtual bool Solve(double input) - { - m_output = input * 2.0; - return true; - } + virtual bool Solve(double input); virtual double GetOutput() const { return m_output; } virtual void SetOutput(double output) { m_output = output; } protected: -- cgit From d44c3a76943c90cfcbf336961d9ba3516a1c80dc Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Sat, 13 May 2017 16:13:12 -0300 Subject: Several bugs fixed, ready to pull --- Project/ControlElement.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Project/ControlElement.h') diff --git a/Project/ControlElement.h b/Project/ControlElement.h index cce739a..1e60f97 100644 --- a/Project/ControlElement.h +++ b/Project/ControlElement.h @@ -65,7 +65,7 @@ class ControlElement : public Element virtual bool IsSolved() const { return m_solved; } virtual void SetSolved(bool solved = true) { m_solved = solved; } - virtual bool Solve(double input); + virtual bool Solve(double input, double timeStep); virtual double GetOutput() const { return m_output; } virtual void SetOutput(double output) { m_output = output; } protected: -- cgit