DPsim
Loading...
Searching...
No Matches
DP_Ph1_RXLoadSwitch.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/DP/DP_Ph1_RXLoad.h>
12#include <dpsim-models/DP/DP_Ph1_Switch.h>
13
14namespace CPS {
15namespace DP {
16namespace Ph1 {
18class RXLoadSwitch : public CompositePowerComp<Complex>,
19 public MNASwitchInterface,
20 public SharedFactory<RXLoadSwitch> {
21protected:
23 std::shared_ptr<DP::Ph1::RXLoad> mSubRXLoad;
25 std::shared_ptr<DP::Ph1::Switch> mSubSwitch;
29 std::vector<const Matrix *> mRightVectorStamps;
30
31public:
33 RXLoadSwitch(String uid, String name,
34 Logger::Level logLevel = Logger::Level::off);
36 RXLoadSwitch(String name, Logger::Level logLevel = Logger::Level::off);
37
38 // #### General ####
40 void initializeFromNodesAndTerminals(Real frequency) override;
42 void setParameters(Real activePower, Real reactivePower, Real nomVolt,
43 Real openResistance, Real closedResistance,
44 Bool closed = false);
46 void setSwitchParameters(Real openResistance, Real closedResistance,
47 Bool closed = false);
49 void updateSwitchState(Real time);
50
51 // #### MNA section ####
53 void mnaParentPreStep(Real time, Int timeStepCount) override;
55 void mnaParentPostStep(Real time, Int timeStepCount,
56 Attribute<Matrix>::Ptr &leftVector) override;
59 AttributeBase::List &prevStepDependencies,
60 AttributeBase::List &attributeDependencies,
61 AttributeBase::List &modifiedAttributes) override;
63 void
64 mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies,
65 AttributeBase::List &attributeDependencies,
66 AttributeBase::List &modifiedAttributes,
67 Attribute<Matrix>::Ptr &leftVector) override;
68
69 // #### MNA section for switch ####
71 Bool mnaIsClosed() override;
74 SparseMatrixRow &systemMatrix,
75 Int freqIdx) override;
76};
77} // namespace Ph1
78} // namespace DP
79} // namespace CPS
CompositePowerComp(String uid, String name, Bool hasPreStep, Bool hasPostStep, Logger::Level logLevel)
void updateSwitchState(Real time)
built-in logic for protection switch
void setParameters(Real activePower, Real reactivePower, Real nomVolt, Real openResistance, Real closedResistance, Bool closed=false)
Sets model specific parameters.
Real mSwitchTimeOffset
internal switch is only opened after this time offset
void mnaCompApplySwitchSystemMatrixStamp(Bool closed, SparseMatrixRow &systemMatrix, Int freqIdx) override
Stamps system matrix considering the defined switch position.
void setSwitchParameters(Real openResistance, Real closedResistance, Bool closed=false)
Sets only switch parameters so that load parameters could be calculated from powerflow.
RXLoadSwitch(String uid, String name, Logger::Level logLevel=Logger::Level::off)
Defines UID, name and logging level.
std::vector< const Matrix * > mRightVectorStamps
Right side vectors of subcomponents.
void mnaParentAddPreStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes) override
Add MNA pre step dependencies.
void mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector) override
Add MNA post step dependencies.
Bool mnaIsClosed() override
Check if switch is closed.
void mnaParentPreStep(Real time, Int timeStepCount) override
MNA pre step operations.
void mnaParentPostStep(Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector) override
MNA post step operations.
std::shared_ptr< DP::Ph1::RXLoad > mSubRXLoad
Internal RXLoad.
void initializeFromNodesAndTerminals(Real frequency) override
Initializes component from power flow data.
std::shared_ptr< DP::Ph1::Switch > mSubSwitch
Internal protection switch.
String uid()
Returns unique id.
MNA interface to be used by switching devices.