public bool Solve(Components.Circuit cir, BasicAnalysis ana) { List<Node> nodos = new List<Node>(); Voltages = new Dictionary<double, Dictionary<string, double>>(); Currents = new Dictionary<double, Dictionary<string, double>>(); circuit = cir; SolveInfo solveinfo = new SolveInfo(); //nodos.AddRange(cir.Nodes.Values); //nodos.Remove(cir.Reference); PreAnalizeToSolve(cir, nodos, solveinfo); TransientAnalysis analis = ana as TransientAnalysis; double t, tf, deltat; deltat = StringUtils.DecodeString(analis.Step); tf = StringUtils.DecodeString(analis.FinalTime); t = 0; cir.CircuitTime = t; cir.Reset(); while (t < tf) { //Calculo de tensiones de nodos Calculate(solveinfo, t); Dictionary<string, double> result = new Dictionary<string, double>(); #region almacenamiento temporal foreach (var nodo in nodos) { result.Add(nodo.Name, nodo.Voltage.Real); } if (!Voltages.ContainsKey(t)) Voltages.Add(t, result); #endregion //calculo las corrientes: CalculateCurrents(cir, t); Dictionary<string, double> currents = new Dictionary<string, double>(); StorageCurrents(cir, currents); Currents.Add(t, currents); cir.CircuitTime = t; t += deltat; } cir.State = Circuit.CircuitState.Solved; return true; }