Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
changgang committed Feb 5, 2024
1 parent 40021ae commit 6f9107e
Show file tree
Hide file tree
Showing 12 changed files with 1,862 additions and 53 deletions.
10 changes: 6 additions & 4 deletions code/steps/STEPS.cbp
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,13 @@
<Unit filename="header/model/auxiliary_signal_model/auxiliary_signal_model_test.h" />
<Unit filename="header/model/auxiliary_signal_model/auxiliary_signal_models.h" />
<Unit filename="header/model/bus_model/bus_frequency_model/bus_frequency_model.h" />
<Unit filename="header/model/bus_model/pll_model/pll0.h" />
<Unit filename="header/model/bus_model/pll_model/pll_model.h" />
<Unit filename="header/model/converter_common_models/current_order_limiter_model/convcol.h" />
<Unit filename="header/model/converter_common_models/pll_model/pll0.h" />
<Unit filename="header/model/converter_common_models/pll_model/pll_model.h" />
<Unit filename="header/model/converter_common_models/vrt_model/hvrt.h" />
<Unit filename="header/model/converter_common_models/vrt_model/lvrt.h" />
<Unit filename="header/model/converter_common_models/vrt_model/vrt_model.h" />
<Unit filename="header/model/converter_common_models/vrt_model/vrt_control_model.h" />
<Unit filename="header/model/converter_common_models/vrt_model/vrt_relay_model.h" />
<Unit filename="header/model/converter_common_models/vsg_model/vsg0.h" />
<Unit filename="header/model/converter_common_models/vsg_model/vsg0_test.h" />
<Unit filename="header/model/converter_common_models/vsg_model/vsg_model2.h" />
Expand Down Expand Up @@ -371,6 +370,7 @@
<Unit filename="header/model/wtg_models/wt_electrical_model/wt3e1.h" />
<Unit filename="header/model/wtg_models/wt_electrical_model/wt3e1_test.h" />
<Unit filename="header/model/wtg_models/wt_electrical_model/wt3ev.h" />
<Unit filename="header/model/wtg_models/wt_electrical_model/wt3evrt.h" />
<Unit filename="header/model/wtg_models/wt_electrical_model/wt_electrical_model.h" />
<Unit filename="header/model/wtg_models/wt_electrical_model/wt_electrical_model_test.h" />
<Unit filename="header/model/wtg_models/wt_electrical_model/wt_electrical_models.h" />
Expand Down Expand Up @@ -621,7 +621,8 @@
<Unit filename="source/model/converter_common_model/pll_model/pll_model.cpp" />
<Unit filename="source/model/converter_common_model/vrt_model/hvrt.cpp" />
<Unit filename="source/model/converter_common_model/vrt_model/lvrt.cpp" />
<Unit filename="source/model/converter_common_model/vrt_model/vrt_model.cpp" />
<Unit filename="source/model/converter_common_model/vrt_model/vrt_control_model.cpp" />
<Unit filename="source/model/converter_common_model/vrt_model/vrt_relay_model.cpp" />
<Unit filename="source/model/converter_common_model/vsg_model/vsg0.cpp" />
<Unit filename="source/model/converter_common_model/vsg_model/vsg_model2.cpp" />
<Unit filename="source/model/energy_storage_model/energy_storage_model.cpp" />
Expand Down Expand Up @@ -786,6 +787,7 @@
<Unit filename="source/model/wtg_models/wt_electrical_model/wt3e1.cpp" />
<Unit filename="source/model/wtg_models/wt_electrical_model/wt3e1_test.cpp" />
<Unit filename="source/model/wtg_models/wt_electrical_model/wt3ev.cpp" />
<Unit filename="source/model/wtg_models/wt_electrical_model/wt3evrt.cpp" />
<Unit filename="source/model/wtg_models/wt_electrical_model/wt_electrical_model.cpp" />
<Unit filename="source/model/wtg_models/wt_electrical_model/wt_electrical_model_test.cpp" />
<Unit filename="source/model/wtg_models/wt_generator_model/lvpl.cpp" />
Expand Down
37 changes: 32 additions & 5 deletions code/steps/STEPS.depend
Original file line number Diff line number Diff line change
Expand Up @@ -56786,7 +56786,7 @@
<string>
<vector>

1707111092 source:d:\steps\code\steps\source\model\wtg_models\wt_relay_model\vrtrly0.cpp
1707117374 source:d:\steps\code\steps\source\model\wtg_models\wt_relay_model\vrtrly0.cpp
"header/model/wtg_models/wt_relay_model/vrtrly0.h"
"header/basic/utility.h"
"header/STEPS.h"
Expand Down Expand Up @@ -56814,8 +56814,8 @@
<istream>
<iostream>

1707114258 d:\steps\code\steps\header\model\converter_common_models\vrt_model\hvrt.h
"header/model/converter_common_models/vrt_model/vrt_model.h"
1707117778 d:\steps\code\steps\header\model\converter_common_models\vrt_model\hvrt.h
"header/model/converter_common_models/vrt_model/vrt_relay_model.h"
"header/block/integral_block.h"

1707113611 d:\steps\code\steps\header\model\converter_common_models\vrt_model\vrt_model.h
Expand All @@ -56831,8 +56831,8 @@
<istream>
<iostream>

1707113013 d:\steps\code\steps\header\model\converter_common_models\vrt_model\lvrt.h
"header/model/converter_common_models/vrt_model/vrt_model.h"
1707117782 d:\steps\code\steps\header\model\converter_common_models\vrt_model\lvrt.h
"header/model/converter_common_models/vrt_model/vrt_relay_model.h"
"header/block/integral_block.h"

1707115094 source:d:\steps\code\steps\source\model\converter_common_model\vrt_model\vrt_model.cpp
Expand Down Expand Up @@ -56919,3 +56919,30 @@
"header/power_system_database.h"
"header/STEPS.h"

1707117770 source:d:\steps\code\steps\source\model\converter_common_model\vrt_model\vrt_relay_model.cpp
"header/model/converter_common_models/vrt_model/vrt_relay_model.h"
"header/power_system_database.h"
"header/basic/utility.h"
<istream>
<iostream>

1707117770 d:\steps\code\steps\header\model\converter_common_models\vrt_model\vrt_relay_model.h
"header/STEPS.h"
"header/basic/constants.h"
"header/basic/multi_point_line.h"

1707117524 source:d:\steps\code\steps\source\model\wtg_models\wt_electrical_model\wt3evrt.cpp
"header/model/wtg_models/wt_electrical_model/wt3evrt.h"
"header/device/wt_generator.h"
"header/power_system_database.h"
"header/STEPS.h"
"header/basic/utility.h"
"header/steps_namespace.h"
<iostream>

1707117526 d:\steps\code\steps\header\model\wtg_models\wt_electrical_model\wt3evrt.h
"header/model/wtg_models/wt_electrical_model/wt_electrical_model.h"
"header/block/first_order_block.h"
"header/block/pi_block.h"
"header/block/integral_block.h"

Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#ifndef HVRT_H
#define HVRT_H

#include "header/model/converter_common_models/vrt_model/vrt_model.h"
#include "header/model/converter_common_models/vrt_model/vrt_relay_model.h"
#include "header/block/integral_block.h"

class HVRT : public VRT_MODEL
class HVRT : public VRT_RELAY_MODEL
{
public:
HVRT(STEPS& toolkit);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#ifndef LVRT_H
#define LVRT_H

#include "header/model/converter_common_models/vrt_model/vrt_model.h"
#include "header/model/converter_common_models/vrt_model/vrt_relay_model.h"
#include "header/block/integral_block.h"

class LVRT : public VRT_MODEL
class LVRT : public VRT_RELAY_MODEL
{
public:
LVRT(STEPS& toolkit);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#ifndef VRT_CONTROL_MODEL_H
#define VRT_CONTROL_MODEL_H

#include "header/STEPS.h"
#include "header/basic/constants.h"
#include "header/basic/multi_point_line.h"

class BUS;

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

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

void set_vrt_voltage_threshold(double v);
void set_P0_pu(double P);
void set_Q0_pu(double Q);
void set_Ip0_pu(double I);
void set_Iq0_pu(double I);

double get_vrt_voltage_threshold() const;
double get_P0_pu() const;
double get_Q0_pu() const;
double get_Ip0_pu() const;
double get_Iq0_pu() const;

void set_vrt_status(VRT_STATUS status);
double get_vrt_activation_time() const;
double get_vrt_start2recover_time() const;
VRT_STATUS get_vrt_status() const;

double get_vrt_P_command();
double get_vrt_Q_command();
double get_vrt_Ip_command();
double get_vrt_Iq_command();
public:
void copy_from_const_model(const VRT_CONTROL_MODEL& model);
virtual void check_vrt_status() = 0;
private:
STEPS* toolkit;
BUS* bus_ptr;

double vrt_voltage_threshold;
double t0_vrt_activated;
double t0_vrt_start2recover;
VRT_STATUS status;

double P0, Q0;
double Ip0, Iq0;
double K, Kp, K;
};

#endif // VRT_CONTROL_MODEL_H
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#ifndef VRT_MODEL_H
#define VRT_MODEL_H
#ifndef VRT_RELAY_MODEL_H
#define VRT_RELAY_MODEL_H

#include "header/STEPS.h"
#include "header/basic/constants.h"
#include "header/basic/multi_point_line.h"

class BUS;

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

Expand Down Expand Up @@ -40,19 +40,19 @@ class VRT_MODEL
double get_vrt_activation_time() const;
VRT_STATUS get_vrt_status() const;
public:
void copy_from_const_model(const VRT_MODEL& model);
void copy_from_const_model(const VRT_RELAY_MODEL& model);
virtual void check_vrt_status() = 0;
private:
STEPS* toolkit;
BUS* bus_ptr;
NONBUS_DEVICE* device;

TIMER vrt_trip_timer;
MULTI_POINT_LINE vrt_line;
TIMER vrt_trip_timer;
double vrt_trip_scale;

double t0_vrt_activated;
VRT_STATUS status;
};

#endif // VRT_MODEL_H
#endif // VRT_RELAY_MODEL_H
159 changes: 159 additions & 0 deletions code/steps/header/model/wtg_models/wt_electrical_model/wt3evrt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
#ifndef WT3EVRT_H
#define WT3EVRT_H

#include "header/model/wtg_models/wt_electrical_model/wt_electrical_model.h"
#include "header/block/first_order_block.h"
#include "header/block/pi_block.h"
#include "header/block/integral_block.h"

class WT3EVRT: public WT_ELECTRICAL_MODEL
{
public:
WT3EVRT(STEPS& toolkit);
WT3EVRT(const WT3EVRT& model);
virtual ~WT3EVRT();
virtual WT3EVRT& operator=(const WT3EVRT& model);
public: // specific exciter
virtual string get_model_name() const;

void set_Xcomp_in_pu(double Xc);
void set_TRV_in_s(double T);
void set_Fn(double Fn);
void set_KIV(double K);
void set_Qmax_in_pu(double q);
void set_Qmin_in_pu(double q);
void set_KPV(double K);
void set_TV_in_s(double T);
void set_TFV_in_s(double T);
void set_TP_in_s(double T);
void set_KQI(double K);
void set_Vmax_in_pu(double v);
void set_Vmin_in_pu(double v);
void set_voltage_flag(unsigned int flag);
void set_KQV(double K);
void set_EQmax_in_pu(double I);
void set_EQmin_in_pu(double I);

void set_Tspeed_in_s(double T);
void set_KPP(double K);
void set_KIP(double K);
void set_Kvi(double K);
void set_Tvi_in_s(double T);
void set_Kdroop(double K);
void set_Tdroop_in_s(double T);
void set_frequency_deviation_upper_deadband_in_pu(double f);
void set_frequency_deviation_lower_deadband_in_pu(double f);
void set_Kfint(double K);
void set_rPmax_in_pu(double r);
void set_rPmin_in_pu(double r);
void set_TFP_in_s(double T);
void set_Pmax_in_pu(double p);
void set_Pmin_in_pu(double p);
void set_IPmax_in_pu(double I);

double get_Xcomp_in_pu() const;
double get_TRV_in_s() const;
double get_Fn() const;
double get_KIV() const;
double get_Qmax_in_pu() const;
double get_Qmin_in_pu() const;
double get_KPV() const;
double get_TV_in_s() const;
double get_TFV_in_s() const;
double get_TP_in_s() const;
double get_KQI() const;
double get_Vmax_in_pu() const;
double get_Vmin_in_pu() const;
unsigned int get_voltage_flag() const;
double get_KQV() const;
double get_EQmax_in_pu() const;
double get_EQmin_in_pu() const;

double get_Tspeed_in_s() const;
double get_KPP() const;
double get_KIP() const;
double get_Kvi() const;
double get_Tvi_in_s() const;
double get_Kdroop() const;
double get_Tdroop_in_s() const;
double get_frequency_deviation_upper_deadband_in_pu() const;
double get_frequency_deviation_lower_deadband_in_pu() const;
double get_Kfint() const;
double get_TFP_in_s() const;
double get_rPmax_in_pu() const;
double get_rPmin_in_pu() const;
double get_Pmax_in_pu() const;
double get_Pmin_in_pu() const;
double get_IPmax_in_pu() const;

bool is_frequency_regulation_enabled() const;

void set_speed_reference_bias_in_pu(double bias);
double get_speed_reference_bias_in_pu() const;
public:
virtual bool setup_model_with_steps_string_vector(vector<string>& 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 double get_active_current_command_in_pu_based_on_mbase();
virtual double get_active_power_command_in_pu_based_on_mbase() const;
virtual double get_reactive_current_command_in_pu_based_on_mbase();
virtual double get_reactive_power_command_in_pu_based_on_mbase();
virtual double get_reactive_voltage_command_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 WT3EVRT& model);

void trip_frequency_regulation();

double Xcomp;
FIRST_ORDER_BLOCK voltage_sensor;
double Fn;
FIRST_ORDER_BLOCK voltage_regulator_first_order_block;
INTEGRAL_BLOCK voltage_regulator_integrator;
FIRST_ORDER_BLOCK voltage_regulator_filter;
FIRST_ORDER_BLOCK active_power_sensor;
INTEGRAL_BLOCK Q_error_integrator;
unsigned int Voltage_Flag;
INTEGRAL_BLOCK V_error_integrator;
double EQmax, EQmin;

FIRST_ORDER_BLOCK wind_turbine_speed_reference_sensor;
PI_BLOCK torque_PI_regulator;
DIFFERENTIAL_BLOCK virtual_inertia_emulator;
FIRST_ORDER_BLOCK frequency_droop_controller;

double f_upper_pu, f_lower_pu;
INTEGRAL_BLOCK frequency_integral_controller;
double max_torque_rate, min_torque_rate;
INTEGRAL_BLOCK power_order_integrator;
double IPmax;

bool frequency_regulation_enabled;

double speedref_bias;
};

#endif // EXCITER_MODEL_H
Loading

0 comments on commit 6f9107e

Please sign in to comment.