예제 #1
0
void Inductance::time_step()
{
	if (!b_status) return;
	
	double i = p_cbranch[0]->i;
	double v_eq_new = 0.0, r_eq_new = 0.0;
	
	if ( m_method == Inductance::m_euler )
	{
		r_eq_new = m_inductance / m_delta;
		v_eq_new = -i * r_eq_new;
	}
	else if ( m_method == Inductance::m_trap ) {
		// TODO Implement + test trapezoidal method
		r_eq_new = 2.0 * m_inductance / m_delta;
	}
	
	if ( scaled_inductance != r_eq_new )
	{
		A_d( 0, 0 ) -= r_eq_new - scaled_inductance;
	}
	
	if ( v_eq_new != v_eq_old )
	{
		b_v( 0 ) += v_eq_new - v_eq_old;
	}
	
	scaled_inductance = r_eq_new;
	v_eq_old = v_eq_new;
}
예제 #2
0
void Inductance::time_step()
{
    if (!b_status) return;

    double i = p_cbranch[0]->current();
    double v_eq_new = 0.0, r_eq_new = 0.0;

    if(m_method == Inductance::m_euler) {
        r_eq_new = m_inductance / m_delta;
        v_eq_new = -i * r_eq_new;
    } else if ( m_method == Inductance::m_trap ) {
        // TODO Implement + test trapezoidal method
        r_eq_new = 2.0 * m_inductance / m_delta;
// We need to update v_eq_new here but I don't know if this is the right code.
        v_eq_new = -i * r_eq_new;
    }

    if(scaled_inductance != r_eq_new) {
        A_d(0, 0) -= r_eq_new - scaled_inductance;
    }

    b_v(0) = v_eq_new;

    scaled_inductance = r_eq_new;
}
예제 #3
0
void CCVS::setGain( const double g )
{
	if ( m_g == g )
		return;
	
	if (p_eSet)
		p_eSet->setCacheInvalidated();
	
	m_g = g;

//	add_initial_dc();
	if(b_status) A_d(0, 0) = -m_g;
}
예제 #4
0
void CCVS::add_initial_dc()
{
	if (!b_status) return;

	A_b(0, 0) = 1;
	A_b(1, 0) = -1;
	A_b(2, 1) = -1;
	A_b(3, 1) = 1;
	
	A_c(1, 0) = 1;
	A_c(1, 1) = -1;
	A_c(0, 2) = 1;
	A_c(0, 3) = -1;

	A_d(0, 0) = -m_g;
}
예제 #5
0
void Inductance::add_initial_dc()
{
    // The adding of r_eg and v_eq will be done for us by time_step.
    // So for now, just reset the constants used.
    scaled_inductance = 0.0;

    // bail if the element is not "ready"
    if(!b_status) return;

    A_c(0, 0) = 1;
    A_c(0, 1) = -1;

    A_b(0, 0) = 1;
    A_b(1, 0) = -1;

    A_d(0, 0) = 0.0;
}
예제 #6
0
void VCCS::add_initial_dc()
{
	if (!b_status)
		return;
	
	A_c( 0, 0 ) =  1.0;
	A_c( 0, 1 ) = -1.0;
	A_b( 3, 0 ) =  1.0;
	A_b( 2, 0 ) = -1.0;
	A_d( 0, 0 ) = -1.0 / m_g;
	
#if 0
	A_g( 2, 0 ) += m_g;
	A_g( 3, 0 ) -= m_g;
	A_g( 2, 1 ) -= m_g;
	A_g( 3, 1 ) += m_g;
#endif
}