diff options
-rw-r--r-- | .codelite/.tern-port | 2 | ||||
-rw-r--r-- | .codelite/PSP.session | 22 | ||||
-rw-r--r-- | .codelite/PSP.tags | bin | 81105920 -> 81112064 bytes | |||
-rw-r--r-- | .codelite/compilation.db | bin | 49152 -> 49152 bytes | |||
-rw-r--r-- | .codelite/compile_commands.json | 4 | ||||
-rw-r--r-- | .codelite/refactoring.db | bin | 1347584 -> 1358848 bytes | |||
-rw-r--r-- | Project/Element.h | 2 | ||||
-rw-r--r-- | Project/Line.cpp | 98 | ||||
-rw-r--r-- | Project/Line.h | 2 | ||||
-rw-r--r-- | Project/Project.mk | 24 | ||||
-rw-r--r-- | Project/Project.project | 4 | ||||
-rw-r--r-- | Project/Project.txt | 2 | ||||
-rw-r--r-- | Project/Release/Branch.cpp.o | bin | 26901 -> 27602 bytes | |||
-rw-r--r-- | Project/Release/Bus.cpp.o | bin | 34488 -> 35205 bytes | |||
-rw-r--r-- | Project/Release/BusForm.cpp.o | bin | 112442 -> 112442 bytes | |||
-rw-r--r-- | Project/Release/Capacitor.cpp.o | bin | 31750 -> 32467 bytes | |||
-rw-r--r-- | Project/Release/Element.cpp.o | bin | 140379 -> 141096 bytes | |||
-rw-r--r-- | Project/Release/GeneratorForm.cpp.o | bin | 104712 -> 104712 bytes | |||
-rw-r--r-- | Project/Release/GeneratorStabForm.cpp.o | bin | 102403 -> 102403 bytes | |||
-rw-r--r-- | Project/Release/IndMotor.cpp.o | bin | 26067 -> 26768 bytes | |||
-rw-r--r-- | Project/Release/Inductor.cpp.o | bin | 31666 -> 32383 bytes | |||
-rw-r--r-- | Project/Release/Line.cpp.o | bin | 146683 -> 153538 bytes | |||
-rw-r--r-- | Project/Release/LineForm.cpp.o | bin | 98677 -> 98677 bytes | |||
-rw-r--r-- | Project/Release/Load.cpp.o | bin | 32495 -> 33212 bytes | |||
-rw-r--r-- | Project/Release/Machines.cpp.o | bin | 32057 -> 32758 bytes | |||
-rw-r--r-- | Project/Release/PSP-UFU.exe | bin | 3750954 -> 3758838 bytes | |||
-rw-r--r-- | Project/Release/Shunt.cpp.o | bin | 26849 -> 27566 bytes | |||
-rw-r--r-- | Project/Release/SyncGenerator.cpp.o | bin | 33578 -> 34295 bytes | |||
-rw-r--r-- | Project/Release/SyncMotor.cpp.o | bin | 22896 -> 23597 bytes | |||
-rw-r--r-- | Project/Release/Transformer.cpp.o | bin | 35788 -> 36489 bytes | |||
-rw-r--r-- | Project/Release/Workspace.cpp.o | bin | 148672 -> 151206 bytes | |||
-rw-r--r-- | Project/Workspace.cpp | 41 |
32 files changed, 151 insertions, 50 deletions
diff --git a/.codelite/.tern-port b/.codelite/.tern-port index 2fba11d..d810b32 100644 --- a/.codelite/.tern-port +++ b/.codelite/.tern-port @@ -1 +1 @@ -60504
\ No newline at end of file +59302
\ No newline at end of file diff --git a/.codelite/PSP.session b/.codelite/PSP.session index e686eb2..aa42bb8 100644 --- a/.codelite/PSP.session +++ b/.codelite/PSP.session @@ -5,8 +5,8 @@ <TabInfoArray Name="TabInfoArray"> <TabInfo> <wxString Value="C:\Users\Thales\Documents\GitHub\PSP\Project\Workspace.cpp" Name="FileName"/> - <int Value="950" Name="FirstVisibleLine"/> - <int Value="973" Name="CurrentLine"/> + <int Value="953" Name="FirstVisibleLine"/> + <int Value="986" Name="CurrentLine"/> <wxArrayString Name="Bookmarks"/> <IntVector Name="CollapsedFolds"/> </TabInfo> @@ -26,8 +26,8 @@ </TabInfo> <TabInfo> <wxString Value="C:\Users\Thales\Documents\GitHub\PSP\Project\Element.h" Name="FileName"/> - <int Value="184" Name="FirstVisibleLine"/> - <int Value="164" Name="CurrentLine"/> + <int Value="153" Name="FirstVisibleLine"/> + <int Value="177" Name="CurrentLine"/> <wxArrayString Name="Bookmarks"/> <IntVector Name="CollapsedFolds"/> </TabInfo> @@ -54,29 +54,29 @@ </TabInfo> <TabInfo> <wxString Value="C:\Users\Thales\Documents\GitHub\PSP\Project\Branch.cpp" Name="FileName"/> - <int Value="0" Name="FirstVisibleLine"/> - <int Value="0" Name="CurrentLine"/> + <int Value="37" Name="FirstVisibleLine"/> + <int Value="43" Name="CurrentLine"/> <wxArrayString Name="Bookmarks"/> <IntVector Name="CollapsedFolds"/> </TabInfo> <TabInfo> <wxString Value="C:\Users\Thales\Documents\GitHub\PSP\Project\Branch.h" Name="FileName"/> <int Value="0" Name="FirstVisibleLine"/> - <int Value="4" Name="CurrentLine"/> + <int Value="18" Name="CurrentLine"/> <wxArrayString Name="Bookmarks"/> <IntVector Name="CollapsedFolds"/> </TabInfo> <TabInfo> <wxString Value="C:\Users\Thales\Documents\GitHub\PSP\Project\Line.h" Name="FileName"/> - <int Value="0" Name="FirstVisibleLine"/> - <int Value="2" Name="CurrentLine"/> + <int Value="30" Name="FirstVisibleLine"/> + <int Value="42" Name="CurrentLine"/> <wxArrayString Name="Bookmarks"/> <IntVector Name="CollapsedFolds"/> </TabInfo> <TabInfo> <wxString Value="C:\Users\Thales\Documents\GitHub\PSP\Project\Line.cpp" Name="FileName"/> - <int Value="101" Name="FirstVisibleLine"/> - <int Value="120" Name="CurrentLine"/> + <int Value="349" Name="FirstVisibleLine"/> + <int Value="366" Name="CurrentLine"/> <wxArrayString Name="Bookmarks"/> <IntVector Name="CollapsedFolds"/> </TabInfo> diff --git a/.codelite/PSP.tags b/.codelite/PSP.tags Binary files differindex 5c5e958..070cb2c 100644 --- a/.codelite/PSP.tags +++ b/.codelite/PSP.tags diff --git a/.codelite/compilation.db b/.codelite/compilation.db Binary files differindex 2a3a9dc..26ce75b 100644 --- a/.codelite/compilation.db +++ b/.codelite/compilation.db diff --git a/.codelite/compile_commands.json b/.codelite/compile_commands.json index e9e3006..747a12e 100644 --- a/.codelite/compile_commands.json +++ b/.codelite/compile_commands.json @@ -4,10 +4,6 @@ "file": "C:\\Users\\Thales\\Documents\\GitHub\\PSP\\Project\\Workspace.cpp" }, { "directory": "C:\\Users\\Thales\\Documents\\GitHub\\PSP\\Project", - "command": "C:/TDM-GCC-64/bin/g++.exe -c C:/Users/Thales/Documents/GitHub/PSP/Project/MainFrame.cpp -O2 -Wall -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -IC:/wxWidgets-3.1.0/lib/gcc_dll/mswu -IC:/wxWidgets-3.1.0/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0 -fno-keep-inline-dllexport -std=c++11 -DNDEBUG -DUNICODE -o ./Release/MainFrame.cpp.o -I. -I.", - "file": "C:\\Users\\Thales\\Documents\\GitHub\\PSP\\Project\\MainFrame.cpp" - }, { - "directory": "C:\\Users\\Thales\\Documents\\GitHub\\PSP\\Project", "command": "C:/TDM-GCC-64/bin/g++.exe -c C:/Users/Thales/Documents/GitHub/PSP/Project/Workspace.cpp -O2 -Wall -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -IC:/wxWidgets-3.1.0/lib/gcc_dll/mswu -IC:/wxWidgets-3.1.0/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0 -fno-keep-inline-dllexport -std=c++11 -DNDEBUG -DUNICODE -o ./Release/Workspace.cpp.o -I. -I.", "file": "C:\\Users\\Thales\\Documents\\GitHub\\PSP\\Project\\Workspace.cpp" }]
\ No newline at end of file diff --git a/.codelite/refactoring.db b/.codelite/refactoring.db Binary files differindex e278706..19ffe62 100644 --- a/.codelite/refactoring.db +++ b/.codelite/refactoring.db diff --git a/Project/Element.h b/Project/Element.h index b1a7163..c1d887f 100644 --- a/Project/Element.h +++ b/Project/Element.h @@ -169,7 +169,7 @@ class Element bool DoubleFromString(wxWindow* parent, wxString strValue, double& value, wxString errorMsg); bool IntFromString(wxWindow* parent, wxString strValue, int& value, wxString errorMsg); - virtual void + virtual void SetNominalVoltage(double nominalVoltage, ElectricalUnit nominalVoltageUnit) {} protected: std::vector<Element*> m_parentList; diff --git a/Project/Line.cpp b/Project/Line.cpp index 25e0e4b..92fce64 100644 --- a/Project/Line.cpp +++ b/Project/Line.cpp @@ -116,10 +116,10 @@ bool Line::AddParent(Element* parent, wxPoint2DDouble position) if(m_electricaData.nominalVoltage != parentBus->GetEletricalData().nominalVoltage || m_electricaData.nominalVoltageUnit != parentBus->GetEletricalData().nominalVoltageUnit) { - wxMessageDialog msgDialog( - NULL, _("Unable to connect with a line two buses with different nominal voltages.\n" - "Use a transformer or edit the bus properties."), - _("Error"), wxOK | wxCENTRE | wxICON_ERROR); + wxMessageDialog msgDialog(NULL, + _("Unable to connect two buses with different nominal voltages.\n" + "Use a transformer or edit the bus properties."), + _("Error"), wxOK | wxCENTRE | wxICON_ERROR); msgDialog.ShowModal(); return false; } @@ -336,3 +336,93 @@ bool Line::ShowForm(wxWindow* parent, Element* element) lineForm->Destroy(); return false; } + +void Line::SetNominalVoltage(double nominalVoltage, ElectricalUnit nominalVoltageUnit) +{ + m_electricaData.nominalVoltage = nominalVoltage; + m_electricaData.nominalVoltageUnit = nominalVoltageUnit; +} + +bool Line::SetNodeParent(Element* parent) +{ + if(m_activeNodeID == 1 && parent == m_parentList[0]) return false; + if(m_activeNodeID == 2 && parent == m_parentList[1]) return false; + + if(parent && m_activeNodeID != 0) { + wxRect2DDouble nodeRect(0, 0, 0, 0); + if(m_activeNodeID == 1) { + nodeRect = + wxRect2DDouble(m_pointList[0].m_x - 5.0 - m_borderSize, m_pointList[0].m_y - 5.0 - m_borderSize, + 10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize); + } + if(m_activeNodeID == 2) { + nodeRect = wxRect2DDouble(m_pointList[m_pointList.size() - 1].m_x - 5.0 - m_borderSize, + m_pointList[m_pointList.size() - 1].m_y - 5.0 - m_borderSize, + 10 + 2.0 * m_borderSize, 10 + 2.0 * m_borderSize); + } + + if(parent->Intersects(nodeRect)) { + // If the line has no parents set the new nominal voltage, otherwise check if it's not connecting + // two different voltages buses + Bus* parentBus = (Bus*)parent; + if(!m_parentList[0] && !m_parentList[1]) { + m_electricaData.nominalVoltage = parentBus->GetEletricalData().nominalVoltage; + m_electricaData.nominalVoltageUnit = parentBus->GetEletricalData().nominalVoltageUnit; + } + else if(m_electricaData.nominalVoltage != parentBus->GetEletricalData().nominalVoltage || + m_electricaData.nominalVoltageUnit != parentBus->GetEletricalData().nominalVoltageUnit) + { + wxMessageDialog msgDialog(NULL, + _("Unable to connect two buses with different nominal voltages.\n" + "Use a transformer or edit the bus properties."), + _("Error"), wxOK | wxCENTRE | wxICON_ERROR); + msgDialog.ShowModal(); + m_activeNodeID = 0; + return false; + } + + if(m_activeNodeID == 1) { + // Check if the user is trying to connect the same bus. + if(m_parentList[1] == parent) { + m_activeNodeID = 0; + return false; + } + + m_parentList[0] = parent; + + // Centralize the node on bus. + wxPoint2DDouble parentPt = parent->RotateAtPosition( + m_pointList[0], -parent->GetAngle()); // Rotate click to horizontal position. + parentPt.m_y = parent->GetPosition().m_y; // Centralize on bus. + parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle()); + m_pointList[0] = parentPt; + + UpdateSwitchesPosition(); + return true; + } + if(m_activeNodeID == 2) { + if(m_parentList[0] == parent) { + m_activeNodeID = 0; + return false; + } + + m_parentList[1] = parent; + + wxPoint2DDouble parentPt = + parent->RotateAtPosition(m_pointList[m_pointList.size() - 1], -parent->GetAngle()); + parentPt.m_y = parent->GetPosition().m_y; + parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle()); + m_pointList[m_pointList.size() - 1] = parentPt; + + UpdateSwitchesPosition(); + return true; + } + } + else + { + if(m_activeNodeID == 1) m_parentList[0] = NULL; + if(m_activeNodeID == 2) m_parentList[1] = NULL; + } + } + return false; +} diff --git a/Project/Line.h b/Project/Line.h index 7dfe104..72f947d 100644 --- a/Project/Line.h +++ b/Project/Line.h @@ -40,6 +40,7 @@ class Line : public Branch virtual void Move(wxPoint2DDouble position); virtual void StartMove(wxPoint2DDouble position); virtual void MoveNode(Element* parent, wxPoint2DDouble position); + virtual bool SetNodeParent(Element* parent); virtual wxCursor GetBestPickboxCursor() const { return wxCURSOR_SIZING; } virtual bool AddParent(Element* parent, wxPoint2DDouble position); virtual bool Intersects(wxRect2DDouble rect) const; @@ -53,6 +54,7 @@ class Line : public Branch virtual bool ShowForm(wxWindow* parent, Element* element); virtual LineElectricalData GetElectricalData() const { return m_electricaData; } virtual void SetElectricalData(LineElectricalData electricalData) { m_electricaData = electricalData; } + virtual void SetNominalVoltage(double nominalVoltage, ElectricalUnit nominalVoltageUnit); protected: double PointToLineDistance(wxPoint2DDouble point, int* segmentNumber = NULL) const; LineElectricalData m_electricaData; diff --git a/Project/Project.mk b/Project/Project.mk index 12e584f..be06c54 100644 --- a/Project/Project.mk +++ b/Project/Project.mk @@ -13,7 +13,7 @@ CurrentFileName := CurrentFilePath := CurrentFileFullPath := User :=Thales -Date :=30/09/2016 +Date :=01/10/2016 CodeLitePath :="C:/Program Files/CodeLite" LinkerName :=C:/TDM-GCC-64/bin/g++.exe SharedObjectLinkerName :=C:/TDM-GCC-64/bin/g++.exe -shared -fPIC @@ -64,9 +64,9 @@ AS := C:/TDM-GCC-64/bin/as.exe CodeLiteDir:=C:\Program Files\CodeLite WXWIN:=C:\wxWidgets-3.1.0 WXCFG:=gcc_dll\mswu -Objects0=$(IntermediateDirectory)/main.cpp$(ObjectSuffix) $(IntermediateDirectory)/win_resources.rc$(ObjectSuffix) $(IntermediateDirectory)/Element.cpp$(ObjectSuffix) $(IntermediateDirectory)/ArtMetro.cpp$(ObjectSuffix) $(IntermediateDirectory)/MainFrame.cpp$(ObjectSuffix) $(IntermediateDirectory)/Workspace.cpp$(ObjectSuffix) $(IntermediateDirectory)/MainFrameBitmaps.cpp$(ObjectSuffix) $(IntermediateDirectory)/WorkspaceBitmaps.cpp$(ObjectSuffix) $(IntermediateDirectory)/BusFormBitmaps.cpp$(ObjectSuffix) $(IntermediateDirectory)/ElementFormBitmaps.cpp$(ObjectSuffix) \ - $(IntermediateDirectory)/MainFrameBase.cpp$(ObjectSuffix) $(IntermediateDirectory)/WorkspaceBase.cpp$(ObjectSuffix) $(IntermediateDirectory)/ElementForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/Bus.cpp$(ObjectSuffix) $(IntermediateDirectory)/Line.cpp$(ObjectSuffix) $(IntermediateDirectory)/Transformer.cpp$(ObjectSuffix) $(IntermediateDirectory)/Machines.cpp$(ObjectSuffix) $(IntermediateDirectory)/SyncGenerator.cpp$(ObjectSuffix) $(IntermediateDirectory)/IndMotor.cpp$(ObjectSuffix) $(IntermediateDirectory)/Branch.cpp$(ObjectSuffix) \ - $(IntermediateDirectory)/SyncMotor.cpp$(ObjectSuffix) $(IntermediateDirectory)/Shunt.cpp$(ObjectSuffix) $(IntermediateDirectory)/Load.cpp$(ObjectSuffix) $(IntermediateDirectory)/Inductor.cpp$(ObjectSuffix) $(IntermediateDirectory)/Capacitor.cpp$(ObjectSuffix) $(IntermediateDirectory)/BusForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/GeneratorForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/GeneratorStabForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/LineForm.cpp$(ObjectSuffix) +Objects0=$(IntermediateDirectory)/main.cpp$(ObjectSuffix) $(IntermediateDirectory)/win_resources.rc$(ObjectSuffix) $(IntermediateDirectory)/ArtMetro.cpp$(ObjectSuffix) $(IntermediateDirectory)/MainFrame.cpp$(ObjectSuffix) $(IntermediateDirectory)/Workspace.cpp$(ObjectSuffix) $(IntermediateDirectory)/MainFrameBitmaps.cpp$(ObjectSuffix) $(IntermediateDirectory)/WorkspaceBitmaps.cpp$(ObjectSuffix) $(IntermediateDirectory)/BusFormBitmaps.cpp$(ObjectSuffix) $(IntermediateDirectory)/ElementFormBitmaps.cpp$(ObjectSuffix) $(IntermediateDirectory)/MainFrameBase.cpp$(ObjectSuffix) \ + $(IntermediateDirectory)/WorkspaceBase.cpp$(ObjectSuffix) $(IntermediateDirectory)/ElementForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/Bus.cpp$(ObjectSuffix) $(IntermediateDirectory)/Line.cpp$(ObjectSuffix) $(IntermediateDirectory)/Transformer.cpp$(ObjectSuffix) $(IntermediateDirectory)/Machines.cpp$(ObjectSuffix) $(IntermediateDirectory)/SyncGenerator.cpp$(ObjectSuffix) $(IntermediateDirectory)/IndMotor.cpp$(ObjectSuffix) $(IntermediateDirectory)/Branch.cpp$(ObjectSuffix) $(IntermediateDirectory)/SyncMotor.cpp$(ObjectSuffix) \ + $(IntermediateDirectory)/Shunt.cpp$(ObjectSuffix) $(IntermediateDirectory)/Load.cpp$(ObjectSuffix) $(IntermediateDirectory)/Inductor.cpp$(ObjectSuffix) $(IntermediateDirectory)/Capacitor.cpp$(ObjectSuffix) $(IntermediateDirectory)/Element.cpp$(ObjectSuffix) $(IntermediateDirectory)/BusForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/GeneratorForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/GeneratorStabForm.cpp$(ObjectSuffix) $(IntermediateDirectory)/LineForm.cpp$(ObjectSuffix) @@ -107,14 +107,6 @@ $(IntermediateDirectory)/main.cpp$(PreprocessSuffix): main.cpp $(IntermediateDirectory)/win_resources.rc$(ObjectSuffix): win_resources.rc $(RcCompilerName) -i "C:/Users/Thales/Documents/GitHub/PSP/Project/win_resources.rc" $(RcCmpOptions) $(ObjectSwitch)$(IntermediateDirectory)/win_resources.rc$(ObjectSuffix) $(RcIncludePath) -$(IntermediateDirectory)/Element.cpp$(ObjectSuffix): Element.cpp $(IntermediateDirectory)/Element.cpp$(DependSuffix) - $(CXX) $(IncludePCH) $(SourceSwitch) "C:/Users/Thales/Documents/GitHub/PSP/Project/Element.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Element.cpp$(ObjectSuffix) $(IncludePath) -$(IntermediateDirectory)/Element.cpp$(DependSuffix): Element.cpp - @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Element.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Element.cpp$(DependSuffix) -MM Element.cpp - -$(IntermediateDirectory)/Element.cpp$(PreprocessSuffix): Element.cpp - $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Element.cpp$(PreprocessSuffix)Element.cpp - $(IntermediateDirectory)/ArtMetro.cpp$(ObjectSuffix): ArtMetro.cpp $(IntermediateDirectory)/ArtMetro.cpp$(DependSuffix) $(CXX) $(IncludePCH) $(SourceSwitch) "C:/Users/Thales/Documents/GitHub/PSP/Project/ArtMetro.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/ArtMetro.cpp$(ObjectSuffix) $(IncludePath) $(IntermediateDirectory)/ArtMetro.cpp$(DependSuffix): ArtMetro.cpp @@ -291,6 +283,14 @@ $(IntermediateDirectory)/Capacitor.cpp$(DependSuffix): Capacitor.cpp $(IntermediateDirectory)/Capacitor.cpp$(PreprocessSuffix): Capacitor.cpp $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Capacitor.cpp$(PreprocessSuffix)Capacitor.cpp +$(IntermediateDirectory)/Element.cpp$(ObjectSuffix): Element.cpp $(IntermediateDirectory)/Element.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "C:/Users/Thales/Documents/GitHub/PSP/Project/Element.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Element.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Element.cpp$(DependSuffix): Element.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Element.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Element.cpp$(DependSuffix) -MM Element.cpp + +$(IntermediateDirectory)/Element.cpp$(PreprocessSuffix): Element.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Element.cpp$(PreprocessSuffix)Element.cpp + $(IntermediateDirectory)/BusForm.cpp$(ObjectSuffix): BusForm.cpp $(IntermediateDirectory)/BusForm.cpp$(DependSuffix) $(CXX) $(IncludePCH) $(SourceSwitch) "C:/Users/Thales/Documents/GitHub/PSP/Project/BusForm.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/BusForm.cpp$(ObjectSuffix) $(IncludePath) $(IntermediateDirectory)/BusForm.cpp$(DependSuffix): BusForm.cpp diff --git a/Project/Project.project b/Project/Project.project index 0eeee11..de24e9b 100644 --- a/Project/Project.project +++ b/Project/Project.project @@ -9,7 +9,6 @@ <Dependencies/> <VirtualDirectory Name="src"> <VirtualDirectory Name="model"> - <File Name="Element.cpp"/> <VirtualDirectory Name="electrical"> <File Name="Bus.cpp"/> <File Name="Line.cpp"/> @@ -23,6 +22,7 @@ <File Name="Load.cpp"/> <File Name="Inductor.cpp"/> <File Name="Capacitor.cpp"/> + <File Name="Element.cpp"/> </VirtualDirectory> </VirtualDirectory> <VirtualDirectory Name="view"> @@ -42,7 +42,6 @@ </VirtualDirectory> <VirtualDirectory Name="include"> <VirtualDirectory Name="model"> - <File Name="Element.h"/> <VirtualDirectory Name="electrical"> <File Name="Bus.h"/> <File Name="Line.h"/> @@ -56,6 +55,7 @@ <File Name="Load.h"/> <File Name="Inductor.h"/> <File Name="Capacitor.h"/> + <File Name="Element.h"/> </VirtualDirectory> </VirtualDirectory> <VirtualDirectory Name="view"> diff --git a/Project/Project.txt b/Project/Project.txt index 0154aed..8582333 100644 --- a/Project/Project.txt +++ b/Project/Project.txt @@ -1 +1 @@ -./Release/main.cpp.o ./Release/win_resources.rc.o ./Release/Element.cpp.o ./Release/ArtMetro.cpp.o ./Release/MainFrame.cpp.o ./Release/Workspace.cpp.o ./Release/MainFrameBitmaps.cpp.o ./Release/WorkspaceBitmaps.cpp.o ./Release/BusFormBitmaps.cpp.o ./Release/ElementFormBitmaps.cpp.o ./Release/MainFrameBase.cpp.o ./Release/WorkspaceBase.cpp.o ./Release/ElementForm.cpp.o ./Release/Bus.cpp.o ./Release/Line.cpp.o ./Release/Transformer.cpp.o ./Release/Machines.cpp.o ./Release/SyncGenerator.cpp.o ./Release/IndMotor.cpp.o ./Release/Branch.cpp.o ./Release/SyncMotor.cpp.o ./Release/Shunt.cpp.o ./Release/Load.cpp.o ./Release/Inductor.cpp.o ./Release/Capacitor.cpp.o ./Release/BusForm.cpp.o ./Release/GeneratorForm.cpp.o ./Release/GeneratorStabForm.cpp.o ./Release/LineForm.cpp.o +./Release/main.cpp.o ./Release/win_resources.rc.o ./Release/ArtMetro.cpp.o ./Release/MainFrame.cpp.o ./Release/Workspace.cpp.o ./Release/MainFrameBitmaps.cpp.o ./Release/WorkspaceBitmaps.cpp.o ./Release/BusFormBitmaps.cpp.o ./Release/ElementFormBitmaps.cpp.o ./Release/MainFrameBase.cpp.o ./Release/WorkspaceBase.cpp.o ./Release/ElementForm.cpp.o ./Release/Bus.cpp.o ./Release/Line.cpp.o ./Release/Transformer.cpp.o ./Release/Machines.cpp.o ./Release/SyncGenerator.cpp.o ./Release/IndMotor.cpp.o ./Release/Branch.cpp.o ./Release/SyncMotor.cpp.o ./Release/Shunt.cpp.o ./Release/Load.cpp.o ./Release/Inductor.cpp.o ./Release/Capacitor.cpp.o ./Release/Element.cpp.o ./Release/BusForm.cpp.o ./Release/GeneratorForm.cpp.o ./Release/GeneratorStabForm.cpp.o ./Release/LineForm.cpp.o diff --git a/Project/Release/Branch.cpp.o b/Project/Release/Branch.cpp.o Binary files differindex 902af22..84b22ff 100644 --- a/Project/Release/Branch.cpp.o +++ b/Project/Release/Branch.cpp.o diff --git a/Project/Release/Bus.cpp.o b/Project/Release/Bus.cpp.o Binary files differindex 55139fe..7b1c93c 100644 --- a/Project/Release/Bus.cpp.o +++ b/Project/Release/Bus.cpp.o diff --git a/Project/Release/BusForm.cpp.o b/Project/Release/BusForm.cpp.o Binary files differindex 12aadfe..a8da886 100644 --- a/Project/Release/BusForm.cpp.o +++ b/Project/Release/BusForm.cpp.o diff --git a/Project/Release/Capacitor.cpp.o b/Project/Release/Capacitor.cpp.o Binary files differindex b12d0cc..0ad91e9 100644 --- a/Project/Release/Capacitor.cpp.o +++ b/Project/Release/Capacitor.cpp.o diff --git a/Project/Release/Element.cpp.o b/Project/Release/Element.cpp.o Binary files differindex 473f91d..2bc4c34 100644 --- a/Project/Release/Element.cpp.o +++ b/Project/Release/Element.cpp.o diff --git a/Project/Release/GeneratorForm.cpp.o b/Project/Release/GeneratorForm.cpp.o Binary files differindex cb870e0..c3aac31 100644 --- a/Project/Release/GeneratorForm.cpp.o +++ b/Project/Release/GeneratorForm.cpp.o diff --git a/Project/Release/GeneratorStabForm.cpp.o b/Project/Release/GeneratorStabForm.cpp.o Binary files differindex e397c97..f04c2e0 100644 --- a/Project/Release/GeneratorStabForm.cpp.o +++ b/Project/Release/GeneratorStabForm.cpp.o diff --git a/Project/Release/IndMotor.cpp.o b/Project/Release/IndMotor.cpp.o Binary files differindex a756600..e8b35dc 100644 --- a/Project/Release/IndMotor.cpp.o +++ b/Project/Release/IndMotor.cpp.o diff --git a/Project/Release/Inductor.cpp.o b/Project/Release/Inductor.cpp.o Binary files differindex 970e078..9bc5448 100644 --- a/Project/Release/Inductor.cpp.o +++ b/Project/Release/Inductor.cpp.o diff --git a/Project/Release/Line.cpp.o b/Project/Release/Line.cpp.o Binary files differindex 6a6185e..8a52f55 100644 --- a/Project/Release/Line.cpp.o +++ b/Project/Release/Line.cpp.o diff --git a/Project/Release/LineForm.cpp.o b/Project/Release/LineForm.cpp.o Binary files differindex 484099c..36c9463 100644 --- a/Project/Release/LineForm.cpp.o +++ b/Project/Release/LineForm.cpp.o diff --git a/Project/Release/Load.cpp.o b/Project/Release/Load.cpp.o Binary files differindex b3562b1..f1abdd1 100644 --- a/Project/Release/Load.cpp.o +++ b/Project/Release/Load.cpp.o diff --git a/Project/Release/Machines.cpp.o b/Project/Release/Machines.cpp.o Binary files differindex 89ad069..8ff8948 100644 --- a/Project/Release/Machines.cpp.o +++ b/Project/Release/Machines.cpp.o diff --git a/Project/Release/PSP-UFU.exe b/Project/Release/PSP-UFU.exe Binary files differindex f0389d9..66ca96b 100644 --- a/Project/Release/PSP-UFU.exe +++ b/Project/Release/PSP-UFU.exe diff --git a/Project/Release/Shunt.cpp.o b/Project/Release/Shunt.cpp.o Binary files differindex a249dff..69d74d5 100644 --- a/Project/Release/Shunt.cpp.o +++ b/Project/Release/Shunt.cpp.o diff --git a/Project/Release/SyncGenerator.cpp.o b/Project/Release/SyncGenerator.cpp.o Binary files differindex fb7a778..e79a1f2 100644 --- a/Project/Release/SyncGenerator.cpp.o +++ b/Project/Release/SyncGenerator.cpp.o diff --git a/Project/Release/SyncMotor.cpp.o b/Project/Release/SyncMotor.cpp.o Binary files differindex 11ad41c..51a893f 100644 --- a/Project/Release/SyncMotor.cpp.o +++ b/Project/Release/SyncMotor.cpp.o diff --git a/Project/Release/Transformer.cpp.o b/Project/Release/Transformer.cpp.o Binary files differindex 1229ebf..1f69f72 100644 --- a/Project/Release/Transformer.cpp.o +++ b/Project/Release/Transformer.cpp.o diff --git a/Project/Release/Workspace.cpp.o b/Project/Release/Workspace.cpp.o Binary files differindex 7458807..6f7cf96 100644 --- a/Project/Release/Workspace.cpp.o +++ b/Project/Release/Workspace.cpp.o diff --git a/Project/Workspace.cpp b/Project/Workspace.cpp index 698ae81..bfcfb89 100644 --- a/Project/Workspace.cpp +++ b/Project/Workspace.cpp @@ -949,27 +949,40 @@ void Workspace::ValidateBusesVoltages(Element* initialBus) Element* child = *it; if(typeid(*child) == typeid(Line)) { - BusElectricalData data1 = ((Bus*)child->GetParentList()[0])->GetEletricalData(); - BusElectricalData data2 = ((Bus*)child->GetParentList()[1])->GetEletricalData(); + if(child->GetParentList()[0] && child->GetParentList()[1]) { + BusElectricalData data1 = ((Bus*)child->GetParentList()[0])->GetEletricalData(); + BusElectricalData data2 = ((Bus*)child->GetParentList()[1])->GetEletricalData(); - if(data1.nominalVoltage != data2.nominalVoltage || - data1.nominalVoltageUnit != data2.nominalVoltageUnit) - { - data1.nominalVoltage = nominalVoltage; - data2.nominalVoltage = nominalVoltage; - data1.nominalVoltageUnit = nominalVoltageUnit; - data2.nominalVoltageUnit = nominalVoltageUnit; + if(data1.nominalVoltage != data2.nominalVoltage || + data1.nominalVoltageUnit != data2.nominalVoltageUnit) + { + data1.nominalVoltage = nominalVoltage; + data2.nominalVoltage = nominalVoltage; + data1.nominalVoltageUnit = nominalVoltageUnit; + data2.nominalVoltageUnit = nominalVoltageUnit; + + ((Bus*)child->GetParentList()[0])->SetElectricalData(data1); + ((Bus*)child->GetParentList()[1])->SetElectricalData(data2); - ((Bus*)child->GetParentList()[0])->SetElectricalData(data1); - ((Bus*)child->GetParentList()[1])->SetElectricalData(data2); - - it = m_elementList.begin();// Restart search. + it = m_elementList.begin(); // Restart search. + } } } } + + ValidateElementsVoltages(); } void Workspace::ValidateElementsVoltages() { - //continua... + for(auto it = m_elementList.begin(); it != m_elementList.end(); it++) { + Element* child = *it; + for(int i = 0; i < (int)child->GetParentList().size(); i++) { + Bus* parent = (Bus*)child->GetParentList()[i]; + if(parent) { + child->SetNominalVoltage(parent->GetEletricalData().nominalVoltage, + parent->GetEletricalData().nominalVoltageUnit); + } + } + } } |