private void BtnExport(object sender, RoutedEventArgs e) { SaveFileDialog save = new SaveFileDialog(); save.InitialDirectory = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);; save.Filter = "Circuit Net List files (*.csv)|*.csv|All files (*.*)|*.*"; if (save.ShowDialog() == true) { ComplexPlainSolver sol5 = (ComplexPlainSolver)cir2.Setup[0].Solver; int index = 1; if (lbNodes.SelectedItem != null) { sol5.SelectedNode = (Node)lbNodes.SelectedItem; } index = lbNodes.SelectedIndex; sol5.ExportToCSV(save.FileName); } }
static void Main(string[] args) { int i = 2; switch (i) { case 0: cir.ReadCircuit("circuits/RLcharge.net"); cir2 = (Circuit)cir.Clone(); DCSolver.Optimize(cir2); DCAnalysis ac0 = (DCAnalysis)cir2.Setup[0]; DCSolver solver = (DCSolver)ac0.Solver; //solver.Solve(cir2, ); cir2.Solve(); solver.ExportToCSV("e:/Test.csv"); break; case 1: cir.ReadCircuit("circuits/testidc.net"); cir2 = (Circuit)cir.Clone(); DCSolver.Optimize(cir2); DCAnalysis ac3 = (DCAnalysis)cir2.Setup[0]; DCSolver solver3 = (DCSolver)ac3.Solver; //solver.Solve(cir2, ); cir2.Solve(); solver3.ExportToCSV("e:/Test.csv"); break; case 2: cir.ReadCircuit("circuits/derivador.net"); //cir.ReadCircuit("RCL.net"); cir2 = (Circuit)cir.Clone(); cir2.Setup.RemoveAt(0); ACAnalysis ac = new ACAnalysis(); cir2.Setup.Add(ac); ACSweepSolver.Optimize(cir2); cir2.Solve(); ACSweepSolver sol = (ACSweepSolver)ac.Solver; sol.ExportToCSV("ACSweep.csv"); break; case 3: //cir.ReadCircuit("derivador.net"); cir.ReadCircuit("circuits/RLC.net"); cir2 = (Circuit)cir.Clone(); cir2.Setup.RemoveAt(0); ComplexPlainAnalysis ac1 = new ComplexPlainAnalysis(); cir2.Setup.Add(ac1); ACSweepSolver.Optimize(cir2); cir2.Solve(); sol1 = (ComplexPlainSolver)ac1.Solver; sol1.SelectedNode = sol1.CurrentCircuit.Nodes["out"]; // sol1. sol1.ExportToCSV("e:/plain.csv"); Bitmap bmp = FileUtils.DrawImage(func, ac1.Points, ac1.Points); bmp.Save("e:/plain.bmp"); break; case 4: cir.ReadCircuit("circuits/RCL.net"); //cir.ReadCircuit("RCcharge.net"); cir2 = (Circuit)cir.Clone(); cir2.Setup.RemoveAt(0); TransientAnalysis ac5 = new TransientAnalysis(); ac5.Step = "10n"; cir2.Setup.Add(ac5); TransientSolver sol5 = (TransientSolver)ac5.Solver; TransientSolver.Optimize(cir2); cir2.Solve(); sol5.ExportToCSV("e:/time.csv"); break; case 5: cir.ReadCircuit("circuits/vsingain.net"); //cir.ReadCircuit("RCcharge.net"); cir2 = (Circuit)cir.Clone(); cir2.Setup.RemoveAt(0); TransientAnalysis ac6 = new TransientAnalysis(); ac6.Step = "100n"; cir2.Setup.Add(ac6); TransientSolver sol6 = (TransientSolver)ac6.Solver; TransientSolver.Optimize(cir2); cir2.Solve(); sol6.ExportToCSV("e:/time.csv"); break; default: break; } Console.ReadKey(); }