PQLoadDP.h 2.35 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/** PQ Load
 *
 * @file
 * @author Markus Mirz <mmirz@eonerc.rwth-aachen.de>
 * @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
 * @license GNU General Public License (version 3)
 *
 * DPsim
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *********************************************************************************/

24
#pragma once
25

26
27
#include "BaseComponent.h"
#include "InductorDP.h"
Markus Mirz's avatar
Markus Mirz committed
28
#include "ResistorDP.h"
29
30

namespace DPsim {
31
	// TODO currently modeled as an impedance, which obviously doesn't have a constant power characteristic
32
	class PQLoadDP : public BaseComponent {
33
	protected:
34
		/// Active power [Watt]
35
		Real mActivePower;
36
		/// Reactive power [VAr]
37
		Real mReactivePower;
38
		/// Voltage [V]
39
		Real mSvVoltage;
40
		/// Resistance [Ohm]
41
		Real mResistance;
42
		/// Conductance [S]
43
		Real mConductance;
44
		/// Reactance [Ohm]
45
46
47
48
49
50
		Real mReactance;
		/// Inductance [H]
		Real mInductance;
		
		shared_ptr<InductorDP> inductor;
		shared_ptr<ResistorDP> resistor;
51
	public:
52
53
54
		PQLoadDP(String name, Int node, Real activePower, Real reactivePower, Real volt, Real angle);

		/// Initializes variables detalvr, deltavi, currr, curri, cureqr and curreqi
55
		void init(Real om, Real dt);
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70

		/// Stamps DC equivalent resistance to the conductance matrix
		void applySystemMatrixStamp(SystemModel& system);

		/// Does nothing
		void applyRightSideVectorStamp(SystemModel& system) { }

		/// calculates the value of the DC equivalent current source for one time step and apply matrix stamp to the current vector
		void step(SystemModel& system, Real time);

		/// Recalculates variables detalvr, deltavi, currr and curri based on the simulation results of one time step
		void postStep(SystemModel& system);

		/// Return current from the previous step
		Complex getCurrent(SystemModel& system);
71
	};
72
}