diff --git a/code/steps/STEPS.cbp b/code/steps/STEPS.cbp
index 82391d19..938f0538 100644
--- a/code/steps/STEPS.cbp
+++ b/code/steps/STEPS.cbp
@@ -203,11 +203,29 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -657,10 +675,49 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/code/steps/STEPS.depend b/code/steps/STEPS.depend
index f235b1a0..a7cf8c92 100644
--- a/code/steps/STEPS.depend
+++ b/code/steps/STEPS.depend
@@ -344,11 +344,15 @@
1709512796 d:\steps\code\steps\header\model\pvu_models\pv_relay_model\pv_relay_model.h
"header/model/pvu_models/pvu_model.h"
-1697457172 d:\steps\code\steps\header\device\energy_storage.h
+1710161028 d:\steps\code\steps\header\device\energy_storage.h
"header/device/source.h"
- "header/model/energy_storage_model/energy_storage_model.h"
+ "header/model/energy_storage_model/es_converter_model/es_converter_model.h"
+ "header/model/energy_storage_model/es_electrical_model/es_electrical_model.h"
+ "header/model/energy_storage_model/es_battery_model/es_battery_model.h"
+ "header/model/energy_storage_model/es_vrt_model/es_vrt_model.h"
+ "header/model/energy_storage_model/es_relay_model/es_relay_model.h"
1634637238 d:\steps\code\steps\header\model\energy_storage_model\energy_storage_model.h
"header/model/model.h"
@@ -709,7 +713,7 @@
"header/basic/utility.h"
"header/data_imexporter/psse_imexporter.h"
-1710156628 source:d:\steps\code\steps\main_tests.cpp
+1710161453 source:d:\steps\code\steps\main_tests.cpp
@@ -812,7 +816,7 @@
"header/model/hvdc_model/vdcol_test.h"
"header/model/hvdc_model/CDC4T_test.h"
"header/model/hvdc_model/CDC6T_test.h"
- "header/model/converter_common_models/vsg_model/vsg0_test.h"
+ "header/model/converter_common_models/source_converter_model/gfrmc_model/vsg_model/vsg0_test.h"
"header/model/converter_common_models/vrt_model/lvrt_control_test.h"
"header/model/wtg_models/wt_generator_model/wt3g1_test.h"
"header/model/wtg_models/wt_generator_model/wt3g0_test.h"
@@ -2385,7 +2389,7 @@
"header/data_imexporter/psse_imexporter.h"
"header/model/all_supported_models.h"
-1710155764 d:\steps\code\steps\header\model\all_supported_models.h
+1710160820 d:\steps\code\steps\header\model\all_supported_models.h
"header/model/sg_models/supported_sg_models.h"
"header/model/load_model/load_models.h"
"header/model/load_relay_model/load_relay_models.h"
@@ -2394,7 +2398,7 @@
"header/model/vsc_hvdc_model/vsc_hvdc_converter_model/vsc_hvdc_converter_models.h"
"header/model/wtg_models/supported_wtg_models.h"
"header/model/pvu_models/supported_pvu_models.h"
- "header/model/energy_storage_model/energy_storage_models.h"
+ "header/model/energy_storage_model/supported_es_models.h"
"header/model/equivalent_model/ARXL.h"
1709519699 d:\steps\code\steps\header\model\sg_models\supported_sg_models.h
@@ -2548,9 +2552,9 @@
"header/block/integral_block.h"
"header/block/first_order_block.h"
-1710159320 d:\steps\code\steps\header\model\wtg_models\wt_generator_model\wt3gx.h
+1710161436 d:\steps\code\steps\header\model\wtg_models\wt_generator_model\wt3gx.h
"header/model/wtg_models/wt_generator_model/wt_generator_model.h"
- "header/model/converter_common_models/converter/gfrmc_model/vsg_model/vsg0.h"
+ "header/model/converter_common_models/source_converter_model/gfrmc_model/vsg_model/vsg0.h"
"header/model/converter_common_models/current_order_limiter_model/convcol.h"
"header/block/integral_block.h"
"header/block/first_order_block.h"
@@ -4034,15 +4038,14 @@
-1709520849 source:d:\steps\code\steps\source\device\energy_storage.cpp
+1710161353 source:d:\steps\code\steps\source\device\energy_storage.cpp
"header/device/energy_storage.h"
"header/basic/utility.h"
- "header/model/energy_storage_model/energy_storage_models.h"
"header/STEPS.h"
-1634637238 source:d:\steps\code\steps\source\device\energy_storage_test.cpp
+1710161643 source:d:\steps\code\steps\source\device\energy_storage_test.cpp
"cpptest.h"
"header/basic/test_macro.h"
@@ -4050,7 +4053,6 @@
"header/basic/constants.h"
"header/basic/utility.h"
"header/steps_namespace.h"
- "header/model/energy_storage_model/estr0.h"
@@ -4397,7 +4399,7 @@
-1710156628 source:d:\steps\code\steps\source\dynamic_model_database.cpp
+1710162214 source:d:\steps\code\steps\source\dynamic_model_database.cpp
"header/dynamic_model_database.h"
"header/STEPS.h"
"header/steps_namespace.h"
@@ -4408,7 +4410,7 @@
-1709523992 source:d:\steps\code\steps\source\meter\meter.cpp
+1710162202 source:d:\steps\code\steps\source\meter\meter.cpp
"header/meter/meter.h"
"header/basic/utility.h"
"header/steps_namespace.h"
@@ -6063,7 +6065,7 @@
"header/steps_namespace.h"
-1710153146 source:d:\steps\code\steps\source\network\network_matrix.cpp
+1710163432 source:d:\steps\code\steps\source\network\network_matrix.cpp
"header/network/network_matrix.h"
"header/basic/utility.h"
"header/STEPS.h"
@@ -6084,7 +6086,7 @@
-1697457172 source:d:\steps\code\steps\source\power_system_database.cpp
+1710162912 source:d:\steps\code\steps\source\power_system_database.cpp
"header/power_system_database.h"
"header/STEPS.h"
"header/steps_namespace.h"
@@ -6265,7 +6267,7 @@
"header/steps_namespace.h"
"header/basic/utility.h"
-1649855541 source:d:\steps\code\steps\source\prepare_for_tests\prepare_basic_devices.cpp
+1710162885 source:d:\steps\code\steps\source\prepare_for_tests\prepare_basic_devices.cpp
"header/prepare_for_tests/prepare_models_for_test.h"
"header/model/all_supported_models.h"
"header/basic/utility.h"
@@ -6690,8 +6692,8 @@
1710159010 d:\steps\code\steps\header\model\converter_common_models\converter\source_converter_model.h
"header/STEPS.h"
-1710159247 source:d:\steps\code\steps\source\model\converter_common_model\source_converter_model\gfrmc_model\vsg_model\vsg0.cpp
- "header/model/converter_common_models/converter/gfrmc_model/vsg_model/vsg0.h"
+1710159905 source:d:\steps\code\steps\source\model\converter_common_model\source_converter_model\gfrmc_model\vsg_model\vsg0.cpp
+ "header/model/converter_common_models/source_converter_model/gfrmc_model/vsg_model/vsg0.h"
"header/basic/utility.h"
"header/power_system_database.h"
"header/STEPS.h"
@@ -6704,8 +6706,8 @@
"header/model/converter_common_models/converter/gfrmc_model/gfrmc_model.h"
"header/STEPS.h"
-1710159228 source:d:\steps\code\steps\source\model\converter_common_model\source_converter_model\gfrmc_model\vsg_model\vsg_model.cpp
- "header/model/converter_common_models/converter/gfrmc_model/vsg_model/vsg_model.h"
+1710159902 source:d:\steps\code\steps\source\model\converter_common_model\source_converter_model\gfrmc_model\vsg_model\vsg_model.cpp
+ "header/model/converter_common_models/source_converter_model/gfrmc_model/vsg_model/vsg_model.h"
"header/basic/utility.h"
"header/power_system_database.h"
"header/STEPS.h"
@@ -6745,3 +6747,200 @@
"header/model/converter_common_models/source_converter_model/source_converter_model.h"
"header/STEPS.h"
+1710160517 d:\steps\code\steps\header\model\energy_storage_model\supported_es_models.h
+ "header/model/energy_storage_model/es_battery_model/es_battery_models.h"
+ "header/model/energy_storage_model/es_converter_model/es_converter_models.h"
+ "header/model/energy_storage_model/es_electrical_model/es_electrical_models.h"
+ "header/model/energy_storage_model/es_vrt_model/es_vrt_models.h"
+ "header/model/energy_storage_model/es_relay_model/es_relay_models.h"
+
+1710160849 d:\steps\code\steps\header\model\energy_storage_model\es_battery_model\es_battery_models.h
+
+1710160879 d:\steps\code\steps\header\model\energy_storage_model\es_converter_model\es_converter_models.h
+
+1710141325 d:\steps\code\steps\header\model\energy_storage_model\es_electrical_model\es_electrical_models.h
+
+1710160891 d:\steps\code\steps\header\model\energy_storage_model\es_vrt_model\es_vrt_models.h
+
+1710160901 d:\steps\code\steps\header\model\energy_storage_model\es_relay_model\es_relay_models.h
+
+1710159915 d:\steps\code\steps\header\model\converter_common_models\source_converter_model\gfrmc_model\vsg_model\vsg0.h
+ "header/model/converter_common_models/source_converter_model/gfrmc_model/vsg_model/vsg_model.h"
+ "header/block/integral_block.h"
+
+1710159918 d:\steps\code\steps\header\model\converter_common_models\source_converter_model\gfrmc_model\vsg_model\vsg_model.h
+ "header/model/converter_common_models/source_converter_model/gfrmc_model/gfrmc_model.h"
+ "header/STEPS.h"
+
+1710080048 d:\steps\code\steps\header\model\energy_storage_model\es_converter_model\es_converter_model.h
+ "header/model/energy_storage_model/es_model.h"
+ "header/block/integral_block.h"
+ "header/block/saturation_block.h"
+
+1710162576 d:\steps\code\steps\header\model\energy_storage_model\es_model.h
+ "header/model/model.h"
+
+
+1710081535 d:\steps\code\steps\header\model\energy_storage_model\es_electrical_model\es_electrical_model.h
+ "header/model/energy_storage_model/es_model.h"
+
+
+1710078589 d:\steps\code\steps\header\model\energy_storage_model\es_battery_model\es_battery_model.h
+ "header/model/energy_storage_model/es_model.h"
+
+
+1710154281 d:\steps\code\steps\header\model\energy_storage_model\es_vrt_model\es_vrt_model.h
+ "header/model/energy_storage_model/es_model.h"
+
+
+1710080918 d:\steps\code\steps\header\model\energy_storage_model\es_relay_model\es_relay_model.h
+ "header/model/energy_storage_model/es_model.h"
+
+1710161501 d:\steps\code\steps\header\model\converter_common_models\source_converter_model\gfrmc_model\vsg_model\vsg0_test.h
+
+
+
+
+ "header/model/converter_common_models/source_converter_model/gfrmc_model/vsg_model/vsg_model_test.h"
+ "header/model/converter_common_models/source_converter_model/gfrmc_model/vsg_model/vsg0.h"
+ "header/power_system_database.h"
+ "header/STEPS.h"
+
+1710161519 d:\steps\code\steps\header\model\converter_common_models\source_converter_model\gfrmc_model\vsg_model\vsg_model_test.h
+
+
+
+
+ "cpptest.h"
+ "header/power_system_database.h"
+ "header/STEPS.h"
+ "header/model/converter_common_models/source_converter_model/gfrmc_model/vsg_model/vsg_model.h"
+
+1710150666 source:d:\steps\code\steps\source\model\energy_storage_model\es_battery_model\es_battery_model.cpp
+ "header/model/energy_storage_model/es_battery_model/es_battery_model.h"
+ "header/basic/utility.h"
+ "header/STEPS.h"
+
+
+
+1709817457 source:d:\steps\code\steps\source\model\energy_storage_model\es_battery_model\es_battery_model_test.cpp
+ "header/basic/test_macro.h"
+ "header/model/pvu_models/pv_panel_model/pv_panel_model_test.h"
+ "header/basic/utility.h"
+
+
+
+
+
+
+
+1710079928 source:d:\steps\code\steps\source\model\energy_storage_model\es_converter_model\es_converter_model.cpp
+ "header/model/energy_storage_model/es_converter_model/es_converter_model.h"
+ "header/basic/utility.h"
+ "header/basic/constants.h"
+ "header/steps_namespace.h"
+
+
+
+
+1709817457 source:d:\steps\code\steps\source\model\energy_storage_model\es_converter_model\es_converter_model_test.cpp
+ "header/basic/test_macro.h"
+ "header/model/pvu_models/pv_converter_model/pv_converter_model_test.h"
+ "header/basic/utility.h"
+ "header/steps_namespace.h"
+
+
+
+
+
+
+
+1709817457 source:d:\steps\code\steps\source\model\energy_storage_model\es_converter_model\escvx.cpp
+ "header/model/pvu_models/pv_converter_model/pvcv0.h"
+ "header/basic/utility.h"
+ "header/steps_namespace.h"
+
+
+
+
+1709817457 source:d:\steps\code\steps\source\model\energy_storage_model\es_converter_model\escvx_test.cpp
+ "header/basic/test_macro.h"
+ "header/model/pvu_models/pv_converter_model/pvcv0_test.h"
+ "header/basic/utility.h"
+ "header/steps_namespace.h"
+
+
+
+
+
+
+
+1710162327 source:d:\steps\code\steps\source\model\energy_storage_model\es_battery_model\esbx.cpp
+ "header/model/energy_storage_model/es_battery_model/esbx.h"
+ "header/basic/utility.h"
+ "header/steps_namespace.h"
+
+
+
+1710162284 d:\steps\code\steps\header\model\energy_storage_model\es_battery_model\esbx.h
+ "header/model/energy_storage_model/es_battery_model/es_battery_model.h"
+
+
+1709817457 source:d:\steps\code\steps\source\model\energy_storage_model\es_converter_model\escvy.cpp
+ "header/model/pvu_models/pv_converter_model/pvgu1.h"
+ "header/basic/utility.h"
+ "header/steps_namespace.h"
+
+
+
+
+1709817457 source:d:\steps\code\steps\source\model\energy_storage_model\es_converter_model\escvy_test.cpp
+ "header/basic/test_macro.h"
+ "header/model/pvu_models/pv_converter_model/pvgu1_test.h"
+ "header/basic/utility.h"
+ "header/steps_namespace.h"
+
+
+
+
+
+
+
+1710081549 source:d:\steps\code\steps\source\model\energy_storage_model\es_electrical_model\es_electrical_model.cpp
+ "header/model/energy_storage_model/es_electrical_model/es_electrical_model.h"
+ "header/basic/utility.h"
+ "header/device/energy_storage.h"
+ "header/power_system_database.h"
+ "header/STEPS.h"
+
+1709817457 source:d:\steps\code\steps\source\model\energy_storage_model\es_model_test.cpp
+ "header/basic/test_macro.h"
+ "header/model/pvu_models/pvu_model_test.h"
+ "header/basic/utility.h"
+ "header/steps_namespace.h"
+
+
+
+
+
+
+
+1710140242 source:d:\steps\code\steps\source\model\energy_storage_model\es_relay_model\es_relay_model.cpp
+ "header/model/energy_storage_model/es_relay_model/es_relay_model.h"
+ "header/basic/utility.h"
+ "header/STEPS.h"
+
+
+1710081331 source:d:\steps\code\steps\source\model\energy_storage_model\es_vrt_model\es_vrt_model.cpp
+ "header/model/energy_storage_model/es_vrt_model/es_vrt_model.h"
+ "header/basic/utility.h"
+ "header/device/energy_storage.h"
+ "header/power_system_database.h"
+ "header/STEPS.h"
+
+1710162576 source:d:\steps\code\steps\source\model\energy_storage_model\es_model.cpp
+ "header/model/energy_storage_model/es_model.h"
+ "header/basic/utility.h"
+ "header/power_system_database.h"
+ "header/STEPS.h"
+
diff --git a/code/steps/header/device/energy_storage.h b/code/steps/header/device/energy_storage.h
index 3bff6654..594fc5b0 100644
--- a/code/steps/header/device/energy_storage.h
+++ b/code/steps/header/device/energy_storage.h
@@ -4,7 +4,11 @@
#include
#include
#include "header/device/source.h"
-#include "header/model/energy_storage_model/energy_storage_model.h"
+#include "header/model/energy_storage_model/es_converter_model/es_converter_model.h"
+#include "header/model/energy_storage_model/es_electrical_model/es_electrical_model.h"
+#include "header/model/energy_storage_model/es_battery_model/es_battery_model.h"
+#include "header/model/energy_storage_model/es_vrt_model/es_vrt_model.h"
+#include "header/model/energy_storage_model/es_relay_model/es_relay_model.h"
using namespace std;
@@ -28,9 +32,17 @@ class ENERGY_STORAGE : public SOURCE
virtual void set_model(MODEL* model);
virtual MODEL* get_model_of_type(string model_type, unsigned int index=0);
- void set_energy_storage_model(ENERGY_STORAGE_MODEL* model);
+ void set_es_converter_model(ES_CONVERTER_MODEL* model);
+ void set_es_battery_model(ES_BATTERY_MODEL* model);
+ void set_es_electrical_model(ES_ELECTRICAL_MODEL* model);
+ void set_es_vrt_model(ES_VRT_MODEL* model);
+ void set_es_relay_model(ES_RELAY_MODEL* model);
- ENERGY_STORAGE_MODEL* get_energy_storage_model() const;
+ ES_CONVERTER_MODEL* get_es_converter_model() const;
+ ES_BATTERY_MODEL* get_es_battery_model() const;
+ ES_ELECTRICAL_MODEL* get_es_electrical_model() const;
+ ES_VRT_MODEL* get_es_vrt_model() const;
+ ES_RELAY_MODEL* get_es_relay_model() const;
virtual void run(DYNAMIC_MODE mode);
@@ -42,7 +54,11 @@ class ENERGY_STORAGE : public SOURCE
void set_sequence_parameter_import_flag(bool flag);
bool get_sequence_parameter_import_flag() const;
private:
- ENERGY_STORAGE_MODEL* energy_storage_model;
+ ES_CONVERTER_MODEL* es_converter_model;
+ ES_BATTERY_MODEL* es_battery_model;
+ ES_ELECTRICAL_MODEL* es_electrical_model;
+ ES_VRT_MODEL* es_vrt_model;
+ ES_RELAY_MODEL* es_relay_model;
private:
virtual complex get_complex_internal_voltage_in_pu_in_xy_axis() const;
virtual complex get_source_dynamic_current_in_pu_based_on_system_base_power();
diff --git a/code/steps/header/model/all_supported_models.h b/code/steps/header/model/all_supported_models.h
index 9a0d81c2..dae593ce 100644
--- a/code/steps/header/model/all_supported_models.h
+++ b/code/steps/header/model/all_supported_models.h
@@ -17,7 +17,7 @@
#include "header/model/pvu_models/supported_pvu_models.h"
-#include "header/model/energy_storage_model/energy_storage_models.h"
+#include "header/model/energy_storage_model/supported_es_models.h"
#include "header/model/equivalent_model/ARXL.h"
diff --git a/code/steps/header/model/converter_common_models/source_converter_model/gfrmc_model/vsg_model/vsg0_test.h b/code/steps/header/model/converter_common_models/source_converter_model/gfrmc_model/vsg_model/vsg0_test.h
index 6010e0d8..3895af1e 100644
--- a/code/steps/header/model/converter_common_models/source_converter_model/gfrmc_model/vsg_model/vsg0_test.h
+++ b/code/steps/header/model/converter_common_models/source_converter_model/gfrmc_model/vsg_model/vsg0_test.h
@@ -10,9 +10,9 @@
#pragma warning (disable: 4290)
#endif
-#include "header/model/converter_common_models/vsg_model/vsg_model_test.h"
+#include "header/model/converter_common_models/source_converter_model/gfrmc_model/vsg_model/vsg_model_test.h"
-#include "header/model/converter_common_models/vsg_model/vsg0.h"
+#include "header/model/converter_common_models/source_converter_model/gfrmc_model/vsg_model/vsg0.h"
#include "header/power_system_database.h"
#include "header/STEPS.h"
diff --git a/code/steps/header/model/converter_common_models/source_converter_model/gfrmc_model/vsg_model/vsg_model_test.h b/code/steps/header/model/converter_common_models/source_converter_model/gfrmc_model/vsg_model/vsg_model_test.h
index 9439fce8..cca3423f 100644
--- a/code/steps/header/model/converter_common_models/source_converter_model/gfrmc_model/vsg_model/vsg_model_test.h
+++ b/code/steps/header/model/converter_common_models/source_converter_model/gfrmc_model/vsg_model/vsg_model_test.h
@@ -14,7 +14,7 @@
#include "header/power_system_database.h"
#include "header/STEPS.h"
-#include "header/model/converter_common_models/converter/gfrmc_model/vsg_model/vsg_model.h"
+#include "header/model/converter_common_models/source_converter_model/gfrmc_model/vsg_model/vsg_model.h"
using namespace std;
class VSG_MODEL_TEST : public Test::Suite
diff --git a/code/steps/header/model/energy_storage_model/energy_storage_model.h b/code/steps/header/model/energy_storage_model/energy_storage_model.h
deleted file mode 100644
index 4b7528e0..00000000
--- a/code/steps/header/model/energy_storage_model/energy_storage_model.h
+++ /dev/null
@@ -1,87 +0,0 @@
-#ifndef ENERGY_STORAGE_MODEL_H
-#define ENERGY_STORAGE_MODEL_H
-
-#include "header/model/model.h"
-#include
-
-class ENERGY_STORAGE;
-
-class ENERGY_STORAGE_MODEL : public MODEL
-{
-public:
- ENERGY_STORAGE_MODEL(STEPS& toolkit);
- virtual ~ENERGY_STORAGE_MODEL();
-
- ENERGY_STORAGE* get_energy_storage_pointer() const;
- double get_mbase_in_MVA() const;
- double get_one_over_mbase_in_one_over_MVA() const;
- complex get_terminal_bus_complex_voltage_in_pu() const;
- double get_terminal_bus_voltage_in_pu() const;
- double get_terminal_bus_angle_in_rad() const;
- double get_terminal_bus_frequency_deviation_in_pu() const;
-
- void set_Pmax_in_pu(double p);
- void set_E0_in_pu(double E);
- void set_En_in_MWh(double E);
- void set_Pref_in_pu(double p);
- void set_Vref_in_pu(double v);
-
- double get_Pmax_in_pu() const;
- double get_E0_in_pu() const;
- double get_En_in_MWh() const;
- double get_Pref_in_pu() const;
- double get_Vref_in_pu() const;
-
- public: // specific model level
- virtual string get_model_type() const;
- virtual string get_model_name() const = 0;
-
- virtual bool setup_model_with_steps_string_vector(vector& data) = 0;
- virtual bool setup_model_with_psse_string(string data) = 0;
- virtual bool setup_model_with_bpa_string(string data) = 0;
-
- virtual void setup_block_toolkit_and_parameters() = 0;
-
- virtual void initialize() = 0;
- virtual void run(DYNAMIC_MODE mode) = 0;
- virtual complex get_terminal_complex_power_in_pu_based_on_mbase() const = 0;
- virtual complex get_terminal_complex_power_in_MVA() const = 0 ;
- virtual double get_terminal_active_power_in_pu_based_on_mbase() const = 0;
- virtual double get_terminal_active_power_in_MW() const = 0;
- virtual double get_terminal_reactive_power_in_pu_based_on_mbase() const = 0;
- virtual double get_terminal_reactive_power_in_MVar() const = 0;
- virtual double get_terminal_current_in_kA() const = 0;
- virtual complex get_terminal_complex_current_in_kA() const = 0;
-
- virtual complex get_terminal_complex_current_in_pu_based_on_mbase() const = 0 ;
- virtual complex get_terminal_complex_current_in_pu_based_on_sbase() const = 0;
- virtual double get_terminal_current_in_pu_based_on_mbase() const = 0;
- virtual double get_terminal_current_in_pu_based_on_sbase() const = 0;
-
- virtual double get_energy_state_in_pu() const = 0;
-
- virtual void check() = 0;
- virtual void clear() = 0;
- virtual void report() = 0;
- virtual void save() = 0;
- virtual string get_standard_psse_string(bool export_internal_bus_number=false) const = 0;
-
- virtual void prepare_model_data_table() = 0;
- virtual double get_model_data_with_name(string par_name) const = 0;
- virtual void set_model_data_with_name(string par_name, double value) = 0;
- virtual double get_minimum_nonzero_time_constant_in_s() = 0;
-
- virtual void prepare_model_internal_variable_table() = 0;
- virtual double get_model_internal_variable_with_name(string var_name)= 0;
-
- virtual string get_dynamic_data_in_psse_format() const = 0;
- virtual string get_dynamic_data_in_bpa_format() const = 0;
- virtual string get_dynamic_data_in_steps_format() const = 0;
- private:
- double initial_energy_in_pu;
- double nominal_energy_in_MWh;
- double max_power_in_pu;
-
- double Pref_in_pu, Vref_in_pu;
-};
-#endif // ENERGY_STORAGE_MODEL_H
diff --git a/code/steps/header/model/energy_storage_model/energy_storage_model_test.h b/code/steps/header/model/energy_storage_model/energy_storage_model_test.h
deleted file mode 100644
index 2799caaa..00000000
--- a/code/steps/header/model/energy_storage_model/energy_storage_model_test.h
+++ /dev/null
@@ -1,48 +0,0 @@
-#ifndef ENERGY_STORAGE_MODEL_TEST_H
-#define ENERGY_STORAGE_MODEL_TEST_H
-
-#include
-#include
-#include
-#include
-
-#ifdef _MSC_VER
- #pragma warning (disable: 4290)
-#endif
-
-#include "cpptest.h"
-
-#include "header/power_system_database.h"
-#include "header/STEPS.h"
-using namespace std;
-
-class ENERGY_STORAGE_MODEL_TEST : public Test::Suite
-{
- public:
- ENERGY_STORAGE_MODEL_TEST();
- ENERGY_STORAGE* get_test_energy_storage();
- ENERGY_STORAGE_MODEL* get_test_energy_storage_model();
- protected:
- virtual void setup();
- virtual void tear_down();
- public:
- void test_get_model_type();
- void test_set_get_max_power();
- void test_set_get_inital_energy();
- void test_set_get_nominal_energy();
- void test_set_get_initial_Pref();
- void test_set_get_initial_Vref();
- void test_frequency_step_response();
- void test_voltage_step_response();
- void test_get_standard_psse_string();
-
- void export_meter_title();
- void export_meter_values();
- void run_a_step();
-
- virtual void test_get_model_name() = 0;
- virtual void test_set_get_parameters() = 0;
- private:
-};
-
-#endif//ENERGY_STORAGE_MODEL_TEST_H
diff --git a/code/steps/header/model/energy_storage_model/energy_storage_models.h b/code/steps/header/model/energy_storage_model/energy_storage_models.h
deleted file mode 100644
index 060e232b..00000000
--- a/code/steps/header/model/energy_storage_model/energy_storage_models.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef ENERGY_STORAGE_MODELS_H
-#define ENERGY_STORAGE_MODELS_H
-
-#include "header/model/energy_storage_model/estr0.h"
-
-#endif // ENERGY_STORAGE_MODELS_H
diff --git a/code/steps/header/model/energy_storage_model/es_battery_model/es_battery_model.h b/code/steps/header/model/energy_storage_model/es_battery_model/es_battery_model.h
new file mode 100644
index 00000000..834b6585
--- /dev/null
+++ b/code/steps/header/model/energy_storage_model/es_battery_model/es_battery_model.h
@@ -0,0 +1,46 @@
+#ifndef ES_BATTERY_MODEL_H
+#define ES_BATTERY_MODEL_H
+
+#include "header/model/energy_storage_model/es_model.h"
+#include
+
+class ES_BATTERY_MODEL : public ES_MODEL
+{
+ public:
+ ES_BATTERY_MODEL(STEPS& toolkit);
+ virtual ~ES_BATTERY_MODEL();
+ public:
+ virtual string get_model_type() const;
+ public:
+ virtual string get_model_name() const = 0;
+
+ virtual bool setup_model_with_steps_string_vector(vector& data) = 0;
+ virtual bool setup_model_with_psse_string(string data) = 0;
+ virtual bool setup_model_with_bpa_string(string data) = 0;
+
+ virtual void setup_block_toolkit_and_parameters() = 0;
+
+ virtual void initialize() = 0;
+ virtual void run(DYNAMIC_MODE mode) = 0;
+
+ virtual void check() = 0;
+ virtual void clear() = 0;
+ virtual void report() = 0;
+ virtual void save() = 0;
+ virtual string get_standard_psse_string(bool export_internal_bus_number=false) const = 0;
+
+ virtual void prepare_model_data_table() = 0;
+ virtual double get_model_data_with_name(string par_name) const = 0;
+ virtual void set_model_data_with_name(string par_name, double value) = 0;
+ virtual double get_minimum_nonzero_time_constant_in_s() = 0;
+
+ virtual void prepare_model_internal_variable_table() = 0;
+ virtual double get_model_internal_variable_with_name(string var_name)= 0;
+
+ virtual string get_dynamic_data_in_psse_format() const = 0;
+ virtual string get_dynamic_data_in_bpa_format() const = 0;
+ virtual string get_dynamic_data_in_steps_format() const = 0;
+ private:
+};
+
+#endif // ES_BATTERY_MODEL_H
diff --git a/code/steps/header/model/energy_storage_model/es_battery_model/es_battery_model_test.h b/code/steps/header/model/energy_storage_model/es_battery_model/es_battery_model_test.h
new file mode 100644
index 00000000..6f519a06
--- /dev/null
+++ b/code/steps/header/model/energy_storage_model/es_battery_model/es_battery_model_test.h
@@ -0,0 +1,34 @@
+#ifndef ES_BATTERY_MODEL_TEST_H
+#define ES_BATTERY_MODEL_TEST_H
+
+#include
+#include
+#include
+#include
+
+#ifdef _MSC_VER
+ #pragma warning (disable: 4290)
+#endif
+
+#include "header/model/pvu_models/pvu_model_test.h"
+#include "header/power_system_database.h"
+
+using namespace std;
+
+class PV_PANEL_MODEL_TEST : public PVU_MODEL_TEST
+{
+ public:
+ PV_PANEL_MODEL_TEST();
+ protected:
+ virtual void setup();
+ virtual void tear_down();
+ protected:
+ void test_get_model_type();
+
+ void test_get_standard_psse_string();
+
+ virtual void test_get_model_name() = 0;
+ virtual void test_set_get_parameters() = 0;
+};
+
+#endif//ES_BATTERY_MODEL_TEST_H
diff --git a/code/steps/header/model/energy_storage_model/es_battery_model/es_battery_models.h b/code/steps/header/model/energy_storage_model/es_battery_model/es_battery_models.h
new file mode 100644
index 00000000..9d88c401
--- /dev/null
+++ b/code/steps/header/model/energy_storage_model/es_battery_model/es_battery_models.h
@@ -0,0 +1,4 @@
+#ifndef ES_BATTERY_MODELS_H
+#define ES_BATTERY_MODELS_H
+
+#endif // ES_BATTERY_MODELS_H
diff --git a/code/steps/header/model/energy_storage_model/es_battery_model/esbx.h b/code/steps/header/model/energy_storage_model/es_battery_model/esbx.h
new file mode 100644
index 00000000..fe4047bd
--- /dev/null
+++ b/code/steps/header/model/energy_storage_model/es_battery_model/esbx.h
@@ -0,0 +1,47 @@
+#ifndef ESBX_H
+#define ESBX_H
+
+#include "header/model/energy_storage_model/es_battery_model/es_battery_model.h"
+#include
+
+class ESBX : public ES_BATTERY_MODEL
+{
+ public:
+ ESBX(STEPS& toolkit);
+ ESBX(const ESBX& model);
+ virtual ~ESBX();
+ virtual ESBX& operator=(const ESBX& model);
+ public:
+ virtual string get_model_name() const;
+
+ virtual bool setup_model_with_steps_string_vector(vector& data);
+ virtual bool setup_model_with_psse_string(string data);
+ virtual bool setup_model_with_bpa_string(string data);
+
+ virtual void prepare_model_data_table();
+ virtual void prepare_model_internal_variable_table();
+
+ virtual void setup_block_toolkit_and_parameters();
+
+ virtual void initialize();
+ virtual void run(DYNAMIC_MODE mode);
+
+ virtual void check();
+ virtual void clear();
+ virtual void report();
+ virtual void save();
+ virtual string get_standard_psse_string(bool export_internal_bus_number=false) const;
+
+ virtual double get_model_data_with_name(string par_name) const;
+ virtual void set_model_data_with_name(string par_name, double value);
+ virtual double get_minimum_nonzero_time_constant_in_s();
+ virtual double get_model_internal_variable_with_name(string var_name);
+
+ 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;
+ private:
+ void copy_from_const_model(const ESBX& model);
+};
+
+#endif // ESBX_H
diff --git a/code/steps/header/model/energy_storage_model/estr0_test.h b/code/steps/header/model/energy_storage_model/es_battery_model/esbx_test.h
similarity index 55%
rename from code/steps/header/model/energy_storage_model/estr0_test.h
rename to code/steps/header/model/energy_storage_model/es_battery_model/esbx_test.h
index 320c6583..83e38f0f 100644
--- a/code/steps/header/model/energy_storage_model/estr0_test.h
+++ b/code/steps/header/model/energy_storage_model/es_battery_model/esbx_test.h
@@ -1,5 +1,5 @@
-#ifndef ESTR0_TEST_H
-#define ESTR0_TEST_H
+#ifndef PVP0_TEST_H
+#define PVP0_TEST_H
#include
#include
@@ -10,27 +10,25 @@
#pragma warning (disable: 4290)
#endif
-#include "header/model/energy_storage_model/energy_storage_model_test.h"
+#include "header/model/pvu_models/pv_panel_model/pv_panel_model_test.h"
-#include "header/model/energy_storage_model/estr0.h"
+#include "header/model/pvu_models/pv_panel_model/pvp0.h"
#include "header/STEPS.h"
using namespace std;
-class ESTR0_TEST : public ENERGY_STORAGE_MODEL_TEST
+class PVP0_TEST : public PV_PANEL_MODEL_TEST
{
public:
- ESTR0_TEST();
+ PVP0_TEST();
protected:
virtual void setup();
virtual void tear_down();
protected:
virtual void test_get_model_name();
virtual void test_set_get_parameters();
-
- void test_initialize_and_get_initialized_inputs();
private:
};
-#endif//ESTR0_TEST_H
+#endif//PVP0_TEST_H
diff --git a/code/steps/header/model/energy_storage_model/es_converter_model/es_converter_model.h b/code/steps/header/model/energy_storage_model/es_converter_model/es_converter_model.h
new file mode 100644
index 00000000..824a3863
--- /dev/null
+++ b/code/steps/header/model/energy_storage_model/es_converter_model/es_converter_model.h
@@ -0,0 +1,112 @@
+#ifndef ES_CONVERTER_MODEL_H
+#define ES_CONVERTER_MODEL_H
+
+#include "header/model/energy_storage_model/es_model.h"
+#include "header/block/integral_block.h"
+#include "header/block/saturation_block.h"
+
+// POWER ELECTRONICS SOURCES
+class ES_CONVERTER_MODEL : public ES_MODEL
+{
+ /*
+ Model of es converter
+ Inputs:
+ IPcmd: active current command in pu, from wt_electrical_model
+ IQcmd: reactive current command in pu, from wt_electrical_model
+ Pcmd: active power command in pu, from wt_electrical_model
+ Qcmd: reactive power command in pu, from wt_electrical_model
+ Eqcmd: reactive voltage command in pu, from wt_electrical_model
+ Output:
+ Isource: current injection to network
+ */
+
+ public:
+ ES_CONVERTER_MODEL(STEPS& toolkit);
+ virtual ~ES_CONVERTER_MODEL();
+
+ public:
+ virtual string get_model_type() const;
+ public:
+ void set_current_source_flag(bool flag);
+ bool get_current_source_flag() const;
+ bool is_current_source() const;
+ bool is_voltage_source() const;
+ // set initial active and reactive current commands
+ void set_initial_active_current_command_in_pu_based_on_mbase(double ip_command);
+ double get_initial_active_current_command_in_pu_based_on_mbase() const;
+
+ void set_initial_reactive_current_command_in_pu_based_on_mbase(double iq_command);
+ double get_initial_reactive_current_command_in_pu_based_on_mbase() const;
+
+ void set_initial_reactive_voltage_command_in_pu(double eq_command);
+ double get_initial_reactive_voltage_command_in_pu() const;
+
+ void set_initial_active_power_command_in_pu_based_on_mbase(double P_command);
+ double get_initial_active_power_command_in_pu_based_on_mbase() const;
+
+ void set_initial_reactive_power_command_in_pu_based_on_mbase(double Q_command);
+ double get_initial_reactive_power_command_in_pu_based_on_mbase() const;
+ // get inputs for dynamics run
+ double get_active_current_command_in_pu_based_on_mbase();
+ double get_reactive_current_command_in_pu_based_on_mbase();
+ double get_reactive_voltage_command_in_pu();
+ double get_active_power_command_in_pu_based_on_mbase();
+ double get_reactive_power_command_in_pu_based_on_mbase();
+ public:
+ virtual string get_model_name() const = 0;
+
+ virtual bool setup_model_with_steps_string_vector(vector& data) = 0;
+ virtual bool setup_model_with_psse_string(string data) = 0;
+ virtual bool setup_model_with_bpa_string(string data) = 0;
+
+ virtual void setup_block_toolkit_and_parameters() = 0;
+
+ virtual void initialize() = 0;
+ virtual void run(DYNAMIC_MODE mode) = 0;
+ virtual complex get_source_Norton_equivalent_complex_current_in_pu_in_xy_axis_based_on_sbase() = 0;
+ virtual complex get_terminal_complex_current_in_pu_in_xy_axis_based_on_mbase() = 0;
+ virtual complex get_terminal_complex_current_in_pu_in_xy_axis_based_on_sbase() = 0;
+ virtual double get_terminal_current_in_pu_based_on_mbase() = 0;
+ virtual double get_terminal_current_in_pu_based_on_sbase() = 0;
+
+ virtual void check() = 0;
+ virtual void clear() = 0;
+ virtual void report() = 0;
+ virtual void save() = 0;
+ virtual string get_standard_psse_string(bool export_internal_bus_number=false) const = 0;
+
+ virtual void prepare_model_data_table() = 0;
+ virtual double get_model_data_with_name(string par_name) const = 0;
+ virtual void set_model_data_with_name(string par_name, double value) = 0;
+ virtual double get_minimum_nonzero_time_constant_in_s() = 0;
+
+ virtual void prepare_model_internal_variable_table() = 0;
+ virtual double get_model_internal_variable_with_name(string var_name)= 0;
+
+ virtual complex get_terminal_complex_power_in_pu_based_on_mbase() = 0;
+ virtual complex get_terminal_complex_power_in_MVA() = 0;
+ virtual double get_terminal_active_power_in_pu_based_on_mbase() = 0;
+ virtual double get_terminal_active_power_in_MW() = 0;
+ virtual double get_terminal_reactive_power_in_pu_based_on_mbase() = 0;
+ virtual double get_terminal_reactive_power_in_MVar() = 0;
+ virtual double get_active_power_generation_including_stator_loss_in_pu_based_on_mbase() = 0;
+ virtual double get_active_power_generation_including_stator_loss_in_MW() = 0;
+
+ virtual double get_pll_angle_in_rad() = 0;
+ virtual double get_pll_angle_in_deg() = 0;
+ virtual double get_pll_frequency_deviation_in_pu() = 0;
+ virtual double get_pll_frequency_deviation_in_Hz() = 0;
+ virtual double get_pll_frequency_in_pu() = 0;
+ virtual double get_pll_frequency_in_Hz() = 0;
+ virtual complex get_internal_voltage_in_pu_in_xy_axis() = 0;
+
+ virtual string get_dynamic_data_in_psse_format() const = 0;
+ virtual string get_dynamic_data_in_bpa_format() const = 0;
+ virtual string get_dynamic_data_in_steps_format() const = 0;
+
+ private:
+ bool current_source_flag;
+ double IP_command0, IQ_command0, EQ_command0, P_command0, Q_command0;
+};
+
+#endif // ES_CONVERTER_MODEL_H
diff --git a/code/steps/header/model/energy_storage_model/es_converter_model/es_converter_model_test.h b/code/steps/header/model/energy_storage_model/es_converter_model/es_converter_model_test.h
new file mode 100644
index 00000000..16d8dd60
--- /dev/null
+++ b/code/steps/header/model/energy_storage_model/es_converter_model/es_converter_model_test.h
@@ -0,0 +1,54 @@
+#ifndef ES_CONVERTER_MODEL_TEST_H
+#define ES_CONVERTER_MODEL_TEST_H
+
+#include
+#include
+#include
+#include
+
+#ifdef _MSC_VER
+ #pragma warning (disable: 4290)
+#endif
+
+#include "header/model/pvu_models/pvu_model_test.h"
+
+#include "header/power_system_database.h"
+
+using namespace std;
+
+class PV_CONVERTER_MODEL_TEST : public PVU_MODEL_TEST
+{
+ public:
+ PV_CONVERTER_MODEL_TEST();
+ protected:
+ virtual void setup();
+ virtual void tear_down();
+ protected:
+ void test_get_mbase_in_MVA();
+ void test_get_terminal_complex_voltage_in_pu();
+ void test_get_number_of_lumped_pv_units();
+ void test_get_rated_power_per_pv_unit_in_MW();
+ void test_get_nominal_frequency_in_Hz();
+ void test_get_source_impedance_in_pu_based_on_mbase();
+
+ void test_get_model_type();
+ void test_set_get_initial_active_current_command();
+ void test_set_get_initial_reactive_current_command();
+ void test_get_standard_psse_string();
+
+ void test_active_current_step_response_of_pv_converter_model();
+ void test_reactive_current_step_response_of_pv_converter_model();
+ void test_bus_magnitude_step_response_of_pv_converter_model();
+ void test_bus_angle_step_response_of_pv_converter_model();
+ void test_variable_step_simulation_with_active_current_step_response();
+
+ void run_a_step();
+ void export_meter_title();
+ void export_meter_values(double time);
+
+ virtual void test_get_model_name() = 0;
+ virtual void test_set_get_parameters() = 0;
+ virtual void test_initialize_and_get_initialized_inputs() = 0;
+};
+
+#endif//ES_CONVERTER_MODEL_TEST_H
diff --git a/code/steps/header/model/energy_storage_model/es_converter_model/es_converter_models.h b/code/steps/header/model/energy_storage_model/es_converter_model/es_converter_models.h
new file mode 100644
index 00000000..8dcce0cf
--- /dev/null
+++ b/code/steps/header/model/energy_storage_model/es_converter_model/es_converter_models.h
@@ -0,0 +1,4 @@
+#ifndef ES_CONVERTER_MODELS_H
+#define ES_CONVERTER_MODELS_H
+
+#endif // ES_CONVERTER_MODELS_H
diff --git a/code/steps/header/model/energy_storage_model/es_converter_model/escvx.h b/code/steps/header/model/energy_storage_model/es_converter_model/escvx.h
new file mode 100644
index 00000000..acec43a5
--- /dev/null
+++ b/code/steps/header/model/energy_storage_model/es_converter_model/escvx.h
@@ -0,0 +1,111 @@
+#ifndef ESCVX_H
+#define ESCVX_H
+
+#include "header/model/pvu_models/pv_converter_model/pv_converter_model.h"
+#include "header/model/converter_common_models/lvpl_model/lvpl.h"
+#include "header/block/integral_block.h"
+#include "header/block/first_order_block.h"
+
+class ESCVX : public PV_CONVERTER_MODEL
+{
+ public:
+ ESCVX(STEPS& toolkit);
+ ESCVX(const ESCVX& model);
+ virtual ~ESCVX();
+ virtual ESCVX& operator=(const ESCVX&);
+
+ void set_converter_activer_current_command_T_in_s(double t);
+ void set_converter_reactiver_voltage_command_T_in_s(double t);
+ void set_KPLL(double K);
+ void set_KIPLL(double K);
+ void set_PLLmax(double pmax);
+ void set_PLLmin(double pmax);
+ void set_LVPL(const LVPL& lvpl);
+ void set_HVRC_voltage_in_pu(double v);
+ void set_HVRC_current_in_pu(double i);
+ void set_LVPL_max_rate_of_active_current_change(double rate);
+ void set_LVPL_voltage_sensor_T_in_s(double t);
+
+ double get_converter_activer_current_command_T_in_s() const;
+ double get_converter_reactiver_voltage_command_T_in_s() const;
+ double get_KPLL() const;
+ double get_KIPLL() const;
+ double get_PLLmax() const;
+ double get_PLLmin() const;
+ LVPL get_LVPL() const;
+ double get_HVRC_voltage_in_pu() const;
+ double get_HVRC_current_in_pu() const;
+ double get_LVPL_max_rate_of_active_current_change() const;
+ double get_LVPL_voltage_sensor_T_in_s() const;
+
+
+ virtual string get_model_name() const;
+
+ virtual bool setup_model_with_steps_string_vector(vector& data);
+ virtual bool setup_model_with_psse_string(string data);
+ virtual bool setup_model_with_bpa_string(string data);
+
+ virtual void prepare_model_data_table();
+ virtual void prepare_model_internal_variable_table();
+
+ virtual void setup_block_toolkit_and_parameters();
+
+ virtual void initialize();
+ virtual void run(DYNAMIC_MODE mode);
+ virtual complex get_source_Norton_equivalent_complex_current_in_pu_in_xy_axis_based_on_sbase();
+ virtual complex get_terminal_complex_current_in_pu_in_xy_axis_based_on_mbase();
+ virtual complex get_terminal_complex_current_in_pu_in_xy_axis_based_on_sbase();
+ virtual double get_terminal_current_in_pu_based_on_mbase();
+ virtual double get_terminal_current_in_pu_based_on_sbase();
+
+ virtual void check();
+ virtual void clear();
+ virtual void report();
+ virtual void save();
+ virtual string get_standard_psse_string(bool export_internal_bus_number=false) const;
+
+ virtual double get_model_data_with_name(string par_name) const;
+ virtual void set_model_data_with_name(string par_name, double value);
+ virtual double get_minimum_nonzero_time_constant_in_s();
+ virtual double get_model_internal_variable_with_name(string var_name);
+
+ virtual complex get_terminal_complex_power_in_pu_based_on_mbase();
+ virtual complex get_terminal_complex_power_in_MVA();
+ virtual double get_terminal_active_power_in_pu_based_on_mbase();
+ virtual double get_terminal_active_power_in_MW();
+ virtual double get_terminal_reactive_power_in_pu_based_on_mbase();
+ virtual double get_terminal_reactive_power_in_MVar();
+ virtual double get_active_power_generation_including_stator_loss_in_pu_based_on_mbase();
+ virtual double get_active_power_generation_including_stator_loss_in_MW();
+
+ virtual double get_pll_angle_in_rad();
+ virtual double get_pll_angle_in_deg();
+ virtual double get_pll_frequency_deviation_in_pu();
+ virtual double get_pll_frequency_deviation_in_Hz();
+ virtual double get_pll_frequency_in_pu();
+ virtual double get_pll_frequency_in_Hz();
+ virtual complex get_internal_voltage_in_pu_in_xy_axis();
+
+ 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 ESCVX as ideal voltage source
+ void set_pll_angle_in_deg(double angle);
+ private:
+ void copy_from_const_model(const ESCVX& model);
+
+ INTEGRAL_BLOCK active_current_commander;
+ FIRST_ORDER_BLOCK LVPL_voltage_sensor;
+ LVPL lvpl;
+
+ FIRST_ORDER_BLOCK reactive_voltage_commander;
+
+ INTEGRAL_BLOCK PLL_frequency_integrator, PLL_angle_integrator;
+
+ double LVPL_active_power_change_rate;
+ double HVRCR_voltage, HVRCR_current;
+ double KPLL;
+};
+
+#endif // GENERATOR_MODEL_H
diff --git a/code/steps/header/model/energy_storage_model/es_converter_model/escvx_test.h b/code/steps/header/model/energy_storage_model/es_converter_model/escvx_test.h
new file mode 100644
index 00000000..339b61be
--- /dev/null
+++ b/code/steps/header/model/energy_storage_model/es_converter_model/escvx_test.h
@@ -0,0 +1,35 @@
+#ifndef PVCV0_TEST_H
+#define PVCV0_TEST_H
+
+#include
+#include
+#include
+#include
+
+#ifdef _MSC_VER
+ #pragma warning (disable: 4290)
+#endif
+
+#include "header/model/pvu_models/pv_converter_model/pv_converter_model_test.h"
+
+#include "header/model/pvu_models/pv_converter_model/pvcv0.h"
+#include "header/STEPS.h"
+
+using namespace std;
+
+class PVCV0_TEST : public PV_CONVERTER_MODEL_TEST
+{
+ public:
+ PVCV0_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();
+ void test_set_get_pll_angle();
+ private:
+};
+
+#endif//PVCV0_TEST_H
diff --git a/code/steps/header/model/energy_storage_model/es_converter_model/escvy.h b/code/steps/header/model/energy_storage_model/es_converter_model/escvy.h
new file mode 100644
index 00000000..aa65e5e3
--- /dev/null
+++ b/code/steps/header/model/energy_storage_model/es_converter_model/escvy.h
@@ -0,0 +1,97 @@
+#ifndef ESCVY_H
+#define ESCVY_H
+
+#include "header/model/pvu_models/pv_converter_model/pv_converter_model.h"
+#include "header/model/converter_common_models/lvpl_model/lvpl.h"
+#include "header/block/integral_block.h"
+#include "header/block/first_order_block.h"
+
+class ESCVY : public PV_CONVERTER_MODEL
+{
+ public:
+ ESCVY(STEPS& toolkit);
+ ESCVY(const ESCVY& model);
+ virtual ~ESCVY();
+ virtual ESCVY& operator=(const ESCVY&);
+
+ void set_converter_activer_current_command_T_in_s(double t);
+ void set_converter_reactiver_voltage_command_T_in_s(double t);
+ void set_LVPL(const LVPL& lvpl);
+ void set_HVRC_voltage_in_pu(double v);
+ void set_HVRC_current_in_pu(double i);
+ void set_LVPL_max_rate_of_active_current_change(double rate);
+ void set_LVPL_voltage_sensor_T_in_s(double t);
+
+ double get_converter_activer_current_command_T_in_s() const;
+ double get_converter_reactiver_voltage_command_T_in_s() const;
+ LVPL get_LVPL() const;
+ double get_HVRC_voltage_in_pu() const;
+ double get_HVRC_current_in_pu() const;
+ double get_LVPL_max_rate_of_active_current_change() const;
+ double get_LVPL_voltage_sensor_T_in_s() const;
+
+
+ virtual string get_model_name() const;
+
+ virtual bool setup_model_with_steps_string_vector(vector& data);
+ virtual bool setup_model_with_psse_string(string data);
+ virtual bool setup_model_with_bpa_string(string data);
+
+ virtual void prepare_model_data_table();
+ virtual void prepare_model_internal_variable_table();
+
+ virtual void setup_block_toolkit_and_parameters();
+
+ virtual void initialize();
+ virtual void run(DYNAMIC_MODE mode);
+ virtual complex get_source_Norton_equivalent_complex_current_in_pu_in_xy_axis_based_on_sbase();
+ virtual complex get_terminal_complex_current_in_pu_in_xy_axis_based_on_mbase();
+ virtual complex get_terminal_complex_current_in_pu_in_xy_axis_based_on_sbase();
+ virtual double get_terminal_current_in_pu_based_on_mbase();
+ virtual double get_terminal_current_in_pu_based_on_sbase();
+
+ virtual void check();
+ virtual void clear();
+ virtual void report();
+ virtual void save();
+ virtual string get_standard_psse_string(bool export_internal_bus_number=false) const;
+
+ virtual double get_model_data_with_name(string par_name) const;
+ virtual void set_model_data_with_name(string par_name, double value);
+ virtual double get_minimum_nonzero_time_constant_in_s();
+ virtual double get_model_internal_variable_with_name(string var_name);
+
+ virtual complex get_terminal_complex_power_in_pu_based_on_mbase();
+ virtual complex get_terminal_complex_power_in_MVA();
+ virtual double get_terminal_active_power_in_pu_based_on_mbase();
+ virtual double get_terminal_active_power_in_MW();
+ virtual double get_terminal_reactive_power_in_pu_based_on_mbase();
+ virtual double get_terminal_reactive_power_in_MVar();
+ virtual double get_active_power_generation_including_stator_loss_in_pu_based_on_mbase();
+ virtual double get_active_power_generation_including_stator_loss_in_MW();
+
+ virtual double get_pll_angle_in_rad();
+ virtual double get_pll_angle_in_deg();
+ virtual double get_pll_frequency_deviation_in_pu();
+ virtual double get_pll_frequency_deviation_in_Hz();
+ virtual double get_pll_frequency_in_pu();
+ virtual double get_pll_frequency_in_Hz();
+ virtual complex get_internal_voltage_in_pu_in_xy_axis();
+
+ 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;
+ private:
+ void copy_from_const_model(const ESCVY& model);
+
+ INTEGRAL_BLOCK active_current_commander;
+ FIRST_ORDER_BLOCK LVPL_voltage_sensor;
+ LVPL lvpl;
+
+ FIRST_ORDER_BLOCK reactive_voltage_commander;
+
+ double LVPL_active_power_change_rate;
+ double HVRCR_voltage, HVRCR_current;
+};
+
+#endif // GENERATOR_MODEL_H
diff --git a/code/steps/header/model/energy_storage_model/es_converter_model/escvy_test.h b/code/steps/header/model/energy_storage_model/es_converter_model/escvy_test.h
new file mode 100644
index 00000000..8101518d
--- /dev/null
+++ b/code/steps/header/model/energy_storage_model/es_converter_model/escvy_test.h
@@ -0,0 +1,35 @@
+#ifndef PVGU1_TEST_H
+#define PVGU1_TEST_H
+
+#include
+#include
+#include
+#include
+
+#ifdef _MSC_VER
+ #pragma warning (disable: 4290)
+#endif
+
+#include "header/model/pvu_models/pv_converter_model/pv_converter_model_test.h"
+
+#include "header/model/pvu_models/pv_converter_model/pvgu1.h"
+
+#include "header/STEPS.h"
+
+using namespace std;
+
+class PVGU1_TEST : public PV_CONVERTER_MODEL_TEST
+{
+ public:
+ PVGU1_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//PVGU1_TEST_H
diff --git a/code/steps/header/model/energy_storage_model/es_electrical_model/es_electrical_model.h b/code/steps/header/model/energy_storage_model/es_electrical_model/es_electrical_model.h
new file mode 100644
index 00000000..d71e6a5a
--- /dev/null
+++ b/code/steps/header/model/energy_storage_model/es_electrical_model/es_electrical_model.h
@@ -0,0 +1,89 @@
+#ifndef ES_ELECTRICAL_MODEL_H
+#define ES_ELECTRICAL_MODEL_H
+
+#include "header/model/energy_storage_model/es_model.h"
+#include
+class ES_ELECTRICAL_MODEL : public ES_MODEL
+{
+ public:
+ ES_ELECTRICAL_MODEL(STEPS& toolkit);
+ virtual ~ES_ELECTRICAL_MODEL();
+ void unbypass_model();
+ void bypass_model();
+ bool is_model_bypassed() const;
+ public: // pe elctricla control common
+ virtual string get_model_type() const;
+ // get input
+ complex get_energy_storage_terminal_generation_in_MVA() const;
+ complex get_energy_storage_terminal_generation_in_pu_based_on_mbase() const;
+ complex get_terminal_bus_complex_voltage_in_pu() const;
+ double get_terminal_bus_voltage_in_pu() const;
+ complex get_energy_storage_terminal_complex_current_in_pu() const;
+ double get_energy_storage_terminal_current_in_pu() const;
+
+ double get_terminal_bus_frequency_in_pu() const;
+ double get_terminal_bus_frequency_deviation_in_pu() const;
+ // reference
+ void set_bus_to_regulate(unsigned int bus);
+ unsigned int get_bus_to_regulate() const;
+
+ void set_voltage_reference_in_pu(double vref);
+ void set_voltage_reference_in_pu_with_bus_to_regulate();
+ double get_voltage_reference_in_pu() const;
+ void set_frequency_reference_in_pu(double fref);
+ double get_frequency_reference_in_pu() const;
+ void set_active_power_reference_in_pu(double pref);
+ double get_active_power_reference_in_pu() const;
+ void set_reactive_power_reference_in_pu(double qref);
+ double get_reactive_power_reference_in_pu() const;
+ void set_power_factor_reference_in_pu(double pfref);
+ double get_power_factor_reference_in_pu() const;
+ void set_var_control_mode(PE_VAR_CONTROL_MODE mode);
+ PE_VAR_CONTROL_MODE get_var_control_mode() const;
+ public: // specific exciter
+ virtual string get_model_name() const = 0;
+
+ virtual bool setup_model_with_steps_string_vector(vector& data) = 0;
+ virtual bool setup_model_with_psse_string(string data) = 0;
+ virtual bool setup_model_with_bpa_string(string data) = 0;
+
+ virtual void setup_block_toolkit_and_parameters() = 0;
+
+ virtual void initialize() = 0;
+ virtual void run(DYNAMIC_MODE mode) = 0;
+ virtual double get_active_current_command_in_pu_based_on_mbase() = 0;
+ virtual double get_active_power_command_in_pu_based_on_mbase() const = 0;
+ virtual double get_reactive_current_command_in_pu_based_on_mbase() = 0;
+ virtual double get_reactive_power_command_in_pu_based_on_mbase() = 0;
+ virtual double get_reactive_voltage_command_in_pu_based_on_mbase() const = 0;
+ virtual double get_reactive_voltage_command_in_pu() const = 0;
+ virtual void check() = 0;
+ virtual void clear() = 0;
+ virtual void report() = 0;
+ virtual void save() = 0;
+ virtual string get_standard_psse_string(bool export_internal_bus_number=false) const = 0;
+
+ virtual void prepare_model_data_table() = 0;
+ virtual double get_model_data_with_name(string par_name) const = 0;
+ virtual void set_model_data_with_name(string par_name, double value) = 0;
+ virtual double get_minimum_nonzero_time_constant_in_s() = 0;
+
+ virtual void prepare_model_internal_variable_table() = 0;
+ virtual double get_model_internal_variable_with_name(string var_name)= 0;
+
+ virtual string get_dynamic_data_in_psse_format() const = 0;
+ virtual string get_dynamic_data_in_bpa_format() const = 0;
+ virtual string get_dynamic_data_in_steps_format() const = 0;
+ private:
+ unsigned int bus_to_regulate;
+ double voltage_reference_in_pu;
+ double frequency_reference_in_pu;
+ double active_power_reference_in_pu;
+ double reactive_power_reference_in_pu;
+ double power_factor_reference_in_pu;
+ PE_VAR_CONTROL_MODE pe_var_control_mode;
+
+ bool flag_model_bypassed;
+};
+
+#endif // ES_ELECTRICAL_MODEL_H
diff --git a/code/steps/header/model/energy_storage_model/es_electrical_model/es_electrical_model_test.h b/code/steps/header/model/energy_storage_model/es_electrical_model/es_electrical_model_test.h
new file mode 100644
index 00000000..4618a0cd
--- /dev/null
+++ b/code/steps/header/model/energy_storage_model/es_electrical_model/es_electrical_model_test.h
@@ -0,0 +1,58 @@
+#ifndef ES_ELECTRICAL_MODEL_TEST_H
+#define ES_ELECTRICAL_MODEL_TEST_H
+
+#include
+#include
+#include
+#include
+
+#ifdef _MSC_VER
+ #pragma warning (disable: 4290)
+#endif
+
+#include "header/model/pvu_models/pvu_model_test.h"
+
+#include "header/power_system_database.h"
+using namespace std;
+
+class PV_ELECTRICAL_MODEL_TEST : public PVU_MODEL_TEST
+{
+ public:
+ PV_ELECTRICAL_MODEL_TEST();
+ protected:
+ virtual void setup();
+ virtual void tear_down();
+ protected:
+ void test_get_model_type();
+ void test_get_pv_unit_terminal_generation();
+ void test_get_terminal_bus_voltage();
+ void test_get_terminal_bus_frequency();
+ void test_set_get_bus_to_regulate();
+
+ void test_set_get_voltage_reference();
+ void test_set_get_frequency_reference();
+ void test_set_get_active_power_reference();
+ void test_set_get_reactive_power_reference();
+ void test_set_get_power_factor_reference();
+ void test_set_get_var_control_mode();
+
+ void test_get_standard_psse_string();
+
+ void test_step_response_with_voltage_drop();
+ void test_step_response_with_frequency_drop();
+
+ virtual void test_get_model_name() = 0;
+ virtual void test_set_get_parameters() = 0;
+ virtual void test_initialize() = 0;
+ private:
+ void apply_voltage_drop_of_10_percent();
+ void apply_frequency_drop_of_5_percent();
+
+ void initialize_models();
+ void run_to_time(double tend);
+
+ void export_meter_title();
+ void export_meter_values();
+};
+
+#endif//ES_ELECTRICAL_MODEL_TEST_H
diff --git a/code/steps/header/model/energy_storage_model/es_electrical_model/es_electrical_models.h b/code/steps/header/model/energy_storage_model/es_electrical_model/es_electrical_models.h
new file mode 100644
index 00000000..d3946d3b
--- /dev/null
+++ b/code/steps/header/model/energy_storage_model/es_electrical_model/es_electrical_models.h
@@ -0,0 +1,5 @@
+#ifndef ES_ELECTRICAL_MODELS_H
+#define ES_ELECTRICAL_MODELS_H
+
+
+#endif // ES_ELECTRICAL_MODELS_H
diff --git a/code/steps/header/model/energy_storage_model/es_model.h b/code/steps/header/model/energy_storage_model/es_model.h
new file mode 100644
index 00000000..4e9a5aca
--- /dev/null
+++ b/code/steps/header/model/energy_storage_model/es_model.h
@@ -0,0 +1,56 @@
+#ifndef ES_MODEL_H
+#define ES_MODEL_H
+
+#include "header/model/model.h"
+#include
+
+class ENERGY_STORAGE;
+
+class ES_MODEL : public MODEL
+{
+public:
+ ES_MODEL(STEPS& toolkit);
+ virtual ~ES_MODEL();
+
+ ENERGY_STORAGE* get_energy_storage_pointer() const;
+ double get_mbase_in_MVA() const;
+ double get_one_over_mbase_in_one_over_MVA() const;
+
+ double get_terminal_voltage_in_pu() const;
+ complex get_terminal_complex_voltage_in_pu() const;
+ double get_terminal_voltage_angle_in_rad() const;
+ double get_bus_base_frequency_in_Hz() const;
+ complex get_source_impedance_in_pu_based_on_mbase() const;
+
+ public: // specific model level
+ virtual string get_model_type() const = 0;
+ virtual string get_model_name() const = 0;
+
+ virtual bool setup_model_with_steps_string_vector(vector& data) = 0;
+ virtual bool setup_model_with_psse_string(string data) = 0;
+ virtual bool setup_model_with_bpa_string(string data) = 0;
+
+ virtual void setup_block_toolkit_and_parameters() = 0;
+
+ virtual void initialize() = 0;
+ virtual void run(DYNAMIC_MODE mode) = 0;
+
+ virtual void check() = 0;
+ virtual void clear() = 0;
+ virtual void report() = 0;
+ virtual void save() = 0;
+ virtual string get_standard_psse_string(bool export_internal_bus_number=false) const = 0;
+
+ virtual void prepare_model_data_table() = 0;
+ virtual double get_model_data_with_name(string par_name) const = 0;
+ virtual void set_model_data_with_name(string par_name, double value) = 0;
+ virtual double get_minimum_nonzero_time_constant_in_s() = 0;
+
+ virtual void prepare_model_internal_variable_table() = 0;
+ virtual double get_model_internal_variable_with_name(string var_name)= 0;
+
+ virtual string get_dynamic_data_in_psse_format() const = 0;
+ virtual string get_dynamic_data_in_bpa_format() const = 0;
+ virtual string get_dynamic_data_in_steps_format() const = 0;
+};
+#endif // ES_MODEL_H
diff --git a/code/steps/header/model/energy_storage_model/es_model_test.h b/code/steps/header/model/energy_storage_model/es_model_test.h
new file mode 100644
index 00000000..fe09ea7d
--- /dev/null
+++ b/code/steps/header/model/energy_storage_model/es_model_test.h
@@ -0,0 +1,35 @@
+#ifndef ES_MODEL_TEST_H
+#define ES_MODEL_TEST_H
+
+#include
+#include
+#include
+#include
+
+#ifdef _MSC_VER
+ #pragma warning (disable: 4290)
+#endif
+
+#include "cpptest.h"
+
+#include "header/power_system_database.h"
+#include "header/STEPS.h"
+
+using namespace std;
+
+class ES_MODEL_TEST : public Test::Suite
+{
+ public:
+ ES_MODEL_TEST();
+ ENERGY_STORAGE* get_test_pv_unit();
+ PV_CONVERTER_MODEL* get_test_es_converter_model();
+ PV_PANEL_MODEL* get_test_pv_panel_model();
+ PV_ELECTRICAL_MODEL* get_test_pv_electrical_model();
+ PV_IRRADIANCE_MODEL* get_test_pv_irradiance_model();
+ protected:
+ virtual void setup();
+ virtual void tear_down();
+ private:
+};
+
+#endif//ES_MODEL_TEST_H
diff --git a/code/steps/header/model/energy_storage_model/es_relay_model/es_relay_model.h b/code/steps/header/model/energy_storage_model/es_relay_model/es_relay_model.h
new file mode 100644
index 00000000..36ede8c7
--- /dev/null
+++ b/code/steps/header/model/energy_storage_model/es_relay_model/es_relay_model.h
@@ -0,0 +1,56 @@
+#ifndef ES_RELAY_MODEL_H
+#define ES_RELAY_MODEL_H
+
+#include "header/model/energy_storage_model/es_model.h"
+class ES_RELAY_MODEL : public ES_MODEL
+{
+ /*
+ es relay model:
+ inputs:
+ frequency: bus frequency
+ voltage: bus voltage
+ output:
+ trip es if necessary
+ */
+ public:
+ ES_RELAY_MODEL(STEPS& toolkit);
+ virtual ~ES_RELAY_MODEL();
+
+ virtual string get_model_type() const;
+ // inputs
+ double get_bus_frequency_in_pu() const;
+ //double get_bus_positive_sequence_voltage_in_pu() const;
+ public: // specific model level
+ virtual string get_model_name() const = 0;
+
+ virtual bool setup_model_with_steps_string_vector(vector& data) = 0;
+ virtual bool setup_model_with_psse_string(string data) = 0;
+ virtual bool setup_model_with_bpa_string(string data) = 0;
+
+ virtual void setup_block_toolkit_and_parameters() = 0;
+
+ virtual void initialize() = 0;
+ virtual void run(DYNAMIC_MODE mode) = 0;
+
+ virtual void check() = 0;
+ virtual void clear() = 0;
+ virtual void report() = 0;
+ virtual void save() = 0;
+ virtual string get_standard_psse_string(bool export_internal_bus_number=false) const = 0;
+
+ virtual void prepare_model_data_table() = 0;
+ virtual double get_model_data_with_name(string par_name) const = 0;
+ virtual void set_model_data_with_name(string par_name, double value) = 0;
+ virtual double get_minimum_nonzero_time_constant_in_s() = 0;
+
+ virtual void prepare_model_internal_variable_table() = 0;
+ virtual double get_model_internal_variable_with_name(string var_name)= 0;
+
+ virtual string get_dynamic_data_in_psse_format() const = 0;
+ virtual string get_dynamic_data_in_bpa_format() const = 0;
+ virtual string get_dynamic_data_in_steps_format() const = 0;
+ private:
+ void common_constructor();
+};
+
+#endif // ES_RELAY_MODEL_H
diff --git a/code/steps/header/model/energy_storage_model/es_relay_model/es_relay_model_test.h b/code/steps/header/model/energy_storage_model/es_relay_model/es_relay_model_test.h
new file mode 100644
index 00000000..d003323a
--- /dev/null
+++ b/code/steps/header/model/energy_storage_model/es_relay_model/es_relay_model_test.h
@@ -0,0 +1,52 @@
+#ifndef ES_RELAY_MODEL_TEST_H
+#define ES_RELAY_MODEL_TEST_H
+
+#include
+#include
+#include
+#include
+
+#ifdef _MSC_VER
+ #pragma warning (disable: 4290)
+#endif
+
+#include "header/model/pvu_models/pvu_model_test.h"
+#include "header/power_system_database.h"
+using namespace std;
+
+class PV_RELAY_MODEL_TEST : public PVG_MODEL_TEST
+{
+ public:
+ PV_RELAY_MODEL_TEST();
+ protected:
+ virtual void setup();
+ virtual void tear_down();
+ protected:
+ void test_get_model_type();
+ void test_set_get_damping();
+ void test_get_standard_psse_string();
+ void test_step_response_of_wt_turbine_model_with_pitch_angle_increase_in_underspeed_mode();
+ void test_step_response_of_wt_turbine_model_with_pitch_angle_increase_in_mppt_mode();
+ void test_step_response_of_wt_turbine_model_with_pitch_angle_increase_in_overspeed_mode();
+ void test_step_response_of_wt_turbine_model_with_generator_power_order_drop_in_underspeed_mode();
+ void test_step_response_of_wt_turbine_model_with_generator_power_order_drop_in_mppt_mode();
+ void test_step_response_of_wt_turbine_model_with_generator_power_order_drop_in_overspeed_mode();
+
+ protected:
+ virtual void test_get_model_name() = 0;
+ virtual void test_set_get_parameters() = 0;
+ virtual void test_initialize() = 0;
+ private:
+ void run_step_response_of_wt_turbine_model_with_pitch_angle_increase_in_underspeed_mode();
+ void run_step_response_of_wt_turbine_model_with_pitch_angle_increase_in_mppt_mode();
+ void run_step_response_of_wt_turbine_model_with_pitch_angle_increase_in_overspeed_mode();
+ void apply_1deg_pitch_angle_increase();
+ void run_step_response_of_wt_turbine_model_with_generator_power_order_drop_in_underspeed_mode();
+ void run_step_response_of_wt_turbine_model_with_generator_power_order_drop_in_mppt_mode();
+ void run_step_response_of_wt_turbine_model_with_generator_power_order_drop_in_overspeed_mode();
+ void apply_10_percent_power_order_drop();
+ void export_meter_title();
+ void export_meter_values();
+};
+
+#endif//ES_RELAY_MODEL_TEST_H
diff --git a/code/steps/header/model/energy_storage_model/es_relay_model/es_relay_models.h b/code/steps/header/model/energy_storage_model/es_relay_model/es_relay_models.h
new file mode 100644
index 00000000..09875498
--- /dev/null
+++ b/code/steps/header/model/energy_storage_model/es_relay_model/es_relay_models.h
@@ -0,0 +1,5 @@
+#ifndef ES_RELAY_MODELS_H
+#define ES_RELAY_MODELS_H
+
+
+#endif // ES_RELAY_MODELS_H
diff --git a/code/steps/header/model/energy_storage_model/es_vrt_model/es_vrt_model.h b/code/steps/header/model/energy_storage_model/es_vrt_model/es_vrt_model.h
new file mode 100644
index 00000000..d1039a3c
--- /dev/null
+++ b/code/steps/header/model/energy_storage_model/es_vrt_model/es_vrt_model.h
@@ -0,0 +1,70 @@
+#ifndef ES_VRT_MODEL_H
+#define ES_VRT_MODEL_H
+
+#include "header/model/energy_storage_model/es_model.h"
+#include
+class ES_VRT_MODEL : public ES_MODEL
+{
+ /*
+ ES voltage ride through control model
+ General inputs:
+ vterm: ES terminal or remote AC voltage
+ General output:
+ ipcmd: active current command in pu
+ iqcmd: reactive current command in pu
+ */
+ public:
+ ES_VRT_MODEL(STEPS& toolkit);
+ virtual ~ES_VRT_MODEL();
+ public: // pe elctricla control common
+ virtual string get_model_type() const;
+ // get input
+ complex get_terminal_bus_complex_voltage_in_pu() const;
+ double get_terminal_bus_voltage_in_pu() const;
+
+ complex get_energy_storage_terminal_generation_in_MVA() const;
+ complex get_energy_storage_terminal_generation_in_pu_based_on_mbase() const;
+ complex get_energy_storage_terminal_complex_current_in_pu() const;
+ double get_energy_storage_terminal_current_in_pu() const;
+ public: // specific exciter
+ virtual string get_model_name() const = 0;
+
+ virtual bool setup_model_with_steps_string_vector(vector& data) = 0;
+ virtual bool setup_model_with_psse_string(string data) = 0;
+ virtual bool setup_model_with_bpa_string(string data) = 0;
+
+ virtual void setup_block_toolkit_and_parameters() = 0;
+
+ virtual void initialize() = 0;
+ virtual void run(DYNAMIC_MODE mode) = 0;
+
+ virtual bool is_in_vrt_status() const = 0;
+ virtual VRT_STATUS get_lvrt_status() const = 0;
+ virtual VRT_STATUS get_hvrt_status() const = 0;
+
+ virtual double get_active_current_command_in_pu_based_on_mbase() = 0;
+ virtual double get_active_power_command_in_pu_based_on_mbase() = 0;
+ virtual double get_reactive_current_command_in_pu_based_on_mbase() = 0;
+ virtual double get_reactive_power_command_in_pu_based_on_mbase() = 0;
+ virtual double get_reactive_voltage_command_in_pu() = 0;
+ virtual void check() = 0;
+ virtual void clear() = 0;
+ virtual void report() = 0;
+ virtual void save() = 0;
+ virtual string get_standard_psse_string(bool export_internal_bus_number=false) const = 0;
+
+ virtual void prepare_model_data_table() = 0;
+ virtual double get_model_data_with_name(string par_name) const = 0;
+ virtual void set_model_data_with_name(string par_name, double value) = 0;
+ virtual double get_minimum_nonzero_time_constant_in_s() = 0;
+
+ virtual void prepare_model_internal_variable_table() = 0;
+ virtual double get_model_internal_variable_with_name(string var_name)= 0;
+
+ virtual string get_dynamic_data_in_psse_format() const = 0;
+ virtual string get_dynamic_data_in_bpa_format() const = 0;
+ virtual string get_dynamic_data_in_steps_format() const = 0;
+ private:
+};
+
+#endif // ES_VRT_MODEL_H
diff --git a/code/steps/header/model/energy_storage_model/es_vrt_model/es_vrt_models.h b/code/steps/header/model/energy_storage_model/es_vrt_model/es_vrt_models.h
new file mode 100644
index 00000000..e783cd28
--- /dev/null
+++ b/code/steps/header/model/energy_storage_model/es_vrt_model/es_vrt_models.h
@@ -0,0 +1,5 @@
+#ifndef ES_VRT_MODELS_H
+#define ES_VRT_MODELS_H
+
+
+#endif // ES_VRT_MODELS_H
diff --git a/code/steps/header/model/energy_storage_model/estr0.h b/code/steps/header/model/energy_storage_model/estr0.h
deleted file mode 100644
index e55cb9e7..00000000
--- a/code/steps/header/model/energy_storage_model/estr0.h
+++ /dev/null
@@ -1,125 +0,0 @@
-#ifndef ESTR0_H
-#define ESTR0_H
-
-#include "header/model/energy_storage_model/energy_storage_model.h"
-#include "header/block/pid_block.h"
-#include "header/block/integral_block.h"
-#include "header/block/lead_lag_block.h"
-#include "header/block/first_order_block.h"
-
-
-class ESTR0 : public ENERGY_STORAGE_MODEL
-{
- public:
- ESTR0(STEPS& toolkit);
- ESTR0(const ESTR0& model);
- virtual ESTR0& operator=(const ESTR0& model);
- virtual ~ESTR0();
-
- virtual string get_model_name() const;
- public:
- void set_Tp1_in_s(double t);
- void set_Tp2_in_s(double t);
- void set_Tp3_in_s(double t);
- void set_Tp4_in_s(double t);
- void set_Kpp(double k);
- void set_Kip(double k);
- void set_Kdp(double k);
- void set_Tdp_in_s(double t);
- void set_Tr_in_s(double t);
- void set_Iacmax_in_pu(double imax);
- void set_Kin_in_pu(double k);
- void set_Kout_in_pu(double k);
-
- void set_Tq1_in_s(double t);
- void set_Tq2_in_s(double t);
- void set_Tq3_in_s(double t);
- void set_Tq4_in_s(double t);
- void set_Kq(double k);
- void set_Dq(double d);
-
- double get_Tp1_in_s() const;
- double get_Tp2_in_s() const;
- double get_Tp3_in_s() const;
- double get_Tp4_in_s() const;
- double get_Kpp() const;
- double get_Kip() const;
- double get_Kdp() const;
- double get_Tdp_in_s() const;
- double get_Tr_in_s() const;
- double get_Iacmax_in_pu() const;
- double get_Kin_in_pu() const;
- double get_Kout_in_pu() const;
-
-
- double get_Tq1_in_s() const;
- double get_Tq2_in_s() const;
- double get_Tq3_in_s() const;
- double get_Tq4_in_s() const;
- double get_Kq() const;
- double get_Dq() const;
-
- public:
- virtual bool setup_model_with_steps_string_vector(vector& data);
- virtual bool setup_model_with_psse_string(string data);
- virtual bool setup_model_with_bpa_string(string data);
-
- virtual void prepare_model_data_table();
- virtual void prepare_model_internal_variable_table();
-
- virtual void setup_block_toolkit_and_parameters();
-
- virtual void initialize();
- virtual void run(DYNAMIC_MODE mode);
-
- virtual complex get_terminal_complex_power_in_pu_based_on_mbase() const;
- virtual complex get_terminal_complex_power_in_MVA() const;
- virtual double get_terminal_active_power_in_pu_based_on_mbase() const;
- virtual double get_terminal_active_power_in_MW() const;
- virtual double get_terminal_reactive_power_in_pu_based_on_mbase() const;
- virtual double get_terminal_reactive_power_in_MVar() const;
- virtual double get_terminal_current_in_kA() const;
- virtual complex get_terminal_complex_current_in_kA() const;
-
- virtual complex get_terminal_complex_current_in_pu_based_on_mbase() const;
- virtual complex get_terminal_complex_current_in_pu_based_on_sbase() const;
- virtual double get_terminal_current_in_pu_based_on_mbase() const;
- virtual double get_terminal_current_in_pu_based_on_sbase() const;
-
- virtual double get_energy_state_in_pu() const;
-
- virtual void check();
- virtual void clear();
- virtual void report();
- virtual void save();
- virtual string get_standard_psse_string(bool export_internal_bus_number=false) const;
-
- virtual double get_model_data_with_name(string par_name) const;
- virtual void set_model_data_with_name(string par_name, double value);
- virtual double get_minimum_nonzero_time_constant_in_s();
- virtual double get_model_internal_variable_with_name(string var_name);
-
- 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;
- private:
- void copy_from_const_model(const ESTR0& model);
-
- LEAD_LAG_BLOCK active_lead_lag_1, active_lead_lag_2;
- PID_BLOCK active_pid_block;
- double Pmax;
- FIRST_ORDER_BLOCK active_power_filter;
- INTEGRAL_BLOCK energy_state_block;
- double E0;
- double Enominal;
-
- double Effin, Effout;
- LEAD_LAG_BLOCK reactive_lead_lag_1, reactive_lead_lag_2;
- INTEGRAL_BLOCK reactive_integral_block;
- double Dq;
-
-
-};
-
-
-#endif // GENERATOR_MODEL_H
diff --git a/code/steps/header/model/energy_storage_model/supported_es_models.h b/code/steps/header/model/energy_storage_model/supported_es_models.h
new file mode 100644
index 00000000..0123c622
--- /dev/null
+++ b/code/steps/header/model/energy_storage_model/supported_es_models.h
@@ -0,0 +1,12 @@
+#ifndef SUPPORTED_ES_MODELS_H
+#define SUPPORTED_ES_MODELS_H
+
+
+#include "header/model/energy_storage_model/es_battery_model/es_battery_models.h"
+#include "header/model/energy_storage_model/es_converter_model/es_converter_models.h"
+#include "header/model/energy_storage_model/es_electrical_model/es_electrical_models.h"
+#include "header/model/energy_storage_model/es_vrt_model/es_vrt_models.h"
+#include "header/model/energy_storage_model/es_relay_model/es_relay_models.h"
+
+
+#endif // SUPPORTED_ES_MODELS_H
diff --git a/code/steps/header/model/wtg_models/wt_generator_model/wt3gx.h b/code/steps/header/model/wtg_models/wt_generator_model/wt3gx.h
index d02a5fde..f27e0deb 100644
--- a/code/steps/header/model/wtg_models/wt_generator_model/wt3gx.h
+++ b/code/steps/header/model/wtg_models/wt_generator_model/wt3gx.h
@@ -2,7 +2,7 @@
#define WT3GX_H
#include "header/model/wtg_models/wt_generator_model/wt_generator_model.h"
-#include "header/model/converter_common_models/converter/gfrmc_model/vsg_model/vsg0.h"
+#include "header/model/converter_common_models/source_converter_model/gfrmc_model/vsg_model/vsg0.h"
#include "header/model/converter_common_models/current_order_limiter_model/convcol.h"
#include "header/block/integral_block.h"
#include "header/block/first_order_block.h"
diff --git a/code/steps/main_tests.cpp b/code/steps/main_tests.cpp
index def3887d..452964bb 100644
--- a/code/steps/main_tests.cpp
+++ b/code/steps/main_tests.cpp
@@ -130,7 +130,7 @@
#include "header/model/hvdc_model/CDC4T_test.h"
#include "header/model/hvdc_model/CDC6T_test.h"
-#include "header/model/converter_common_models/vsg_model/vsg0_test.h"
+#include "header/model/converter_common_models/source_converter_model/gfrmc_model/vsg_model/vsg0_test.h"
#include "header/model/converter_common_models/vrt_model/lvrt_control_test.h"
//#include "header/model/vsc_hvdc_model/VSCHVDC1_test.h"
diff --git a/code/steps/source/device/energy_storage.cpp b/code/steps/source/device/energy_storage.cpp
index b1a37b12..2edb55ec 100644
--- a/code/steps/source/device/energy_storage.cpp
+++ b/code/steps/source/device/energy_storage.cpp
@@ -1,7 +1,6 @@
#include "header/device/energy_storage.h"
#include "header/basic/utility.h"
-#include "header/model/energy_storage_model/energy_storage_models.h"
#include "header/STEPS.h"
#include
@@ -42,7 +41,13 @@ complex ENERGY_STORAGE::get_energy_storage_impedance_in_pu() const
void ENERGY_STORAGE::clear()
{
SOURCE::clear();
- energy_storage_model = NULL;
+
+ es_converter_model = NULL;
+ es_electrical_model = NULL;
+ es_vrt_model = NULL;
+ es_relay_model = NULL;
+ es_battery_model = NULL;
+
sequence_parameter_import_flag = false;
}
@@ -64,60 +69,192 @@ void ENERGY_STORAGE::set_model(MODEL* model)
if(model!=NULL and model->has_allowed_device_type(STEPS_ENERGY_STORAGE))
{
model->set_device_id(get_device_id());
- if(model->get_model_type()=="ENERGY STORAGE")
- set_energy_storage_model((ENERGY_STORAGE_MODEL*) model);
- else
+ if(model->get_model_type()=="ES CONVERTER")
+ {
+ set_es_converter_model((ES_CONVERTER_MODEL*) model);
+ return;
+ }
+
+ if(model->get_model_type()=="ES BATTERY")
+ {
+ set_es_battery_model((ES_BATTERY_MODEL*) model);
+ return;
+ }
+
+ if(model->get_model_type()=="ES ELECTRICAL")
{
- ostringstream osstream;
- osstream<<"Warning. Unsupported model type '"<get_model_type()<<"' when setting up energy storage-related model.";
- STEPS& toolkit = get_toolkit();
- toolkit.show_information_with_leading_time_stamp(osstream);
+ set_es_electrical_model((ES_ELECTRICAL_MODEL*) model);
+ return;
}
+
+ if(model->get_model_type()=="ES VRT")
+ {
+ set_es_vrt_model((ES_VRT_MODEL*) model);
+ return;
+ }
+
+ if(model->get_model_type()=="ES RELAY")
+ {
+ set_es_relay_model((ES_RELAY_MODEL*) model);
+ return;
+ }
+
+ ostringstream osstream;
+ osstream<<"Warning. Unsupported model type '"<get_model_type()<<"' when setting up energy storage-related model.";
+ STEPS& toolkit = get_toolkit();
+ toolkit.show_information_with_leading_time_stamp(osstream);
}
}
MODEL* ENERGY_STORAGE::get_model_of_type(string model_type, unsigned int index)
{
model_type = string2upper(model_type);
- if(model_type=="ENERGY STORAGE")
- return get_energy_storage_model();
- else
- return NULL;
+ if(model_type=="ES CONVERTER")
+ return get_es_converter_model();
+ if(model_type=="ES BATTERY")
+ return get_es_battery_model();
+ if(model_type=="ES ELECTRICAL")
+ return get_es_electrical_model();
+ if(model_type=="ES VRT")
+ return get_es_vrt_model();
+ if(model_type=="ES RELAY")
+ return get_es_relay_model();
+ return NULL;
+}
+
+void ENERGY_STORAGE::set_es_converter_model(ES_CONVERTER_MODEL* model)
+{
+ if(model!=NULL)
+ es_converter_model = model;
+}
+
+void ENERGY_STORAGE::set_es_battery_model(ES_BATTERY_MODEL* model)
+{
+ if(model!=NULL)
+ es_battery_model = model;
+}
+
+void ENERGY_STORAGE::set_es_electrical_model(ES_ELECTRICAL_MODEL* model)
+{
+ if(model!=NULL)
+ es_electrical_model = model;
+}
+
+void ENERGY_STORAGE::set_es_vrt_model(ES_VRT_MODEL* model)
+{
+ if(model!=NULL)
+ es_vrt_model = model;
}
-void ENERGY_STORAGE::set_energy_storage_model(ENERGY_STORAGE_MODEL* model)
+void ENERGY_STORAGE::set_es_relay_model(ES_RELAY_MODEL* model)
{
if(model!=NULL)
- energy_storage_model = model;
+ es_relay_model = model;
}
-ENERGY_STORAGE_MODEL* ENERGY_STORAGE::get_energy_storage_model() const
+ES_CONVERTER_MODEL* ENERGY_STORAGE::get_es_converter_model() const
{
- return energy_storage_model;
+ return es_converter_model;
+}
+
+ES_BATTERY_MODEL* ENERGY_STORAGE::get_es_battery_model() const
+{
+ return es_battery_model;
+}
+
+ES_ELECTRICAL_MODEL* ENERGY_STORAGE::get_es_electrical_model() const
+{
+ return es_electrical_model;
+}
+
+ES_VRT_MODEL* ENERGY_STORAGE::get_es_vrt_model() const
+{
+ return es_vrt_model;
+}
+
+ES_RELAY_MODEL* ENERGY_STORAGE::get_es_relay_model() const
+{
+ return es_relay_model;
}
void ENERGY_STORAGE::run(DYNAMIC_MODE mode)
{
+ ostringstream osstream;
+ STEPS& toolkit = get_toolkit();
+
if(get_status()==true)
{
+ ES_CONVERTER_MODEL* conv = get_es_converter_model();
+ ES_ELECTRICAL_MODEL* elec = get_es_electrical_model();
+ ES_BATTERY_MODEL* battery = get_es_battery_model();
+ ES_VRT_MODEL* vrt = get_es_vrt_model();
+ ES_RELAY_MODEL* relay = get_es_relay_model();
+
switch(mode)
{
case INITIALIZE_MODE:
{
- ENERGY_STORAGE_MODEL* estorage = get_energy_storage_model();
- if(estorage!=NULL and estorage->is_model_active())
- estorage->initialize();
+ if(conv!=NULL and conv->is_model_active())
+ conv->initialize();
else
+ {
+ osstream<<"Error. No ES CONVERTER model is provided for "<is_model_active())
+ elec->initialize();
+
+ if(battery!=NULL and battery->is_model_active())
+ battery->initialize();
+
+ if(vrt!=NULL and vrt->is_model_active())
+ vrt->initialize();
+
+ if(relay!=NULL and relay->is_model_active())
+ relay->initialize();
+
break;
}
- default:
+ case INTEGRATE_MODE:
+ case UPDATE_MODE:
{
- ENERGY_STORAGE_MODEL* estorage = get_energy_storage_model();
- if(estorage!=NULL and estorage->is_model_active())
- estorage->run(mode);
+ if(vrt!=NULL and vrt->is_model_active())
+ {
+ vrt->run(mode);
+ if(elec!=NULL and elec->is_model_active())
+ {
+ if(elec->is_model_bypassed()
+ and (not vrt->is_in_vrt_status()))
+ elec->unbypass_model();
+ else
+ {
+ if(not elec->is_model_bypassed()
+ and (vrt->is_in_vrt_status()))
+ elec->bypass_model();
+ }
+ }
+ }
+
+ if(battery!=NULL and battery->is_model_active())
+ battery->run(mode);
+
+ if(elec!=NULL and elec->is_model_active() and (not elec->is_model_bypassed()))
+ elec->run(mode);
+
+ if(conv!=NULL and conv->is_model_active())
+ conv->run(mode);
break;
}
+ case RELAY_MODE:
+ {
+ if(relay!=NULL and relay->is_model_active())
+ relay->run(mode);
+ break;
+ }
+ default:
+ break;
}
}
}
@@ -163,7 +300,11 @@ ENERGY_STORAGE& ENERGY_STORAGE::operator=(const ENERGY_STORAGE& estorage)
set_bus_to_regulate(estorage.get_bus_to_regulate());
set_voltage_to_regulate_in_pu(estorage.get_voltage_to_regulate_in_pu());
- set_model(estorage.get_energy_storage_model());
+ set_model(estorage.get_es_converter_model());
+ set_model(estorage.get_es_electrical_model());
+ set_model(estorage.get_es_vrt_model());
+ set_model(estorage.get_es_relay_model());
+ set_model(estorage.get_es_vrt_model());
return *this;
}
diff --git a/code/steps/source/device/energy_storage_test.cpp b/code/steps/source/device/energy_storage_test.cpp
index fc0a3745..7ba42447 100644
--- a/code/steps/source/device/energy_storage_test.cpp
+++ b/code/steps/source/device/energy_storage_test.cpp
@@ -9,7 +9,7 @@
#include "header/basic/utility.h"
#include "header/steps_namespace.h"
-#include "header/model/energy_storage_model/estr0.h"
+//#include "header/model/energy_storage_model/estr0.h"
#include
#include
@@ -147,6 +147,7 @@ void ENERGY_STORAGE_TEST::test_get_device_id()
void ENERGY_STORAGE_TEST::test_set_get_energy_storage_model()
{
+ /*
show_test_information_for_function_of_class(__FUNCTION__,"ENERGY_STORAGE_TEST");
energy_storage.set_energy_storage_bus(1);
@@ -179,6 +180,7 @@ void ENERGY_STORAGE_TEST::test_set_get_energy_storage_model()
TEST_ASSERT(fabs(((ESTR0*)modelptr)->get_Tr_in_s()-3.0) wt_generator_meters{ "TERMINAL CURRENT IN PU ON MBASE", "TERMINA
"WT TURBINE MODEL INTERNAL VARIABLE",
"WT ELECTRICAL MODEL INTERNAL VARIABLE",
"WT PITCH MODEL INTERNAL VARIABLE",
+ "WT VRT MODEL INTERNAL VARIABLE",
+ "WT RELAY MODEL INTERNAL VARIABLE",
"WIND SPEED MODEL INTERNAL VARIABLE"};
vector pv_unit_meters{ "TERMINAL CURRENT IN PU", "TERMINAL CURRENT IN KA",
@@ -135,16 +137,23 @@ vector pv_unit_meters{ "TERMINAL CURRENT IN PU", "TERMINAL CURRENT IN KA
"PV CONVERTER MODEL INTERNAL VARIABLE",
"PV PANEL MODEL INTERNAL VARIABLE",
"PV ELECTRICAL MODEL INTERNAL VARIABLE",
- "PV IRRADIANCE MODEL INTERNAL VARIABLE"};
-
-vector energy_storage_meters{"STATE OF ENERGY IN PU",
- "ACTIVE POWER IN MW",
- "ACTIVE POWER IN PU",
- "REACTIVE POWER IN MVAR",
- "REACTIVE POWER IN PU",
- "TERMINAL CURRENT IN KA",
- "TERMINAL CURRENT IN PU",
- "ENERGY STORAGE MODEL INTERNAL VARIABLE"};
+ "PV IRRADIANCE MODEL INTERNAL VARIABLE",
+ "PV VRT MODEL INTERNAL VARIABLE",
+ "PV RELAY MODEL INTERNAL VARIABLE"};
+
+vector energy_storage_meters{"TERMINAL CURRENT IN PU", "TERMINAL CURRENT IN KA",
+ "TERMINAL ACTIVE POWER IN MW",
+ "TERMINAL REACTIVE POWER IN MVAR",
+ "ACTIVE CURRENT COMMAND IN PU",
+ "REACTIVE CURRENT COMMAND IN PU",
+ "ACTIVE POWER COMMAND IN PU",
+ "REACTIVE POWER COMMAND IN PU",
+ "REACTIVE VOLTAGE COMMAND IN PU",
+ "ES CONVERTER MODEL INTERNAL VARIABLE",
+ "ES ELECTRICAL MODEL INTERNAL VARIABLE",
+ "ES BATTERY MODEL INTERNAL VARIABLE",
+ "ES VRT MODEL INTERNAL VARIABLE",
+ "ES RELAY MODEL INTERNAL VARIABLE"};
vector hvdc_meters{ "DC CURRENT IN KA",
"RECTIFIER DC CURRENT IN KA", "INVERTER DC CURRENT IN KA",
@@ -386,6 +395,10 @@ bool METER::is_internal_variable_name_valid(string& name, unsigned int index) co
model = ptr->get_wt_electrical_model();
if(meter_type=="WT PITCH MODEL INTERNAL VARIABLE")
model = ptr->get_wt_pitch_model();
+ if(meter_type=="WT VRT MODEL INTERNAL VARIABLE")
+ model = ptr->get_wt_vrt_model();
+ if(meter_type=="WT RELAY MODEL INTERNAL VARIABLE")
+ model = ptr->get_wt_relay_model();
if(meter_type=="WIND SPEED MODEL INTERNAL VARIABLE")
model = ptr->get_wind_speed_model();
}
@@ -400,12 +413,24 @@ bool METER::is_internal_variable_name_valid(string& name, unsigned int index) co
model = ptr->get_pv_electrical_model();
if(meter_type=="PV IRRADIANCE MODEL INTERNAL VARIABLE")
model = ptr->get_pv_irradiance_model();
+ if(meter_type=="PV VRT MODEL INTERNAL VARIABLE")
+ model = ptr->get_pv_vrt_model();
+ if(meter_type=="PV RELAY MODEL INTERNAL VARIABLE")
+ model = ptr->get_pv_relay_model();
}
if(device_type==STEPS_ENERGY_STORAGE)
{
ENERGY_STORAGE* ptr = (ENERGY_STORAGE*)get_device_pointer();
- if(meter_type=="ENERGY STORAGE MODEL INTERNAL VARIABLE")
- model = ptr->get_energy_storage_model();
+ if(meter_type=="ES CONVERTER MODEL INTERNAL VARIABLE")
+ model = ptr->get_es_converter_model();
+ if(meter_type=="ES ELECTRICAL MODEL INTERNAL VARIABLE")
+ model = ptr->get_es_electrical_model();
+ if(meter_type=="ES BATTERY MODEL INTERNAL VARIABLE")
+ model = ptr->get_es_battery_model();
+ if(meter_type=="ES VRT MODEL INTERNAL VARIABLE")
+ model = ptr->get_es_vrt_model();
+ if(meter_type=="ES RELAY MODEL INTERNAL VARIABLE")
+ model = ptr->get_es_relay_model();
}
if(device_type==STEPS_HVDC)
{
@@ -1558,8 +1583,9 @@ double METER::get_meter_value_as_a_wt_generator() const
WT_AERODYNAMIC_MODEL* aerd_model = generator->get_wt_aerodynamic_model();
WT_TURBINE_MODEL* turbine_model = generator->get_wt_turbine_model();
WT_ELECTRICAL_MODEL* electrical_model = generator->get_wt_electrical_model();
- WT_VRT_MODEL* vrt_model = generator->get_wt_vrt_model();
WT_PITCH_MODEL* pitch_model = generator->get_wt_pitch_model();
+ WT_VRT_MODEL* vrt_model = generator->get_wt_vrt_model();
+ WT_RELAY_MODEL* relay_model = generator->get_wt_relay_model();
WIND_SPEED_MODEL* windspeed_model = generator->get_wind_speed_model();
if(meter_type=="TERMINAL CURRENT IN PU ON MBASE")
@@ -1892,6 +1918,20 @@ double METER::get_meter_value_as_a_wt_generator() const
else
return 0.0;
}
+ if(meter_type=="WT VRT MODEL INTERNAL VARIABLE")
+ {
+ if(vrt_model!=NULL)
+ return vrt_model->get_model_internal_variable_with_name(get_internal_variable_name());
+ else
+ return 0.0;
+ }
+ if(meter_type=="WT RELAY MODEL INTERNAL VARIABLE")
+ {
+ if(relay_model!=NULL)
+ return relay_model->get_model_internal_variable_with_name(get_internal_variable_name());
+ else
+ return 0.0;
+ }
if(meter_type=="WIND SPEED MODEL INTERNAL VARIABLE")
{
if(windspeed_model!=NULL)
@@ -1927,6 +1967,8 @@ double METER::get_meter_value_as_a_pv_unit() const
PV_PANEL_MODEL* panel_model = pv_unit->get_pv_panel_model();
PV_ELECTRICAL_MODEL* electrical_model = pv_unit->get_pv_electrical_model();
PV_IRRADIANCE_MODEL* irradiance_model = pv_unit->get_pv_irradiance_model();
+ PV_VRT_MODEL* vrt_model = pv_unit->get_pv_vrt_model();
+ PV_RELAY_MODEL* relay_model = pv_unit->get_pv_relay_model();
if(meter_type=="TERMINAL CURRENT IN PU ON MBASE")
{
@@ -2099,6 +2141,20 @@ double METER::get_meter_value_as_a_pv_unit() const
else
return 0.0;
}
+ if(meter_type=="PV VRT MODEL INTERNAL VARIABLE")
+ {
+ if(vrt_model!=NULL)
+ return vrt_model->get_model_internal_variable_with_name(get_internal_variable_name());
+ else
+ return 0.0;
+ }
+ if(meter_type=="PV RELAY MODEL INTERNAL VARIABLE")
+ {
+ if(relay_model!=NULL)
+ return relay_model->get_model_internal_variable_with_name(get_internal_variable_name());
+ else
+ return 0.0;
+ }
return 0.0;
}
else
@@ -2525,37 +2581,196 @@ double METER::get_meter_value_as_an_equivalent_device() const
double METER::get_meter_value_as_an_energy_storage() const
{
- ENERGY_STORAGE* estorage = (ENERGY_STORAGE*) get_device_pointer();
- if(estorage != NULL)
+ ostringstream osstream;
+
+ ENERGY_STORAGE* energy_storage = (ENERGY_STORAGE*) get_device_pointer();
+ if(energy_storage != NULL)
{
- ENERGY_STORAGE_MODEL* model = estorage->get_energy_storage_model();
- if(model!=NULL)
+ if(energy_storage->get_status()==true)
{
string meter_type = get_meter_type();
- if(meter_type=="STATE OF ENERGY IN PU")
- return model->get_energy_state_in_pu();
-
- if(meter_type=="ACTIVE POWER IN MW")
- return model->get_terminal_active_power_in_MW();
-
- if(meter_type=="ACTIVE POWER IN PU")
- return model->get_terminal_active_power_in_pu_based_on_mbase();
+ unsigned int bus = energy_storage->get_energy_storage_bus();
+ POWER_SYSTEM_DATABASE& psdb = toolkit->get_power_system_database();
+ double one_over_sbase = toolkit->get_one_over_system_base_power_in_one_over_MVA();
+ double mbase = energy_storage->get_mbase_in_MVA();
- if(meter_type=="REACTIVE POWER IN MVAR")
- return model->get_terminal_reactive_power_in_MVar();
+ ES_CONVERTER_MODEL* converter_model = energy_storage->get_es_converter_model();
+ ES_BATTERY_MODEL* battery_model = energy_storage->get_es_battery_model();
+ ES_ELECTRICAL_MODEL* electrical_model = energy_storage->get_es_electrical_model();
+ ES_VRT_MODEL* vrt_model = energy_storage->get_es_vrt_model();
+ ES_RELAY_MODEL* relay_model = energy_storage->get_es_relay_model();
- if(meter_type=="REACTIVE POWER IN PU")
- return model->get_terminal_reactive_power_in_pu_based_on_mbase();
+ if(meter_type=="TERMINAL CURRENT IN PU ON MBASE")
+ {
+ if(converter_model != NULL)
+ return converter_model->get_terminal_current_in_pu_based_on_mbase();
+ else
+ return 0.0;
+ }
+ if(meter_type=="TERMINAL CURRENT IN PU ON SBASE")
+ {
+ if(converter_model != NULL)
+ return converter_model->get_terminal_current_in_pu_based_on_mbase()*(mbase*one_over_sbase);
+ else
+ return 0.0;
+ }
if(meter_type=="TERMINAL CURRENT IN KA")
- return model->get_terminal_current_in_kA();
-
- if(meter_type=="TERMINAL CURRENT IN PU")
- return model->get_terminal_current_in_pu_based_on_mbase();
-
- if(meter_type=="ENERGY STORAGE MODEL INTERNAL VARIABLE")
- return model->get_model_internal_variable_with_name(get_internal_variable_name());
-
+ {
+ if(converter_model != NULL)
+ {
+ double vbase = psdb.get_bus_base_voltage_in_kV(bus);
+ double ibase = mbase/(SQRT3*vbase);
+ return converter_model->get_terminal_current_in_pu_based_on_mbase()*ibase;
+ }
+ else
+ return 0.0;
+ }
+ if(meter_type=="TERMINAL ACTIVE POWER IN PU ON MBASE")
+ {
+ if(converter_model != NULL)
+ return converter_model->get_terminal_active_power_in_pu_based_on_mbase();
+ else
+ return 0.0;
+ }
+ if(meter_type=="TERMINAL ACTIVE POWER IN PU ON SBASE")
+ {
+ if(converter_model != NULL)
+ return converter_model->get_terminal_active_power_in_MW()*one_over_sbase;
+ else
+ return 0.0;
+ }
+ if(meter_type=="TERMINAL ACTIVE POWER IN MW")
+ {
+ if(converter_model != NULL)
+ return converter_model->get_terminal_active_power_in_MW();
+ else
+ return 0.0;
+ }
+ if(meter_type=="TERMINAL REACTIVE POWER IN PU ON MBASE")
+ {
+ if(converter_model != NULL)
+ return converter_model->get_terminal_reactive_power_in_pu_based_on_mbase();
+ else
+ return 0.0;
+ }
+ if(meter_type=="TERMINAL REACTIVE POWER IN PU ON SBASE")
+ {
+ if(converter_model != NULL)
+ return converter_model->get_terminal_reactive_power_in_MVar()*one_over_sbase;
+ else
+ return 0.0;
+ }
+ if(meter_type=="TERMINAL REACTIVE POWER IN MVAR")
+ {
+ if(converter_model != NULL)
+ return converter_model->get_terminal_reactive_power_in_MVar();
+ else
+ return 0.0;
+ }
+ if(meter_type=="TERMINAL APPARENT POWER IN PU ON MBASE")
+ {
+ if(converter_model != NULL)
+ {
+ double p = converter_model->get_terminal_active_power_in_pu_based_on_mbase();
+ double q = converter_model->get_terminal_reactive_power_in_pu_based_on_mbase();
+ return steps_sqrt(p*p+q*q);
+ }
+ else
+ return 0.0;
+ }
+ if(meter_type=="TERMINAL APPARENT POWER IN PU ON SBASE")
+ {
+ if(converter_model != NULL)
+ {
+ double p = converter_model->get_terminal_active_power_in_MW()*one_over_sbase;
+ double q = converter_model->get_terminal_reactive_power_in_MVar()*one_over_sbase;
+ return steps_sqrt(p*p+q*q);
+ }
+ else
+ return 0.0;
+ }
+ if(meter_type=="TERMINAL APPARENT POWER IN MVAR")
+ {
+ if(converter_model != NULL)
+ {
+ double p = converter_model->get_terminal_active_power_in_MW();
+ double q = converter_model->get_terminal_reactive_power_in_MVar();
+ return steps_sqrt(p*p+q*q);
+ }
+ else
+ return 0.0;
+ }
+ if(meter_type=="ACTIVE CURRENT COMMAND IN PU")
+ {
+ if(electrical_model != NULL)
+ return electrical_model->get_active_current_command_in_pu_based_on_mbase();
+ else
+ return converter_model->get_active_current_command_in_pu_based_on_mbase();
+ }
+ if(meter_type=="REACTIVE CURRENT COMMAND IN PU")
+ {
+ if(electrical_model != NULL)
+ return electrical_model->get_reactive_current_command_in_pu_based_on_mbase();
+ else
+ return converter_model->get_reactive_current_command_in_pu_based_on_mbase();
+ }
+ if(meter_type=="ACTIVE POWER COMMAND IN PU")
+ {
+ if(electrical_model != NULL)
+ return electrical_model->get_active_power_command_in_pu_based_on_mbase();
+ else
+ return 0.0;
+ }
+ if(meter_type=="REACTIVE POWER COMMAND IN PU")
+ {
+ if(electrical_model != NULL)
+ return electrical_model->get_reactive_power_command_in_pu_based_on_mbase();
+ else
+ return 0.0;
+ }
+ if(meter_type=="REACTIVE VOLTAGE COMMAND IN PU")
+ {
+ if(electrical_model != NULL)
+ return electrical_model->get_reactive_voltage_command_in_pu();
+ else
+ return 0.0;
+ }
+ if(meter_type=="ES CONVERTER MODEL INTERNAL VARIABLE")
+ {
+ if(converter_model!=NULL)
+ return converter_model->get_model_internal_variable_with_name(get_internal_variable_name());
+ else
+ return 0.0;
+ }
+ if(meter_type=="ES BATTERY MODEL INTERNAL VARIABLE")
+ {
+ if(battery_model!=NULL)
+ return battery_model->get_model_internal_variable_with_name(get_internal_variable_name());
+ else
+ return 0.0;
+ }
+ if(meter_type=="ES ELECTRICAL MODEL INTERNAL VARIABLE")
+ {
+ if(electrical_model!=NULL)
+ return electrical_model->get_model_internal_variable_with_name(get_internal_variable_name());
+ else
+ return 0.0;
+ }
+ if(meter_type=="ES VRT MODEL INTERNAL VARIABLE")
+ {
+ if(vrt_model!=NULL)
+ return vrt_model->get_model_internal_variable_with_name(get_internal_variable_name());
+ else
+ return 0.0;
+ }
+ if(meter_type=="ES RELAY MODEL INTERNAL VARIABLE")
+ {
+ if(relay_model!=NULL)
+ return relay_model->get_model_internal_variable_with_name(get_internal_variable_name());
+ else
+ return 0.0;
+ }
return 0.0;
}
else
diff --git a/code/steps/source/model/energy_storage_model/energy_storage_model.cpp b/code/steps/source/model/energy_storage_model/energy_storage_model.cpp
deleted file mode 100644
index 406a508d..00000000
--- a/code/steps/source/model/energy_storage_model/energy_storage_model.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-#include "header/model/energy_storage_model/energy_storage_model.h"
-#include "header/basic/utility.h"
-#include "header/power_system_database.h"
-#include "header/STEPS.h"
-ENERGY_STORAGE_MODEL::ENERGY_STORAGE_MODEL(STEPS& toolkit) : MODEL(toolkit)
-{
- set_allowed_device_type_CAN_ONLY_BE_CALLED_BY_SPECIFIC_MODEL_CONSTRUCTOR(STEPS_ENERGY_STORAGE);
-}
-
-ENERGY_STORAGE_MODEL::~ENERGY_STORAGE_MODEL()
-{
- ;
-}
-
-ENERGY_STORAGE* ENERGY_STORAGE_MODEL::get_energy_storage_pointer() const
-{
- return (ENERGY_STORAGE*) get_device_pointer();
-}
-
-double ENERGY_STORAGE_MODEL::get_mbase_in_MVA() const
-{
- ENERGY_STORAGE* estorage = get_energy_storage_pointer();
- return estorage->get_mbase_in_MVA();
-}
-
-double ENERGY_STORAGE_MODEL::get_one_over_mbase_in_one_over_MVA() const
-{
- ENERGY_STORAGE* estorage = get_energy_storage_pointer();
- return estorage->get_one_over_mbase_in_one_over_MVA();
-}
-
-string ENERGY_STORAGE_MODEL::get_model_type() const
-{
- return "ENERGY STORAGE";
-}
-
-complex ENERGY_STORAGE_MODEL::get_terminal_bus_complex_voltage_in_pu() const
-{
- BUS* bus = get_bus_pointer();
- return bus->get_positive_sequence_complex_voltage_in_pu();
-}
-
-double ENERGY_STORAGE_MODEL::get_terminal_bus_voltage_in_pu() const
-{
- BUS* bus = get_bus_pointer();
- return bus->get_positive_sequence_voltage_in_pu();
-}
-
-double ENERGY_STORAGE_MODEL::get_terminal_bus_angle_in_rad() const
-{
- BUS* bus = get_bus_pointer();
- return bus->get_positive_sequence_angle_in_rad();
-}
-
-
-double ENERGY_STORAGE_MODEL::get_terminal_bus_frequency_deviation_in_pu() const
-{
- BUS* bus = get_bus_pointer();
- return bus->get_frequency_deviation_in_pu();
-}
-
-void ENERGY_STORAGE_MODEL::set_Pmax_in_pu(double p)
-{
- this->max_power_in_pu = p;
-}
-
-void ENERGY_STORAGE_MODEL::set_E0_in_pu(double E)
-{
- this->initial_energy_in_pu = E;
-}
-
-void ENERGY_STORAGE_MODEL::set_En_in_MWh(double E)
-{
- this->nominal_energy_in_MWh = E;
-}
-
-void ENERGY_STORAGE_MODEL::set_Pref_in_pu(double p)
-{
- this->Pref_in_pu = p;
-}
-
-void ENERGY_STORAGE_MODEL::set_Vref_in_pu(double v)
-{
- this->Vref_in_pu = v;
-}
-
-double ENERGY_STORAGE_MODEL::get_Pmax_in_pu() const
-{
- return max_power_in_pu;
-}
-
-double ENERGY_STORAGE_MODEL::get_E0_in_pu() const
-{
- return initial_energy_in_pu;
-}
-
-double ENERGY_STORAGE_MODEL::get_En_in_MWh() const
-{
- return nominal_energy_in_MWh;
-}
-
-double ENERGY_STORAGE_MODEL::get_Pref_in_pu() const
-{
- return this->Pref_in_pu;
-}
-
-double ENERGY_STORAGE_MODEL::get_Vref_in_pu() const
-{
- return this->Vref_in_pu;
-}
diff --git a/code/steps/source/model/energy_storage_model/energy_storage_model_test.cpp b/code/steps/source/model/energy_storage_model/energy_storage_model_test.cpp
deleted file mode 100644
index 869569a0..00000000
--- a/code/steps/source/model/energy_storage_model/energy_storage_model_test.cpp
+++ /dev/null
@@ -1,368 +0,0 @@
-#include "header/basic/test_macro.h"
-#include "header/model/energy_storage_model/energy_storage_model_test.h"
-#include "header/basic/utility.h"
-#include "header/steps_namespace.h"
-#include
-#include
-#include
-#include
-#include
-#include
-
-#ifdef ENABLE_STEPS_TEST
-using namespace std;
-
-ENERGY_STORAGE_MODEL_TEST::ENERGY_STORAGE_MODEL_TEST()
-{
- TEST_ADD(ENERGY_STORAGE_MODEL_TEST::test_get_model_type);
- TEST_ADD(ENERGY_STORAGE_MODEL_TEST::test_set_get_max_power);
- TEST_ADD(ENERGY_STORAGE_MODEL_TEST::test_set_get_inital_energy);
- TEST_ADD(ENERGY_STORAGE_MODEL_TEST::test_set_get_nominal_energy);
- TEST_ADD(ENERGY_STORAGE_MODEL_TEST::test_set_get_initial_Pref);
- TEST_ADD(ENERGY_STORAGE_MODEL_TEST::test_set_get_initial_Vref);
- TEST_ADD(ENERGY_STORAGE_MODEL_TEST::test_frequency_step_response);
- TEST_ADD(ENERGY_STORAGE_MODEL_TEST::test_voltage_step_response);
- TEST_ADD(ENERGY_STORAGE_MODEL_TEST::test_get_standard_psse_string);
-}
-
-
-
-void ENERGY_STORAGE_MODEL_TEST::setup()
-{
- POWER_SYSTEM_DATABASE& psdb = default_toolkit.get_power_system_database();
- psdb.set_allowed_max_bus_number(100);
- psdb.set_system_base_power_in_MVA(100.0);
-
- BUS bus(default_toolkit);
- bus.set_bus_number(1);
- bus.set_bus_type(PV_TYPE);
- bus.set_base_voltage_in_kV(21.0);
- bus.set_positive_sequence_voltage_in_pu(1.0);
- bus.set_positive_sequence_angle_in_rad(0.0);
-
- psdb.append_bus(bus);
-
- ENERGY_STORAGE estorage(default_toolkit);
- estorage.set_energy_storage_bus(1);
- estorage.set_identifier("#1");
- estorage.set_status(true);
- estorage.set_mbase_in_MVA(100.0);
- estorage.set_source_impedance_in_pu(complex(0.01, 0.1));
- estorage.set_p_generation_in_MW(10.0);
- estorage.set_q_generation_in_MVar(0.0);
-
- psdb.append_energy_storage(estorage);
-}
-
-void ENERGY_STORAGE_MODEL_TEST::tear_down()
-{
- POWER_SYSTEM_DATABASE& psdb = default_toolkit.get_power_system_database();
- psdb.clear();
-}
-
-
-ENERGY_STORAGE* ENERGY_STORAGE_MODEL_TEST::get_test_energy_storage()
-{
- DEVICE_ID did;
- did.set_device_type(STEPS_ENERGY_STORAGE);
- TERMINAL terminal;
- terminal.append_bus(1);
- did.set_device_terminal(terminal);
- did.set_device_identifier_index(get_index_of_string("#1"));
-
- POWER_SYSTEM_DATABASE& psdb = default_toolkit.get_power_system_database();
- return psdb.get_energy_storage(did);
-}
-
-ENERGY_STORAGE_MODEL* ENERGY_STORAGE_MODEL_TEST::get_test_energy_storage_model()
-{
- ENERGY_STORAGE* esptr = get_test_energy_storage();
- if(esptr!=NULL)
- return esptr->get_energy_storage_model();
- else
- return NULL;
-}
-
-
-void ENERGY_STORAGE_MODEL_TEST::test_get_model_type()
-{
- ENERGY_STORAGE_MODEL* model = get_test_energy_storage_model();
- if(model!=NULL)
- {
- show_test_information_for_function_of_class(__FUNCTION__,model->get_model_name()+"_TEST");
-
- TEST_ASSERT(model->get_model_type()=="ENERGY STORAGE");
- }
- else
- TEST_ASSERT(false);
-}
-
-void ENERGY_STORAGE_MODEL_TEST::test_set_get_max_power()
-{
- ENERGY_STORAGE_MODEL* model = get_test_energy_storage_model();
- if(model!=NULL)
- {
- show_test_information_for_function_of_class(__FUNCTION__,model->get_model_name()+"_TEST");
-
- model->set_Pmax_in_pu(1.0);
- TEST_ASSERT(fabs(model->get_Pmax_in_pu()-1.0)set_Pmax_in_pu(2.0);
- TEST_ASSERT(fabs(model->get_Pmax_in_pu()-2.0)get_model_name()+"_TEST");
-
- model->set_E0_in_pu(1.0);
- TEST_ASSERT(fabs(model->get_E0_in_pu()-1.0)set_E0_in_pu(0.5);
- TEST_ASSERT(fabs(model->get_E0_in_pu()-0.5)get_model_name()+"_TEST");
-
- model->set_En_in_MWh(10.0);
- TEST_ASSERT(fabs(model->get_En_in_MWh()-10.0)set_En_in_MWh(20.0);
- TEST_ASSERT(fabs(model->get_En_in_MWh()-20.0)get_model_name()+"_TEST");
-
- model->set_Pref_in_pu(0.0);
- TEST_ASSERT(fabs(model->get_Pref_in_pu()-0.0)set_Pref_in_pu(0.5);
- TEST_ASSERT(fabs(model->get_Pref_in_pu()-0.5)get_model_name()+"_TEST");
-
- model->set_Vref_in_pu(1.0);
- TEST_ASSERT(fabs(model->get_Vref_in_pu()-1.0)set_Vref_in_pu(0.5);
- TEST_ASSERT(fabs(model->get_Vref_in_pu()-0.5)get_terminal_bus_frequency_deviation_in_pu();
- double volt = model->get_terminal_bus_voltage_in_pu();
- double pelec = model->get_terminal_active_power_in_MW();
- double qelec = model->get_terminal_reactive_power_in_MVar();
- double soc = model->get_energy_state_in_pu();
-
- osstream<get_model_name()+"_TEST");
-
- default_toolkit.open_log_file("test_log/"+model->get_model_name()+"_"+__FUNCTION__+".txt");
-
- osstream<<"Model:"<get_standard_psse_string()<initialize();
-
- export_meter_title();
- export_meter_values();
-
- while(true)
- {
- default_toolkit.set_dynamic_simulation_time_in_s(default_toolkit.get_dynamic_simulation_time_in_s()+delt);
-
- if(default_toolkit.get_dynamic_simulation_time_in_s()>1.0+FLOAT_EPSILON)
- {
- default_toolkit.set_dynamic_simulation_time_in_s(default_toolkit.get_dynamic_simulation_time_in_s()-delt);
- break;
- }
- run_a_step();
- export_meter_values();
- }
-
- BUS* bus = psdb.get_bus(1);
- bus->set_frequency_deviation_in_pu(-0.02);
- model->run(UPDATE_MODE);
-
- export_meter_values();
-
- while(true)
- {
- default_toolkit.set_dynamic_simulation_time_in_s(default_toolkit.get_dynamic_simulation_time_in_s()+delt);
-
- if(default_toolkit.get_dynamic_simulation_time_in_s()>6.0+FLOAT_EPSILON)
- {
- default_toolkit.set_dynamic_simulation_time_in_s(default_toolkit.get_dynamic_simulation_time_in_s()-delt);
- break;
- }
-
- run_a_step();
- export_meter_values();
- }
- default_toolkit.close_log_file();
- }
- else
- TEST_ASSERT(false);
-}
-
-void ENERGY_STORAGE_MODEL_TEST::test_voltage_step_response()
-{
- ostringstream osstream;
-
- POWER_SYSTEM_DATABASE& psdb = default_toolkit.get_power_system_database();
- ENERGY_STORAGE_MODEL* model = get_test_energy_storage_model();
- if(model!=NULL)
- {
- show_test_information_for_function_of_class(__FUNCTION__,model->get_model_name()+"_TEST");
-
- default_toolkit.open_log_file("test_log/"+model->get_model_name()+"_"+__FUNCTION__+".txt");
-
- osstream<<"Model:"<get_standard_psse_string()<initialize();
-
- export_meter_title();
- export_meter_values();
-
- while(true)
- {
- default_toolkit.set_dynamic_simulation_time_in_s(default_toolkit.get_dynamic_simulation_time_in_s()+delt);
- if(default_toolkit.get_dynamic_simulation_time_in_s()>1.0+FLOAT_EPSILON)
- {
- default_toolkit.set_dynamic_simulation_time_in_s(default_toolkit.get_dynamic_simulation_time_in_s()-delt);
- break;
- }
- run_a_step();
- export_meter_values();
- }
-
- BUS* bus = psdb.get_bus(1);
- bus->set_positive_sequence_voltage_in_pu(bus->get_positive_sequence_voltage_in_pu()-0.1);
- model->run(UPDATE_MODE);
-
- export_meter_values();
-
- while(true)
- {
- default_toolkit.set_dynamic_simulation_time_in_s(default_toolkit.get_dynamic_simulation_time_in_s()+delt);
-
- if(default_toolkit.get_dynamic_simulation_time_in_s()>6.0+FLOAT_EPSILON)
- {
- default_toolkit.set_dynamic_simulation_time_in_s(default_toolkit.get_dynamic_simulation_time_in_s()-delt);
- break;
- }
-
- run_a_step();
- export_meter_values();
- }
- default_toolkit.close_log_file();
- }
- else
- TEST_ASSERT(false);
-}
-
-
-void ENERGY_STORAGE_MODEL_TEST::run_a_step()
-{
- ENERGY_STORAGE_MODEL* model = get_test_energy_storage_model();
- double pelec = model->get_terminal_active_power_in_MW();
- while(true)
- {
- model->run(INTEGRATE_MODE);
- if(fabs(pelec-model->get_terminal_active_power_in_MW())>1e-6)
- pelec = model->get_terminal_active_power_in_MW();
- else
- break;
- }
- model->run(UPDATE_MODE);
-}
-
-
-void ENERGY_STORAGE_MODEL_TEST::test_get_standard_psse_string()
-{
- ENERGY_STORAGE_MODEL* model = get_test_energy_storage_model();
- if(model!=NULL)
- {
- show_test_information_for_function_of_class(__FUNCTION__,model->get_model_name()+"_TEST");
-
- cout<get_standard_psse_string()<
+#include
+
+using namespace std;
+
+ES_BATTERY_MODEL::ES_BATTERY_MODEL(STEPS& toolkit) : ES_MODEL(toolkit)
+{
+
+}
+
+ES_BATTERY_MODEL::~ES_BATTERY_MODEL()
+{
+
+}
+
+string ES_BATTERY_MODEL::get_model_type() const
+{
+ return "ES BATTERY";
+}
diff --git a/code/steps/source/model/energy_storage_model/es_battery_model/es_battery_model_test.cpp b/code/steps/source/model/energy_storage_model/es_battery_model/es_battery_model_test.cpp
new file mode 100644
index 00000000..f9b1e5c4
--- /dev/null
+++ b/code/steps/source/model/energy_storage_model/es_battery_model/es_battery_model_test.cpp
@@ -0,0 +1,65 @@
+#include "header/basic/test_macro.h"
+#include "header/model/pvu_models/pv_panel_model/pv_panel_model_test.h"
+#include "header/basic/utility.h"
+#include
+#include
+#include
+#include
+#include
+#include
+
+#ifdef ENABLE_STEPS_TEST
+using namespace std;
+
+PV_PANEL_MODEL_TEST::PV_PANEL_MODEL_TEST()
+{
+ TEST_ADD(PV_PANEL_MODEL_TEST::test_get_model_type);
+
+ TEST_ADD(PV_PANEL_MODEL_TEST::test_get_standard_psse_string);
+}
+
+void PV_PANEL_MODEL_TEST::setup()
+{
+ PVU_MODEL_TEST::setup();
+
+ PV_UNIT* pv_unit = get_test_pv_unit();
+ pv_unit->set_p_generation_in_MW(28.0);
+ pv_unit->set_rated_power_per_pv_unit_in_MW(1.5);
+ pv_unit->set_number_of_lumped_pv_units(20);
+
+ //pv_unit->set_model(&genmodel);
+}
+
+void PV_PANEL_MODEL_TEST::tear_down()
+{
+ PVU_MODEL_TEST::tear_down();
+}
+
+void PV_PANEL_MODEL_TEST::test_get_model_type()
+{
+ PV_PANEL_MODEL* model = get_test_pv_panel_model();
+ if(model!=NULL)
+ {
+ show_test_information_for_function_of_class(__FUNCTION__,model->get_model_name()+"_TEST");
+
+ TEST_ASSERT(model->get_model_type()=="WT AERODYNAMIC");
+ }
+ else
+ TEST_ASSERT(false);
+}
+
+void PV_PANEL_MODEL_TEST::test_get_standard_psse_string()
+{
+ PV_PANEL_MODEL* model = get_test_pv_panel_model();
+ if(model!=NULL)
+ {
+ show_test_information_for_function_of_class(__FUNCTION__,model->get_model_name()+"_TEST");
+
+ model->get_standard_psse_string();
+ }
+ else
+ TEST_ASSERT(false);
+}
+
+
+#endif
diff --git a/code/steps/source/model/energy_storage_model/es_battery_model/esbx.cpp b/code/steps/source/model/energy_storage_model/es_battery_model/esbx.cpp
new file mode 100644
index 00000000..59470b13
--- /dev/null
+++ b/code/steps/source/model/energy_storage_model/es_battery_model/esbx.cpp
@@ -0,0 +1,173 @@
+#include "header/model/energy_storage_model/es_battery_model/esbx.h"
+#include "header/basic/utility.h"
+#include "header/steps_namespace.h"
+#include
+#include
+
+using namespace std;
+
+ESBX::ESBX(STEPS& toolkit) : ES_BATTERY_MODEL(toolkit)
+{
+ clear();
+}
+
+ESBX::ESBX(const ESBX& model):ES_BATTERY_MODEL(model.get_toolkit())
+{
+ copy_from_const_model(model);
+}
+
+ESBX::~ESBX()
+{
+ ;
+}
+
+ESBX& ESBX::operator=(const ESBX& model)
+{
+ if(this==(&model))
+ return *this;
+ copy_from_const_model(model);
+ return *this;
+}
+
+void ESBX::copy_from_const_model(const ESBX& model)
+{
+ set_toolkit(model.get_toolkit());
+
+ clear();
+ //ES_BATTERY_MODEL::copy_from_const_model(model);
+}
+
+string ESBX::get_model_name() const
+{
+ return "ESBX";
+}
+
+bool ESBX::setup_model_with_steps_string_vector(vector& data)
+{
+ ostringstream osstream;
+ osstream< record = psse_dyr_string2steps_string_vector(data);
+ return setup_model_with_steps_string_vector(record);
+}
+
+bool ESBX::setup_model_with_bpa_string(string data)
+{
+ ostringstream osstream;
+ osstream<
+#include
+#include
+#include
+#include
+#include
+
+#ifdef ENABLE_STEPS_TEST
+using namespace std;
+
+PVP0_TEST::PVP0_TEST() : PV_PANEL_MODEL_TEST()
+{
+ TEST_ADD(PVP0_TEST::test_get_model_name);
+ TEST_ADD(PVP0_TEST::test_set_get_parameters);
+}
+
+void PVP0_TEST::setup()
+{
+ PV_PANEL_MODEL_TEST::setup();
+}
+
+void PVP0_TEST::tear_down()
+{
+ PV_PANEL_MODEL_TEST::tear_down();
+
+ show_test_end_information();
+}
+
+
+void PVP0_TEST::test_get_model_name()
+{
+ show_test_information_for_function_of_class(__FUNCTION__,"PVP0_TEST");
+
+ PV_PANEL_MODEL* model = get_test_pv_panel_model();
+ if(model!=NULL)
+ {
+ TEST_ASSERT(model->get_model_name()=="PVP0");
+ }
+ else
+ TEST_ASSERT(false);
+}
+
+void PVP0_TEST::test_set_get_parameters()
+{
+ show_test_information_for_function_of_class(__FUNCTION__,"PVP0_TEST");
+
+}
+
+#endif
diff --git a/code/steps/source/model/energy_storage_model/es_converter_model/es_converter_model.cpp b/code/steps/source/model/energy_storage_model/es_converter_model/es_converter_model.cpp
new file mode 100644
index 00000000..a8bd6f6f
--- /dev/null
+++ b/code/steps/source/model/energy_storage_model/es_converter_model/es_converter_model.cpp
@@ -0,0 +1,182 @@
+#include "header/model/energy_storage_model/es_converter_model/es_converter_model.h"
+#include "header/basic/utility.h"
+#include "header/basic/constants.h"
+#include "header/steps_namespace.h"
+#include
+#include
+#include
+
+using namespace std;
+
+ES_CONVERTER_MODEL::ES_CONVERTER_MODEL(STEPS& toolkit) : ES_MODEL(toolkit)
+{
+ set_allowed_device_type_CAN_ONLY_BE_CALLED_BY_SPECIFIC_MODEL_CONSTRUCTOR(STEPS_ENERGY_STORAGE);
+
+ set_current_source_flag(true);
+ set_initial_active_current_command_in_pu_based_on_mbase(0.0);
+ set_initial_reactive_current_command_in_pu_based_on_mbase(0.0);
+ set_initial_active_power_command_in_pu_based_on_mbase(0.0);
+ set_initial_reactive_power_command_in_pu_based_on_mbase(0.0);
+ set_initial_reactive_voltage_command_in_pu(0.0);
+}
+
+ES_CONVERTER_MODEL::~ES_CONVERTER_MODEL()
+{
+ ;
+}
+
+string ES_CONVERTER_MODEL::get_model_type() const
+{
+ return "ES CONVERTER";
+}
+
+
+void ES_CONVERTER_MODEL::set_current_source_flag(bool flag)
+{
+ current_source_flag = flag;
+}
+
+bool ES_CONVERTER_MODEL::get_current_source_flag() const
+{
+ return current_source_flag;
+}
+
+bool ES_CONVERTER_MODEL::is_current_source() const
+{
+ return current_source_flag;
+}
+
+bool ES_CONVERTER_MODEL::is_voltage_source() const
+{
+ return not is_current_source();
+}
+
+void ES_CONVERTER_MODEL::set_initial_active_current_command_in_pu_based_on_mbase(double ip_command)
+{
+ IP_command0 = ip_command;
+}
+
+double ES_CONVERTER_MODEL::get_initial_active_current_command_in_pu_based_on_mbase() const
+{
+ return IP_command0;
+}
+
+void ES_CONVERTER_MODEL::set_initial_reactive_current_command_in_pu_based_on_mbase(double iq_command)
+{
+ IQ_command0 = iq_command;
+}
+
+double ES_CONVERTER_MODEL::get_initial_reactive_current_command_in_pu_based_on_mbase() const
+{
+ return IQ_command0;
+}
+
+void ES_CONVERTER_MODEL::set_initial_reactive_voltage_command_in_pu(double eq_command)
+{
+ EQ_command0 = eq_command;
+}
+
+double ES_CONVERTER_MODEL::get_initial_reactive_voltage_command_in_pu() const
+{
+ return EQ_command0;
+}
+
+void ES_CONVERTER_MODEL::set_initial_active_power_command_in_pu_based_on_mbase(double P_command)
+{
+ P_command0 = P_command;
+}
+
+double ES_CONVERTER_MODEL::get_initial_active_power_command_in_pu_based_on_mbase() const
+{
+ return P_command0;
+}
+
+void ES_CONVERTER_MODEL::set_initial_reactive_power_command_in_pu_based_on_mbase(double Q_command)
+{
+ Q_command0 = Q_command;
+}
+
+double ES_CONVERTER_MODEL::get_initial_reactive_power_command_in_pu_based_on_mbase() const
+{
+ return Q_command0;
+}
+
+double ES_CONVERTER_MODEL::get_active_current_command_in_pu_based_on_mbase()
+{
+ ENERGY_STORAGE* energy_storage = get_energy_storage_pointer();
+ ES_ELECTRICAL_MODEL* elec_model = energy_storage->get_es_electrical_model();
+ ES_VRT_MODEL* vrt_model = energy_storage->get_es_vrt_model();
+ if(elec_model!=NULL and elec_model->is_model_initialized() and not elec_model->is_model_bypassed())
+ return elec_model->get_active_current_command_in_pu_based_on_mbase();
+ else
+ {
+ if(vrt_model!=NULL and vrt_model->is_model_initialized())
+ return vrt_model->get_active_current_command_in_pu_based_on_mbase();
+ else
+ return get_initial_active_current_command_in_pu_based_on_mbase();
+ }
+}
+
+double ES_CONVERTER_MODEL::get_reactive_current_command_in_pu_based_on_mbase()
+{
+ ENERGY_STORAGE* energy_storage = get_energy_storage_pointer();
+ ES_ELECTRICAL_MODEL* elec_model = energy_storage->get_es_electrical_model();
+ ES_VRT_MODEL* vrt_model = energy_storage->get_es_vrt_model();
+ if(elec_model!=NULL and elec_model->is_model_initialized() and not elec_model->is_model_bypassed())
+ return elec_model->get_reactive_current_command_in_pu_based_on_mbase();
+ else
+ {
+ if(vrt_model!=NULL and vrt_model->is_model_initialized())
+ return vrt_model->get_reactive_current_command_in_pu_based_on_mbase();
+ else
+ return get_initial_reactive_current_command_in_pu_based_on_mbase();
+ }
+}
+
+double ES_CONVERTER_MODEL::get_reactive_voltage_command_in_pu()
+{
+ ENERGY_STORAGE* energy_storage = get_energy_storage_pointer();
+ ES_ELECTRICAL_MODEL* elec_model = energy_storage->get_es_electrical_model();
+ ES_VRT_MODEL* vrt_model = energy_storage->get_es_vrt_model();
+ if(elec_model!=NULL and elec_model->is_model_initialized() and not elec_model->is_model_bypassed())
+ return elec_model->get_reactive_voltage_command_in_pu();
+ else
+ {
+ if(vrt_model!=NULL and vrt_model->is_model_initialized())
+ return vrt_model->get_reactive_voltage_command_in_pu();
+ else
+ return get_initial_reactive_voltage_command_in_pu();
+ }
+}
+
+double ES_CONVERTER_MODEL::get_active_power_command_in_pu_based_on_mbase()
+{
+ ENERGY_STORAGE* energy_storage = get_energy_storage_pointer();
+ ES_ELECTRICAL_MODEL* elec_model = energy_storage->get_es_electrical_model();
+ ES_VRT_MODEL* vrt_model = energy_storage->get_es_vrt_model();
+ if(elec_model!=NULL and elec_model->is_model_initialized() and not elec_model->is_model_bypassed())
+ return elec_model->get_active_power_command_in_pu_based_on_mbase();
+ else
+ {
+ if(vrt_model!=NULL and vrt_model->is_model_initialized())
+ return vrt_model->get_active_power_command_in_pu_based_on_mbase();
+ else
+ return get_initial_active_power_command_in_pu_based_on_mbase();
+ }
+}
+
+double ES_CONVERTER_MODEL::get_reactive_power_command_in_pu_based_on_mbase()
+{
+ ENERGY_STORAGE* energy_storage = get_energy_storage_pointer();
+ ES_ELECTRICAL_MODEL* elec_model = energy_storage->get_es_electrical_model();
+ ES_VRT_MODEL* vrt_model = energy_storage->get_es_vrt_model();
+ if(elec_model!=NULL and elec_model->is_model_initialized() and not elec_model->is_model_bypassed())
+ return elec_model->get_reactive_power_command_in_pu_based_on_mbase();
+ else
+ {
+ if(vrt_model!=NULL and vrt_model->is_model_initialized())
+ return vrt_model->get_reactive_power_command_in_pu_based_on_mbase();
+ else
+ return get_initial_reactive_power_command_in_pu_based_on_mbase();
+ }
+}
diff --git a/code/steps/source/model/energy_storage_model/es_converter_model/es_converter_model_test.cpp b/code/steps/source/model/energy_storage_model/es_converter_model/es_converter_model_test.cpp
new file mode 100644
index 00000000..f804a6c2
--- /dev/null
+++ b/code/steps/source/model/energy_storage_model/es_converter_model/es_converter_model_test.cpp
@@ -0,0 +1,552 @@
+#include "header/basic/test_macro.h"
+#include "header/model/pvu_models/pv_converter_model/pv_converter_model_test.h"
+#include "header/basic/utility.h"
+#include "header/steps_namespace.h"
+#include
+#include
+#include
+#include
+#include
+#include
+
+#ifdef ENABLE_STEPS_TEST
+using namespace std;
+
+PV_CONVERTER_MODEL_TEST::PV_CONVERTER_MODEL_TEST()
+{
+ TEST_ADD(PV_CONVERTER_MODEL_TEST::test_get_mbase_in_MVA);
+ TEST_ADD(PV_CONVERTER_MODEL_TEST::test_get_terminal_complex_voltage_in_pu);
+ TEST_ADD(PV_CONVERTER_MODEL_TEST::test_get_number_of_lumped_pv_units);
+ TEST_ADD(PV_CONVERTER_MODEL_TEST::test_get_rated_power_per_pv_unit_in_MW);
+ TEST_ADD(PV_CONVERTER_MODEL_TEST::test_get_nominal_frequency_in_Hz);
+ TEST_ADD(PV_CONVERTER_MODEL_TEST::test_get_source_impedance_in_pu_based_on_mbase);
+
+ TEST_ADD(PV_CONVERTER_MODEL_TEST::test_get_model_type);
+ TEST_ADD(PV_CONVERTER_MODEL_TEST::test_get_model_name);
+ TEST_ADD(PV_CONVERTER_MODEL_TEST::test_set_get_parameters);
+
+ TEST_ADD(PV_CONVERTER_MODEL_TEST::test_set_get_initial_active_current_command);
+ TEST_ADD(PV_CONVERTER_MODEL_TEST::test_set_get_initial_reactive_current_command);
+ TEST_ADD(PV_CONVERTER_MODEL_TEST::test_get_standard_psse_string);
+
+ TEST_ADD(PV_CONVERTER_MODEL_TEST::test_active_current_step_response_of_pv_converter_model);
+ TEST_ADD(PV_CONVERTER_MODEL_TEST::test_reactive_current_step_response_of_pv_converter_model);
+ TEST_ADD(PV_CONVERTER_MODEL_TEST::test_bus_magnitude_step_response_of_pv_converter_model);
+ TEST_ADD(PV_CONVERTER_MODEL_TEST::test_bus_angle_step_response_of_pv_converter_model);
+ TEST_ADD(PV_CONVERTER_MODEL_TEST::test_variable_step_simulation_with_active_current_step_response);
+}
+
+
+
+void PV_CONVERTER_MODEL_TEST::setup()
+{
+ PVU_MODEL_TEST::setup();
+}
+
+void PV_CONVERTER_MODEL_TEST::tear_down()
+{
+ PVU_MODEL_TEST::tear_down();
+}
+
+void PV_CONVERTER_MODEL_TEST::test_get_mbase_in_MVA()
+{
+ PV_UNIT* pv_unit = get_test_pv_unit();
+ PV_CONVERTER_MODEL* model = get_test_pv_converter_model();
+ TEST_ASSERT(fabs(model->get_mbase_in_MVA()-pv_unit->get_mbase_in_MVA())get_unit_bus();
+ TEST_ASSERT(abs(model->get_terminal_complex_voltage_in_pu()-psdb.get_bus_positive_sequence_complex_voltage_in_pu(bus))get_number_of_lumped_pv_units()-pv_unit->get_number_of_lumped_pv_units())get_rated_power_per_pv_unit_in_MW()-pv_unit->get_rated_power_per_pv_unit_in_MW())get_bus_base_frequency_in_Hz()-psdb.get_bus_base_frequency_in_Hz(pv_unit->get_unit_bus()))get_source_impedance_in_pu_based_on_mbase()-pv_unit->get_source_impedance_in_pu())get_model_name()+"_TEST");
+ TEST_ASSERT(model->get_model_type()=="PV CONVERTER");
+ }
+ else
+ TEST_ASSERT(false);
+}
+
+void PV_CONVERTER_MODEL_TEST::test_set_get_initial_active_current_command()
+{
+ PV_CONVERTER_MODEL* model = get_test_pv_converter_model();
+ if(model!=NULL)
+ {
+ show_test_information_for_function_of_class(__FUNCTION__,model->get_model_name()+"_TEST");
+
+ model->set_initial_active_current_command_in_pu_based_on_mbase(1.0);
+ TEST_ASSERT(fabs(model->get_initial_active_current_command_in_pu_based_on_mbase()-1.0)set_initial_active_current_command_in_pu_based_on_mbase(2.0);
+ TEST_ASSERT(fabs(model->get_initial_active_current_command_in_pu_based_on_mbase()-2.0)get_model_name()+"_TEST");
+
+ model->set_initial_reactive_current_command_in_pu_based_on_mbase(1.0);
+ TEST_ASSERT(fabs(model->get_initial_reactive_current_command_in_pu_based_on_mbase()-1.0)set_initial_reactive_current_command_in_pu_based_on_mbase(2.0);
+ TEST_ASSERT(fabs(model->get_initial_reactive_current_command_in_pu_based_on_mbase()-2.0)get_terminal_active_power_in_MW();
+ while(true)
+ {
+ model->run(INTEGRATE_MODE);
+ if(fabs(pelec-model->get_terminal_active_power_in_MW())>1e-6)
+ pelec = model->get_terminal_active_power_in_MW();
+ else
+ break;
+ }
+ model->run(UPDATE_MODE);
+}
+
+void PV_CONVERTER_MODEL_TEST::export_meter_title()
+{
+ ostringstream osstream;
+ osstream<<"TIME\tVTERM\tBUSANGLE\tPLL_FREQ\tPLL_ANGLE\tIPCMD\tIQCMD\tEQCMD\tPELEC\tQELEC";
+ default_toolkit.show_information_with_leading_time_stamp(osstream);
+}
+
+void PV_CONVERTER_MODEL_TEST::export_meter_values(double time)
+{
+ ostringstream osstream;
+
+ PV_CONVERTER_MODEL* model = get_test_pv_converter_model();
+
+ complex Vxy = model->get_terminal_complex_voltage_in_pu();
+ double vterm = steps_fast_complex_abs(Vxy);
+ double busangle = rad2deg(atan2(Vxy.imag(), Vxy.real()));
+ double freq = model->get_pll_frequency_deviation_in_pu();
+ double angle = model->get_pll_angle_in_deg();
+ double ipcmd = model->get_active_current_command_in_pu_based_on_mbase();
+ double iqcmd = model->get_reactive_current_command_in_pu_based_on_mbase();
+ double pelec = model->get_terminal_active_power_in_MW();
+ double qelec = model->get_terminal_reactive_power_in_MVar();
+
+ osstream<get_model_name()+"_TEST");
+
+ default_toolkit.open_log_file("test_log/"+model->get_model_name()+"_"+__FUNCTION__+".txt");
+
+ osstream<<"Model:"<get_standard_psse_string()<initialize();
+
+ export_meter_title();
+ export_meter_values(time);
+
+ while(true)
+ {
+ time += delt;
+ if(time>1.0+FLOAT_EPSILON)
+ {
+ time -=delt;
+ break;
+ }
+ run_a_step();
+ export_meter_values(time);
+ }
+
+ double ipcmd = model->get_initial_active_current_command_in_pu_based_on_mbase();
+ model->set_initial_active_current_command_in_pu_based_on_mbase(ipcmd*0.99);
+ model->run(UPDATE_MODE);
+
+ export_meter_values(time);
+
+ while(true)
+ {
+ time += delt;
+
+ if(time>6.0+FLOAT_EPSILON)
+ {
+ time -=delt;
+ break;
+ }
+
+ run_a_step();
+ export_meter_values(time);
+ }
+ default_toolkit.close_log_file();
+ }
+ else
+ TEST_ASSERT(false);
+}
+
+void PV_CONVERTER_MODEL_TEST::test_reactive_current_step_response_of_pv_converter_model()
+{
+ PV_CONVERTER_MODEL* model = get_test_pv_converter_model();
+ ostringstream osstream;
+ if(model!=NULL)
+ {
+ show_test_information_for_function_of_class(__FUNCTION__,model->get_model_name()+"_TEST");
+
+ default_toolkit.open_log_file("test_log/"+model->get_model_name()+"_"+__FUNCTION__+".txt");
+
+ osstream<<"Model:"<get_standard_psse_string()<initialize();
+
+ export_meter_title();
+ export_meter_values(time);
+
+ while(true)
+ {
+ time += delt;
+ if(time>1.0+FLOAT_EPSILON)
+ {
+ time -=delt;
+ break;
+ }
+ run_a_step();
+ export_meter_values(time);
+ }
+
+ double iqcmd = model->get_initial_reactive_current_command_in_pu_based_on_mbase();
+ model->set_initial_reactive_current_command_in_pu_based_on_mbase(iqcmd*0.99);
+ model->run(UPDATE_MODE);
+
+ export_meter_values(time);
+
+ while(true)
+ {
+ time += delt;
+
+ if(time>6.0+FLOAT_EPSILON)
+ {
+ time -=delt;
+ break;
+ }
+
+ run_a_step();
+ export_meter_values(time);
+ }
+ default_toolkit.close_log_file();
+ }
+ else
+ TEST_ASSERT(false);
+}
+
+void PV_CONVERTER_MODEL_TEST::test_bus_magnitude_step_response_of_pv_converter_model()
+{
+ POWER_SYSTEM_DATABASE& psdb = default_toolkit.get_power_system_database();
+ PV_CONVERTER_MODEL* model = get_test_pv_converter_model();
+ ostringstream osstream;
+ if(model!=NULL)
+ {
+ show_test_information_for_function_of_class(__FUNCTION__,model->get_model_name()+"_TEST");
+
+ default_toolkit.open_log_file("test_log/"+model->get_model_name()+"_"+__FUNCTION__+".txt");
+
+ osstream<<"Model:"<get_standard_psse_string()<initialize();
+
+ export_meter_title();
+ export_meter_values(time);
+
+ while(true)
+ {
+ time += delt;
+ if(time>1.0+FLOAT_EPSILON)
+ {
+ time -=delt;
+ break;
+ }
+ run_a_step();
+ export_meter_values(time);
+ }
+
+ BUS* bus = psdb.get_bus(get_test_pv_unit()->get_unit_bus());
+ double vterm = bus->get_positive_sequence_voltage_in_pu();
+ bus->set_positive_sequence_voltage_in_pu(vterm*0.99);
+
+ model->run(UPDATE_MODE);
+
+ export_meter_values(time);
+
+ while(true)
+ {
+ time += delt;
+
+ if(time>6.0+FLOAT_EPSILON)
+ {
+ time -=delt;
+ break;
+ }
+
+ run_a_step();
+ export_meter_values(time);
+ }
+ default_toolkit.close_log_file();
+ }
+ else
+ TEST_ASSERT(false);
+}
+
+void PV_CONVERTER_MODEL_TEST::test_bus_angle_step_response_of_pv_converter_model()
+{
+ POWER_SYSTEM_DATABASE& psdb = default_toolkit.get_power_system_database();
+ PV_CONVERTER_MODEL* model = get_test_pv_converter_model();
+ ostringstream osstream;
+ if(model!=NULL)
+ {
+ show_test_information_for_function_of_class(__FUNCTION__,model->get_model_name()+"_TEST");
+
+ default_toolkit.open_log_file("test_log/"+model->get_model_name()+"_"+__FUNCTION__+".txt");
+
+ osstream<<"Model:"<get_standard_psse_string()<