Skip to content

Commit

Permalink
fix calculation ybus for genericbranch
Browse files Browse the repository at this point in the history
  • Loading branch information
Eduard Fried committed Sep 19, 2024
1 parent 23141ff commit 2a6c1c6
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
paramaters should be given as r1, x1, ....
-----| |-----------y_series-------
| | | |
| | | |
| | y_shunt y_shunt
| | | |
| | | |
Expand All @@ -37,7 +37,7 @@ class GenericBranch final : public Branch {
static constexpr char const* name = "genericbranch";

explicit GenericBranch(GenericBranchInput const& genericbranch_input, double u1_rated, double u2_rated)
: Branch{genericbranch_input},
: Branch{genericbranch_input},
u1_{genericbranch_input.u1},
u2_{genericbranch_input.u2},
sn_{genericbranch_input.sn},
Expand All @@ -48,7 +48,7 @@ class GenericBranch final : public Branch {
r0_{genericbranch_input.r0},
x0_{genericbranch_input.x0},
b0_{genericbranch_input.b0},
g0_{genericbranch_input.g0},
g0_{genericbranch_input.g0},
shift_{fmod(genericbranch_input.shift, 2 * M_PI)},
nominal_ratio_{u1_rated / u2_rated},
base_i_from_{base_power_3p / u1_rated / sqrt3},
Expand All @@ -61,9 +61,15 @@ class GenericBranch final : public Branch {
double const base_y_to = base_i_to_ * base_i_to_ / base_power_1p;
y1_series_ = 1.0 / (r1_ + 1.0i*x1_) / base_y_to;
y1_shunt_ = (g1_ + 1.0i*b1_) / base_y_to;

r0_ = is_nan(r0_) ? 0 : r0_;
x0_ = is_nan(x0_) ? 0 : x0_;
b0_ = is_nan(b0_) ? 0 : b0_;
g0_ = is_nan(g0_) ? 0 : g0_;

y0_series_ = 1.0 / (r0_ + 1.0i * x0_) / base_y_to;
y1_shunt_ = (g0_ + 1.0i*b0_) / base_y_to;
ratio_ = (u1_ / u2_) / nominal_ratio_;
y0_shunt_ = (g0_ + 1.0i*b0_) / base_y_to;
ratio_ = (u1_ / u2_) / nominal_ratio_;
}

// override getter
Expand Down Expand Up @@ -95,7 +101,7 @@ class GenericBranch final : public Branch {
DoubleComplex y1_shunt_;
DoubleComplex y0_series_;
DoubleComplex y0_shunt_;

BranchCalcParam<symmetric_t> sym_calc_param() const override {
return calc_param_y_sym(y1_series_, y1_shunt_, ratio_*std::exp(1.0i * shift_));
}
Expand Down

0 comments on commit 2a6c1c6

Please sign in to comment.