Example #1
0
void solver::getSources(circuit C)
{
    int N = C.nComponents();
    v_s = matrix<complex<double> >(N,1);
    i_s = matrix<complex<double> >(N,1);
    for(int i=0; i<N; i++)
    {
        if(C.circuit_graph.edges[i].link.type == vsource) v_s(i,0).real() = C.circuit_graph.edges[i].link.amplitude;
        if(C.circuit_graph.edges[i].link.type == csource) i_s(i,0).real() = C.circuit_graph.edges[i].link.amplitude;
    }
}
Example #2
0
void solver::getImpedance(circuit C)
{
    int N = C.nComponents();
    Z = matrix< complex<double> >(N,N);
    for(int i=0; i<N; i++) Z(i,i) = C.circuit_graph.edges[i].link.impedance;
}