diff options
Diffstat (limited to 'Project')
-rw-r--r-- | Project/ConnectionLine.cpp | 7 | ||||
-rw-r--r-- | Project/ConnectionLine.h | 2 | ||||
-rw-r--r-- | Project/Constant.cpp | 11 | ||||
-rw-r--r-- | Project/Constant.h | 3 | ||||
-rw-r--r-- | Project/ControlEditor.cpp | 4 | ||||
-rw-r--r-- | Project/ControlEditor.h | 2 | ||||
-rw-r--r-- | Project/ControlElement.cpp | 39 | ||||
-rw-r--r-- | Project/ControlElement.h | 3 | ||||
-rw-r--r-- | Project/ControlElementContainer.cpp | 59 | ||||
-rw-r--r-- | Project/ControlElementContainer.h | 7 | ||||
-rw-r--r-- | Project/Exponential.cpp | 7 | ||||
-rw-r--r-- | Project/Exponential.h | 2 | ||||
-rw-r--r-- | Project/Gain.cpp | 9 | ||||
-rw-r--r-- | Project/Gain.h | 4 | ||||
-rw-r--r-- | Project/IOControl.cpp | 9 | ||||
-rw-r--r-- | Project/IOControl.h | 7 | ||||
-rw-r--r-- | Project/Limiter.cpp | 7 | ||||
-rw-r--r-- | Project/Limiter.h | 2 | ||||
-rw-r--r-- | Project/Multiplier.cpp | 7 | ||||
-rw-r--r-- | Project/Multiplier.h | 2 | ||||
-rw-r--r-- | Project/Project.mk | 2 | ||||
-rw-r--r-- | Project/RateLimiter.cpp | 7 | ||||
-rw-r--r-- | Project/RateLimiter.h | 2 | ||||
-rw-r--r-- | Project/Sum.cpp | 7 | ||||
-rw-r--r-- | Project/Sum.h | 2 | ||||
-rw-r--r-- | Project/SyncGenerator.cpp | 14 | ||||
-rw-r--r-- | Project/SyncGenerator.h | 19 | ||||
-rw-r--r-- | Project/TransferFunction.cpp | 10 | ||||
-rw-r--r-- | Project/TransferFunction.h | 3 |
29 files changed, 220 insertions, 39 deletions
diff --git a/Project/ConnectionLine.cpp b/Project/ConnectionLine.cpp index ea04e5e..0258f2e 100644 --- a/Project/ConnectionLine.cpp +++ b/Project/ConnectionLine.cpp @@ -184,3 +184,10 @@ void ConnectionLine::RemoveParent(Element* parent) if(element == parent) m_parentList.erase(it--); } } + +Element* ConnectionLine::GetCopy() +{ + ConnectionLine* copy = new ConnectionLine(); + *copy = *this; + return copy; +} diff --git a/Project/ConnectionLine.h b/Project/ConnectionLine.h index 98e3098..c0355cd 100644 --- a/Project/ConnectionLine.h +++ b/Project/ConnectionLine.h @@ -32,6 +32,8 @@ class ConnectionLine : public ControlElement virtual double GetValue() const { return m_value; } virtual void SetValue(double value) { m_value = value; } + + Element* GetCopy(); protected: double m_lineOffset = 0.0; diff --git a/Project/Constant.cpp b/Project/Constant.cpp index ff0ae02..f0c90fc 100644 --- a/Project/Constant.cpp +++ b/Project/Constant.cpp @@ -101,4 +101,13 @@ void Constant::SetValue(double value) m_height = m_glStringValue->getheight() + 6 + 2 * m_borderSize; UpdatePoints(); -}
\ No newline at end of file +} + +Element* Constant::GetCopy() +{ + Constant* copy = new Constant(m_elementID); + *copy = *this; + m_glStringValue = NULL; + SetValue(m_value); + return copy; +} diff --git a/Project/Constant.h b/Project/Constant.h index 9868627..3f84b91 100644 --- a/Project/Constant.h +++ b/Project/Constant.h @@ -19,10 +19,13 @@ class Constant : public ControlElement virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); } virtual bool ShowForm(wxWindow* parent, Element* element); virtual void Rotate(bool clockwise = true); + virtual void UpdateText() { SetValue(m_value); } virtual void SetValue(double value); virtual double GetValue() const { return m_value; } virtual void UpdatePoints(); + + virtual Element* GetCopy(); protected: double m_value = 1.0; diff --git a/Project/ControlEditor.cpp b/Project/ControlEditor.cpp index f361b2e..4ee12ac 100644 --- a/Project/ControlEditor.cpp +++ b/Project/ControlEditor.cpp @@ -850,6 +850,10 @@ void ControlEditor::ConsolidateTexts() if(m_firstDraw) { TransferFunction* tf = new TransferFunction(0); m_elementList.push_back(tf); + for(auto it = m_elementList.begin(), itEnd = m_elementList.end(); it != itEnd; ++it) { + ControlElement* element = *it; + element->UpdateText(); + } Redraw(); m_elementList.pop_back(); delete tf; diff --git a/Project/ControlEditor.h b/Project/ControlEditor.h index 50ef565..11e27ea 100644 --- a/Project/ControlEditor.h +++ b/Project/ControlEditor.h @@ -95,7 +95,6 @@ class ControlEditor : public ControlEditorBase virtual void SetElementsList(std::vector<ControlElement*> elementList) { m_elementList = elementList; } virtual void SetConnectionsList(std::vector<ConnectionLine*> connectionList) { m_connectionList = connectionList; } virtual void SetControlContainer(ControlElementContainer* ctrlContainer) { m_ctrlContainer = ctrlContainer; } - virtual void ConsolidateTexts(); protected: virtual void OnClose(wxCloseEvent& event); virtual void OnTestClick(wxCommandEvent& event); @@ -116,6 +115,7 @@ class ControlEditor : public ControlEditorBase void BuildControlElementPanel(); void SetViewport(); + void ConsolidateTexts(); std::vector<ConnectionLine*>::iterator DeleteLineFromList(std::vector<ConnectionLine*>::iterator& it); diff --git a/Project/ControlElement.cpp b/Project/ControlElement.cpp index 8df534a..29a1fec 100644 --- a/Project/ControlElement.cpp +++ b/Project/ControlElement.cpp @@ -15,11 +15,10 @@ Node::Node(wxPoint2DDouble position, NodeType nodeType, double borderSize) } Node::~Node() {} - void Node::SetPosition(wxPoint2DDouble position) { - m_rect = wxRect2DDouble( - position.m_x - m_rect.m_width / 2, position.m_y - m_rect.m_height / 2, m_rect.m_width, m_rect.m_height); + m_rect = wxRect2DDouble(position.m_x - m_rect.m_width / 2, position.m_y - m_rect.m_height / 2, m_rect.m_width, + m_rect.m_height); m_triPts[0] = GetPosition() + wxPoint2DDouble(-m_radius - m_rect.GetSize().GetWidth() / 2, m_radius); m_triPts[1] = GetPosition() + wxPoint2DDouble(-m_radius - m_rect.GetSize().GetWidth() / 2, -m_radius); m_triPts[2] = GetPosition() + wxPoint2DDouble(-m_radius + 1, 0); @@ -35,7 +34,6 @@ void Node::StartMove(wxPoint2DDouble position) } void Node::Move(wxPoint2DDouble position) { SetPosition(m_movePos + position - m_moveStartPt); } - wxPoint2DDouble Node::GetPosition() const { return m_rect.GetPosition() + wxPoint2DDouble(m_rect.GetSize().GetWidth() / 2, m_rect.GetSize().GetHeight() / 2); @@ -47,17 +45,17 @@ void Node::RotateTriPt(double angle) wxPoint2DDouble rectCenter = m_rect.GetPosition() + wxPoint2DDouble(m_rect.GetSize().GetWidth() / 2.0, m_rect.GetSize().GetHeight() / 2.0); m_triPts[0] = wxPoint2DDouble(std::cos(radAngle) * (m_triPts[0].m_x - rectCenter.m_x) - - std::sin(radAngle) * (m_triPts[0].m_y - rectCenter.m_y) + rectCenter.m_x, - std::sin(radAngle) * (m_triPts[0].m_x - rectCenter.m_x) + - std::cos(radAngle) * (m_triPts[0].m_y - rectCenter.m_y) + rectCenter.m_y); + std::sin(radAngle) * (m_triPts[0].m_y - rectCenter.m_y) + rectCenter.m_x, + std::sin(radAngle) * (m_triPts[0].m_x - rectCenter.m_x) + + std::cos(radAngle) * (m_triPts[0].m_y - rectCenter.m_y) + rectCenter.m_y); m_triPts[1] = wxPoint2DDouble(std::cos(radAngle) * (m_triPts[1].m_x - rectCenter.m_x) - - std::sin(radAngle) * (m_triPts[1].m_y - rectCenter.m_y) + rectCenter.m_x, - std::sin(radAngle) * (m_triPts[1].m_x - rectCenter.m_x) + - std::cos(radAngle) * (m_triPts[1].m_y - rectCenter.m_y) + rectCenter.m_y); + std::sin(radAngle) * (m_triPts[1].m_y - rectCenter.m_y) + rectCenter.m_x, + std::sin(radAngle) * (m_triPts[1].m_x - rectCenter.m_x) + + std::cos(radAngle) * (m_triPts[1].m_y - rectCenter.m_y) + rectCenter.m_y); m_triPts[2] = wxPoint2DDouble(std::cos(radAngle) * (m_triPts[2].m_x - rectCenter.m_x) - - std::sin(radAngle) * (m_triPts[2].m_y - rectCenter.m_y) + rectCenter.m_x, - std::sin(radAngle) * (m_triPts[2].m_x - rectCenter.m_x) + - std::cos(radAngle) * (m_triPts[2].m_y - rectCenter.m_y) + rectCenter.m_y); + std::sin(radAngle) * (m_triPts[2].m_y - rectCenter.m_y) + rectCenter.m_x, + std::sin(radAngle) * (m_triPts[2].m_x - rectCenter.m_x) + + std::cos(radAngle) * (m_triPts[2].m_y - rectCenter.m_y) + rectCenter.m_y); } void Node::Rotate(bool clockwise) @@ -86,14 +84,8 @@ bool Node::Contains(wxPoint2DDouble position) const return m_rect.Contains(position); } -ControlElement::ControlElement(int id) - : Element() -{ - m_elementID = id; -} - +ControlElement::ControlElement(int id) : Element() { m_elementID = id; } ControlElement::~ControlElement() {} - void ControlElement::DrawNodes() const { for(auto it = m_nodeList.begin(), itEnd = m_nodeList.end(); it != itEnd; ++it) { @@ -127,3 +119,10 @@ bool ControlElement::Solve(double input, double timeStep) m_output = input; return true; } + +void ControlElement::ReplaceNode(Node* oldNode, Node* newNode) +{ + for(unsigned int i = 0; i < m_nodeList.size(); i++) { + if(m_nodeList[i] == oldNode) m_nodeList[i] = newNode; + } +} diff --git a/Project/ControlElement.h b/Project/ControlElement.h index 1e60f97..7d0e620 100644 --- a/Project/ControlElement.h +++ b/Project/ControlElement.h @@ -62,7 +62,8 @@ class ControlElement : public Element void SetNodeList(std::vector<Node*> nodeList) { m_nodeList = nodeList; } std::vector<Node*> GetNodeList() const { return m_nodeList; } virtual void DrawNodes() const; - + virtual void ReplaceNode(Node* oldNode, Node* newNode); + virtual void UpdateText() {} virtual bool IsSolved() const { return m_solved; } virtual void SetSolved(bool solved = true) { m_solved = solved; } virtual bool Solve(double input, double timeStep); diff --git a/Project/ControlElementContainer.cpp b/Project/ControlElementContainer.cpp index f8accdc..edfe684 100644 --- a/Project/ControlElementContainer.cpp +++ b/Project/ControlElementContainer.cpp @@ -76,3 +76,62 @@ void ControlElementContainer::FillContainer(std::vector<ControlElement*> control } } } + +void ControlElementContainer::GetContainerCopy(std::vector<ControlElement*>& controlElementList, + std::vector<ConnectionLine*>& connectionLineList) +{ + controlElementList.clear(); + connectionLineList.clear(); + + // Copy connection lines + for(auto it = m_cLineList.begin(), itEnd = m_cLineList.end(); it != itEnd; ++it) { + ConnectionLine* copy = static_cast<ConnectionLine*>((*it)->GetCopy()); + connectionLineList.push_back(copy); + } + + // Copy elements (exept connection line). + int nodeID = 0; + for(auto it = m_ctrlElementsList.begin(), itEnd = m_ctrlElementsList.end(); it != itEnd; ++it) { + Element* oldElement = *it; + ControlElement* copy = static_cast<ControlElement*>(oldElement->GetCopy()); + controlElementList.push_back(copy); + // Copy nodes. + std::vector<Node*> nodeList = copy->GetNodeList(); + std::vector<Node*> nodeListCopy; + for(auto itN = nodeList.begin(), itEndN = nodeList.end(); itN != itEndN; ++itN) { + Node* node = *itN; + node->SetID(nodeID); + Node* copyNode = new Node(); + *copyNode = *node; + nodeListCopy.push_back(copyNode); + nodeID++; + } + copy->SetNodeList(nodeListCopy); + + // Replace children to copies. + auto childList = copy->GetChildList(); + for(auto itC = childList.begin(), itEndC = childList.end(); itC != itEndC; ++itC) { + ConnectionLine* child = static_cast<ConnectionLine*>(*itC); + // Replace child's parent to copy. + for(auto itCL = connectionLineList.begin(), itEndCL = connectionLineList.end(); itCL != itEndCL; ++itCL) { + ConnectionLine* copyLine = *itCL; + if(copyLine->GetID() == child->GetID()) { + // Replace node. + nodeList = child->GetNodeList(); + for(auto itN = nodeList.begin(), itEndN = nodeList.end(); itN != itEndN; ++itN) { + Node* node = *itN; + for(auto itCN = nodeListCopy.begin(), itEndCN = nodeListCopy.end(); itCN != itEndCN; ++itCN) { + Node* nodeCopy = *itCN; + if(node->GetID() == nodeCopy->GetID()) { + copyLine->ReplaceNode(node, nodeCopy); + break; + } + } + } + copyLine->ReplaceParent(oldElement, copy); + copy->ReplaceChild(child, copyLine); + } + } + } + } +} diff --git a/Project/ControlElementContainer.h b/Project/ControlElementContainer.h index 119ba82..62b63e3 100644 --- a/Project/ControlElementContainer.h +++ b/Project/ControlElementContainer.h @@ -24,9 +24,12 @@ class ControlElementContainer ~ControlElementContainer(); virtual void FillContainer(ControlEditor* editor); - virtual void FillContainer(std::vector<ControlElement*> controlElementList, std::vector<ConnectionLine*> connectionLineList); + virtual void FillContainer(std::vector<ControlElement*> controlElementList, + std::vector<ConnectionLine*> connectionLineList); + virtual void GetContainerCopy(std::vector<ControlElement*>& controlElementList, + std::vector<ConnectionLine*>& connectionLineList); virtual void ClearContainer(); - + std::vector<ControlElement*> GetControlElementsList() const { return m_ctrlElementsList; } std::vector<ConnectionLine*> GetConnectionLineList() const { return m_cLineList; } std::vector<Constant*> GetConstantList() const { return m_constantList; } diff --git a/Project/Exponential.cpp b/Project/Exponential.cpp index e0daeef..3ff1842 100644 --- a/Project/Exponential.cpp +++ b/Project/Exponential.cpp @@ -117,3 +117,10 @@ bool Exponential::Solve(double input, double timeStep) m_output = m_aValue * std::exp(m_bValue * input); return true; } + +Element* Exponential::GetCopy() +{ + Exponential* copy = new Exponential(m_elementID); + *copy = *this; + return copy; +} diff --git a/Project/Exponential.h b/Project/Exponential.h index e9e9511..7510266 100644 --- a/Project/Exponential.h +++ b/Project/Exponential.h @@ -24,6 +24,8 @@ public: virtual bool Solve(double input, double timeStep); + virtual Element* GetCopy(); + protected: double m_aValue = 0.001; double m_bValue = 5.0; diff --git a/Project/Gain.cpp b/Project/Gain.cpp index d2106d7..d6dc7a2 100644 --- a/Project/Gain.cpp +++ b/Project/Gain.cpp @@ -173,3 +173,12 @@ bool Gain::Solve(double input, double timeStep) m_output = input * m_value; return true; } + +Element* Gain::GetCopy() +{ + Gain* copy = new Gain(m_elementID); + *copy = *this; + m_glStringValue = NULL; + SetValue(m_value); + return copy; +} diff --git a/Project/Gain.h b/Project/Gain.h index bb9c3ce..82b2793 100644 --- a/Project/Gain.h +++ b/Project/Gain.h @@ -20,12 +20,14 @@ class Gain : public ControlElement virtual bool ShowForm(wxWindow* parent, Element* element); virtual void Rotate(bool clockwise = true); virtual void Move(wxPoint2DDouble position); - + virtual void UpdateText() { SetValue(m_value); } virtual void SetValue(double value); virtual double GetValue() const { return m_value; } virtual void UpdatePoints(); virtual bool Solve(double input, double timeStep); + + virtual Element* GetCopy(); protected: double m_value = 1.0; diff --git a/Project/IOControl.cpp b/Project/IOControl.cpp index d9ea52e..2eab8de 100644 --- a/Project/IOControl.cpp +++ b/Project/IOControl.cpp @@ -222,3 +222,12 @@ void IOControl::UpdatePoints() } } } + +Element* IOControl::GetCopy() +{ + IOControl* copy = new IOControl(m_ioFlags, m_elementID); + *copy = *this; + m_glStringValue = NULL; + SetValue(m_value); + return copy; +} diff --git a/Project/IOControl.h b/Project/IOControl.h index 8a7666f..513b008 100644 --- a/Project/IOControl.h +++ b/Project/IOControl.h @@ -28,7 +28,7 @@ class IOControl : public ControlElement virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); } virtual bool ShowForm(wxWindow* parent, Element* element); virtual void Rotate(bool clockwise = true); - + virtual void UpdateText() { SetValue(m_value); } virtual wxString GenerateText(); virtual void UpdatePoints(); @@ -36,11 +36,12 @@ class IOControl : public ControlElement virtual void SetValue(IOFlags value); virtual int GetIOFlags() const { return m_ioFlags; } virtual Node::NodeType GetType() { return m_ioNodeType; } - + + virtual Element* GetCopy(); protected: IOFlags m_value; int m_ioFlags; - + Node::NodeType m_ioNodeType = Node::NODE_IN; wxGLString* m_glStringValue = NULL; diff --git a/Project/Limiter.cpp b/Project/Limiter.cpp index cd76fba..8519482 100644 --- a/Project/Limiter.cpp +++ b/Project/Limiter.cpp @@ -96,3 +96,10 @@ bool Limiter::Solve(double input, double timeStep) return true; } + +Element* Limiter::GetCopy() +{ + Limiter* copy = new Limiter(m_elementID); + *copy = *this; + return copy; +} diff --git a/Project/Limiter.h b/Project/Limiter.h index 1585a3c..82617a7 100644 --- a/Project/Limiter.h +++ b/Project/Limiter.h @@ -26,6 +26,8 @@ public: void SetUpLimit(double upLimit) { m_upLimit = upLimit; } void SetLowLimit(double lowLimit) { m_lowLimit = lowLimit; } + virtual Element* GetCopy(); + protected: double m_upLimit = 5.0; double m_lowLimit = -5.0; diff --git a/Project/Multiplier.cpp b/Project/Multiplier.cpp index e8708c9..a44f254 100644 --- a/Project/Multiplier.cpp +++ b/Project/Multiplier.cpp @@ -115,3 +115,10 @@ bool Multiplier::Solve(double input, double timeStep) return true; } + +Element* Multiplier::GetCopy() +{ + Multiplier* copy = new Multiplier(m_elementID); + *copy = *this; + return copy; +} diff --git a/Project/Multiplier.h b/Project/Multiplier.h index 19fca71..76a8679 100644 --- a/Project/Multiplier.h +++ b/Project/Multiplier.h @@ -20,6 +20,8 @@ class Multiplier : public ControlElement virtual void UpdatePoints(); virtual bool Solve(double input, double timeStep); + + virtual Element* GetCopy(); }; #endif // MULTIPLIER_H diff --git a/Project/Project.mk b/Project/Project.mk index 191cd32..1582ff8 100644 --- a/Project/Project.mk +++ b/Project/Project.mk @@ -13,7 +13,7 @@ CurrentFileName := CurrentFilePath := CurrentFileFullPath := User :=NDSE-69 -Date :=15/05/2017 +Date :=16/05/2017 CodeLitePath :="C:/Program Files/CodeLite" LinkerName :=C:/TDM-GCC-64/bin/g++.exe SharedObjectLinkerName :=C:/TDM-GCC-64/bin/g++.exe -shared -fPIC diff --git a/Project/RateLimiter.cpp b/Project/RateLimiter.cpp index 42bede1..ea0db25 100644 --- a/Project/RateLimiter.cpp +++ b/Project/RateLimiter.cpp @@ -112,3 +112,10 @@ bool RateLimiter::Solve(double input, double timeStep) m_output = input; return true; } + +Element* RateLimiter::GetCopy() +{ + RateLimiter* copy = new RateLimiter(m_elementID); + *copy = *this; + return copy; +} diff --git a/Project/RateLimiter.h b/Project/RateLimiter.h index b1e669c..49596db 100644 --- a/Project/RateLimiter.h +++ b/Project/RateLimiter.h @@ -26,6 +26,8 @@ class RateLimiter : public ControlElement virtual bool Solve(double input, double timeStep); + virtual Element* GetCopy(); + protected: double m_upLimit = 5.0; double m_lowLimit = -5.0; diff --git a/Project/Sum.cpp b/Project/Sum.cpp index b7a4f8a..45dc80d 100644 --- a/Project/Sum.cpp +++ b/Project/Sum.cpp @@ -217,3 +217,10 @@ bool Sum::Solve(double input, double timeStep) } return true; } + +Element* Sum::GetCopy() +{ + Sum* copy = new Sum(m_elementID); + *copy = *this; + return copy; +} diff --git a/Project/Sum.h b/Project/Sum.h index f3ab4c6..72a71a5 100644 --- a/Project/Sum.h +++ b/Project/Sum.h @@ -27,6 +27,8 @@ public: virtual void UpdatePoints(); void AddInNode(); void RemoveInNode(); + + virtual Element* GetCopy(); protected: std::vector<Signal> m_signalList; diff --git a/Project/SyncGenerator.cpp b/Project/SyncGenerator.cpp index c9cb497..18d4119 100644 --- a/Project/SyncGenerator.cpp +++ b/Project/SyncGenerator.cpp @@ -144,6 +144,20 @@ Element* SyncGenerator::GetCopy() { SyncGenerator* copy = new SyncGenerator(); *copy = *this; + auto data = copy->GetElectricalData(); + + // Copy AVR + std::vector<ConnectionLine*> cLineList; + std::vector<ControlElement*> elementList; + m_electricalData.avr->GetContainerCopy(elementList, cLineList); + + ControlElementContainer* avrCopy = new ControlElementContainer(); + avrCopy->FillContainer(elementList, cLineList); + data.avr = avrCopy; + + //Copy Speed Governor + + copy->SetElectricalData(data); return copy; } diff --git a/Project/SyncGenerator.h b/Project/SyncGenerator.h index c23cb2e..282d9fa 100644 --- a/Project/SyncGenerator.h +++ b/Project/SyncGenerator.h @@ -36,8 +36,8 @@ struct SyncGeneratorElectricalData { double groundReactance = 0.0; bool groundNeutral = true; // p.u. fault data - std::complex<double> faultCurrent[3] = { std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0), - std::complex<double>(0.0, 0.0) }; + std::complex<double> faultCurrent[3] = {std::complex<double>(0.0, 0.0), std::complex<double>(0.0, 0.0), + std::complex<double>(0.0, 0.0)}; // Stability bool plotSyncMachine = false; @@ -60,20 +60,20 @@ struct SyncGeneratorElectricalData { double subXq = 0.0; double subTd0 = 0.0; double subTq0 = 0.0; - - //Control + + // Control ControlElementContainer* avr = NULL; ControlElementContainer* speedGov = NULL; }; class SyncGenerator : public Machines { -public: + public: SyncGenerator(); SyncGenerator(wxString name); ~SyncGenerator(); - - virtual Element* GetCopy(); + + virtual Element* GetCopy(); virtual void Init(); virtual void DrawSymbol() const; virtual bool GetContextMenu(wxMenu& menu); @@ -83,10 +83,11 @@ public: virtual SyncGeneratorElectricalData GetPUElectricalData(double systemPowerBase); virtual void SetElectricalData(SyncGeneratorElectricalData electricalData) { m_electricalData = electricalData; } virtual void SetNominalVoltage(std::vector<double> nominalVoltage, std::vector<ElectricalUnit> nominalVoltageUnit); -protected: + + protected: std::vector<wxPoint2DDouble> m_sinePts; SyncGeneratorElectricalData m_electricalData; }; -#endif // SYNCGENERATOR_H +#endif // SYNCGENERATOR_H diff --git a/Project/TransferFunction.cpp b/Project/TransferFunction.cpp index ebb59fb..b91627a 100644 --- a/Project/TransferFunction.cpp +++ b/Project/TransferFunction.cpp @@ -355,3 +355,13 @@ bool TransferFunction::Solve(double input, double timeStep) return true; } + +Element* TransferFunction::GetCopy() +{ + TransferFunction* copy = new TransferFunction(m_elementID); + *copy = *this; + m_glStringNum = NULL; + m_glStringDen = NULL; + UpdateTFText(); + return copy; +} diff --git a/Project/TransferFunction.h b/Project/TransferFunction.h index 19bd04e..aab4bd2 100644 --- a/Project/TransferFunction.h +++ b/Project/TransferFunction.h @@ -32,9 +32,12 @@ class TransferFunction : public ControlElement virtual void SetNumerator(std::vector<double> numerator) { m_numerator = numerator; } virtual void SetDenominator(std::vector<double> denominator) { m_denominator = denominator; } virtual void UpdateTFText(); + virtual void UpdateText() { UpdateTFText(); } virtual SpaceState GetSpaceState() { return m_ss; } virtual void CalculateSpaceState(int maxIteration = 100, double error = 1e-3); virtual bool Solve(double input, double timeStep); + + virtual Element* GetCopy(); protected: virtual void SetText(wxString numerator, wxString denominator); |