private void Generation_Click(object sender, EventArgs e) { // horisontal: form width = max object width - 18 // vertical: form height = max object height - 48 textBox1.Text = 3.ToString(); MountainNumber.Text = 40.ToString(); RiverNumber.Text = 20.ToString(); ClinicNumber.Text = 10.ToString(); PitNumber.Text = 10.ToString(); proprietorExists.Checked = true; eggExists.Checked = true; elfExists.Checked = true; hatExists.Checked = true; ozoneExists.Checked = true; combatForceOptions.SelectedIndex = 2; if (combatForceOptions.SelectedIndex < 0) { MessageBox.Show("Please choose combat force options", "Warning: No choice of combat options"); return; } Random random = new Random(Guid.NewGuid().GetHashCode()); BattleField.Top = groupBox1.Top; BattleField.Left = groupBox1.Left; BattleField.Width = this.Width - groupBox1.Left - 10 - 10; BattleField.Height = this.Height - groupBox1.Top - 35 - 10; groupBox1.Visible = false; groupBox2.Visible = false; BattleField.Visible = true; int Temp = 0; if (!int.TryParse(textBox1.Text, out Temp)) { textBox1.Text = "Invalid input"; return; } else { Player.PlayerNumber = Temp; playerRemainedNumber = Temp; if (proprietorExists.Checked) { proprieter = new Proprieter(BattleField); } if (eggExists.Checked) { egg = new Egg(BattleField); } if (elfExists.Checked) { elf = new Elf(BattleField); } if (hatExists.Checked) { hat = new Hat(combatForceOptions.SelectedIndex, BattleField); } if (ozoneExists.Checked) { ozone = new Ozone(combatForceOptions.SelectedIndex, BattleField); } players = new Player[Temp]; StreamReader PlayerName = new StreamReader(@"./PlayerName.txt"); for (int i = 0; i < Temp; i++) { players[i] = new Player(i, combatForceOptions.SelectedIndex, BattleField); players[i].PlayerLabel.Text = PlayerName.ReadLine() + " " + players[i].CombatForceLevel.ToString(); } PlayerName.Close(); // Horizontal Order Sorting for (int i = 0; i < Player.PlayerNumber; i++) { for (int j = 0; j < Player.PlayerNumber; j++) { if (players[i].PlayerLabel.Left > players[j].PlayerLabel.Left && players[i].HorizontalOrder < players[j].HorizontalOrder) { int temp = players[i].HorizontalOrder; players[i].HorizontalOrder = players[j].HorizontalOrder; players[j].HorizontalOrder = temp; } } if (proprietorExists.Checked) { int temp = random.Next(14); if (temp == 0) { switch (proprieter.FistProprieter) { case 0: players[i].FingerGuessState = 2; break; case 1: players[i].FingerGuessState = 0; break; case 2: players[i].FingerGuessState = 1; break; default: break; } } else if (temp < 4) { players[i].FingerGuessState = proprieter.FistProprieter; } else { switch (proprieter.FistProprieter) { case 0: players[i].FingerGuessState = 1; break; case 1: players[i].FingerGuessState = 2; break; case 2: players[i].FingerGuessState = 0; break; default: break; } } } } }// player number if (!int.TryParse(MountainNumber.Text, out Temp)) { MountainNumber.Text = "Invalid input"; return; } else { mountains = new Mountain[Temp]; double switchL = 5 * (Math.Atan(-Temp / 10) / 2 + Math.PI / 4); for (int i = 0; i < Temp; i++) { mountains[i] = new Mountain(Temp, switchL, players[0], BattleField); } }// Mountain if (!int.TryParse(RiverNumber.Text, out Temp)) { RiverNumber.Text = "Invalid input"; return; } else { rivers = new River[Temp]; double switchL = 5 * (Math.Atan(-Temp / 10) / 8 + Math.PI / 16); for (int i = 0; i < Temp; i++) { rivers[i] = new River(Temp, switchL, players[0], BattleField); } }// River if (!int.TryParse(ClinicNumber.Text, out Temp)) { ClinicNumber.Text = "Invalid input"; return; } else { clinics = new Clinic[Temp]; for (int i = 0; i < Temp; i++) { clinics[i] = new Clinic(10, 10, BattleField); } }// Clinic if (!int.TryParse(PitNumber.Text, out Temp)) { PitNumber.Text = "Invalid input"; return; } else { pits = new Pit[Temp]; for (int i = 0; i < Temp; i++) { pits[i] = new Pit(10, 10, BattleField); } }// Pit isGenerated = true; playerRemained.Text = playerRemainedNumber.ToString(); generation.Enabled = false; start.Enabled = true; clear.Enabled = true; }
private void Generation_Click(object sender, EventArgs e) { // horisontal: form width = max object width - 18 // vertical: form height = max object height - 48 // textBox1.Text = 3.ToString(); //MountainNumber.Text = 1.ToString(); //RiverNumber.Text = 1.ToString(); //ClinicNumber.Text = 10.ToString(); //PitNumber.Text = 10.ToString(); //proprietorExists.Checked = true; //eggExists.Checked = true; //elfExists.Checked = true; //hatExists.Checked = true; //ozoneExists.Checked = true; //combatForceOptions.SelectedIndex = 1; //killOptions.SelectedIndex = 2; if (killOptions.SelectedIndex < 0) { MessageBox.Show("Please choose kill options", "Warning: No choice of kill options"); return; } if (combatForceOptions.SelectedIndex < 0) { MessageBox.Show("Please choose combat force options", "Warning: No choice of combat options"); return; } Random random = new Random(Guid.NewGuid().GetHashCode()); BattleField.Top = groupBox1.Top; BattleField.Left = groupBox1.Left; BattleField.Width = Width - groupBox1.Left - 10 - 10; BattleField.Height = Height - groupBox1.Top - 35 - 10; groupBox1.Visible = false; //groupBox2.Visible = false; Result.Visible = false; BattleField.Visible = true; Result.Visible = false; Result.Rows.Clear(); #region player initialization players = new PlayerGroup(); StreamReader PlayerName; try { PlayerName = new StreamReader(@"./PlayerName.txt"); } catch (FileNotFoundException) { MessageBox.Show(@"请确认PlayerName.txt和此程序在同一路径。", "未发现PlayerName.txt"); CleanUp(); return; } int order = 0; string nameTemp = ""; while (!PlayerName.EndOfStream) { nameTemp = PlayerName.ReadToEnd(); } string[] names = nameTemp.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); if (names.Length <= 1) { MessageBox.Show("请添加至少2名玩家。", "玩家太少啦"); CleanUp(); return; } Player.PlayerNumber = names.Length; Player.PlayerRemainedNumber = names.Length; foreach (var name in names) { var p = new Player(order, combatForceOptions.SelectedIndex, BattleField, (int)TeamNumber.Value) { PlayerName = name }; p.PlayerLabel.Text = $"{p.Team.ToString()} {p.PlayerName} {p.CombatForceLevel.ToString()}"; players.AddPlayer(p); ++order; } PlayerName.Close(); if (proprietorExists.Checked) { proprieter = new Proprieter(BattleField); players.AddPlayer(proprieter); } if (eggExists.Checked) { egg = new Egg(BattleField); players.AddPlayer(egg); } if (elfExists.Checked) { elf = new Elf(BattleField); players.AddPlayer(elf); } if (hatExists.Checked) { hat = new Hat(combatForceOptions.SelectedIndex, BattleField); players.AddPlayer(hat); } if (ozoneExists.Checked) { ozone = new Ozone(combatForceOptions.SelectedIndex, BattleField); players.AddPlayer(ozone); } #endregion int Temp; if (!int.TryParse(MountainNumber.Text, out Temp)) { MessageBox.Show("Invalid mountain number"); CleanUp(); MountainNumber.Text = "山的数量"; return; } else { Temp = Temp <= 0 ? 1 : Temp; mountains = new Mountain[Temp]; double switchL = 5 * (Math.Atan(-Temp / 10) / 2 + Math.PI / 4); for (int i = 0; i < Temp; i++) { int rand = random.Next(5); mountains[i] = new Mountain(rand, switchL, BattleField); } }// Mountain if (!int.TryParse(RiverNumber.Text, out Temp)) { MessageBox.Show("Invalid river number"); CleanUp(); RiverNumber.Text = "河的数量"; return; } else { Temp = Temp <= 0 ? 1 : Temp; rivers = new River[Temp]; double switchL = 5 * (Math.Atan(-Temp / 10) / 8 + Math.PI / 16); for (int i = 0; i < Temp; i++) { rivers[i] = new River(switchL, BattleField); } }// River if (!int.TryParse(ClinicNumber.Text, out Temp)) { MessageBox.Show("Invalid clinic number"); CleanUp(); ClinicNumber.Text = "医疗站数量"; return; } else { Temp = Temp <= 0 ? 1 : Temp; clinics = new Clinic[Temp]; Clinic.NumberOfClinic = Temp; for (int i = 0; i < Temp; i++) { clinics[i] = new Clinic(10, 10, BattleField); } }// Clinic if (!int.TryParse(PitNumber.Text, out Temp)) { MessageBox.Show("Invalid pit number"); CleanUp(); PitNumber.Text = "坑的数量"; return; } else { Temp = Temp <= 0 ? 1 : Temp; pits = new Pit[Temp]; for (int i = 0; i < Temp; i++) { pits[i] = new Pit(i, 10, 10, BattleField); } }// Pit isGenerated = true; playerRemained.Text = players.Count.ToString(); Number.Text = Player.PlayerNumber.ToString(); RandomGeneration.Enabled = false; generation.Enabled = false; start.Enabled = true; clear.Enabled = true; }
private void hesapla_Click(object sender, EventArgs e) { direkOku(); Console.WriteLine(direk.direkTipi); Console.WriteLine(direk.devreTipi); Console.WriteLine(direk.d); Console.WriteLine(direk.f); Console.WriteLine(direk.g); Console.WriteLine(direk.h); Console.WriteLine(direk.k); double xr = Math.Sqrt((4 * 2 * Math.PI * 50) / (r0 * 10000)); if (xr > 3) { rac = r0 * ((xr / 2.828427125) + 0.26); } else { rac = r0 * ((Math.Sqrt(1 + Math.Pow(xr, 4) / 48) + 1) / 2); } if (string.Compare(dau.Text, "") != 0) { d = Convert.ToDouble(dau.Text) * 10; } else { d = 1.0; } if (tekDemet.Checked) { GMRd = GMR; rd = r; } if (ciftDemet.Checked) { GMRd = Math.Pow(GMR * d, (1.0 / 2.0)); rd = Math.Pow(r * d, (1.0 / 2.0)); } if (ucDemet.Checked) { GMRd = Math.Pow(GMR * d * d, (1.0 / 3.0)); rd = Math.Pow(r * d * d, (1.0 / 3.0)); } if (dortDemet.Checked) { GMRd = Math.Pow(GMR * d * d * d, (1.0 / 4.0)); rd = Math.Pow(r * d * d * d, (1.0 / 4.0)) * 1.09; } Console.WriteLine("GMRd: " + GMRd + " rd: " + rd); if (direk.devreTipi == 1) { double a = direk.f * 2; double b = Math.Sqrt(Math.Pow(direk.d + direk.f, 2) + direk.g * direk.g); double c = Math.Sqrt(Math.Pow(direk.f - direk.d, 2) + direk.g * direk.g); direk.GMD = Math.Pow(a * b * c, (1.0 / 3.0)); L = 0.2 * Math.Log(direk.GMD * 1000 / GMRd); C = 0.0556 / (Math.Log((direk.GMD * 1000) / rd)); } else if (direk.devreTipi == 2) { a1b1 = Math.Sqrt(Math.Pow((direk.f - direk.d), 2) + direk.h * direk.h); a1b2 = Math.Sqrt(Math.Pow((direk.d + direk.f), 2) + direk.h * direk.h); a2b1 = Math.Sqrt(Math.Pow((direk.f + direk.g), 2) + direk.k * direk.k); a2b2 = Math.Sqrt(Math.Pow((direk.f - direk.g), 2) + direk.k * direk.k); Dab = Math.Pow((a1b1 * a1b2 * a2b1 * a2b2), (1.0 / 4.0)); b1c1 = Math.Sqrt(Math.Pow((direk.f - direk.g), 2) + direk.k * direk.k); b1c2 = Math.Sqrt(Math.Pow((direk.d + direk.f), 2) + direk.h * direk.h); b2c1 = Math.Sqrt(Math.Pow((direk.f + direk.g), 2) + direk.k * direk.k); b2c2 = Math.Sqrt(Math.Pow((direk.f - direk.d), 2) + direk.h * direk.h); Dbc = Math.Pow((b1c1 * b1c2 * b2c1 * b2c2), (1.0 / 4.0)); a1c1 = Math.Sqrt(Math.Pow((direk.g - direk.d), 2) + Math.Pow((direk.h + direk.k), 2)); a1c2 = 2 * direk.d; a2c1 = 2 * direk.g; a2c2 = Math.Sqrt(Math.Pow((direk.g - direk.d), 2) + Math.Pow((direk.h + direk.k), 2)); Dac = Math.Pow((a1c1 * a1c2 * a2c1 * a2c2), (1.0 / 4.0)); direk.GMD = Math.Pow(Dab * Dbc * Dac, (1.0 / 3.0)); Da1a2 = Math.Sqrt(Math.Pow(direk.d + direk.g, 2) + Math.Pow(direk.h + direk.k, 2)); Db1b2 = 2 * direk.f; Dc1c2 = Da1a2; GMRa = Math.Sqrt(GMRd * Da1a2 * 1000); ra = Math.Sqrt(rd * Da1a2 * 1000); GMRb = Math.Sqrt(GMRd * Db1b2 * 1000); rb = Math.Sqrt(rd * Db1b2 * 1000); GMRc = Math.Sqrt(GMRd * Dc1c2 * 1000); rc = Math.Sqrt(rd * Dc1c2 * 1000); GMRL = Math.Pow(GMRa * GMRb * GMRc, (1.0 / 3.0)); rK = Math.Pow(ra * rb * rc, (1.0 / 3.0)); L = 0.2 * Math.Log(direk.GMD * 1000 / GMRL); C = 0.0556 / (Math.Log(direk.GMD * 1000 / rK)); } else if (direk.devreTipi == 3) { double a = 2 * direk.f; double b = Math.Sqrt(direk.d * direk.d + direk.f * direk.f); double c = Math.Sqrt(direk.d * direk.d + direk.f * direk.f); direk.GMD = Math.Pow(a * b * c, (1.0 / 3.0)); L = 0.2 * Math.Log(direk.GMD * 1000 / GMRd); C = 0.0556 / (Math.Log((direk.GMD * 1000) / rd)); } else if (direk.devreTipi == 4) { double a = direk.d; double b = direk.d; double c = 2 * direk.d; direk.GMD = Math.Pow(a * b * c, (1.0 / 3.0)); L = 0.2 * Math.Log(direk.GMD * 1000 / GMRd); C = 0.0556 / (Math.Log((direk.GMD * 1000) / rd)); } Console.WriteLine("GMD: " + direk.GMD); kl.Text = "L=" + Math.Round(L, 4); kc.Text = "C=" + Math.Round(C, 4); L *= Math.Pow(10, -3); C *= Math.Pow(10, -6); Hat kisaHat = new Hat(); Hat ortaUzunHat = new Hat(); Hat ortaUzunHatT = new Hat(); Hat uzunHat = new Hat(); if (string.Compare(uzunluk.Text, "") != 0) { double omega = 2 * Math.PI * 50 * L; double uznlkyuzde = 1.0; switch (uzunlukyuzde.Text) { case "100 %": uznlkyuzde = 1.0; break; case "90 %": uznlkyuzde = 0.9; break; case "80 %": uznlkyuzde = 0.8; break; case "70 %": uznlkyuzde = 0.7; break; case "60 %": uznlkyuzde = 0.6; break; case "50 %": uznlkyuzde = 0.5; break; case "40 %": uznlkyuzde = 0.4; break; case "30 %": uznlkyuzde = 0.3; break; case "20 %": uznlkyuzde = 0.2; break; case "10 %": uznlkyuzde = 0.1; break; } double uznlk = Convert.ToDouble(uzunluk.Text) * uznlkyuzde; iletimhatuzunlugu.Text = "İletim Hattı Uzunluğu: " + uznlk.ToString(); Complex Z = new Complex(rac * uznlk, omega * uznlk); kisaHat.A = 1; kisaHat.B = Z; kisaHat.C = 0; kisaHat.D = 1; kisahat_a.Text = "[" + Math.Round(kisaHat.A.Real, 2).ToString() + " " + Math.Round(kisaHat.A.Imaginary, 2).ToString() + "]"; kisahat_b.Text = "[" + Math.Round(kisaHat.B.Real, 2).ToString() + " " + Math.Round(kisaHat.B.Imaginary, 2).ToString() + "]"; kisahat_c.Text = "[" + Math.Round(kisaHat.C.Real, 2).ToString() + " " + Math.Round(kisaHat.C.Imaginary, 2).ToString() + "]"; kisahat_d.Text = "[" + Math.Round(kisaHat.D.Real, 2).ToString() + " " + Math.Round(kisaHat.D.Imaginary, 2).ToString() + "]"; Complex omegaC = new Complex(0, 2 * Math.PI * 50 * C * uznlk); Complex Y = omegaC; ortaUzunHat.A = (1 + (Complex.Multiply(Z, Y) / 2)); ortaUzunHat.B = Z; ortaUzunHat.C = (Y + (Complex.Multiply(Complex.Multiply(Y, Y), Z) / 4)); Console.WriteLine("z y"); Console.WriteLine(Z); Console.WriteLine(Y); ortaUzunHat.D = (1 + (Complex.Multiply(Z, Y) / 2)); ortauzunhat_a.Text = "[" + Math.Round(ortaUzunHat.A.Real, 2).ToString() + " " + Math.Round(ortaUzunHat.A.Imaginary, 2).ToString() + "]"; ortauzunhat_b.Text = "[" + Math.Round(ortaUzunHat.B.Real, 2).ToString() + " " + Math.Round(ortaUzunHat.B.Imaginary, 2).ToString() + "]"; ortauzunhat_c.Text = "[" + Math.Round(ortaUzunHat.C.Real, 2).ToString() + " " + Math.Round(ortaUzunHat.C.Imaginary, 2).ToString() + "]"; ortauzunhat_d.Text = "[" + Math.Round(ortaUzunHat.D.Real, 2).ToString() + " " + Math.Round(ortaUzunHat.D.Imaginary, 2).ToString() + "]"; ortaUzunHatT.A = (1 + (Complex.Multiply(Z, Y) / 2)); ortaUzunHatT.B = Y; ortaUzunHatT.C = (Z + (Complex.Multiply(Complex.Multiply(Z, Z), Y) / 4)); ortaUzunHatT.D = (1 + (Complex.Multiply(Z, Y) / 2)); ortauzunhatt_a.Text = "[" + Math.Round(ortaUzunHatT.A.Real, 2).ToString() + " " + Math.Round(ortaUzunHatT.A.Imaginary, 2).ToString() + "]"; ortauzunhatt_b.Text = "[" + Math.Round(ortaUzunHatT.B.Real, 2).ToString() + " " + Math.Round(ortaUzunHatT.B.Imaginary, 2).ToString() + "]"; ortauzunhatt_c.Text = "[" + Math.Round(ortaUzunHatT.C.Real, 2).ToString() + " " + Math.Round(ortaUzunHatT.C.Imaginary, 2).ToString() + "]"; ortauzunhatt_d.Text = "[" + Math.Round(ortaUzunHatT.D.Real, 2).ToString() + " " + Math.Round(ortaUzunHatT.D.Imaginary, 2).ToString() + "]"; Z = Z / Convert.ToDouble(uzunluk.Text); Y = Y / Convert.ToDouble(uzunluk.Text); Complex gamma = new Complex(); gamma = Complex.Sqrt(Complex.Multiply(Z, Y)) * Convert.ToDouble(uzunluk.Text); Complex Zc = new Complex(); Zc = Complex.Sqrt(Complex.Divide(Z, Y)); uzunHat.A = Complex.Cosh(gamma); uzunHat.B = Complex.Multiply(Complex.Sinh(gamma), Zc); uzunHat.C = Complex.Divide(Complex.Sinh(gamma), Zc); uzunHat.D = Complex.Cosh(gamma); uzunhat_a.Text = "[" + Math.Round(uzunHat.A.Real, 2).ToString() + " " + Math.Round(uzunHat.A.Imaginary, 2).ToString() + "]"; uzunhat_b.Text = "[" + Math.Round(uzunHat.B.Real, 2).ToString() + " " + Math.Round(uzunHat.B.Imaginary, 2).ToString() + "]"; uzunhat_c.Text = "[" + Math.Round(uzunHat.C.Real, 2).ToString() + " " + Math.Round(uzunHat.C.Imaginary, 2).ToString() + "]"; uzunhat_d.Text = "[" + Math.Round(uzunHat.D.Real, 2).ToString() + " " + Math.Round(uzunHat.D.Imaginary, 2).ToString() + "]"; } double U2 = Convert.ToDouble(this.hatsonugerilimi.Text); double s2 = (Convert.ToDouble(s2katsayisi.Text) * (U2 * U2)) / Math.Sqrt(L / C); hatsonugerililmi1.Text = "S2: " + s2.ToString(); double I = s2 / (3 * U2); if (string.Compare(guckatsayisi.Text, "") != 0 && string.Compare(katsayitipi.Text, "") != 0) { double gucKatsayisi = Convert.ToDouble(guckatsayisi.Text); double deger; if (string.Compare(katsayitipi.Text, "Kapasitif") == 0) { deger = Math.Sin(Math.Acos(gucKatsayisi)); } else { deger = (-1) * Math.Sin(Math.Acos(gucKatsayisi)); } double real = I * gucKatsayisi; double imajiner = I * deger; Complex I2 = new Complex(real, imajiner); Console.WriteLine(I2); Complex imgZ = kisaHat.B; kisaHat.U1 = new Complex(); kisaHat.U1 = U2 + Complex.Multiply(imgZ, I2); kisaHat.I1 = I2; kisahat_u1.Text = "U1: " + Math.Round(kisaHat.U1.Real, 2).ToString() + " " + Math.Round(kisaHat.U1.Imaginary, 2).ToString(); kisahat_i1.Text = "I1: " + Math.Round(kisaHat.I1.Real, 2).ToString() + " " + Math.Round(kisaHat.I1.Imaginary, 2).ToString(); u2.Text = "U2: " + U2.ToString(); i2.Text = "I2: " + Math.Round(I2.Real, 2).ToString() + " " + Math.Round(I2.Imaginary, 2).ToString(); ortaUzunHat.U1 = new Complex(); ortaUzunHat.U1 = ortaUzunHat.A * U2 + Complex.Multiply(ortaUzunHat.B, I2); Console.WriteLine("U2*O.C"); Console.WriteLine(ortaUzunHat.C); Console.WriteLine("O.D * İ2"); Console.WriteLine(Complex.Multiply(ortaUzunHat.D, I2)); ortaUzunHat.I1 = U2 * ortaUzunHat.C + Complex.Multiply(ortaUzunHat.D, I2); ortauzunhat_u1.Text = "U1: " + Math.Round(ortaUzunHat.U1.Real, 2).ToString() + " " + Math.Round(ortaUzunHat.U1.Imaginary, 2).ToString(); ortauzunhat_i1.Text = "I1: " + Math.Round(ortaUzunHat.I1.Real, 2).ToString() + " " + Math.Round(ortaUzunHat.I1.Imaginary, 2).ToString(); uzunHat.U1 = uzunHat.A * U2 + Complex.Multiply(uzunHat.B, I2); uzunHat.I1 = U2 * uzunHat.C + Complex.Multiply(uzunHat.D, I2); uzunhat_u1.Text = "U1: " + Math.Round(uzunHat.U1.Real, 2).ToString() + " " + Math.Round(uzunHat.U1.Imaginary, 2).ToString(); uzunhat_i1.Text = "I1: " + Math.Round(uzunHat.I1.Real, 2).ToString() + " " + Math.Round(uzunHat.I1.Imaginary, 2).ToString(); double P2 = s2 * gucKatsayisi; double Q2 = s2 * Math.Sin(Math.Acos(gucKatsayisi)); kisaHat.S1 = 3 * Complex.Multiply(kisaHat.U1, new Complex(kisaHat.I1.Real, (-1) * kisaHat.I1.Imaginary)); kisaHat.P1 = kisaHat.S1.Real; kisaHat.Q1 = kisaHat.S1.Imaginary; ortaUzunHat.S1 = 3 * Complex.Multiply(ortaUzunHat.U1, new Complex(ortaUzunHat.I1.Real, (-1) * ortaUzunHat.I1.Imaginary)); Console.WriteLine("s1"); Console.WriteLine(ortaUzunHat.S1); ortaUzunHat.P1 = ortaUzunHat.S1.Real; ortaUzunHat.Q1 = ortaUzunHat.S1.Imaginary; uzunHat.S1 = 3 * Complex.Multiply(uzunHat.U1, new Complex(uzunHat.I1.Real, (-1) * uzunHat.I1.Imaginary)); Console.WriteLine("s1"); Console.WriteLine(uzunHat.S1); uzunHat.P1 = uzunHat.S1.Real; uzunHat.Q1 = uzunHat.S1.Imaginary; p2.Text = "P2: " + P2.ToString(); q2.Text = "Q2: " + Q2.ToString(); kisahat_p1.Text = "P1: " + kisaHat.P1.ToString(); kisahat_q1.Text = "Q1: " + kisaHat.Q1.ToString(); ortauzunhat_p1.Text = "P1: " + ortaUzunHat.P1.ToString(); ortauzunhat_q1.Text = "Q1: " + ortaUzunHat.Q1.ToString(); uzunhat_p1.Text = "P1: " + uzunHat.P1.ToString(); uzunhat_q1.Text = "Q1: " + uzunHat.Q1.ToString(); kisaHat.M = (P2 / kisaHat.P1) * 100; kisaHat.VR = ((Math.Sqrt(kisaHat.U1.Real * kisaHat.U1.Real + kisaHat.U1.Imaginary * kisaHat.U1.Imaginary)) - U2) / (U2 / 100); ortaUzunHat.M = (P2 / ortaUzunHat.P1) * 100; ortaUzunHat.VR = ((Math.Sqrt(ortaUzunHat.U1.Real * ortaUzunHat.U1.Real + ortaUzunHat.U1.Imaginary * ortaUzunHat.U1.Imaginary) / ortaUzunHat.A.Real) - U2) / (U2 / 100); uzunHat.M = (P2 / uzunHat.P1) * 100; uzunHat.VR = ((Math.Sqrt(uzunHat.U1.Real * uzunHat.U1.Real + uzunHat.U1.Imaginary * uzunHat.U1.Imaginary) / uzunHat.A.Real) - U2) / (U2 / 100); kisahat_m.Text = "M: " + kisaHat.M.ToString(); kisahat_vr.Text = "VR: " + kisaHat.VR.ToString(); ortauzunhat_m.Text = "M: " + ortaUzunHat.M.ToString(); ortauzunhat_vr.Text = "VR: " + ortaUzunHat.VR.ToString(); uzunhat_m.Text = "M: " + uzunHat.M.ToString(); uzunhat_vr.Text = "VR: " + uzunHat.VR.ToString(); } }