Skip to content

Commit

Permalink
add test for VSG related models. found some problems
Browse files Browse the repository at this point in the history
  • Loading branch information
changgang committed Jan 25, 2024
1 parent 5bb86a3 commit 71c8ac9
Show file tree
Hide file tree
Showing 8 changed files with 448 additions and 11 deletions.
19 changes: 15 additions & 4 deletions code/steps/STEPS.cbp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
<Option compiler="gcc" />
<Build>
<Target title="release">
<Option output="../../build/bin/release/libSTEPS" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).def" prefix_auto="1" extension_auto="1" />
<Option output="../../build/bin/release/STEPS" prefix_auto="1" extension_auto="1" />
<Option object_output="../../build/obj/release/" />
<Option type="3" />
<Option type="1" />
<Option compiler="gcc" />
<Option use_console_runner="0" />
<Option parameters="--compiler " />
<Compiler>
<Add option="-O3" />
Expand Down Expand Up @@ -344,7 +345,9 @@
<Unit filename="header/model/vsc_hvdc_model/vsc_hvdc_network_model/vsc_hvdc_network_model.h" />
<Unit filename="header/model/vsc_hvdc_model/vsc_hvdc_network_model/vsc_hvdc_network_models.h" />
<Unit filename="header/model/vsg_model/vsg_model.h" />
<Unit filename="header/model/vsg_model/vsg_model_test.h" />
<Unit filename="header/model/vsg_model/vsgcontrol0.h" />
<Unit filename="header/model/vsg_model/vsgcontrol0_test.h" />
<Unit filename="header/model/wtg_models/wind_speed_model/filewind.h" />
<Unit filename="header/model/wtg_models/wind_speed_model/filewind_test.h" />
<Unit filename="header/model/wtg_models/wind_speed_model/wind_speed_model.h" />
Expand Down Expand Up @@ -430,10 +433,10 @@
<Unit filename="main_powerflow.cpp">
<Option link="0" />
</Unit>
<Unit filename="main_short_circuit.cpp" />
<Unit filename="main_tests.cpp">
<Unit filename="main_short_circuit.cpp">
<Option link="0" />
</Unit>
<Unit filename="main_tests.cpp" />
<Unit filename="main_ufls_simulation.cpp">
<Option link="0" />
</Unit>
Expand Down Expand Up @@ -752,7 +755,15 @@
<Unit filename="source/model/vsc_hvdc_model/vsc_hvdc_network_model/VSCHVDCP0.cpp" />
<Unit filename="source/model/vsc_hvdc_model/vsc_hvdc_network_model/vsc_hvdc_network_model.cpp" />
<Unit filename="source/model/vsg_model/vsg_model.cpp" />
<Unit filename="source/model/vsg_model/vsg_model_test.cpp">
<Option compile="0" />
<Option link="0" />
</Unit>
<Unit filename="source/model/vsg_model/vsgcontrol0.cpp" />
<Unit filename="source/model/vsg_model/vsgcontrol0_test.cpp">
<Option compile="0" />
<Option link="0" />
</Unit>
<Unit filename="source/model/wtg_models/wind_speed_model/filewind.cpp" />
<Unit filename="source/model/wtg_models/wind_speed_model/filewind_test.cpp" />
<Unit filename="source/model/wtg_models/wind_speed_model/wind_speed_model.cpp" />
Expand Down
4 changes: 2 additions & 2 deletions code/steps/STEPS.depend
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@
"header/basic/utility.h"
"header/data_imexporter/psse_imexporter.h"

1649855541 source:d:\steps\code\steps\main_tests.cpp
1706157211 source:d:\steps\code\steps\main_tests.cpp
<istream>
<cstdlib>
<cstring>
Expand Down Expand Up @@ -56603,7 +56603,7 @@
"header/device/bus.h"
<complex>

1706070274 source:d:\steps\code\steps\source\model\vsg_model\vsg_model.cpp
1706147195 source:d:\steps\code\steps\source\model\vsg_model\vsg_model.cpp
"header/model/vsg_model/vsg_model.h"
"header/basic/utility.h"
"header/power_system_database.h"
Expand Down
63 changes: 63 additions & 0 deletions code/steps/header/model/vsg_model/vsg_model_test.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#ifndef VSG_MODEL_TEST_H
#define VSG_MODEL_TEST_H

#include <istream>
#include <cstdlib>
#include <cstring>
#include <iostream>

#ifdef _MSC_VER
#pragma warning (disable: 4290)
#endif

#include "cpptest.h"

#include "header/power_system_database.h"
#include "header/STEPS.h"
#include "header/model/vsg_model/vsg_model.h"
#include "header/model/wtg_models/wt_generator_model/wt3g0.h"
using namespace std;

class VSG_MODEL_TEST : public Test::Suite
{
public:
VSG_MODEL_TEST();

WT_GENERATOR* get_test_wt_generator();
VSG_MODEL* get_test_model();
void set_test_model(VSG_MODEL* model);


void test_get_mbase_in_MVA();
void test_get_one_over_mbase_in_one_over_MVA();

void test_get_terminal_complex_power_in_pu_based_on_mbase();
void test_get_terminal_voltage_in_pu();
void test_get_terminal_complex_voltage_in_pu();
void test_get_terminal_voltage_angle_in_rad();
void test_get_bus_base_frequency_in_Hz();
void test_get_bus_base_angle_speed_in_radps();
void test_get_source_impedance_in_pu_based_on_mbase();

void test_set_get_Pref_in_pu_based_on_mbase();
void test_set_get_Qref_in_pu_based_on_mbase();
void test_set_get_Vref_in_pu();

void test_get_virtual_speed_in_pu();

void test_active_power_step_response_of_vsg_model();
void test_reactive_power_step_response_of_vsg_model();
void test_voltage_step_response_of_vsg_model();

void run_a_step();
void export_meter_title();
void export_meter_values(double time);
protected:
virtual setup();
virtual tear_down();
private:
VSG_MODEL* model;
WT3G0* wtg_model;
};

#endif//VSG_MODEL_TEST_H
37 changes: 37 additions & 0 deletions code/steps/header/model/vsg_model/vsgcontrol0_test.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#ifndef WT_GENERATOR_MODEL_TEST_H
#define WT_GENERATOR_MODEL_TEST_H

#include <istream>
#include <cstdlib>
#include <cstring>
#include <iostream>

#ifdef _MSC_VER
#pragma warning (disable: 4290)
#endif

#include "header/model/vsg_model/vsg_model_test.h"

#include "header/model/vsg_model/vsgcontrol0.h"
#include "header/power_system_database.h"
#include "header/STEPS.h"

using namespace std;

class VSGCONTROL0_TEST : public VSG_MODEL_TEST
{
public:
VSGCONTROL0_TEST();
protected:
virtual void setup();
virtual void tear_down();
protected:
VSGCONTROL0* get_model();

virtual void test_get_model_name();
virtual void test_set_get_parameters();
private:

};

#endif//WT_GENERATOR_MODEL_TEST_H
35 changes: 35 additions & 0 deletions code/steps/header/model/vsg_model/wt3g0_test.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#ifndef WT3G0_TEST_H
#define WT3G0_TEST_H

#include <istream>
#include <cstdlib>
#include <cstring>
#include <iostream>

#ifdef _MSC_VER
#pragma warning (disable: 4290)
#endif

#include "header/model/wtg_models/wt_generator_model/wt_generator_model_test.h"

#include "header/model/wtg_models/wt_generator_model/wt3g0.h"

#include "header/STEPS.h"

using namespace std;

class WT3G0_TEST : public WT_GENERATOR_MODEL_TEST
{
public:
WT3G0_TEST();
protected:
virtual void setup();
virtual void tear_down();
protected:
virtual void test_get_model_name();
virtual void test_set_get_parameters();
virtual void test_initialize_and_get_initialized_inputs();
private:
};

#endif//WT3G0_TEST_H
10 changes: 5 additions & 5 deletions code/steps/main_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ int main(int argc, char* argv[])
{
Test::Suite ts;
#ifdef ENABLE_STEPS_TEST
/*

ts.add(unique_ptr<Test::Suite>(new STR_INT_MAP_TEST));

ts.add(unique_ptr<Test::Suite>(new TERMINAL_TEST));
Expand Down Expand Up @@ -250,8 +250,8 @@ int main(int argc, char* argv[])
ts.add(unique_ptr<Test::Suite>(new FIXED_SHUNT_TEST));

ts.add(unique_ptr<Test::Suite>(new HVDC_TEST));
*/
ts.add(unique_ptr<Test::Suite>(new VSC_HVDC_TEST));

//ts.add(unique_ptr<Test::Suite>(new VSC_HVDC_TEST));
/* ts.add(unique_ptr<Test::Suite>(new EQUIVALENT_DEVICE_TEST));
ts.add(unique_ptr<Test::Suite>(new ENERGY_STORAGE_TEST));
Expand Down Expand Up @@ -289,8 +289,8 @@ int main(int argc, char* argv[])
ts.add(unique_ptr<Test::Suite>(new MODEL_VAR_TABLE_TEST));
*/
ts.add(unique_ptr<Test::Suite>(new METER_TEST));
ts.add(unique_ptr<Test::Suite>(new METER_SETTER_TEST));
//ts.add(unique_ptr<Test::Suite>(new METER_TEST));
//ts.add(unique_ptr<Test::Suite>(new METER_SETTER_TEST));
/*
ts.add(unique_ptr<Test::Suite>(new MODEL_TEST));
Expand Down
Loading

0 comments on commit 71c8ac9

Please sign in to comment.