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,
21 public SharedFactory<RXLoadSwitch> {
22protected:
24 std::shared_ptr<DP::Ph1::RXLoad> mSubRXLoad;
26 std::shared_ptr<DP::Ph1::Switch> mSubSwitch;
30 std::vector<const Matrix *> mRightVectorStamps;
31
32public:
34 RXLoadSwitch(String uid, String name,
35 Logger::Level logLevel = Logger::Level::off);
37 RXLoadSwitch(String name, Logger::Level logLevel = Logger::Level::off);
38
39 // #### General ####
41 void initializeFromNodesAndTerminals(Real frequency) override;
43 void setParameters(Real activePower, Real reactivePower, Real nomVolt,
44 Real openResistance, Real closedResistance,
45 Bool closed = false);
47 void setSwitchParameters(Real openResistance, Real closedResistance,
48 Bool closed = false);
50 void updateSwitchState(Real time);
51
52 // #### MNA section ####
54 void mnaParentPreStep(Real time, Int timeStepCount) override;
56 void mnaParentPostStep(Real time, Int timeStepCount,
57 Attribute<Matrix>::Ptr &leftVector) override;
60 AttributeBase::List &prevStepDependencies,
61 AttributeBase::List &attributeDependencies,
62 AttributeBase::List &modifiedAttributes) override;
64 void
65 mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies,
66 AttributeBase::List &attributeDependencies,
67 AttributeBase::List &modifiedAttributes,
68 Attribute<Matrix>::Ptr &leftVector) override;
69
70 // #### MNA section for switch ####
72 Bool mnaIsClosed() override;
75 SparseMatrixRow &systemMatrix,
76 Int freqIdx) override;
77
78 // #### MNA section for variable component ####
79 Bool hasParameterChanged() override;
80};
81} // namespace Ph1
82} // namespace DP
83} // 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.
Bool hasParameterChanged() override
Returns true if one of the element paramters has changed.
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.
MNA interface to be used by elements that require recomputing of the system matrix.