Exemplo n.º 1
0
        public Dictionary <IComponentBase, PropertyIU> GetIUParameterComponents(Dictionary <Node, Complex> nodalVoltages)
        {
            Complex I = 0;

            if (DirectionCurrent == Direction.Node_1_to_Node_2)
            {
                I = (nodalVoltages[Node_1] - nodalVoltages[Node_2] + VoltageSources.Sum(i => i.Voltage)) * Y;
            }
            else
            {
                I = (nodalVoltages[Node_2] - nodalVoltages[Node_1] + VoltageSources.Sum(i => i.Voltage)) * Y;
            }

            var tempI     = I.Magnitude;
            var retuenedD = new Dictionary <IComponentBase, PropertyIU>();

            foreach (var i in AllComponentsInBrunch)
            {
                if (i is Resistor)
                {
                    retuenedD.Add(i, new PropertyIU {
                        I = I.Magnitude, U = I.Magnitude * (i as Resistor).Resistance
                    });
                }
            }

            return(retuenedD);
        }
Exemplo n.º 2
0
 public void Add(IComponentBase component)
 {
     if (component is Node)
     {
         Node_2 = component as Node;
         FindDirection();
         return;
     }
     AllComponentsInBrunch.Add(component);
     if (component is ICurrentSource)
     {
         CurrentSources.Add(component as ICurrentSource);
     }
     if (component is IVoltageSource)
     {
         VoltageSources.Add(component as IVoltageSource);
     }
 }