Power System Platform  2026w34a-beta
Loading...
Searching...
No Matches
Branch.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18#ifndef BRANCH_H
19#define BRANCH_H
20
21#include "PowerElement.h"
22#include "Bus.h"
23
24
26 double current = 0.0; // A
27 double time = 0.0; // s
28};
29
30enum class ArcFlashProtectionType {
31 CIRCUIT_BREAKER,
32 FUSE
33};
34
35enum class ArcFlashProtectionMethod {
36 TCC_CURVE,
37 ANNEX_H,
38 ANNEX_I
39};
40
41enum class ArcFlashI1Source {
42 DIRECT,
43 FROM_IT
44};
45
46// Fuse family (Annex H). Order MUST match arcflash::FuseFamily exactly
47enum class ArcFlashFuseFamily {
48 CLASS_L_601_800A,
49 CLASS_L_801_1200A,
50 CLASS_L_1201_1600A,
51 CLASS_L_1601_2000A,
52 CLASS_RK1_UPTO100A,
53 CLASS_RK1_101_200A,
54 CLASS_RK1_201_400A,
55 CLASS_RK1_401_600A
56};
57
58// Breaker family (Annex I). Order MUST match arcflash::BreakerFamily exactly.
59enum class ArcFlashBreakerFamily {
60 MCCB_100_400A,
61 MCCB_600_1200A_TM_OR_M,
62 MCCB_600_1200A_E_LI,
63 MCCB_OR_ICCB_1600_6000A,
64 LVPCB_800_6300A_E_LI,
65 LVPCB_800_6300A_E_LS
66};
67
68// Order MUST match arcflash::BreakerVoltageBand exactly.
69enum class ArcFlashBreakerVoltageBand {
70 V480_AND_LOWER,
71 V575_TO_690
72};
73
75 bool consider = false; // whether this path's protection config participates
76 bool configured = false;
77
78 ArcFlashProtectionType type = ArcFlashProtectionType::CIRCUIT_BREAKER;
79 ArcFlashProtectionMethod method = ArcFlashProtectionMethod::TCC_CURVE;
80
81 // --- TCC_CURVE method ---
82 std::vector<ArcFlashTCCPoint> tccPoints;
83 bool curveIsMeltTimeOnly = false; // fuses only (6.9.2 melt->clearing adjustment)
84 double additionalDelay = 0.0; // s; retrofit breaker opening time (6.9.3) or
85 // relay+breaker interrupting time (6.9.4)
86
87// Reserved for future UI exposure
88 double floorSeconds = 0.01;
89 double practicalCapSeconds = -1.0; // <=0 disables the cap
90 int belowRangePolicy = 0; // 0 = ThrowError, 1 = ClampToNearest
91 int aboveRangePolicy = 1; // 0 = ThrowError, 1 = ClampToNearest
92
93 // --- ANNEX_H method (fuse) ---
94 ArcFlashFuseFamily fuseFamily = ArcFlashFuseFamily::CLASS_L_601_800A;
95
96 // --- ANNEX_I method (breaker) ---
97 ArcFlashBreakerFamily breakerFamily = ArcFlashBreakerFamily::MCCB_100_400A;
98 ArcFlashBreakerVoltageBand breakerVoltageBand = ArcFlashBreakerVoltageBand::V480_AND_LOWER;
99 double i2_kA = 0.0; // interrupting rating — was missing, required by both
100 // CalcSpecialBreakerModel overloads
101 ArcFlashI1Source i1Source = ArcFlashI1Source::DIRECT;
102 double i1_kA = 0.0;
103 double it_A = 0.0;
104 double breakerNominalCurrent_A = 0.0; // A; optional, used to determine the default It
105
106 // --- Current distribution (6.8/6.10) ---
107 double faultCurrentContribution_kA = 0.0;
108};
109
117class Branch : public PowerElement
118{
119public:
120 Branch();
121 ~Branch();
122
123 virtual bool Contains(wxPoint2DDouble position) const { return false; }
124 //virtual void Draw(wxPoint2DDouble translation, double scale) const {}
125 virtual void Move(wxPoint2DDouble position) {}
126 virtual void StartMove(wxPoint2DDouble position) {}
127 virtual void MoveNode(Element* parent, wxPoint2DDouble position) {}
128 virtual bool NodeContains(wxPoint2DDouble position);
129 virtual bool SetNodeParent(Element* parent);
130 virtual void RemoveParent(Element* parent);
131 virtual void UpdateNodes();
132 virtual wxCursor GetBestPickboxCursor() const { return wxCURSOR_ARROW; }
133 virtual bool Intersects(wxRect2DDouble rect) const { return false; }
134 virtual void MovePickbox(wxPoint2DDouble position) {}
135 virtual bool PickboxContains(wxPoint2DDouble position) { return false; }
136 virtual void RotateNode(Element* parent, bool clockwise = true);
137 virtual void AddPoint(wxPoint2DDouble point) {};
138 virtual bool GetContextMenu(wxMenu& menu) { return false; }
139 virtual void UpdateSwitchesPosition();
140 virtual void UpdateSwitches();
141 //ArcFlashProtectionData& GetArcFlashProtectionData() { return arcFlashProtection; }
142
143//protected:
144 //ArcFlashProtectionData arcFlashProtection;
145};
146
147#endif // BRANCH_H
virtual void UpdateSwitches()
Update the switch position.
Definition Branch.cpp:179
virtual void RotateNode(Element *parent, bool clockwise=true)
Rotate a node.
Definition Branch.cpp:143
virtual void UpdateNodes()
Update the nodes according to the parents. If a parent is removed, use this method.
Definition Branch.cpp:116
virtual bool NodeContains(wxPoint2DDouble position)
Check if a node contains a point. If contains, set the attributes related to node movement.
Definition Branch.cpp:22
virtual wxCursor GetBestPickboxCursor() const
Get the best cursor to shown to the user when the mouse is above a pickbox.
Definition Branch.h:132
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition Branch.h:123
virtual bool GetContextMenu(wxMenu &menu)
Get the element contex menu.
Definition Branch.h:138
virtual void Move(wxPoint2DDouble position)
Move the element other position.
Definition Branch.h:125
virtual bool PickboxContains(wxPoint2DDouble position)
Check if a pickbox contains a point. If contains the attributes related to pickbox movement will be c...
Definition Branch.h:135
virtual void AddPoint(wxPoint2DDouble point)
Add point to the list of points that connect the element to the bus.
Definition Branch.h:137
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
Definition Branch.h:126
virtual void RemoveParent(Element *parent)
Remove a parent.
Definition Branch.cpp:105
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element's rect intersects other rect.
Definition Branch.h:133
virtual bool SetNodeParent(Element *parent)
Set a perent to the node. If all conditions are met, a new parent are added to the element and the po...
Definition Branch.cpp:43
virtual void MoveNode(Element *parent, wxPoint2DDouble position)
Move a node. StartMove(wxPoint2DDouble position) before start moving.
Definition Branch.h:127
virtual void MovePickbox(wxPoint2DDouble position)
Move the pickbox.
Definition Branch.h:134
Base class of all elements of the program. This class is responsible for manage graphical and his dat...
Definition Element.h:115
Element()
Constructor.
Definition Element.cpp:28
PowerElement()
Constructor.