DPsim
Loading...
Searching...
No Matches
DP_Ph1_DPDQInterface.cpp
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#include <dpsim-models/DP/DP_Ph1_DPDQInterface.h>
10
11using namespace CPS;
12
13void DP::Ph1::DPDQInterface::setDPShiftFrequency(const Real &omegaShift) {
14 mOmegaShift = omegaShift;
15}
16
18 const Real &simTime) {
19 mDQToDPTransform << cos(thetaDQ - mOmegaShift * simTime),
20 -sin(thetaDQ - mOmegaShift * simTime),
21 sin(thetaDQ - mOmegaShift * simTime),
22 cos(thetaDQ - mOmegaShift * simTime);
23}
24
26 const Real &simTime) {
27 mDPToDQTransform << cos(thetaDQ - mOmegaShift * simTime),
28 sin(thetaDQ - mOmegaShift * simTime),
29 -sin(thetaDQ - mOmegaShift * simTime),
30 cos(thetaDQ - mOmegaShift * simTime);
31}
32
34 const MatrixFixedSize<2, 1> &dqMatrix) {
35 Complex dpComplex;
36 dpComplex = Complex((mDQToDPTransform * dqMatrix)(0, 0),
37 (mDQToDPTransform * dqMatrix)(1, 0));
38 return dpComplex;
39}
40
41MatrixFixedSize<2, 1>
43 MatrixFixedSize<2, 1> dqMatrix;
44 dqMatrix(0, 0) = mDPToDQTransform(0, 0) * dpComplex.real() +
45 mDPToDQTransform(0, 1) * dpComplex.imag();
46 dqMatrix(1, 0) = mDPToDQTransform(1, 0) * dpComplex.real() +
47 mDPToDQTransform(1, 1) * dpComplex.imag();
48 return dqMatrix;
49}
MatrixFixedSize< 2, 2 > mDQToDPTransform
Transform from DQ to DP domain.
void updateDQToDPTransform(const Real &thetaDQ, const Real &simTime)
Update transformation matrix from DQ to DP.
void updateDPToDQTransform(const Real &thetaDQ, const Real &simTime)
Update transformation matrix from DP to DQ.
Complex applyDQToDPTransform(const MatrixFixedSize< 2, 1 > &dqMatrix)
Apply transform to obtain current complex DP.
MatrixFixedSize< 2, 1 > applyDPToDQTransform(const Complex &dpComplex)
Apply transform to obtain current DQ vector.
MatrixFixedSize< 2, 2 > mDPToDQTransform
Transform from DP to DQ domain.
Real mOmegaShift
Shifting frequency of the DP domain (assumed to be constant)
void setDPShiftFrequency(const Real &omegaShift)
Setter for shit frequency.