From 25031d1486d307b1cf2ef92db0d37eb70fe8e9f8 Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Tue, 27 Mar 2018 21:35:32 -0300 Subject: LST file parse created --- Project/ImportForm.h | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) (limited to 'Project/ImportForm.h') diff --git a/Project/ImportForm.h b/Project/ImportForm.h index 7881c64..a1925de 100644 --- a/Project/ImportForm.h +++ b/Project/ImportForm.h @@ -3,10 +3,20 @@ #include "base/PropertiesFormBase.h" +#include #include +#include +#include class Workspace; +/** + * @class ImportForm + * @author Thales Lima Oliveira + * @date 27/03/2018 + * @brief Form to import other programs files to PSP + * @file ImportForm.h + */ class ImportForm : public ImportFormBase { public: @@ -23,4 +33,71 @@ class ImportForm : public ImportFormBase Workspace* m_workspace = NULL; wxWindow* m_parent; }; + +/** + * @enum ElementType + * @brief ID of ANAREDE's elements. + */ +enum ElementTypeAnarede { + ANA_BUS = 1, /**< Bus */ + ANA_GENERATOR = 4, /**< Generator */ + ANA_LOAD = 5, /**< Load */ + ANA_SHUNT = 6, /**< Shunt element */ + ANA_MIT = 7, /**< Induction motor */ + ANA_TRANSFORMER = 9, /**< Transformer */ + ANA_LINE = 14, /**< Power line */ + ANA_IND_LOAD = 22, /**< Independent load */ + ANA_IND_SHUNT = 23, /**< Independent shunt element */ + ANA_IND_GENERATOR = 24, /**< Independent generator */ +}; + +/** + * @class ParseAnarede + * @author Thales Lima Oliveira + * @date 27/03/2018 + * @brief Class responsible to parse ANAREDE files to import data to PSP. + * @file ImportForm.h + */ +class ParseAnarede +{ + public: + // Graphic files data structs + struct Component { + int id = 0; /**< Graphical ID */ + ElementTypeAnarede type = ANA_BUS; /**< Element type */ + double length = 0.0; /**< Element lenght (only buses) */ + int rotationID = 0; /**< Rotation ID (0, 1, 2 or 4) */ + wxPoint2DDouble position; /**< X and Y coordinates */ + int electricalID = 0; /**< Bus, Branch or Group electrical IDs */ + std::pair busConnectionID[2] = { + std::make_pair(0, 0), std::make_pair(0, 0)}; /**< In the form */ + std::pair busConnectionNode[2] = {std::make_pair(0, 0), + std::make_pair(0, 0)}; /**< In the form */ + }; + struct PowerLine { + int id = 0; /**< Graphical ID */ + ElementTypeAnarede type = ANA_LINE; /**< Element type */ + int electricalID = 0; /**< Bus, Branch or Group electrical IDs */ + std::pair busConnectionID[2] = { + std::make_pair(0, 0), std::make_pair(0, 0)}; /**< In the form */ + std::pair busConnectionNode[2] = {std::make_pair(0, 0), + std::make_pair(0, 0)}; /**< In the form */ + std::vector nodesPosition; /**< Coordinates of the line breaks, if any */ + }; + + ParseAnarede(wxFileName lstFile, wxFileName pwfFile); + ~ParseAnarede() {} + bool Parse(); + + protected: + bool GetLenghtAndRotationFromBusCode(wxString code, double& lenght, int& rotationID); + wxString GetLSTLineNextValue(wxString line, int& currentPos); + + wxFileName m_lstFile; + wxFileName m_pwfFile; + + std::vector m_components; + std::vector m_lines; +}; + #endif // IMPORTFORM_H -- cgit