forked from dynawo/dynawo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dynawo#30 Add smoothed out NodeFault for numerical stability
Signed-off-by: FredericSabot <[email protected]>
- Loading branch information
1 parent
74fc33a
commit 8237c86
Showing
6 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
dynawo/sources/Models/Modelica/Dynawo/Electrical/Events/NodeFaultContinuous.extvar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<!-- | ||
Copyright (c) 2024, RTE (http://www.rte-france.com) | ||
See AUTHORS.txt | ||
All rights reserved. | ||
This Source Code Form is subject to the terms of the Mozilla Public | ||
License, v. 2.0. If a copy of the MPL was not distributed with this | ||
file, you can obtain one at http://mozilla.org/MPL/2.0/. | ||
SPDX-License-Identifier: MPL-2.0 | ||
This file is part of Dynawo, an hybrid C++/Modelica open source suite of | ||
simulation tools for power systems. | ||
--> | ||
<external_variables xmlns="http://www.rte-france.com/dynawo"> | ||
<variable type="continuous" id="terminal.V.re"/> | ||
<variable type="continuous" id="terminal.V.im"/> | ||
</external_variables> |
58 changes: 58 additions & 0 deletions
58
dynawo/sources/Models/Modelica/Dynawo/Electrical/Events/NodeFaultContinuous.mo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
within Dynawo.Electrical.Events; | ||
|
||
/* | ||
* Copyright (c) 2024, RTE (http://www.rte-france.com) | ||
* See AUTHORS.txt | ||
* All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, you can obtain one at http://mozilla.org/MPL/2.0/. | ||
* SPDX-License-Identifier: MPL-2.0 | ||
* | ||
* This file is part of Dynawo, an hybrid C++/Modelica open source suite | ||
* of simulation tools for power systems. | ||
*/ | ||
|
||
model NodeFaultContinuous "Node fault which lasts from tBegin to tEnd" | ||
/* | ||
Between tBegin and tEnd, the impedance between the node and the ground is equal to ZPu. | ||
*/ | ||
import Dynawo.NonElectrical.Logs.Timeline; | ||
import Dynawo.NonElectrical.Logs.TimelineKeys; | ||
|
||
Dynawo.Connectors.ACPower terminal annotation( | ||
Placement(visible = true, transformation(origin = {2, 2}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {0, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); | ||
Dynawo.Connectors.BPin nodeFault(value(start = false)) "True when the fault is ongoing, false otherwise"; | ||
|
||
parameter Types.PerUnit RPu "Fault resistance in pu (base SnRef)"; | ||
parameter Types.PerUnit XPu "Fault reactance in pu (base SnRef)"; | ||
parameter Types.Time tBegin "Time when the fault begins"; | ||
parameter Types.Time tEnd "Time when the fault ends"; | ||
parameter Types.Time tFilter = 1e-3 "Filter to smooth out the behaviour of the fault"; | ||
|
||
protected | ||
parameter Types.ComplexImpedancePu ZPu(re = RPu, im = XPu) "Impedance of the fault in pu (base SnRef)"; | ||
|
||
equation | ||
when time >= tEnd then | ||
Timeline.logEvent1(TimelineKeys.NodeFaultEnd); | ||
nodeFault.value = false; | ||
elsewhen time >= tBegin then | ||
Timeline.logEvent1(TimelineKeys.NodeFaultBegin); | ||
nodeFault.value = true; | ||
end when; | ||
|
||
if time > tEnd + tFilter or time < tBegin then | ||
terminal.i = Complex(0); | ||
elseif time >= tBegin and time < tBegin + tFilter then | ||
terminal.i = 1/ZPu * terminal.V * (time - tBegin) / tFilter; | ||
elseif time >= tBegin + tFilter and time < tEnd then | ||
terminal.i = 1/ZPu * terminal.V; | ||
else | ||
terminal.i = 1/ZPu * terminal.V * (1 - (time - tEnd) / tFilter); | ||
end if; | ||
|
||
annotation(preferredView = "text", | ||
Documentation(info = "<html><head></head><body>During the fault, the impedance between the node and the ground is defined by R and X values.</body></html>"), | ||
Icon(graphics = {Polygon(origin = {0, 55}, fillPattern = FillPattern.Solid, points = {{0, 45}, {-6, 5}, {20, 5}, {0, -45}, {6, -5}, {-20, -5}, {0, 45}, {0, 45}})})); | ||
end NodeFaultContinuous; |
1 change: 1 addition & 0 deletions
1
dynawo/sources/Models/Modelica/Dynawo/Electrical/Events/package.order
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
Event | ||
NodeFault | ||
NodeFaultContinuous |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
dynawo/sources/Models/Modelica/PreassembledModels/NodeFaultContinuous.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<!-- | ||
Copyright (c) 2024, RTE (http://www.rte-france.com) | ||
See AUTHORS.txt | ||
All rights reserved. | ||
This Source Code Form is subject to the terms of the Mozilla Public | ||
License, v. 2.0. If a copy of the MPL was not distributed with this | ||
file, you can obtain one at http://mozilla.org/MPL/2.0/. | ||
SPDX-License-Identifier: MPL-2.0 | ||
This file is part of Dynawo, an hybrid C++/Modelica open source suite of | ||
simulation tools for power systems. | ||
--> | ||
<dyn:dynamicModelsArchitecture xmlns:dyn="http://www.rte-france.com/dynawo"> | ||
<!-- Short circuit on a node --> | ||
<dyn:modelicaModel id="NodeFaultContinuous"> | ||
<dyn:unitDynamicModel id="fault" name="Dynawo.Electrical.Events.NodeFaultContinuous"/> | ||
</dyn:modelicaModel> | ||
</dyn:dynamicModelsArchitecture> |