DPsim
Loading...
Searching...
No Matches
dpsim-models
include
dpsim-models
Base
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
14
namespace
CPS {
15
namespace
Base {
16
namespace
Ph1 {
18
class
Switch {
19
protected
:
20
Bool mIsClosedPrev =
false
;
21
22
public
:
24
const
Attribute<Real>::Ptr
mOpenResistance
;
26
const
Attribute<Real>::Ptr
mClosedResistance
;
28
const
Attribute<Bool>::Ptr
mIsClosed
;
29
30
explicit
Switch(CPS::AttributeList::Ptr attributeList)
31
:
mOpenResistance
(attributeList->create<Real>(
"R_open"
)),
32
mClosedResistance
(attributeList->create<Real>(
"R_closed"
)),
33
mIsClosed
(attributeList->create<Bool>(
"is_closed"
)){};
34
36
void
setParameters(Real openResistance, Real closedResistance,
37
Bool closed =
false
) {
38
**
mOpenResistance
= openResistance;
39
**
mClosedResistance
= closedResistance;
40
**
mIsClosed
= closed;
41
}
42
44
void
close
() { **
mIsClosed
=
true
; }
46
void
open
() { **
mIsClosed
=
false
; }
48
Bool
isClosed
() {
return
**
mIsClosed
; }
49
};
50
}
// namespace Ph1
51
}
// namespace Base
52
}
// namespace CPS
CPS::Base::Ph1::Switch::close
void close()
Close switch.
Definition
Base_Ph1_Switch.h:44
CPS::Base::Ph1::Switch::mClosedResistance
const Attribute< Real >::Ptr mClosedResistance
Resistance if switch is closed [ohm].
Definition
Base_Ph1_Switch.h:26
CPS::Base::Ph1::Switch::isClosed
Bool isClosed()
Check if switch is closed.
Definition
Base_Ph1_Switch.h:48
CPS::Base::Ph1::Switch::mOpenResistance
const Attribute< Real >::Ptr mOpenResistance
Resistance if switch is open [ohm].
Definition
Base_Ph1_Switch.h:24
CPS::Base::Ph1::Switch::mIsClosed
const Attribute< Bool >::Ptr mIsClosed
Defines if Switch is open or closed.
Definition
Base_Ph1_Switch.h:28
CPS::Base::Ph1::Switch::open
void open()
Open switch.
Definition
Base_Ph1_Switch.h:46
Generated by
1.13.2