Skip to content

Commit

Permalink
add PLL related models. Modify bus frequency model directory. Change …
Browse files Browse the repository at this point in the history
…WT3G0 model with new PLL mode. Not tested.
  • Loading branch information
changgang committed Jan 23, 2024
1 parent 581a150 commit 11b5623
Show file tree
Hide file tree
Showing 13 changed files with 470 additions and 154 deletions.
8 changes: 6 additions & 2 deletions code/steps/STEPS.cbp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@
<Unit filename="header/model/auxiliary_signal_model/auxiliary_signal_model.h" />
<Unit filename="header/model/auxiliary_signal_model/auxiliary_signal_model_test.h" />
<Unit filename="header/model/auxiliary_signal_model/auxiliary_signal_models.h" />
<Unit filename="header/model/bus_frequency_model/bus_frequency_model.h" />
<Unit filename="header/model/bus_model/bus_frequency_model/bus_frequency_model.h" />
<Unit filename="header/model/bus_model/pll_model/pll0.h" />
<Unit filename="header/model/bus_model/pll_model/pll_model.h" />
<Unit filename="header/model/energy_storage_model/energy_storage_model.h" />
<Unit filename="header/model/energy_storage_model/energy_storage_model_test.h" />
<Unit filename="header/model/energy_storage_model/energy_storage_models.h" />
Expand Down Expand Up @@ -597,7 +599,9 @@
<Unit filename="source/meter/meter_setter.cpp" />
<Unit filename="source/meter/meter_setter_test.cpp" />
<Unit filename="source/meter/meter_test.cpp" />
<Unit filename="source/model/bus_frequency_model/bus_frequency_model.cpp" />
<Unit filename="source/model/bus_model/bus_frequency_model/bus_frequency_model.cpp" />
<Unit filename="source/model/bus_model/pll_model/pll0.cpp" />
<Unit filename="source/model/bus_model/pll_model/pll_model.cpp" />
<Unit filename="source/model/energy_storage_model/energy_storage_model.cpp" />
<Unit filename="source/model/energy_storage_model/energy_storage_model_test.cpp" />
<Unit filename="source/model/energy_storage_model/estr0.cpp" />
Expand Down
46 changes: 40 additions & 6 deletions code/steps/STEPS.depend
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@
"header/basic/device_index_map.h"
<string>

1664187911 d:\steps\code\steps\header\device\bus.h
1706013715 d:\steps\code\steps\header\device\bus.h
"header/device/device.h"
"header/basic/area.h"
"header/basic/zone.h"
"header/basic/owner.h"
"header/basic/steps_enum.h"
"header/basic/fault.h"
"header/model/bus_frequency_model/bus_frequency_model.h"
"header/model/bus_model/bus_frequency_model/bus_frequency_model.h"
<string>
<complex>
<map>
Expand Down Expand Up @@ -1942,9 +1942,10 @@
"header/power_system_database.h"
"header/STEPS.h"

1697457172 d:\steps\code\steps\header\model\wtg_models\wt_generator_model\wt3g0.h
1706019019 d:\steps\code\steps\header\model\wtg_models\wt_generator_model\wt3g0.h
"header/model/wtg_models/wt_generator_model/wt_generator_model.h"
"header/model/wtg_models/wt_generator_model/lvpl.h"
"header/model/bus_model/pll_model/pll0.h"
"header/block/integral_block.h"
"header/block/first_order_block.h"

Expand All @@ -1958,7 +1959,7 @@
"header/block/integral_block.h"
"header/block/first_order_block.h"

1583938871 d:\steps\code\steps\header\model\wtg_models\wt_generator_model\wt3g0_test.h
1706019069 d:\steps\code\steps\header\model\wtg_models\wt_generator_model\wt3g0_test.h
<istream>
<cstdlib>
<cstring>
Expand Down Expand Up @@ -5223,15 +5224,15 @@
"header/basic/constants.h"
<cmath>

1697457172 source:d:\steps\code\steps\source\model\wtg_models\wt_generator_model\wt3g0.cpp
1706019282 source:d:\steps\code\steps\source\model\wtg_models\wt_generator_model\wt3g0.cpp
"header/model/wtg_models/wt_generator_model/wt3g0.h"
"header/basic/utility.h"
"header/steps_namespace.h"
<cstdio>
<istream>
<iostream>

1585314815 source:d:\steps\code\steps\source\model\wtg_models\wt_generator_model\wt3g0_test.cpp
1706019100 source:d:\steps\code\steps\source\model\wtg_models\wt_generator_model\wt3g0_test.cpp
"header/basic/test_macro.h"
"header/model/wtg_models/wt_generator_model/wt3g0_test.h"
"header/basic/utility.h"
Expand Down Expand Up @@ -56553,3 +56554,36 @@
<iostream>
<fstream>

1664187911 d:\steps\code\steps\header\model\bus_model\bus_frequency_model\bus_frequency_model.h
"header/block/differential_block.h"

1706019143 source:d:\steps\code\steps\source\model\bus_model\pll_model\pll0.cpp
"header/model/bus_model/pll_model/pll0.h"
"header/power_system_database.h"
"header/STEPS.h"
"header/basic/utility.h"
<istream>
<iostream>

1706018649 d:\steps\code\steps\header\model\bus_model\pll_model\pll0.h
"header/model/bus_model/pll_model/pll_model.h"
"header/block/integral_block.h"

1706017775 d:\steps\code\steps\header\model\bus_model\pll_model\pll_model.h
"header/STEPS.h"

1706017945 source:d:\steps\code\steps\source\model\bus_model\bus_frequency_model\bus_frequency_model.cpp
"header/model/bus_model/bus_frequency_model/bus_frequency_model.h"
"header/power_system_database.h"
"header/STEPS.h"
"header/basic/utility.h"
<istream>
<iostream>

1706017094 source:d:\steps\code\steps\source\model\bus_model\pll_model\pll_model.cpp
"header/model/bus_model/pll_model/pll_model.h"
"header/power_system_database.h"
"header/basic/utility.h"
<istream>
<iostream>

2 changes: 1 addition & 1 deletion code/steps/header/device/bus.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "header/basic/steps_enum.h"
#include "header/basic/fault.h"

#include "header/model/bus_frequency_model/bus_frequency_model.h"
#include "header/model/bus_model/bus_frequency_model/bus_frequency_model.h"

#include <string>
#include <complex>
Expand Down
40 changes: 40 additions & 0 deletions code/steps/header/model/bus_model/pll_model/pll0.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#ifndef PLL0_H
#define PLL0_H

#include "header/model/bus_model/pll_model/pll_model.h"
#include "header/block/integral_block.h"

class PLL0 : public PLL_MODEL
{
public:
PLL0(STEPS& toolkit);
~PLL0();
PLL0(const PLL0& model);
virtual PLL0& operator=(const PLL0& model);
void clear();
void copy_from_const_model(const PLL0& model);
public:
void set_Kp(double K);
void set_Ki(double K);
void set_Pllmax(double P);
void set_Pllmin(double P);

double get_Kp() const;
double get_Ki() const;
double get_Pllmax() const;
double get_Pllmin() const;

double get_frquency_deviation_block_state() const;
double get_angle_block_state() const;
public:
virtual void initialize();
virtual void run(DYNAMIC_MODE mode);

virtual double get_pll_frequency_deviation_in_Hz() const;
virtual double get_pll_angle_in_rad() const;
private:
double Kp;
INTEGRAL_BLOCK frequency_deviation_in_Hz_block, angle_in_rad_block;
};

#endif // PLL0_H
43 changes: 43 additions & 0 deletions code/steps/header/model/bus_model/pll_model/pll_model.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#ifndef PLL_MODEL_H
#define PLL_MODEL_H

#include "header/STEPS.h"

class BUS;

class PLL_MODEL
{
public:
PLL_MODEL(STEPS& toolkit);
~PLL_MODEL();
void set_toolkit(STEPS& toolkit);
STEPS& get_toolkit() const;

void set_bus_pointer(BUS* bus);
BUS* get_bus_pointer() const;
unsigned int get_bus() const;

double get_pll_frequency_deviation_in_pu() const;
double get_pll_frequency_in_pu() const;
double get_pll_frequency_in_Hz() const;
double get_pll_angle_in_deg() const;

void initialize_base_frequency_and_base_period();
double get_base_frequency_in_Hz() const;
double get_base_angle_speed_in_radps() const;
double get_base_period_in_s() const;
complex<double> get_terminal_complex_voltage_in_pu() const;
double get_terminal_voltage_angle_in_rad() const;
public:
virtual void initialize() = 0;
virtual void run(DYNAMIC_MODE mode) = 0;

virtual double get_pll_frequency_deviation_in_Hz() const = 0;
virtual double get_pll_angle_in_rad() const = 0;
private:
STEPS* toolkit;
BUS* bus_ptr;
double fbase_Hz, tbase_s;
};

#endif // PLL_MODEL_H
7 changes: 2 additions & 5 deletions code/steps/header/model/wtg_models/wt_generator_model/wt3g0.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "header/model/wtg_models/wt_generator_model/wt_generator_model.h"
#include "header/model/wtg_models/wt_generator_model/lvpl.h"
#include "header/model/bus_model/pll_model/pll0.h"
#include "header/block/integral_block.h"
#include "header/block/first_order_block.h"

Expand Down Expand Up @@ -89,9 +90,6 @@ class WT3G0 : public WT_GENERATOR_MODEL
virtual string get_dynamic_data_in_psse_format() const;
virtual string get_dynamic_data_in_bpa_format() const;
virtual string get_dynamic_data_in_steps_format() const;
public:
// the following function are used to model WT3G0 as ideal voltage source
void set_pll_angle_in_deg(double angle);
private:
void copy_from_const_model(const WT3G0& model);

Expand All @@ -103,8 +101,7 @@ class WT3G0 : public WT_GENERATOR_MODEL
FIRST_ORDER_BLOCK reactive_voltage_commander;
double HVRCR_voltage, HVRCR_current;

double KPLL, KIPLL;
INTEGRAL_BLOCK PLL_frequency_integrator, PLL_angle_integrator;
PLL0 Pll;
};

#endif // GENERATOR_MODEL_H
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class WT3G0_TEST : public WT_GENERATOR_MODEL_TEST
virtual void test_get_model_name();
virtual void test_set_get_parameters();
virtual void test_initialize_and_get_initialized_inputs();
void test_set_get_pll_angle();
private:
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "header/model/bus_frequency_model/bus_frequency_model.h"
#include "header/model/bus_model/bus_frequency_model/bus_frequency_model.h"
#include "header/power_system_database.h"
#include "header/STEPS.h"
#include "header/basic/utility.h"
Expand Down
Loading

0 comments on commit 11b5623

Please sign in to comment.