summaryrefslogtreecommitdiffstats
path: root/Project/Fault.h
blob: ef101895f367f2d025d34b77901e2acd359af2a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*
 *  Copyright (C) 2017  Thales Lima Oliveira <thales@ufu.br>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */

#ifndef FAULT_H
#define FAULT_H

#include "ElectricCalculation.h"
/**
 * @class Fault
 * @author Thales Lima Oliveira
 * @date 10/01/2017
 * @brief Calculate the fault of the system and update the elements data.
 * @file Fault.h
 */

class Fault : public ElectricCalculation
{
   public:
    /**
     * @brief Contructor.
     * @param elementList List of elements in workspace
     */
    Fault(std::vector<Element*> elementList);

    /**
     * @brief Default contructor. Use GetElementsFromList(std::vector<Element*> elementList).
     */
    Fault();

    /**
     * @brief Destructor.
     */
    ~Fault();

    /**
     * @brief Calculate the fault of the system. Return true if was possible the calculation.
     * @param systemPowerBase System base of power.
     */
    virtual bool RunFaultCalculation(double systemPowerBase);

    /**
     * @brief Calculate the short-circuit power of the system. Return true if was possible the calculation.
     * @param systemPowerBase System base of power.
     */
    virtual bool RunSCPowerCalcutation(double systemPowerBase);

    /**
     * @brief Update the data of the elements.
     * @param systemPowerBase System base of power.
     */
    virtual void UpdateElementsFault(double systemPowerBase);

    /**
     * @brief Get the error message generated in RunFaultCalculation(double systemPowerBase).
     * @return Error message.
     */
    virtual wxString GetErrorMessage() { return m_errorMsg; }
   protected:
    wxString m_errorMsg = "";

    double m_systemPowerBase;

    std::vector<std::vector<std::complex<double> > > m_zBusPos;
    std::vector<std::vector<std::complex<double> > > m_zBusNeg;
    std::vector<std::vector<std::complex<double> > > m_zBusZero;

    std::vector<std::complex<double> > m_posFaultVoltagePos;
    std::vector<std::complex<double> > m_posFaultVoltageNeg;
    std::vector<std::complex<double> > m_posFaultVoltageZero;

    std::complex<double> m_fCurrentA;
    std::complex<double> m_fCurrentB;
    std::complex<double> m_fCurrentC;

    std::vector<std::complex<double> > m_posFaultVoltageA;
    std::vector<std::complex<double> > m_posFaultVoltageB;
    std::vector<std::complex<double> > m_posFaultVoltageC;
};

#endif  // FAULT_H