DPsim
Loading...
Searching...
No Matches
Base_Ph1_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>
13
14namespace CPS {
15namespace Base {
16namespace Ph1 {
18class Switch {
19public:
21 const Attribute<Real>::Ptr mOpenResistance;
23 const Attribute<Real>::Ptr mClosedResistance;
25 const Attribute<Bool>::Ptr mIsClosed;
26
27 explicit Switch(CPS::AttributeList::Ptr attributeList)
28 : mOpenResistance(attributeList->create<Real>("R_open")),
29 mClosedResistance(attributeList->create<Real>("R_closed")),
30 mIsClosed(attributeList->create<Bool>("is_closed")){};
31
33 void setParameters(Real openResistance, Real closedResistance,
34 Bool closed = false) {
35 **mOpenResistance = openResistance;
36 **mClosedResistance = closedResistance;
37 **mIsClosed = closed;
38 }
39
41 void close() { **mIsClosed = true; }
43 void open() { **mIsClosed = false; }
45 Bool isClosed() { return **mIsClosed; }
46};
47} // namespace Ph1
48} // namespace Base
49} // namespace CPS
void close()
Close switch.
const Attribute< Real >::Ptr mClosedResistance
Resistance if switch is closed [ohm].
Bool isClosed()
Check if switch is closed.
const Attribute< Real >::Ptr mOpenResistance
Resistance if switch is open [ohm].
const Attribute< Bool >::Ptr mIsClosed
Defines if Switch is open or closed.
void open()
Open switch.