//NOT RELATED TO UPDATING. private void ConjugateMatch_btn_Click(object sender, EventArgs e) { //Dummy validation script. //Take s-parameters. //TwoPortNetworks.TwoPortNetwork tpn = new TwoPortNetworks.TwoPortNetwork( // MenialOperations.complex_magphase(0.869, -159, true), // MenialOperations.complex_magphase(0.031, -9, true), // MenialOperations.complex_magphase(4.250, 61, true), // MenialOperations.complex_magphase(0.507, -117, true), // TwoPortNetworks.STATE.S, // 50.0 // ); // //ComplexXY gammaIN_TEST_XY = new ComplexXY(new ComplexLinearSpace(100, 100), tpn.CalculateGammaIN); //ComplexXY gammaOUT_TEST_XY = new ComplexXY(new ComplexLinearSpace(100, 100), tpn.CalculateGammaOUT); // //this.PlotGammaXY(gammaIN_TEST_XY, Color.Red); //this.PlotGammaXY(gammaOUT_TEST_XY, Color.Blue, false); TwoPortNetworks.TwoPortNetwork tpn = this.Device.ExtractTwoPortNetwork(DesignFrequency); //Calculate gamma_s and gamma_L. Complex gamma_s = PAdesign.gamma_S(tpn); Complex gamma_l = PAdesign.gamma_L(tpn); Complex Z_s = Conversions.GammaToZ(gamma_s, this.Device.Zo); Complex Z_l = Conversions.GammaToZ(gamma_l, this.Device.Zo); //Compute gain. double GS = PAdesign.G_S(tpn); double GL = PAdesign.G_L(tpn); double GTotal = PAdesign.G_total(tpn); //Report. string CompleteCircuitDesign = ""; CompleteCircuitDesign += "Gamma S: " + Environment.NewLine + gamma_s.Magnitude + " " + MenialOperations.radtodeg(gamma_s.Phase) + Environment.NewLine + Z_s + Environment.NewLine + Z_s.Real + ", " + Conversions.XtoComponent(Z_s.Imaginary, DesignFrequency) + Environment.NewLine + Environment.NewLine; CompleteCircuitDesign += "Gamma L: " + Environment.NewLine + gamma_l.Magnitude + " " + MenialOperations.radtodeg(gamma_l.Phase) + Environment.NewLine + Z_l + Environment.NewLine + Z_l.Real + ", " + Conversions.XtoComponent(Z_l.Imaginary, DesignFrequency) + Environment.NewLine + Environment.NewLine; ////These.... might not be correct..... //CompleteCircuitDesign += "GS is: " + GS + " (" + 10 * Math.Log10(GS) + "dB)" + Environment.NewLine; //CompleteCircuitDesign += "GL is: " + GL + " (" + 10 * Math.Log10(GL) + "dB)" + Environment.NewLine; //CompleteCircuitDesign += "GTotal is: " + GTotal + " (" + 10 * Math.Log10(GTotal) + "dB)" + Environment.NewLine; //CompleteCircuitDesign += "Mu is: " + tpn.mu(); // ThreadSafe.SetControlTextThreadSafe_uc(this, CompleteCircuitDesign_tb, CompleteCircuitDesign); }
protected virtual void UpdateForNewParams() { //Change DesignFrequency. bool UserInputFrequency = double.TryParse(setDesignFrequency_tb.Text, out DesignFrequency); if (!UserInputFrequency) { MessageBox.Show("Please enter valid frequency"); return; } DesignFrequency *= MenialOperations.M; //Fill out table. TwoPortNetworks.TwoPortNetwork temp_tpn = this.Device.ExtractTwoPortNetwork(DesignFrequency); ThreadSafe.SetControlTextThreadSafe_uc(this, sParamsChosen_tlp.GetControlFromPosition(0, 0), temp_tpn.m(1, 1).ToString()); ThreadSafe.SetControlTextThreadSafe_uc(this, sParamsChosen_tlp.GetControlFromPosition(0, 1), temp_tpn.m(1, 2).ToString()); ThreadSafe.SetControlTextThreadSafe_uc(this, sParamsChosen_tlp.GetControlFromPosition(1, 0), temp_tpn.m(2, 1).ToString()); ThreadSafe.SetControlTextThreadSafe_uc(this, sParamsChosen_tlp.GetControlFromPosition(1, 1), temp_tpn.m(2, 2).ToString()); }