You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DVRLastVersionsCompare/SYSCTRL/SymmetricalComponents.cpp

181 lines
11 KiB
C++

/*
* SymmetricalComponents.cpp
*
* Author: Aleksey Gerasimenko
* gerasimenko.aleksey.n@gmail.com
*/
#include "SYSCTRL/SymmetricalComponents.h"
namespace SYSCTRL
{
//CONSTRUCTOR
SymmetricalComponents::SymmetricalComponents()
{}//CONSTRUCTOR
//
#pragma CODE_SECTION("ramfuncs");
void SymmetricalComponents::compute_symmetrical_components_axis_common(const SYSCTRL::ProjectionAnalogSignalStructure in_ph_a,
const SYSCTRL::ProjectionAnalogSignalStructure in_ph_b,
const SYSCTRL::ProjectionAnalogSignalStructure in_ph_c,
SYSCTRL::SymmetricalComponentsStructure& out)
{
SYSCTRL::SymmetricalComponents::compute_direct_symmetrical_components_axis_common(in_ph_a, in_ph_b, in_ph_c, out.direct);
SYSCTRL::SymmetricalComponents::compute_inverse_symmetrical_components_axis_common(in_ph_a, in_ph_b, in_ph_c, out.inverse);
SYSCTRL::SymmetricalComponents::compute_zero_symmetrical_components_axis_common(in_ph_a, in_ph_b, in_ph_c, out.zero);
//
}//
//
#pragma CODE_SECTION("ramfuncs");
void SymmetricalComponents::compute_direct_symmetrical_components_axis_common(const SYSCTRL::ProjectionAnalogSignalStructure in_ph_a,
const SYSCTRL::ProjectionAnalogSignalStructure in_ph_b,
const SYSCTRL::ProjectionAnalogSignalStructure in_ph_c,
SYSCTRL::SymmetricalComponentsPhase& out)
{
SYSCTRL::SymmetricalComponents::_direct_common_inverse_own(in_ph_a, in_ph_b, in_ph_c, out);
out.b.active = -m_coefficient_a * out.a.active + m_coefficient_b * out.a.reactive;
out.b.reactive = -m_coefficient_b * out.a.active - m_coefficient_a * out.a.reactive;
out.c.active = -m_coefficient_a * out.a.active - m_coefficient_b * out.a.reactive;
out.c.reactive = m_coefficient_b * out.a.active - m_coefficient_a * out.a.reactive;
//
}//
//
#pragma CODE_SECTION("ramfuncs");
void SymmetricalComponents::compute_inverse_symmetrical_components_axis_common(const SYSCTRL::ProjectionAnalogSignalStructure in_ph_a,
const SYSCTRL::ProjectionAnalogSignalStructure in_ph_b,
const SYSCTRL::ProjectionAnalogSignalStructure in_ph_c,
SYSCTRL::SymmetricalComponentsPhase& out)
{
SYSCTRL::SymmetricalComponents::_inverse_common_zero_own(in_ph_a, in_ph_b, in_ph_c, out);
out.b.active = -m_coefficient_a * out.a.active - m_coefficient_b * out.a.reactive;
out.b.reactive = m_coefficient_b * out.a.active - m_coefficient_a * out.a.reactive;
out.c.active = -m_coefficient_a * out.a.active + m_coefficient_b * out.a.reactive;
out.c.reactive = -m_coefficient_b * out.a.active - m_coefficient_a * out.a.reactive;
//
}//
//
#pragma CODE_SECTION("ramfuncs");
void SymmetricalComponents::compute_zero_symmetrical_components_axis_common(const SYSCTRL::ProjectionAnalogSignalStructure in_ph_a,
const SYSCTRL::ProjectionAnalogSignalStructure in_ph_b,
const SYSCTRL::ProjectionAnalogSignalStructure in_ph_c,
SYSCTRL::SymmetricalComponentsPhase& out)
{
SYSCTRL::SymmetricalComponents::_zero_common_direct_own(in_ph_a, in_ph_b, in_ph_c, out);
out.b.active = out.a.active;
out.b.reactive = out.a.reactive;
out.c.active = out.a.active;
out.c.reactive = out.a.reactive;
//
}//
//
#pragma CODE_SECTION("ramfuncs");
void SymmetricalComponents::compute_symmetrical_components_axis_own(const SYSCTRL::ProjectionAnalogSignalStructure in_ph_a,
const SYSCTRL::ProjectionAnalogSignalStructure in_ph_b,
const SYSCTRL::ProjectionAnalogSignalStructure in_ph_c,
SYSCTRL::SymmetricalComponentsStructure& out)
{
SYSCTRL::SymmetricalComponents::compute_direct_symmetrical_components_axis_own(in_ph_a, in_ph_b, in_ph_c, out.direct);
SYSCTRL::SymmetricalComponents::compute_inverse_symmetrical_components_axis_own(in_ph_a, in_ph_b, in_ph_c, out.inverse);
SYSCTRL::SymmetricalComponents::compute_zero_symmetrical_components_axis_own(in_ph_a, in_ph_b, in_ph_c, out.zero);
//
}//
//
#pragma CODE_SECTION("ramfuncs");
void SymmetricalComponents::compute_direct_symmetrical_components_axis_own(const SYSCTRL::ProjectionAnalogSignalStructure in_ph_a,
const SYSCTRL::ProjectionAnalogSignalStructure in_ph_b,
const SYSCTRL::ProjectionAnalogSignalStructure in_ph_c,
SYSCTRL::SymmetricalComponentsPhase& out)
{
SYSCTRL::SymmetricalComponents::_zero_common_direct_own(in_ph_a, in_ph_b, in_ph_c, out);
//out.b.active = -m_coefficient_a * out.a.active + m_coefficient_b * out.a.reactive;
//out.b.reactive = -m_coefficient_b * out.a.active - m_coefficient_a * out.a.reactive;
out.b.active = 0.8660254 * (out.a.reactive - 0.577350269 * out.a.active);
out.b.reactive = -0.8660254 * (out.a.active + 0.577350269 * out.a.reactive);
//out.c.active = -m_coefficient_a * out.a.active - m_coefficient_b * out.a.reactive;
//out.c.reactive = m_coefficient_b * out.a.active - m_coefficient_a * out.a.reactive;
out.c.active = -0.8660254 * (0.577350269 * out.a.active + out.a.reactive);
out.c.reactive = 0.8660254 * (out.a.active - 0.577350269 * out.a.reactive);
//
}//
//
#pragma CODE_SECTION("ramfuncs");
void SymmetricalComponents::compute_inverse_symmetrical_components_axis_own(const SYSCTRL::ProjectionAnalogSignalStructure in_ph_a,
const SYSCTRL::ProjectionAnalogSignalStructure in_ph_b,
const SYSCTRL::ProjectionAnalogSignalStructure in_ph_c,
SYSCTRL::SymmetricalComponentsPhase& out)
{
SYSCTRL::SymmetricalComponents::_direct_common_inverse_own(in_ph_a, in_ph_b, in_ph_c, out);
//out.b.active = -m_coefficient_a * out.a.active - m_coefficient_b * out.a.reactive;
//out.b.reactive = m_coefficient_b * out.a.active - m_coefficient_a * out.a.reactive;
out.b.active = -0.8660254 * (0.577350269 * out.a.active + out.a.reactive);
out.b.reactive = 0.8660254 * (out.a.active - 0.577350269 * out.a.reactive);
//out.c.active = -m_coefficient_a * out.a.active + m_coefficient_b * out.a.reactive;
//out.c.reactive = -m_coefficient_b * out.a.active - m_coefficient_a * out.a.reactive;
out.c.active = 0.8660254 * (out.a.reactive - 0.577350269 * out.a.active);
out.c.reactive = -0.8660254 * (out.a.active + 0.577350269 * out.a.reactive);
//
}//
//
#pragma CODE_SECTION("ramfuncs");
void SymmetricalComponents::compute_zero_symmetrical_components_axis_own(const SYSCTRL::ProjectionAnalogSignalStructure in_ph_a,
const SYSCTRL::ProjectionAnalogSignalStructure in_ph_b,
const SYSCTRL::ProjectionAnalogSignalStructure in_ph_c,
SYSCTRL::SymmetricalComponentsPhase& out)
{
SYSCTRL::SymmetricalComponents::_inverse_common_zero_own(in_ph_a, in_ph_b, in_ph_c, out);
out.b.active = out.a.active;
out.b.reactive = out.a.reactive;
out.c.active = out.a.active;
out.c.reactive = out.a.reactive;
//
}//
//
#pragma CODE_SECTION("ramfuncs");
inline void SymmetricalComponents::_direct_common_inverse_own(const SYSCTRL::ProjectionAnalogSignalStructure in_ph_a,
const SYSCTRL::ProjectionAnalogSignalStructure in_ph_b,
const SYSCTRL::ProjectionAnalogSignalStructure in_ph_c,
SYSCTRL::SymmetricalComponentsPhase& out)
{
out.a.active = m_three_recipcoral * (in_ph_a.active - m_coefficient_a * (in_ph_b.active + in_ph_c.active) - m_coefficient_b * (in_ph_b.reactive - in_ph_c.reactive));
out.a.reactive = m_three_recipcoral * (in_ph_a.reactive - m_coefficient_a * (in_ph_b.reactive + in_ph_c.reactive) + m_coefficient_b * (in_ph_b.active - in_ph_c.active));
//
}//
//
#pragma CODE_SECTION("ramfuncs");
inline void SymmetricalComponents::_inverse_common_zero_own(const SYSCTRL::ProjectionAnalogSignalStructure in_ph_a,
const SYSCTRL::ProjectionAnalogSignalStructure in_ph_b,
const SYSCTRL::ProjectionAnalogSignalStructure in_ph_c,
SYSCTRL::SymmetricalComponentsPhase& out)
{
out.a.active = m_three_recipcoral * (in_ph_a.active - m_coefficient_a * (in_ph_b.active + in_ph_c.active) + m_coefficient_b * (in_ph_b.reactive - in_ph_c.reactive));
out.a.reactive = m_three_recipcoral * (in_ph_a.reactive - m_coefficient_a * (in_ph_b.reactive + in_ph_c.reactive) - m_coefficient_b * (in_ph_b.active - in_ph_c.active));
//
}//
//
#pragma CODE_SECTION("ramfuncs");
inline void SymmetricalComponents::_zero_common_direct_own(const SYSCTRL::ProjectionAnalogSignalStructure in_ph_a,
const SYSCTRL::ProjectionAnalogSignalStructure in_ph_b,
const SYSCTRL::ProjectionAnalogSignalStructure in_ph_c,
SYSCTRL::SymmetricalComponentsPhase& out)
{
out.a.active = m_three_recipcoral * (in_ph_a.active + in_ph_b.active + in_ph_c.active);
out.a.reactive = m_three_recipcoral * (in_ph_a.reactive + in_ph_b.reactive + in_ph_c.reactive);
//
}//
//
//
} /* namespace SYSCTRL */