Skip to content

Commit 235c14e

Browse files
calculate + use base_current
Signed-off-by: petersalemink95 <[email protected]>
1 parent dade513 commit 235c14e

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

power_grid_model_c/power_grid_model/include/power_grid_model/component/current_sensor.hpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,9 @@ template <symmetry_tag current_sensor_symmetry_> class CurrentSensor : public Ge
7979
using UpdateType = CurrentSensorUpdate<current_sensor_symmetry>;
8080
template <symmetry_tag sym_calc> using OutputType = CurrentSensorOutput<sym_calc>;
8181

82-
// TODO: add u_rated to calculate base_current = base_power_3p / u_rated / sqrt3
83-
explicit CurrentSensor(CurrentSensorInput<current_sensor_symmetry> const& current_sensor_input)
84-
: GenericCurrentSensor{current_sensor_input},
85-
i_sigma_{current_sensor_input.i_sigma / base_power<current_sensor_symmetry>}, // TODO use base_current
86-
i_angle_sigma_{current_sensor_input.i_angle_sigma /
87-
base_power<current_sensor_symmetry>}, // TODO use base_current
88-
i_angle_measured_{current_sensor_input.i_angle_measured} {
89-
set_current(current_sensor_input.i_measured);
82+
explicit CurrentSensor(CurrentSensorInput<current_sensor_symmetry> const& current_sensor_input, double u_rated)
83+
: GenericCurrentSensor{current_sensor_input}, i_angle_measured_{current_sensor_input.i_angle_measured} {
84+
set_current(current_sensor_input, u_rated);
9085
};
9186

9287
UpdateChange update(CurrentSensorUpdate<current_sensor_symmetry> const& update_data) {
@@ -106,8 +101,11 @@ template <symmetry_tag current_sensor_symmetry_> class CurrentSensor : public Ge
106101
double i_sigma_{};
107102
double i_angle_sigma_{};
108103

109-
void set_current(RealValue<current_sensor_symmetry> const& i_measured) {
110-
// TODO
104+
void set_current(CurrentSensorInput<current_sensor_symmetry> const& input, double const& u_rated) {
105+
double base_current = base_power_3p / u_rated / sqrt3 double scalar = convert_direction() / base_current;
106+
i_sigma_ = input.i_sigma / base_current;
107+
i_angle_sigma_ = input.i_angle_sigma / base_current; // TODO i_angle_sigma is optional
108+
i_measured_ = input.i_measured / base_current;
111109
}
112110

113111
CurrentSensorCalcParam<symmetric_t> sym_calc_param() const final {

0 commit comments

Comments
 (0)