/// <summary> /// Server服务实例向Client服务实例Notify当前周期的Mission对象 /// </summary> /// <returns></returns> public IEnumerator <ITask> MissionParaNotification() { // Notify all subscribers. MissionPara announce = new MissionPara(); // 将当前仿真使命的通用Mission对象拷贝一份用于策略调用的参数传递 Mission mission = (Mission)MyMission.Instance().MissionRef.Clone(); for (int i = 0; i < mission.CommonPara.TeamCount; i++) {// 循环对每条仿真机器鱼施加图像处理干扰 LiYoubing 20110617 for (int j = 0; j < mission.CommonPara.FishCntPerTeam; j++) { RoboFish f = mission.TeamsRef[i].Fishes[j]; Interference.ImageProcessInterference(ref f.PositionMm, ref f.BodyDirectionRad, f.VelocityMmPs, f.AngularVelocityRadPs); } } for (int i = 0; i < mission.EnvRef.Balls.Count; i++) {// 循环对所有仿真水球施加图像处理干扰 LiYoubing 20110617 Ball b = mission.EnvRef.Balls[i]; float tmp = 0; Interference.ImageProcessInterference(ref b.PositionMm, ref tmp, b.VelocityMmPs, b.AngularVelocityRadPs); } announce.Body = new MissionParaRequest(mission); //announce.Body = new MissionParaRequest(MyMission.Instance().MissionRef);//modified 20101203 base.SendNotification(_submgrPort, announce); announce.ResponsePort.Post(DefaultUpdateResponseType.Instance); yield break; }
private void ReadInterference(Interference itf) { double[] k_svt_alpha = { 0, 20.0D, 40.0D, 60.0D, 80.0D, 100.0D, 120.0D, 140.0D, 160.0D, 180.0D, 200.0D, 220.0D, 240.0D, 260.0D, 280.0D, 300.0D, 320.0D, 340.0D, 360.0D }; double[] k_svt_wg_k_svt = new double[19]; double[] k_svt_ht_k_svt = new double[19]; int i; for (i = 0; i < k_svt_alpha.Length; i++) { k_svt_alpha[i] = MathTool.DegToRad(k_svt_alpha[i]); } Pass("k_SVtail_Wing_stall(alpha) = "); for (i = 0; i < 19; i++) { k_svt_wg_k_svt[i] = ReadDouble(); } itf.k_SVtail_Wing_stall = new Function2D(k_svt_alpha, k_svt_wg_k_svt); Pass("k_SVtail_Htail_stall(alpha) = "); for (i = 0; i < 19; i++) { k_svt_ht_k_svt[i] = ReadDouble(); } itf.k_SVtail_Htail_stall = new Function2D(k_svt_alpha, k_svt_ht_k_svt); }
public void Add(Identifier id1, Identifier id2) { if (id1 != id2) { Interference i = new Interference(id1, id2); if (!intf.ContainsKey(i)) intf.Add(i, i); } }
/// <summary> /// 指示是否已经发生过策略调用异常true是false否 /// 20110820废弃 策略代码中存在条件性除零/数组越界等异常时 不必要直接结束掉策略运行 /// </summary> //bool _strategyExceptionFlag = false; /// <summary> /// 进行策略调用 获取指定id对应队伍的决策数据 /// </summary> /// <param name="teamId">待获取决策数据的队伍id(从0开始)</param> void GetLocalDecision(int teamId) { MyMission myMission = MyMission.Instance(); Decision[] decisions = null; if (_serverControlBoard.TeamStrategyControls[teamId].StrategyInterface != null /*&& _strategyExceptionFlag == false*/) {// 进行null检查确保不出异常 LiYoubing 20110511 // 将当前仿真使命的通用Mission对象拷贝一份用于策略调用的参数传递 Mission mission = (Mission)MyMission.Instance().MissionRef.Clone(); for (int i = 0; i < mission.CommonPara.TeamCount; i++) {// 循环对每条仿真机器鱼施加图像处理干扰 LiYoubing 20110617 for (int j = 0; j < mission.CommonPara.FishCntPerTeam; j++) { RoboFish f = mission.TeamsRef[i].Fishes[j]; Interference.ImageProcessInterference(ref f.PositionMm, ref f.BodyDirectionRad, f.VelocityMmPs, f.AngularVelocityRadPs); } } for (int i = 0; i < mission.EnvRef.Balls.Count; i++) {// 循环对所有仿真水球施加图像处理干扰 LiYoubing 20110617 Ball b = mission.EnvRef.Balls[i]; float tmp = 0; Interference.ImageProcessInterference(ref b.PositionMm, ref tmp, b.VelocityMmPs, b.AngularVelocityRadPs); } // 交换半场后交换策略处理 LiYoubing 20110711 // 交换半场后TeamsRef[0]/[1]代表交换前右/左半场的队伍因此应该分别调用第1/0号控件所加载的策略 int strategyId = myMission.ParasRef.IsExchangedHalfCourt ? (teamId + 1) % 2 : teamId; try { decisions = _serverControlBoard.TeamStrategyControls[strategyId].StrategyInterface.GetDecision( mission, teamId); } catch { //_strategyExceptionFlag = true; MessageBox.Show("Remoting object timeout.\nThe instance of class Strategy has been released." + "\nYour simulated robofish will not be controlled.", "Confirming", MessageBoxButtons.OK, MessageBoxIcon.Warning); } //decision = _serverControlBoard.TeamStrategyControls[teamId].StrategyInterface.GetDecision( // mission, teamId); //decision = _serverControlBoard.TeamStrategyControls[teamId].StrategyInterface.GetDecision( // myMission.MissionRef, teamId); } if (decisions == null) { return; } for (int j = 0; j < myMission.TeamsRef[teamId].Fishes.Count; j++) { myMission.DecisionRef[teamId, j] = decisions[j]; } }
public AirPlane(String path) { plane = new PlaneGeneral(); n_fuselage = 0; fuslage = new Fuselage[7, 2]; n_wing = 0; wing = new Wing[1]; n_htail = 0; htail = new Wing[1]; n_vtail = 0; vtail = new Wing[1]; n_canard = 0; canard = new Wing[1]; n_fin = 0; fin = new Wing[5]; n_aileron = 0; aileron = new ControlPlane[1, 2]; n_elevator = 0; elevator = new ControlPlane[1, 2]; n_rudder = 0; rudder = new ControlPlane[1, 2]; n_l_flap = 0; l_flap = new ControlPlane[1, 2]; n_t_flap = 0; t_flap = new ControlPlane[1, 2]; n_canard_elevator = 0; canard_elevator = new ControlPlane[1, 2]; n_powerPlant = 0; powerPlant = new PowerPlant[4]; n_LandingGear = 0; landing_gear = new LandingGear[3, 2]; airbrake = new AirBrake(); interference = new Interference(); pilot = new Pilot(); force = new Vector3D(); torque = new Vector3D(); a_force = new Vector3D(); a_torque = new Vector3D(); f_force = new Vector3D(); f_torque = new Vector3D(); n_force = new Vector3D(); n_torque = new Vector3D(); t_force = new Vector3D(); t_torque = new Vector3D(); flag_landing_gear = 1; flag_land = 1; crash_point = -1; MakeObject(); AirPlaneFile apsf = new AirPlaneFile(this, path); Init(); }
public void InterfSymmetry() { var id1 = new Identifier("id1", PrimitiveType.Word32, null); var id2 = new Identifier("id2", PrimitiveType.Word32, null); var intf1 = new Interference(id1, id2); var intf2 = new Interference(id1, id2); var intf3 = new Interference(id2, id1); Assert.AreEqual(intf1.GetHashCode(), intf2.GetHashCode()); Assert.AreEqual(intf1.GetHashCode(), intf3.GetHashCode()); Assert.AreEqual(intf2.GetHashCode(), intf3.GetHashCode()); Assert.AreEqual(intf1, intf2, "1 compared 2"); Assert.AreEqual(intf1, intf3, "1 compared 3"); Assert.AreEqual(intf2, intf3, "2 compared 3"); }
private void btInterference_Click(object sender, EventArgs e) { if (cmbAssembly.Text == "胀缩法") { //调用过盈计算并给变量赋值 Interference infe = new Interference(); infe.T = double.Parse(txtT.Text); infe.Df = double.Parse(txtDf.Text); infe.Lf = double.Parse(txtLf.Text); infe.Mu = double.Parse(txtMu.Text); infe.Da = double.Parse(txtDa.Text); infe.Di = double.Parse(txtDi.Text); infe.Ea = double.Parse(txtEa.Text); infe.Ei = double.Parse(txtEi.Text); infe.Va = double.Parse(txtVa.Text); infe.Vi = double.Parse(txtVi.Text); infe.Sigmasa = double.Parse(txtSigmasa.Text); infe.Sigmasi = double.Parse(txtSigmasi.Text); // 求解 txtPfmin.Text = infe.Pfmin().ToString("f4"); txtQa.Text = infe.Qa().ToString("f4"); txtQi.Text = infe.Qi().ToString("f4"); txtEamin.Text = infe.Eamin().ToString("f4"); txtEimin.Text = infe.Eimin().ToString("f4"); txtDeltaemin.Text = infe.Deltaemin().ToString("f4"); txtDeltamin.Text = infe.Deltamin().ToString("f4"); txtPfamax.Text = infe.Pfamax().ToString("f4"); txtPfimax.Text = infe.Pfimax().ToString("f4"); txtPfmax.Text = infe.Pfmax().ToString("f4"); txtFt.Text = infe.Ft().ToString("f4"); txtEamax.Text = infe.Eamax().ToString("f4"); txtEimax.Text = infe.Eimax().ToString("f4"); txtDeltaemax.Text = infe.Deltaemax().ToString("f4"); txtDeltab.Text = infe.Deltab().ToString("f4"); } }
public bool Interfere(Identifier id1, Identifier id2) { Interference i = new Interference(id1, id2); return intf.ContainsKey(i); }
public InterferenceObject(Interference Interferenceinstance) { InterferenceInstance = Interferenceinstance; }
// Use this for initialization void Start() { // Initialization of photon inter = (GameObject.Find ("/UI/Window")).GetComponent<Interference> (); PhotonNetwork.ConnectUsingSettings ("0.1"); caution = (GameObject.Find ("/UI/Caution/CautionMark")).GetComponent<CautionManager> (); selectedName = CharacterSelect.SelectedCharacter.Name; }