DPsim
Loading...
Searching...
No Matches
Base_Ph3_Switch.h
Go to the documentation of this file.
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
13
14namespace CPS {
15namespace Base {
16namespace Ph3 {
17
19class Switch {
20protected:
22
23public:
30
31 explicit Switch(CPS::AttributeList::Ptr attributeList)
32 : mOpenResistance(attributeList->create<Matrix>("R_open")),
33 mClosedResistance(attributeList->create<Matrix>("R_closed")),
34 mIsClosed(attributeList->create<Bool>("is_closed")) {}
35
36 virtual ~Switch() = default;
37
38 void setParameters(Matrix openResistance, Matrix closedResistance,
39 Bool closed = false) {
40 **mOpenResistance = openResistance;
41 **mClosedResistance = closedResistance;
42 **mIsClosed = closed;
43 }
44
49 virtual void closeSwitch() { **mIsClosed = true; }
50
55 virtual void openSwitch() { **mIsClosed = false; }
56
58 Bool isClosed() { return **mIsClosed; }
59};
60
61} // namespace Ph3
62} // namespace Base
63} // namespace CPS
AttributePointer< Attribute< T > > Ptr
Definition Attribute.h:249
std::shared_ptr< AttributeList > Ptr
const CPS::Attribute< Matrix >::Ptr mClosedResistance
Resistance if switch is closed [ohm].
virtual void closeSwitch()
const CPS::Attribute< Matrix >::Ptr mOpenResistance
Resistance if switch is open [ohm].
Switch(CPS::AttributeList::Ptr attributeList)
virtual void openSwitch()
void setParameters(Matrix openResistance, Matrix closedResistance, Bool closed=false)
virtual ~Switch()=default
const CPS::Attribute< Bool >::Ptr mIsClosed
Commanded/global switch state.
Bool isClosed()
Check commanded/global state.
Eigen::Matrix< Real, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > Matrix
Dense matrix for real numbers.
Definition Definitions.h:81
bool Bool
Definition Definitions.h:64