DPsim
Loading...
Searching...
No Matches
Base_Ph3_Switch.h
1/* Copyright 2017-2021 Institute for Automation of Complex Power Systems,
2 * EONERC, RWTH Aachen University
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
7 *********************************************************************************/
8
9#pragma once
10
11#include <dpsim-models/AttributeList.h>
12#include <dpsim-models/Definitions.h>
13namespace CPS {
14namespace Base {
15namespace Ph3 {
17class Switch {
18protected:
19 Bool mIsClosedPrev = false;
20
21public:
23 const CPS::Attribute<Matrix>::Ptr mOpenResistance;
25 const CPS::Attribute<Matrix>::Ptr mClosedResistance;
27 const CPS::Attribute<Bool>::Ptr mIsClosed;
28
29 explicit Switch(CPS::AttributeList::Ptr attributeList)
30 : mOpenResistance(attributeList->create<Matrix>("R_open")),
31 mClosedResistance(attributeList->create<Matrix>("R_closed")),
32 mIsClosed(attributeList->create<Bool>("is_closed")){};
33
35 void setParameters(Matrix openResistance, Matrix closedResistance,
36 Bool closed = false) {
37 **mOpenResistance = openResistance;
38 **mClosedResistance = closedResistance;
39 **mIsClosed = closed;
40 }
41 void closeSwitch() { **mIsClosed = true; }
42 void openSwitch() { **mIsClosed = false; }
43
45 Bool isClosed() { return **mIsClosed; }
46};
47} // namespace Ph3
48} // namespace Base
49} // namespace CPS
const CPS::Attribute< Matrix >::Ptr mClosedResistance
Resistance if switch is closed [ohm].
const CPS::Attribute< Matrix >::Ptr mOpenResistance
Resistance if switch is open [ohm].
const CPS::Attribute< Bool >::Ptr mIsClosed
Defines if Switch is open or closed.
Bool isClosed()
Check if switch is closed.