protected override void OnResetPlugin() { fluidB = null; fluidC = null; fluidD = null; distanceMultiplier = 0.5f; }
public override void OnFluidEnter(Fluid fluid) { if (dolphin.currentFluid == null || fluid.nutrients > dolphin.currentFluid.nutrients) { dolphin.currentFluid = fluid; } }
public virtual void OnFluidEnter(Fluid fluid) { if (entity.currentFluid == null || fluid.nutrients > entity.currentFluid.nutrients) { entity.currentFluid = fluid; } }
public override void OnFluidEnter(Fluid fluid) { if (fish.currentFluid == null || fluid.nutrients > fish.currentFluid.nutrients) { fish.currentFluid = fluid; } }
public override void OnFluidEnter(Fluid fluid) { if (mekka.currentFluid == null || fluid.nutrients > mekka.currentFluid.nutrients) { mekka.currentFluid = fluid; } }
public void InitVolume() { Component<Collider>().isTrigger = true; Component<Renderer>().material = Fluid.material; Component<Renderer>().material.color = new Color(10/255f, 79/255f, 163/255f, 220/225f); fluid = Component<Fluid>(true); fluid.entity = this; renderer.enabled = false; }
public void InitFluid() { Component<Collider>().isTrigger = true; Component<Renderer>().material = Fluid.material; fluid = Component<Fluid>(true); fluid.entity = this; fluid.nutrients = Random.Range(10f, 100f); Color(Util.RainbowColor()); }
public override void OnFluidExit(Fluid fluid) { if (fish.target == null) { if (fluid == fish.currentFluid) { fish.currentFluid = null; fish.target = fluid.entity; fish.targetVelocity = fish.maxSpeed * fish.Orientation(); Debug.Log("Fish returning to fluid: " + fluid.entity); } } }
private Color MapFluidToColor(Fluid fluid) { Color color; if (fluid == Fluid.OIL) { color = Color.Green; } else if (fluid == Fluid.WATER) { color = Color.Blue; } else if (fluid == Fluid.GAS) { color = Color.Red; } else { //默认按油井处理 color = Color.FromArgb(255, 255, 127, 0); } return color; }
private void Update() { if (IsDying) { Audio.volume = 0; Transition += Time.deltaTime / Desc.DeathDuration; if (Transition >= 1) { Transition = 1; IsDying = false; } transform.position = Fluid.Lerp(TransitionOrigin, TransitionOrigin - Vector3.up * 1.5f, Transition, AnimationMode.easeIn); } else if (IsStaying) { Audio.volume = 0; Transition += Time.deltaTime / Desc.AttackDuration; if (Transition >= 1) { IsStaying = false; IsReturning = true; Transition = 0; TransitionOrigin = transform.position; } transform.position = Fluid.Lerp(TransitionOrigin, TransitionOrigin + Vector3.up * 0.5f, Transition, AnimationMode.easeOut); } else { if (IsTurning) { Audio.volume = Mathf.Clamp01(Audio.volume - Time.deltaTime * 3); TurnTransition += Time.deltaTime / Desc.TurnDuration; if (TurnTransition >= 1) { TurnTransition = 1; IsTurning = false; } transform.eulerAngles = new Vector3(transform.eulerAngles.x, Fluid.LerpAngle(TurnOrigin, TurnTarget, TurnTransition, AnimationMode.easeInOut), transform.eulerAngles.z); } else if (IsMoving) { Audio.volume = 1; var segment = Cell.SegmentLength(Path, PathIndex); if (IsAttacking && PathIndex + segment >= Path.Length) { segment--; } Transition += Time.deltaTime / (segment * Desc.ShiftDuration); while (Transition >= 1 && PathIndex + segment - 1 < Path.Length) { if (Cell != null) { Cell.Character = null; } Cell = Path[PathIndex + segment - 1]; Cell.Character = this; Transition -= 1; TransitionOrigin = transform.position; PathIndex += segment; if (PathIndex < Path.Length) { prepareToMoveTo(Path[PathIndex]); } segment = 1; } if (PathIndex + segment - 1 < Path.Length) { transform.position = Fluid.Lerp(TransitionOrigin, Path[PathIndex + segment - 1].transform.position, Transition, AnimationMode.easeInOut); } if (IsAttacking) { if (PathIndex + 1 >= Path.Length) { TransitionOrigin = transform.position; Transition = 0; IsMoving = false; prepareToMoveTo(Path[Path.Length - 1]); } } else { if (PathIndex >= Path.Length) { Transition = 0; IsMoving = false; } } } else if (IsAttacking) { Audio.volume = 0; if (Desc.Projectile != null && !HasFired) { HasFired = true; Play(AttackSound); var instance = GameObject.Instantiate(Desc.Projectile.gameObject); instance.transform.position = Origin.position; instance.SetActive(true); var projectile = instance.GetComponent <Projectile>(); projectile.Origin = instance.transform.position; projectile.Enemy = Path[Path.Length - 1].Character; projectile.Target = projectile.Enemy.transform.position; projectile.Damage = IsRivalsWith(projectile.Enemy) ? 4 : 2; Manager.Process(projectile); } else if (!HasFired) { HasFired = true; Play(AttackSound); } Transition += Time.deltaTime / Desc.AttackDuration; if (Transition >= 1) { if (Desc.Projectile == null) { var enemy = Path[Path.Length - 1].Character; if (enemy != null) { enemy.Play(enemy.HitSound); enemy.Lives -= IsRivalsWith(enemy) ? 4 : 2; if (enemy.Lives <= 0) { enemy.Die(); } } } IsAttacking = false; IsReturning = true; Transition = 0; TransitionOrigin = transform.position; } var target = Path[Path.Length - 1]; if (target.X > Cell.X + 1) { target = Manager.Grid.Cells[Cell.X + 1, Cell.Y]; } if (target.X < Cell.X - 1) { target = Manager.Grid.Cells[Cell.X - 1, Cell.Y]; } if (target.Y > Cell.Y + 1) { target = Manager.Grid.Cells[Cell.X, Cell.Y + 1]; } if (target.Y < Cell.Y - 1) { target = Manager.Grid.Cells[Cell.X, Cell.Y - 1]; } var targetPosition = target.transform.position; if (Desc.Projectile != null) { targetPosition = TransitionOrigin - (target.transform.position - TransitionOrigin); } transform.position = Fluid.Lerp(TransitionOrigin, targetPosition, Transition, AnimationMode.easeIn); } else if (IsReturning) { Audio.volume = 0; Transition += Time.deltaTime / Desc.ReturnDuration; if (Transition >= 1) { IsReturning = false; } transform.position = Fluid.Lerp(TransitionOrigin, Cell.transform.position, Transition, AnimationMode.easeOut); } else { Audio.volume = 0; } } }
void Update() { if (!started) { oldTime = Time.time; threadStopped = false; wind = new Fluid(width, height, cellSize, force, diffusion, viscosity); thread = new Thread(step); thread.Start(); started = true; } }
public override void OnFluidEnter(Fluid fluid) { }
public override void Float(Fluid fluid) { rigidBody.useGravity = true; rigidBody.drag = fluid.fluidDrag; }
protected virtual List <MultiTiledObject> FluidGraphSearchInputTanksThatCanAcceptThisFluid(Fluid L) { List <MultiTiledObject> fluidSources = new List <MultiTiledObject>(); List <MultiTiledComponent> searchedComponents = new List <MultiTiledComponent>(); List <MultiTiledComponent> entitiesToSearch = new List <MultiTiledComponent>(); entitiesToSearch.AddRange(this.GetNeighboringFluidManagers()); searchedComponents.Add(this); while (entitiesToSearch.Count > 0) { MultiTiledComponent searchComponent = entitiesToSearch[0]; entitiesToSearch.Remove(searchComponent); if (searchedComponents.Contains(searchComponent)) { continue; } else { searchedComponents.Add(searchComponent); entitiesToSearch.AddRange(searchComponent.GetNeighboringFluidManagers()); if (searchComponent.containerObject.info.fluidManager.canRecieveThisFluid(L)) { fluidSources.Add(searchComponent.containerObject); } } } return(fluidSources); }
/// <summary> /// Searches for output tanks that have the corresponding fluid and tries to drain from them. /// </summary> /// <param name="L"></param> /// <param name="FluidSources"></param> public void pullFluidFromNetworkOutputs(List <MultiTiledObject> FluidSources, Fluid L) { List <MultiTiledObject> energySources = FluidSources; int index = 0; for (int i = 0; i < energySources.Count; i++) { FluidManagerV2 other = energySources[i].GetFluidManager(); other.outputFluidToOtherSources(this.GetFluidManager()); if (this.GetFluidManager().canRecieveThisFluid(L) == false) { break; //Since we already check for valid tanks this will basically check again to see if the tanks are full. } } }
public Windmill(CustomObjectData PyTKData, BasicItemInformation info, Vector2 TileLocation, Vector2 offsetKey, List <ResourceInformation> ProducedResources = null, int EnergyRequiredPer10Minutes = 0, int TimeToProduce = 0, bool UpdatesContainer = false, string CraftingBook = "", MultiTiledObject obj = null, Fluid FluidRequiredForOperation = null, int FluidAmountRequiredPerOperation = 0) : base(PyTKData, info, TileLocation) { this.offsetKey = offsetKey; this.containerObject = obj; this.producedResources = ProducedResources ?? new List <ResourceInformation>(); this.energyRequiredPer10Minutes = EnergyRequiredPer10Minutes; this.timeToProduce = TimeToProduce; this.updatesContainerObjectForProduction = UpdatesContainer; this.MinutesUntilReady = TimeToProduce; this.craftingRecipeBook = CraftingBook; this.createStatusBubble(); this.requiredFluidForOperation = FluidRequiredForOperation; this.amountOfFluidRequiredForOperation = FluidAmountRequiredPerOperation; }
/// <summary> /// Searches a network of fluid managers to see if any of these fluid managers have an output tank with the corresponding fluid. /// </summary> /// <param name="L"></param> /// <returns></returns> protected virtual List <MultiTiledObject> FluidGraphSearchForFluidFromOutputTanks(Fluid L) { List <MultiTiledObject> fluidSources = new List <MultiTiledObject>(); HashSet <Guid> searchedComponents = new HashSet <Guid>(); Queue <MultiTiledComponent> entitiesToSearch = new Queue <MultiTiledComponent>(); HashSet <Guid> searchedObjects = new HashSet <Guid>(); foreach (MultiTiledComponent tile in this.GetNeighboringFluidManagers()) { entitiesToSearch.Enqueue(tile); } //entitiesToSearch.AddRange(this.GetNeighboringFluidManagers()); searchedComponents.Add(this.guid); while (entitiesToSearch.Count > 0) { MultiTiledComponent searchComponent = entitiesToSearch.Dequeue(); //entitiesToSearch.Remove(searchComponent); if (searchedComponents.Contains(searchComponent.guid)) { continue; } /* * else if (searchedObjects.Contains(searchComponent.containerObject)) * { * continue; * } */ else { searchedComponents.Add(searchComponent.guid); searchedObjects.Add(searchComponent.containerObject.guid); List <MultiTiledComponent> neighbors = searchComponent.GetNeighboringFluidManagers(); foreach (MultiTiledComponent tile in neighbors) { if (searchedObjects.Contains(tile.containerObject.guid) || searchedComponents.Contains(tile.guid)) { continue; } else { entitiesToSearch.Enqueue(tile); } } if (searchComponent.containerObject.info.fluidManager.doesThisOutputTankContainThisFluid(L)) { fluidSources.Add(searchComponent.containerObject); //ModCore.log("Found a tank that contains this fluid!"); } } } return(fluidSources); }
private ObservableCollection <Product> BaseTestProducts() { ObservableCollection <Product> result = new ObservableCollection <Product>(); #region Products creation Product product1 = new Cold(); product1.Id = 1; product1.Name = "product 1"; product1.Price = new Decimal(10); result.Add(product1); Product product2 = new Consistant(); product2.Id = 2; product2.Name = "product 2"; product2.Price = new Decimal(20); result.Add(product2); Product product3 = new Fluid(); product3.Id = 3; product3.Name = "product 3"; product3.Price = new Decimal(30); result.Add(product3); Product product4 = new Hot(); product4.Id = 4; product4.Name = "product 4"; product4.Price = new Decimal(40); result.Add(product4); Product product5 = new Usefull(); product5.Id = 5; product5.Name = "product 5"; product5.Price = new Decimal(50); result.Add(product5); Product product6 = new Useless(); product6.Id = 6; product6.Name = "product 6"; product6.Price = new Decimal(60); result.Add(product6); Product product7 = new Usable(); product7.Id = 7; product7.Name = "product 7"; product7.Price = new Decimal(70); result.Add(product7); Product product8 = new Cold(); product8.Id = 8; product8.Name = "product 8"; product8.Price = new Decimal(80); result.Add(product8); Product product9 = new Cold(); product9.Id = 9; product9.Name = "product 9"; product9.Price = new Decimal(90); result.Add(product9); Product product10 = new Cold(); product10.Id = 10; product10.Name = "product 10"; product10.Price = new Decimal(100); result.Add(product10); #endregion return(result); }
public Compressor(FluidList fluidType) { //Setting the inlet and outlet to the selected fluid type Inlet = new Fluid(fluidType); Outlet = new Fluid(fluidType); }
protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory, IContentManager contentManager) { PhysxPhysicWorld PhysxPhysicWorld = World.PhysicWorld as PhysxPhysicWorld; base.LoadContent(GraphicInfo, factory, contentManager); const int maximumParticles = 3000; ///Remember ///There are 2 math apis (XNA AND PHYSX) ///Sometimes we need to convert between then ///Use the extension methods AsPhysx() in XNA API and AsXNA in Physx APi ///emitter var fluidEmitterDesc = new FluidEmitterDescription() { DimensionX = 1.5f, DimensionY = 1.5f, Rate = 65, RelativePose = Phyx.Matrix.RotationAxis(new Phyx.Vector3(0, 1, 0), (float)Math.PI) * Phyx.Matrix.Translation(-40, 10, -50), Shape = EmitterShape.Rectangular, Type = EmitterType.ConstantFlowRate, RandomAngle = 0.5f, }; fluidEmitterDesc.Flags |= (FluidEmitterFlag.Enabled | FluidEmitterFlag.Visualization); ///fluid var fluidDesc = new FluidDescription() { Emitters = { fluidEmitterDesc }, Flags = FluidFlag.Enabled | FluidFlag.Visualization, MaximumParticles = maximumParticles, }; fluidDesc.ParticleWriteData.AllocatePositionBuffer <Vector3>(maximumParticles); fluidDesc.ParticleWriteData.NumberOfParticles = maximumParticles; ///create and add the fluid to the world fluid = PhysxPhysicWorld.Scene.CreateFluid(fluidDesc); ///Use Billboards to render the fuild particles (dummy way) Texture2D tex = factory.GetTexture2D("Textures/Smoke"); for (int i = 0; i < maximumParticles; i++) { Billboard3D Billboard3D = new Billboard3D(tex, Vector3.Zero, new Vector2(0.001f)); Billboard3D.Enabled = false; CPUSphericalBillboardComponent.Billboards.Add(Billboard3D); } // Ledge { var boxShapeDesc = new BoxShapeDescription(5, 0.1f, 5); SimpleModel SimpleModel = new PloobsEngine.Modelo.SimpleModel(factory, "Model/block"); SimpleModel.SetTexture(factory.CreateTexture2DColor(1, 1, Color.Red), TextureType.DIFFUSE); PhysxPhysicObject PhysxPhysicObject = new PloobsEngine.Physics.PhysxPhysicObject(boxShapeDesc, (Phyx.Matrix.RotationX(-0.5f) * Phyx.Matrix.Translation(-40, 5, -52)).AsXNA(), new Vector3(5, 0.1f, 5)); ForwardXNABasicShader shader = new ForwardXNABasicShader(ForwardXNABasicShaderDescription.Default()); ForwardMaterial fmaterial = new ForwardMaterial(shader); IObject obj = new IObject(fmaterial, SimpleModel, PhysxPhysicObject); this.World.AddObject(obj); } // Drain { var boxShapeDesc = new BoxShapeDescription(5, 0.1f, 5); boxShapeDesc.Flags |= ShapeFlag.FluidDrain; var drainActorDesc = new ActorDescription() { GlobalPose = Phyx.Matrix.Translation(-40, -20, -55), Shapes = { boxShapeDesc } }; var drianActor = PhysxPhysicWorld.Scene.CreateActor(drainActorDesc); } BallThrowPhysx28 BallThrowBullet = new BallThrowPhysx28(this.World, GraphicFactory); BallThrowBullet.ballSize = 1f; BallThrowBullet.Speed = 25; this.AttachCleanUpAble(BallThrowBullet); CameraFirstPerson CameraFirstPerson = new CameraFirstPerson(GraphicInfo); CameraFirstPerson.Position = new Vector3(-35, 8, -52); CameraFirstPerson.LeftRightRot = MathHelper.ToRadians(125); this.World.CameraManager.AddCamera(CameraFirstPerson); }
public void PlaceLiquid(Vector3 position, Fluid fluid, float leftVal, float rightVal, bool doAnimation) { left = leftVal; right = rightVal; PlaceLiquid(position, fluid, doAnimation); }
/// <summary> /// 计算下一个节点的数据 /// </summary> /// <param name="coolent">冷却剂 对象模型</param> /// <param name="income">入口流动节点 上一个节点的数据</param> /// <param name="channel">所要计算的通道模型</param> /// <param name="Lj">长度m</param> /// <param name="power">线功率。W/m</param> /// <param name="massVelocity">质量流速(kg/s)</param> /// <param name="deltaP">压降Pa *这是个返回值*</param> /// <param name="flowDirection">流动方向(-1~1)</param> /// <returns></returns> internal FluidData NodeToNext( Fluid coolent, FluidData income, Channel channel, double Lj, double power, double massVelocity, Precision Acc, out double deltaP, CHF_Formula_Types chf_formula, double flowDirection = 1) { ///****根据根据流体比焓和功率关系,从一个节点数据,计算下一个节点。 ///****输出模型中,压力单位是Mpa,压降计算中,压力单位为Pa,注意单位转换 //等效水力直径 double De = 4 * channel.FlowArea / channel.WetPerimeter; //入口比焓 double Hin = coolent.GetH(income.Temperature, income.Pressure); //计算出口比焓 double Hout = Hin + power * 0.001 * Lj / income.MassFlowRate; //入口压力(压力显示单位为Mpa,计算单位使用pa) double Pin = income.Pressure; //出口压力 double Pout = Pin; //入口位置 double pos_in = income.Position; //出口位置 double pos_out = pos_in + Lj; //入口温度 double Tin = income.Temperature; //出口温度 double Tout = coolent.GetT(Hout, Pout); //出口节点流体密度 double density = coolent.GetDensity(Tout, Pout); //出口流速 double velocity = massVelocity / channel.FlowArea / density; //运动粘度 double Kv = coolent.GetKv(Tout, Pout); //雷诺数 double Re = velocity * De / Kv; //普朗特数 double Pr = coolent.GetPr(Tout, Pout); //导热系数 double K = coolent.GetK(Tout, Pout); //重力压降 double Ph = density * G * Lj * flowDirection; //摩擦压降 double Pf = FrictionFactor(Re) * Lj / De * density * velocity * velocity * 0.5; //加速压降 double Pa = density * (velocity + income.Velocity) * (velocity - income.Velocity) * 0.5; //总压降 deltaP = (Ph + Pf + Pa); //出口节点压力,显示单位是Mpa Pout = Pin - deltaP * 0.000001; ///计算临界热流密度 //饱和液体比焓 double Hf = coolent.GetHf(Pin); //饱和蒸汽比焓 double Hg = coolent.GetHg(Pin); //热平衡寒气率 double Xe = (Hout - Hf) / (Hg - Hf); //计算临界热流密度 double Qc = Q_Critical(Xe, De, velocity * density, Hf, Hout, chf_formula); //本地临界热流密度 double Ql = power / channel.HotPerimeter; //DNBR默认保留三位小数点 double DNBR = Qc / Ql; //对流换热系数 double h = h_convect(Re, Pr, K, De, DNBR); FluidData outcome = new FluidData { //出口比焓 Enthalphy = Math.Round(Hout, Acc.H), //先预定压力为入口节点的压力 Pressure = Math.Round(Pout, Acc.Pressure + 6), //出口温度 Temperature = Math.Round(Tout, Acc.T), //节点位置 Position = pos_out, //质量流速 MassFlowRate = Math.Round(massVelocity, Acc.MassFlowRate), //流体密度 Density = Math.Round(density, Acc.Density), //出口流速 Velocity = Math.Round(velocity, Acc.Velocity), //运动粘度 Kv = Math.Round(Kv, Acc.Kv), //雷诺数 Re = Math.Round(Re, Acc.Re), //普朗特数 Pr = Math.Round(Pr, Acc.Pr), //导热系数 K = Math.Round(K, Acc.K), //烧毁比 DNBR = Math.Round(DNBR, 3), //对流换热系数 h = Math.Round(h, Acc.h), //热平衡含气率 -1~1 · Xe = Math.Round(Xe, 3), }; #if DEBUG if (Hout < 0 | density < 0 | Pout < 0 | Pf < 0) { string MsgHeader = "-----[Fatal error]计算出现错误(出现负值),请查看下面的调试信息-----"; string MsgBody = ""; MsgBody += "入口数据\n"; foreach (PropertyInfo item in income.GetType().GetProperties()) { MsgBody += item.Name + ":" + item.GetValue(income, null) + "\n"; } MsgBody += "出口数据\n"; foreach (PropertyInfo item in outcome.GetType().GetProperties()) { MsgBody += item.Name + ":" + item.GetValue(outcome, null) + "\n"; } MsgBody += "通道数据\n"; foreach (PropertyInfo item in channel.GetType().GetProperties()) { MsgBody += item.Name + ":" + item.GetValue(channel, null) + "\n"; } MsgBody += "压降数据\n"; MsgBody += "Ph:" + Ph + "\n"; MsgBody += "Pf:" + Pf + "\n"; MsgBody += "Pa:" + Pa + "\n"; Debug.WriteLine(MsgHeader); Debug.WriteLine(MsgBody); //throw new Exception("计算出现错误(出现负值),请查看调试信息"); } #endif #if !DEBUG if (Hout < 0 | density < 0 | Pout < 0 | Pf < 0) { string MsgHeader = "-----[Fatal error]计算出现错误(出现负值),请查看下面的调试信息-----"; string MsgBody = ""; MsgBody += "入口数据\n"; foreach (PropertyInfo item in income.GetType().GetProperties()) { MsgBody += item.Name + ":" + item.GetValue(income, null) + "\n"; } MsgBody += "出口数据\n"; foreach (PropertyInfo item in outcome.GetType().GetProperties()) { MsgBody += item.Name + ":" + item.GetValue(outcome, null) + "\n"; } MsgBody += "通道数据\n"; foreach (PropertyInfo item in channel.GetType().GetProperties()) { MsgBody += item.Name + ":" + item.GetValue(channel, null) + "\n"; } MsgBody += "压降数据\n"; MsgBody += "Ph:" + Ph + "\n"; MsgBody += "Pf:" + Pf + "\n"; MsgBody += "Pa:" + Pa + "\n"; Main.MsgCenter.ShowMessage(MsgHeader); Main.MsgCenter.ShowMessage(MsgBody); } #endif return(outcome); }
public override void LoadContent() { // We add to the GameServices objects that we want to be able to use accross different classes // without having to pass them explicitly every time. GraphicsDevice = GameServices.GetService<GraphicsDevice>(); Content = GameServices.GetService<ContentManager>(); graphics = GameServices.GetService<GraphicsDeviceManager>(); soundManager = GameServices.GetService<SoundManager>(); ScreenManager.AddScreen(RankScreen, null, false); ScreenManager.AddScreen(PauseScreen, null, false); world = new World(new Vector2(0, 0)); GameServices.AddService<World>(world); this.world.ContactManager.PostSolve += new PostSolveDelegate(PostSolve); // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // Create a new track randomRaceTrack = RandomTrack.createTrack(); randomRaceTrack.polygonList = polygonsList; int[] crucialPoints = { 300, 600, 1000 }; Logic = new GameLogic(crucialPoints, randomRaceTrack.curvePointsMiddle.Count); randomRaceTrack.gameLogic = Logic; Logic.DidFinishLap += randomRaceTrack.ResetStickyNotes; mySneezesManager.randomTrack = randomRaceTrack; LoadPaperEffect(); screenRenderer = new ScreenRenderer(); GameServices.AddService<ScreenRenderer>(screenRenderer); Logic.DidEliminateCar += screenRenderer.setSadToPlayer; Logic.DidFinishLap += screenRenderer.setLap; for (int i = 0; i < 4; i++) { Car aCar = new Car(world, Content.Load<Texture2D>("Images/small_car"), Color.White, randomRaceTrack, i, playerIndexes[i]); Cars.Add(aCar); } assetCreator = new AssetCreator(graphics.GraphicsDevice); assetCreator.LoadContent(this.Content); defaultViewport = GraphicsDevice.Viewport; isFullHd=(ScreenManager.preferredHeight!=720); // Single screen mode only cameraFollowing = new Camera(defaultViewport, Vector2.Zero, new Vector2(defaultViewport.Width / 2, defaultViewport.Height / 2), 0.0f, Cars.Count, isFullHd); //ZOOM: //low res: //0.95 for 2 players //0.93 for 3 players //0.91 for 4 players //high res: //0.95 for 4 players GameServices.AddService<Camera>(cameraFollowing); mySneezesManager.camera = cameraFollowing; //generate starting positions and angles int startingPoint = 0; // positionCars(startingPoint); _debugView = new DebugViewXNA(world); _debugView.AppendFlags(FarseerPhysics.DebugViewFlags.Shape); _debugView.AppendFlags(FarseerPhysics.DebugViewFlags.DebugPanel); _debugView.AppendFlags(FarseerPhysics.DebugViewFlags.PerformanceGraph); _debugView.AppendFlags(FarseerPhysics.DebugViewFlags.Joint); _debugView.AppendFlags(FarseerPhysics.DebugViewFlags.ContactPoints); _debugView.AppendFlags(FarseerPhysics.DebugViewFlags.ContactNormals); _debugView.AppendFlags(FarseerPhysics.DebugViewFlags.Controllers); _debugView.AppendFlags(FarseerPhysics.DebugViewFlags.CenterOfMass); _debugView.AppendFlags(FarseerPhysics.DebugViewFlags.AABB); _debugView.DefaultShapeColor = Color.White; _debugView.SleepingShapeColor = Color.LightGray; _debugView.LoadContent(GraphicsDevice, Content); basicVert = new VertexPositionColorTexture[maxNumberOfTriangles]; for (int i = 0; i < maxNumberOfTriangles; i++) basicVert[i].TextureCoordinate = new Vector2(-1); verticesBorders = new VertexPositionColorTexture[randomRaceTrack.curvePointsInternal.Count]; fluid = new Fluid(); fluid.Init(); currentPoses = new Vector2[4]; prevPoses = new Vector2[4]; currentMousePos = new Vector2(100); prevMousePos = new Vector2(0); quad = new QuadRenderComponent(ScreenManager.Game, cameraFollowing, ScreenManager.GraphicsDevice.Viewport.Width, ScreenManager.GraphicsDevice.Viewport.Height); ScreenManager.Game.Components.Add(quad); fluidUpdateThread = new Thread(this.UpdateFluid); fluidUpdateThread.Start(); mySneezesManager.fluid = fluid; fluidEffect = Content.Load<Effect>("Shaders/FluidEffect"); fluidEffect.Parameters["random"].SetValue(randomTex); texInk = new Texture2D(graphics.GraphicsDevice, fluid.m_w, fluid.m_h, true, SurfaceFormat.Color); buffer = new RenderTarget2D(GraphicsDevice, ScreenManager.GraphicsDevice.Viewport.Width, ScreenManager.GraphicsDevice.Viewport.Height, true, SurfaceFormat.Color, GraphicsDevice.PresentationParameters.DepthStencilFormat); //gaussian = new GaussianBlur(ScreenManager.Game); }
/// <summary> /// 计算稳态子通道流量场,使用进出口压力迭代,即不考虑横向流动 /// </summary> /// <param name="coolent">冷却剂</param> /// <param name="channels">通道集合</param> /// <param name="rods">燃料棒集合</param> /// <param name="massFlow">质量流速对象</param> /// <param name="Ni">通道数</param> /// <param name="Nj">轴向分段数</param> /// <param name="totalArea">总流通面积</param> /// <param name="options">计算选项</param> /// <returns></returns> public List <ChannelFlow> Caculate_Channels_Steady_IOIteration( Fluid coolent, List <Channel> channels, List <Rod> rods, MassFlow massFlow, int Ni, int Nj, double totalArea, Options options) { ///使用压力迭代方法确定稳态不同子通道之间的流量,此计算方法使用压力迭代确定 ///一些局部变量 /// //初始化输出结果 List <ChannelFlow> channelsFlow = new List <ChannelFlow>(); for (int i = 0; i < Ni; i++) { ChannelFlow channelFlow = new ChannelFlow { //流动计算结果 编号与输入的子通道编号相对应 ChannelIndex = channels[i].Index, FluidDatas = new List <FluidData>() }; for (int j = 0; j < Nj + 1; j++) { channelFlow.FluidDatas.Add(new FluidData()); } channelsFlow.Add(channelFlow); } //迭代的限制参数 Iteration iteration = options.Iteration; //功率的乘子 PowerFactor powerFactor = options.PowerFactor; //计算的准确度 Precision acc = options.Precision; //CHF公式选取 CHF_Formula_Types chf_formula = options.DNBR_Formula; //流动方向(-1~1) double flow_direction = massFlow.Flow_Direction; //压降迭代,每个子通道的压降 double[] DeltaP = new double[Ni]; //压降迭代,每个子通道的压降 double[] m = new double[Ni]; //每个子通道的分段压降,Ni行xNj列初值为0 Matrix <double> P_Local = Matrix <double> .Build.Dense(Nj + 1, Ni, 0); //压降迭代收敛因子 double Sigma = 0; //迭代次数统计 int iteration_times = 0; //迭代压降 do { //遍历子通道 for (int i = 0; i < Ni; i++) { //初始化压降 DeltaP[i] = 0; //初始化子通道入口数据节点 FluidData InitNode = SetInitNode(coolent, totalArea, channels[i], massFlow, acc); //初始化子通道数据节点加入 channelsFlow[i].FluidDatas[0] = InitNode; //局部压力场矩阵 P_Local[0, i] = InitNode.Pressure; if (iteration_times <= 1) { //质量流速 m[i] = InitNode.MassFlowRate; } //每个通道数据节点(共Nj+1个,初始节点1个,循环Nj个) for (int j = 1; j < Nj + 1; j++) { //计算当前段的长度j>=1 double Lj = rods[0].SubPowerCollection[j - 1].To - rods[0].SubPowerCollection[j - 1].From; //前一个节点 FluidData pre = channelsFlow[i].FluidDatas[j - 1]; //当前子通道燃料棒功率输出 double SubPowerJ = 0; //遍历所有燃料棒 foreach (Rod rod in rods) { //燃料棒所有接触的通道 foreach (var ContactedChannel in rod.ContactedChannel) { //如果与燃料棒接触的通道,如果是当前正在计算的通道 if (ContactedChannel.Index == channels[i].Index) { SubPowerJ += rod.SubPowerCollection[j - 1].Value * ContactedChannel.Angle / 360; } } } //乘以功率因子 SubPowerJ = SubPowerJ * powerFactor.Multiplier; //计算新节点,NodeToNext计算子通道节点 FluidData next = NodeToNext( coolent, pre, channels[i], Lj, SubPowerJ, m[i], acc, out double DeltaPij, chf_formula, flow_direction); //存储计算结果 channelsFlow[i].FluidDatas[j] = next; //i棒j段压降 P_Local[j, i] = next.Pressure; //压降用于迭代 DeltaP[i] += DeltaPij; } } //初始化迭代收敛因子Sigma Sigma = 0; //平均压降 double AvgPressure = 0; for (int i = 0; i < Ni; i++) { #if DEBUG Main.MsgCenter.ShowMessage(String.Format("通道{0}压降:{1}", i, DeltaP[i])); #endif AvgPressure += DeltaP[i]; } //平均压降 AvgPressure = AvgPressure / Ni; //所有偏差之和 for (int i = 0; i < Ni; i++) { Sigma += Math.Abs(DeltaP[i] - AvgPressure); } double TotalM = 0; for (int i = 0; i < Ni; i++) { //子通道i压降和平均压降的比值 double Factor = Math.Sqrt(AvgPressure / DeltaP[i]); //重新分配压降 m[i] = Factor * m[i]; // 所有偏差之和 //计算平衡后的总质量流速 TotalM += m[i]; } //计算平衡后与平衡前的比值 double k = massFlow.MassVelocity / TotalM; //对质量流量进行修正,保持总质量流速不变 for (int i = 0; i < Ni; i++) { m[i] = k * m[i]; #if DEBUG Main.MsgCenter.ShowMessage(String.Format("通道{0}质量流速:{1}", i, m[i])); #endif } //输出迭代收敛因子 Main.MsgCenter.ShowMessage(String.Format("Sigma->{0}", Sigma)); //迭代次数+1 iteration_times += 1; Main.MsgCenter.ShowMessage(String.Format("压力迭代次数:{0}", iteration_times)); if (iteration_times > iteration.MaxIteration) { Main.MsgCenter.ShowMessage(String.Format("超过最大迭代次数限制,最大迭代次数限制{0}", iteration.MaxIteration)); break; } }while (Sigma > iteration.Sigma); // MyIOManager.OutputData.SteadyResult.ChannelsFlow = ChannelsFlow; //信息输出 Main.MsgCenter.ShowMessage("--------压力场预览--------"); Main.MsgCenter.ShowMessage(P_Local.ToMatrixString(Nj + 1, Ni)); Main.MsgCenter.ShowMessage("--------流量场预览--------"); var MassFlowRate = Matrix <double> .Build.Dense(Nj + 1, Ni, (Mi, Mj) => m[Mj]); Main.MsgCenter.ShowMessage(MassFlowRate.ToMatrixString(Nj + 1, Ni)); return(channelsFlow); }
public Plot_LogPH(LiveCharts.WinForms.CartesianChart myChart, FluidList refType) { //Settings MyChart = myChart; RefType = refType; Fluid Dome = new Fluid(RefType); //Finding the zoom on the X-axis Dome.UpdatePX(Dome.LimitPressureMin, 0); SpecificEnergy GraphHMin = Dome.Enthalpy * 0.5; Dome.UpdatePX(Dome.LimitPressureMin, 1); SpecificEnergy GraphHMax = Dome.Enthalpy * 1.4; //Rounds to nearest 50 GraphHMin = SpecificEnergy.FromJoulesPerKilogram(Math.Round(GraphHMin.JoulesPerKilogram / 50) * 50); //Creating Y Axis MyChart.AxisY.Add(new LogarithmicAxis { LabelFormatter = value => (Math.Pow(10, value)).ToString("N0"), Base = 10, //Note that Max and min values are based on the 'Base = 10'! MaxValue = 2.5, //2.5, MinValue = 0, //1 Title = "Pressure - [" + string.Format(new CultureInfo("en-US"), "{0:a}", Dome.Pressure.ToUnit(PressureUnit.Bar)) + "]", Separator = new Separator { Stroke = Brushes.LightGray, Step = Math.Log10(10) / 2, StrokeThickness = 1, }, }); //Creating X Axis MyChart.AxisX.Add(new Axis { LabelFormatter = value => value.ToString("N0"), MaxValue = GraphHMax.As(SpecificEnergyUnit.KilojoulePerKilogram), MinValue = GraphHMin.As(SpecificEnergyUnit.KilojoulePerKilogram), Title = "Enthalpy - [" + string.Format(new CultureInfo("en-US"), "{0:a}", GraphHMax.ToUnit(SpecificEnergyUnit.KilojoulePerKilogram)) + "]", Separator = new Separator { Stroke = Brushes.LightGray, Step = 100, StrokeThickness = 0.3, }, }); //Settings MyChart.DataTooltip = null; MyChart.DisableAnimations = true; MyChart.Background = new SolidColorBrush(Color.FromRgb(250, 250, 250)); MyChart.Hoverable = false; }
public override void OnFluidExit(Fluid fluid) { }
/// <summary> /// Generates a terrain patch from an array of bytes; returns null if the data is invalid. /// </summary> /// <param name="data">The array of bytes to generate the patch from.</param> /// <returns>See summary.</returns> public static TerrainPatch FromByteArray(byte[] data) { if (data == null) { return null; } else { ReadOnlyCollection<Season> seasons = SeasonExtensions.GetSeasons(); BinaryReader reader = new BinaryReader(new MemoryStream(data)); try { // Read the patch ID int x = reader.ReadInt32(); int y = reader.ReadInt32(); int z = reader.ReadInt32(); // Create a patch object TerrainPatch patch = new TerrainPatch(new Point3D(x, y, z)); // Read the array of heights for (int i = 0; i < patch.vertexHeightsArray.Length; i++) { patch.vertexHeightsArray[i] = reader.ReadSingle(); } // Read terrain types for all seasons for (int j = 0; j < seasons.Count; j++) { // Read the array of textures for (int i = 0; i < patch.vertexTexturesArray[j].Length; i++) { patch.vertexTexturesArray[(int)seasons[j]][i] = (TerrainType)reader.ReadInt16(); } } // Read the number of fluids short countFluids = reader.ReadInt16(); // Read all the fluids for (int i = 0; i < countFluids; i++) { // Create a new fluid object to store on the patch Fluid fluid = new Fluid(patch.PatchId); // Read fluid properties for all seasons for (int j = 0; j < seasons.Count; j++) { // Read the vertices Vector3 southWest = new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); Vector3 southEast = new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); Vector3 northWest = new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); Vector3 northEast = new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); // Read the fluid type short fluidType = reader.ReadInt16(); // Read the fluid flow direction short flowDirection = reader.ReadInt16(); // Read the fluid flow speed float flowSpeed = reader.ReadSingle(); // Copy the read variables into the properties of the fluid object fluid.SetPoint(seasons[j], FluidVertex.Southwest, southWest); fluid.SetPoint(seasons[j], FluidVertex.Southeast, southEast); fluid.SetPoint(seasons[j], FluidVertex.Northwest, northWest); fluid.SetPoint(seasons[j], FluidVertex.Northeast, northEast); fluid.SetFluidType(seasons[j], (FluidType)fluidType); fluid.SetFlowDirection(seasons[j], (FluidFlowDirection)flowDirection); fluid.SetFlowSpeed(seasons[j], flowSpeed); } // Add the fluid to the patch patch.Fluids.Add(fluid); } return patch; } catch (EndOfStreamException) { return null; } catch (IOException) { return null; } finally { reader.Close(); } } }
public SteamEngine(BasicItemInformation info, Vector2 TileLocation, List <ResourceInformation> ProducedResources = null, int EnergyRequiredPer10Minutes = 0, int TimeToProduce = 0, string CraftingBook = "", Fluid FluidRequiredForOperation = null, int FluidAmountRequiredPerOperation = 0) : base(info, TileLocation) { this.producedResources = ProducedResources ?? new List <ResourceInformation>(); this.energyRequiredPer10Minutes = EnergyRequiredPer10Minutes; this.timeToProduce = TimeToProduce; this.MinutesUntilReady = TimeToProduce; this.craftingRecipeBook = CraftingBook; this.createStatusBubble(); this.requiredFluidForOperation = FluidRequiredForOperation; this.amountOfFluidRequiredForOperation = FluidAmountRequiredPerOperation; }
public override void OnFluidStay(Fluid fluid) { }
public virtual void OnFluidStay(Fluid fluid) { }
protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager) { PhysxPhysicWorld PhysxPhysicWorld = World.PhysicWorld as PhysxPhysicWorld; base.LoadContent(GraphicInfo, factory, contentManager); const int maximumParticles = 3000; ///Remember ///There are 2 math apis (XNA AND PHYSX) ///Sometimes we need to convert between then ///Use the extension methods AsPhysx() in XNA API and AsXNA in Physx APi ///emitter var fluidEmitterDesc = new FluidEmitterDescription() { DimensionX = 1.5f, DimensionY = 1.5f, Rate = 65, RelativePose = Phyx.Matrix.RotationAxis(new Phyx.Vector3(0, 1, 0), (float)Math.PI) * Phyx.Matrix.Translation(-40, 10, -50), Shape = EmitterShape.Rectangular, Type = EmitterType.ConstantFlowRate, RandomAngle = 0.5f, }; fluidEmitterDesc.Flags |= (FluidEmitterFlag.Enabled | FluidEmitterFlag.Visualization); ///fluid var fluidDesc = new FluidDescription() { Emitters = { fluidEmitterDesc }, Flags = FluidFlag.Enabled | FluidFlag.Visualization, MaximumParticles = maximumParticles, }; fluidDesc.ParticleWriteData.AllocatePositionBuffer<Vector3>(maximumParticles); fluidDesc.ParticleWriteData.NumberOfParticles = maximumParticles; ///create and add the fluid to the world fluid = PhysxPhysicWorld.Scene.CreateFluid(fluidDesc); ///Use Billboards to render the fuild particles (dummy way) Texture2D tex = factory.GetTexture2D("Textures/Smoke"); for (int i = 0; i < maximumParticles; i++) { Billboard3D Billboard3D = new Billboard3D(tex,Vector3.Zero,new Vector2(0.001f)); Billboard3D.Enabled = false; CPUSphericalBillboardComponent.Billboards.Add(Billboard3D); } // Ledge { var boxShapeDesc = new BoxShapeDescription(5, 0.1f, 5); SimpleModel SimpleModel = new PloobsEngine.Modelo.SimpleModel(factory, "Model/block"); SimpleModel.SetTexture(factory.CreateTexture2DColor(1, 1, Color.Red), TextureType.DIFFUSE); PhysxPhysicObject PhysxPhysicObject = new PloobsEngine.Physics.PhysxPhysicObject(boxShapeDesc, (Phyx.Matrix.RotationX(-0.5f) * Phyx.Matrix.Translation(-40, 5, -52)).AsXNA(),new Vector3(5,0.1f,5)); ForwardXNABasicShader shader = new ForwardXNABasicShader(ForwardXNABasicShaderDescription.Default()); ForwardMaterial fmaterial = new ForwardMaterial(shader); IObject obj = new IObject(fmaterial, SimpleModel, PhysxPhysicObject); this.World.AddObject(obj); } // Drain { var boxShapeDesc = new BoxShapeDescription(5, 0.1f, 5); boxShapeDesc.Flags |= ShapeFlag.FluidDrain; var drainActorDesc = new ActorDescription() { GlobalPose = Phyx.Matrix.Translation(-40, -20, -55), Shapes = { boxShapeDesc } }; var drianActor = PhysxPhysicWorld.Scene.CreateActor(drainActorDesc); } BallThrowPhysx28 BallThrowBullet = new BallThrowPhysx28(this.World, GraphicFactory); BallThrowBullet.ballSize = 1f; BallThrowBullet.Speed = 25; this.AttachCleanUpAble(BallThrowBullet); CameraFirstPerson CameraFirstPerson = new CameraFirstPerson(GraphicInfo); CameraFirstPerson.Position = new Vector3(-35, 8, -52); CameraFirstPerson.LeftRightRot = MathHelper.ToRadians(125); this.World.CameraManager.AddCamera(CameraFirstPerson); }
void Awake() { fluids = Fluid.All(); }
/// <summary> /// 计算稳态子通道流量场,使用节点压力迭代,即用压力平衡思想考虑横向流动 /// </summary> /// <param name="coolent">冷却剂</param> /// <param name="channels">通道集合</param> /// <param name="rods">燃料棒集合</param> /// <param name="massFlow">质量流速对象</param> /// <param name="Ni">通道数</param> /// <param name="Nj">轴向分段数</param> /// <param name="totalArea">总流通面积</param> /// <param name="options">计算选项</param> /// <returns></returns> public List <ChannelFlow> Caculate_Channels_Steady_NodeIteration( Fluid coolent, List <Channel> channels, List <Rod> rods, MassFlow massFlow, int Ni, int Nj, double totalArea, Options options) { ///使用压力迭代方法确定不同子通道之间的流量,此计算方法使用压力迭代确定 /// Main.MsgCenter.ShowMessage("计算子通道数据,流量计算方式压力迭代:节点迭代..."); //初始化输出结果 List <ChannelFlow> channelsFlow = new List <ChannelFlow>(); for (int i = 0; i < Ni; i++) { ChannelFlow channelFlow = new ChannelFlow { //流动计算结果 编号与输入的子通道编号相对应 ChannelIndex = channels[i].Index, FluidDatas = new List <FluidData>() }; for (int j = 0; j < Nj + 1; j++) { channelFlow.FluidDatas.Add(new FluidData()); } channelsFlow.Add(channelFlow); } //迭代的限制参数 Iteration iteration = options.Iteration; //功率的乘子 PowerFactor powerFactor = options.PowerFactor; //计算的准确度 Precision acc = options.Precision; //CHF公式选取 CHF_Formula_Types chf_formula = options.DNBR_Formula; //流动方向(-1~1) double flow_direction = massFlow.Flow_Direction; //质量流量迭代 var MassFlowRate = Matrix <double> .Build.Dense(Nj + 1, Ni, 0); //每个子通道的分段压降,Ni行xNj列初值为0 var P_Local = Matrix <double> .Build.Dense(Nj + 1, Ni, 0); //压降迭代因子 double Sigma = 0; //质量流速迭代中间变量 double[] m = new double[Ni]; //质量流速迭代中间变量 double[] velocity = new double[Ni]; //质量流速迭代中间变量 double[] DeltaP = new double[Nj]; //遍历所有子通道 for (int i = 0; i < Ni; i++) { //初始化j=0入口节点 FluidData InitNode = SetInitNode(coolent, totalArea, channels[i], massFlow, acc); //初始化子通道数据节点加入 channelsFlow[i].FluidDatas[0] = InitNode; //局部压力场矩阵(Mpa) P_Local[0, i] = InitNode.Pressure; //质量流速kg/s 迭代用) m[i] = InitNode.MassFlowRate; //流速m/s(迭代用) velocity[i] = InitNode.Velocity; //质量流速矩阵(输出用) MassFlowRate[0, i] = m[i]; } //轴向迭代 for (int j = 1; j < Nj + 1; j++) { //迭代次数 int iteration_times = 0; do { //计算所有燃料棒j段(J=1~Nj-1) for (int i = 0; i < Ni; i++) { //计算当前段的长度j>=1 double Lj = rods[0].SubPowerCollection[j - 1].To - rods[0].SubPowerCollection[j - 1].From; //前一个节点 FluidData pre = channelsFlow[i].FluidDatas[j - 1]; //当前子通道燃料棒功率输出 double SubPowerJ = 0; //遍历所有燃料棒 foreach (Rod rod in rods) { //燃料棒所有接触的通道 foreach (var ContactedChannel in rod.ContactedChannel) { //如果与燃料棒接触的通道,如果是当前正在计算的通道 if (ContactedChannel.Index == channels[i].Index) { SubPowerJ += rod.SubPowerCollection[j - 1].Value * ContactedChannel.Angle / 360; } } } //乘以功率因子 SubPowerJ = SubPowerJ * powerFactor.Multiplier; //计算新节点,NodeToNext计算子通道节点 FluidData next = NodeToNext( coolent, pre, channels[i], Lj, SubPowerJ, m[i], acc, out double DeltaPij, chf_formula, flow_direction); //迭代中间变量赋值 DeltaP[i] = DeltaPij; //存储计算结果 channelsFlow[i].FluidDatas[j] = next; //i棒j段压降 P_Local[j, i] = next.Pressure; //质量流速 MassFlowRate[j, i] = m[i]; } //初始化迭代收敛因子 Sigma = 0; //平均压降 double AvgPressure = 0; for (int i = 0; i < Ni; i++) { AvgPressure += DeltaP[i]; } //平均压降 AvgPressure = AvgPressure / Ni; // 所有偏差之和 for (int i = 0; i < Ni; i++) { Sigma += Math.Abs(DeltaP[i] - AvgPressure); } //总质量流速 double TotalM = 0; for (int i = 0; i < Ni; i++) { //子通道i压降和平均压降的比值 double Factor = (1 - DeltaP[i] / AvgPressure) * 0.1; //重新分配压降 m[i] = m[i] + m[i] * Factor; TotalM += m[i]; Debug.WriteLine(String.Format("因子{0}:", Factor)); } //计算平衡后与平衡前的比值 double k = massFlow.MassVelocity / TotalM; //保持总质量流速不变 for (int i = 0; i < Ni; i++) { //对质量流量进行修正 m[i] = k * m[i]; Debug.WriteLine(String.Format("通道{0}压降{1}Pa", i, DeltaP[i])); } Debug.WriteLine("========================================="); //迭代压降 iteration_times += 1; Main.MsgCenter.ShowMessage(String.Format("压力迭代次数:{0}", iteration_times)); if (iteration_times > iteration.MaxIteration) { Main.MsgCenter.ShowMessage(String.Format("超过最大迭代次数限制,最大迭代次数限制{0}", iteration.MaxIteration)); break; } }while (Sigma > iteration.Sigma); //循环每个通道 Main.MsgCenter.ShowMessage(String.Format("Sigma->{0}", Sigma)); } //信息输出 Main.MsgCenter.ShowMessage("--------压力场预览--------"); Main.MsgCenter.ShowMessage(P_Local.ToMatrixString(Nj + 1, Ni)); Main.MsgCenter.ShowMessage("--------流量场预览--------"); Main.MsgCenter.ShowMessage(MassFlowRate.ToMatrixString(Nj + 1, Ni)); return(channelsFlow); }
protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory, IContentManager contentManager) { PhysxPhysicWorld PhysxPhysicWorld = World.PhysicWorld as PhysxPhysicWorld; base.LoadContent(GraphicInfo, factory, contentManager); const int maximumParticles = 1000; var fluidEmitterDesc = new FluidEmitterDescription() { DimensionX = 0.5f, DimensionY = 0.5f, Rate = 15, RelativePose = Phyx.Matrix.RotationAxis(new Phyx.Vector3(0, 1, 0), (float)Math.PI) * Phyx.Matrix.Translation(-40, 10, -50), Shape = EmitterShape.Rectangular, Type = EmitterType.ConstantFlowRate, RandomAngle = 0.5f }; fluidEmitterDesc.Flags |= (FluidEmitterFlag.Enabled | FluidEmitterFlag.Visualization); var fluidDesc = new FluidDescription() { Emitters = { fluidEmitterDesc }, Flags = FluidFlag.Enabled | FluidFlag.Visualization | FluidFlag.Enabled, MaximumParticles = maximumParticles, }; fluidDesc.ParticleWriteData.AllocatePositionBuffer <Vector3>(maximumParticles); fluidDesc.ParticleWriteData.NumberOfParticles = maximumParticles; fluid = PhysxPhysicWorld.Scene.CreateFluid(fluidDesc); Texture2D tex = factory.GetTexture2D("Textures/Smoke"); for (int i = 0; i < maximumParticles; i++) { Billboard3D Billboard3D = new Billboard3D(tex, Vector3.Zero, new Vector2(0.002f)); Billboard3D.Enabled = false; CPUSphericalBillboardComponent.Billboards.Add(Billboard3D); } // Ledge { var boxShapeDesc = new BoxShapeDescription(5, 0.1f, 5); SimpleModel SimpleModel = new PloobsEngine.Modelo.SimpleModel(factory, "Model/block"); SimpleModel.SetTexture(factory.CreateTexture2DColor(1, 1, Color.Red), TextureType.DIFFUSE); PhysxPhysicObject PhysxPhysicObject = new PloobsEngine.Physics.PhysxPhysicObject(boxShapeDesc, (Phyx.Matrix.RotationX(-0.5f) * Phyx.Matrix.Translation(-40, 5, -52)).AsXNA(), new Vector3(5, 0.1f, 5)); ForwardXNABasicShader shader = new ForwardXNABasicShader(ForwardXNABasicShaderDescription.Default()); ForwardMaterial fmaterial = new ForwardMaterial(shader); IObject obj = new IObject(fmaterial, SimpleModel, PhysxPhysicObject); this.World.AddObject(obj); } // Drain { var boxShapeDesc = new BoxShapeDescription(5, 0.1f, 5); boxShapeDesc.Flags |= ShapeFlag.FluidDrain; var drainActorDesc = new ActorDescription() { GlobalPose = Phyx.Matrix.Translation(-40, 0, -55), Shapes = { boxShapeDesc } }; var drianActor = PhysxPhysicWorld.Scene.CreateActor(drainActorDesc); } BallThrowPhysx28 BallThrowBullet = new BallThrowPhysx28(this.World, GraphicFactory); this.AttachCleanUpAble(BallThrowBullet); this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo)); }
protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager) { PhysxPhysicWorld PhysxPhysicWorld = World.PhysicWorld as PhysxPhysicWorld; base.LoadContent(GraphicInfo, factory, contentManager); const int maximumParticles = 1000; var fluidEmitterDesc = new FluidEmitterDescription() { DimensionX = 0.5f, DimensionY = 0.5f, Rate = 15, RelativePose = Phyx.Matrix.RotationAxis(new Phyx.Vector3(0, 1, 0), (float)Math.PI) * Phyx.Matrix.Translation(-40, 10, -50), Shape = EmitterShape.Rectangular, Type = EmitterType.ConstantFlowRate, RandomAngle = 0.5f }; fluidEmitterDesc.Flags |= (FluidEmitterFlag.Enabled | FluidEmitterFlag.Visualization); var fluidDesc = new FluidDescription() { Emitters = { fluidEmitterDesc }, Flags = FluidFlag.Enabled | FluidFlag.Visualization | FluidFlag.Enabled, MaximumParticles = maximumParticles, }; fluidDesc.ParticleWriteData.AllocatePositionBuffer<Vector3>(maximumParticles); fluidDesc.ParticleWriteData.NumberOfParticles = maximumParticles; fluid = PhysxPhysicWorld.Scene.CreateFluid(fluidDesc); Texture2D tex = factory.GetTexture2D("Textures/Smoke"); for (int i = 0; i < maximumParticles; i++) { Billboard3D Billboard3D = new Billboard3D(tex,Vector3.Zero,new Vector2(0.002f)); Billboard3D.Enabled = false; CPUSphericalBillboardComponent.Billboards.Add(Billboard3D); } // Ledge { var boxShapeDesc = new BoxShapeDescription(5, 0.1f, 5); SimpleModel SimpleModel = new PloobsEngine.Modelo.SimpleModel(factory, "Model/block"); SimpleModel.SetTexture(factory.CreateTexture2DColor(1, 1, Color.Red), TextureType.DIFFUSE); PhysxPhysicObject PhysxPhysicObject = new PloobsEngine.Physics.PhysxPhysicObject(boxShapeDesc, (Phyx.Matrix.RotationX(-0.5f) * Phyx.Matrix.Translation(-40, 5, -52)).AsXNA(),new Vector3(5,0.1f,5)); ForwardXNABasicShader shader = new ForwardXNABasicShader(ForwardXNABasicShaderDescription.Default()); ForwardMaterial fmaterial = new ForwardMaterial(shader); IObject obj = new IObject(fmaterial, SimpleModel, PhysxPhysicObject); this.World.AddObject(obj); } // Drain { var boxShapeDesc = new BoxShapeDescription(5, 0.1f, 5); boxShapeDesc.Flags |= ShapeFlag.FluidDrain; var drainActorDesc = new ActorDescription() { GlobalPose = Phyx.Matrix.Translation(-40, 0, -55), Shapes = { boxShapeDesc } }; var drianActor = PhysxPhysicWorld.Scene.CreateActor(drainActorDesc); } BallThrowPhysx28 BallThrowBullet = new BallThrowPhysx28(this.World, GraphicFactory); this.AttachCleanUpAble(BallThrowBullet); this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo)); }
/// <summary> /// 计算燃料棒稳态温度场 /// </summary> /// <param name="Nj">轴向分段数</param> /// <param name="Nk">燃料棒数</param> /// <param name="coolent">冷却剂</param> /// <param name="channels">通道结合</param> /// <param name="rods">燃料棒集合</param> /// <param name="rodTypes">燃料棒类型集合</param> /// <param name="materials">材料集合</param> /// <param name="channelsFlow">已经得到的子通道稳态流体计算结果</param> /// <param name="gasGap">气体间隙模型对象</param> /// <param name="options">计算选项集合</param> /// <returns></returns> public List <RodTemperature> Caculate_Rods_Temperature_Steady( int Nj, int Nk, Fluid coolent, List <Channel> channels, List <Rod> rods, List <RodType> rodTypes, List <Material> materials, List <ChannelFlow> channelsFlow, GasGap gasGap, Options options) { Main.MsgCenter.ShowMessage("--------计算燃料棒温度场--------"); //燃料棒温度集合 返回数据 List <RodTemperature> RodsTemperature = new List <RodTemperature>(); //包壳分段数 var CladSegment = options.CladSegment; //芯块分段数 var PelletSegment = options.PelletSegment; //功率因子 var powerFactor = options.PowerFactor.Multiplier; //包壳功率份额 var cladShare = options.PowerFactor.CladShare; //芯块功率份额 var pelletShare = options.PowerFactor.PelletShare; //冷却剂中功率份额 var fluidShare = options.PowerFactor.FluidShare; //计算结果准确度设置 var acc = options.Precision; //燃料棒周围主流流体温度 Matrix <double> Tf = Matrix <double> .Build.Dense(Nj, Nk, 0); //燃料棒周围主流流体对流换热系数 Matrix <double> h = Matrix <double> .Build.Dense(Nj, Nk, 0); Matrix <double> massFlowDensity = Matrix <double> .Build.Dense(Nj, Nk, 0); //遍历所有燃料棒 for (int k = 0; k < Nk; k++) { //新建一个用于存储一个燃料棒输出的对象 RodTemperature RodkTemperature = new RodTemperature { Index = rods[k].Index, SubRods = new List <SubRodTemperature>(), }; //径向温度节点数 int size = CladSegment + PelletSegment + 2; //燃料棒k的温度场 矩阵 Matrix <double> RodTField = Matrix <double> .Build.Dense(Nj, size, 0); //是否找到燃料类型 bool isTypeFound = false; RodType rodType = new RodType(); //找到燃料棒k的燃料棒类型 foreach (RodType type in rodTypes) { if (type.Index == rods[k].Type) { rodType = type; //找到了燃料棒类型 isTypeFound = true; break; } } //如果未找到燃料棒类型 if (!isTypeFound) { Main.MsgCenter.ShowMessage(String.Format("燃料棒{0}未找到匹配的{1}燃料棒类型", k, rods[k].Type)); } //寻找燃料棒固体材料数据 Material Clad = new Material(); Material Pellet = new Material(); foreach (var material in materials) { if (material.Index == rodType.CladMaterialIndex) { Clad = material; } else if (material.Index == rodType.PelletMaterialIndex) { Pellet = material; } } //燃料棒直径 double d_rod = rodType.Diameter; //燃料芯块直径 double d_pellet = rodType.PelletDiameter; //燃料包壳厚度 double clad_thickness = rodType.CladThickness; //气体间隙通过计算得出 double gap_thickness = (d_rod - d_pellet) * 0.5 - clad_thickness; //分段计算燃料棒温度场 for (int j = 0; j < Nj; j++) { //分段长度 double Lj = rods[0].SubPowerCollection[j].To - rods[0].SubPowerCollection[j].From; //接触的全部角度 double TotalAngle = 0; double Xe = 0; FluidData FluidJ; //遍历与[燃料棒k] 接触的 子通道,找到流体外部边界条件 foreach (ContactedChannel EachContactedChannel in rods[k].ContactedChannel) { //与燃料棒k接触的所有子通道流体物性参数计算结果 ChannelFlow ChannelFlowOfContactChannel = new ChannelFlow(); //找到与燃料棒接触的子通道计算结果 foreach (ChannelFlow channelFlow in channelsFlow) { //通道数据 index和连接的通道 index相同 if (channelFlow.ChannelIndex == EachContactedChannel.Index) { ChannelFlowOfContactChannel = channelFlow; } } FluidJ = ChannelFlowOfContactChannel.FluidDatas[j]; h[j, k] += FluidJ.h * EachContactedChannel.Angle; Tf[j, k] += FluidJ.Temperature * EachContactedChannel.Angle; Xe = FluidJ.Xe * EachContactedChannel.Angle; //质量流密度 massFlowDensity[j, k] += FluidJ.Velocity * FluidJ.Density * EachContactedChannel.Angle; //累加接触的角度份额 TotalAngle += EachContactedChannel.Angle; } //加权平均对流换热系数 h[j, k] = h[j, k] / TotalAngle; //加权平均流体温度 Tf[j, k] = Tf[j, k] / TotalAngle; //加权平均热平衡含气率 Xe = Xe / TotalAngle; //加权平均质量流密度 massFlowDensity[j, k] = massFlowDensity[j, k] / TotalAngle; //线性功率,单位W/M double Linearpower = rods[k].SubPowerCollection[j].Value * powerFactor; //体热源W/m3 double fi_pellet = Linearpower * pelletShare / (0.25 * PI * d_pellet * d_pellet); //clad面积 double cladArea = 0.25 * PI * (d_rod * d_rod - (d_rod - 2 * clad_thickness) * (d_rod - 2 * clad_thickness)); //包壳 体热流密度 double fi_clad = Linearpower * cladShare / cladArea; //包壳分段长度 double deltaR_clad = clad_thickness / CladSegment; //芯块分段长度 double deltaR_pellet = d_pellet * 0.5 / PelletSegment; //包壳外表面 - 热流密度 double q = Linearpower * (1 - fluidShare) / (PI * d_rod); //包壳外表面 - 温度 double Tw = q / h[j, k] + Tf[j, k]; //内推温度场 RodTField[j, 0] = Tw; //稳态,温度场由外向内内推 for (int layer = 0; layer < CladSegment; layer++) { //外径 double r_outside = 0.5 * d_rod - deltaR_clad * layer; //内径 double r_inside = 0.5 * d_rod - deltaR_clad * (layer + 1); //层平均半径 double r_av = (r_inside + r_outside) * 0.5; //已经内推过的层面积 double layerArea = PI * (d_rod * d_rod * 0.25 - r_inside * r_inside); //内推过的层发热线功率 double layerHeat = layerArea * fi_clad; //层导热热阻ln(d2/d1)/2π lamd l Clad.K.Get(vectorT[layer]) double R_layer = Math.Log(r_outside / r_inside) / (2 * PI * Clad.GetK(RodTField[j, layer]) * Lj); //内推节点 RodTField[j, layer + 1] = (Linearpower - layerHeat) * Lj * R_layer + RodTField[j, layer]; } //稳态下气体间隙传递的热流密度(导出热量等于芯块Pellet产热) double q_gap = Linearpower * pelletShare / (PI * d_pellet); //芯块外表面温度 RodTField[j, CladSegment + 1] = RodTField[j, CladSegment] + q_gap / gasGap.Get_h(); //计算燃料棒 for (int layer = 0; layer < PelletSegment; layer++) { //外径 double r_outside = 0.5 * d_pellet - deltaR_pellet * layer; //内径 double r_inside = 0.5 * d_pellet - deltaR_pellet * (layer + 1); //层平均半径 double r_av = (r_inside + r_outside) * 0.5; //已经内推过的层面积 double layerArea = PI * (0.25 * d_pellet * d_pellet - r_inside * r_inside); //层发热线功率 double layerHeat = layerArea * fi_pellet; //层导热热阻ln(d2/d1)/2π*lamd*l Clad.K.Get(vectorT[layer]) double R_layer = Math.Log(r_outside / r_inside) / (2 * PI * Clad.GetK(RodTField[j, layer]) * Lj); RodTField[j, layer + CladSegment + 2] = (Linearpower * pelletShare - layerHeat) * Lj * R_layer + RodTField[j, layer + CladSegment + 1]; } //芯块中心温度(根据有内热源传热方程) RodTField[j, PelletSegment + CladSegment + 1] = RodTField[j, PelletSegment + CladSegment] + 0.25 * fi_pellet / Pellet.GetK(RodTField[j, PelletSegment + CladSegment]) * deltaR_pellet * deltaR_pellet; //计算临界热流密度 double q_critical = Q_Critical(Xe, d_rod, massFlowDensity[j, k], coolent.GetHf(Tf[j, k]), coolent.GetH(Tf[j, k]), options.DNBR_Formula); //设置输出对象(燃料棒k第j段) SubRodTemperature subRodTemperature = new SubRodTemperature { Index = j, //一些重要观测点温度 CladOutsideT = Math.Round(RodTField[j, 0], acc.T), CladInsideT = Math.Round(RodTField[j, CladSegment], acc.T), PelletOutsideT = Math.Round(RodTField[j, CladSegment + 1], acc.T), PelletCenterT = Math.Round(RodTField[j, PelletSegment + CladSegment + 1], acc.T), //对流换热系数 h = Math.Round(h[j, k], acc.h), //热流密度 Q = Math.Round(q, 1), //临界热流密度 Qc = Math.Round(q_critical, 1), //DNBR DNBR = Math.Round(q_critical / q, 3), //温度向量 TemperatureVector = RodTField.Row(j), }; //加入计算结果集合 RodkTemperature.SubRods.Add(subRodTemperature); }//---结束轴向J循环 RodsTemperature.Add(RodkTemperature); //输出消息提示 Main.MsgCenter.ShowMessage(String.Format("燃料棒{0}:", rods[k].Index)); Main.MsgCenter.ShowMessage(RodTField.ToMatrixString(Nj, PelletSegment + CladSegment + 2)); }//结束燃料棒k循环 return(RodsTemperature); }
public virtual void OnFluidExit(Fluid fluid) { }
static void Main(string[] args) { #region Object creation Shop shop = new Shop(); shop.Id = 1; shop.Name = "My Grocerie"; shop.Finance = new Decimal(1200); shop.Credit = new Decimal(1500); Client client1 = new Client(); client1.Id = 1; client1.Money = new Decimal(100.20); client1.Name = "Eude"; client1.Surname = "Jean"; Address address1 = new Address(); address1.Id = 1; address1.City = "Rennes"; address1.Path = "Voie"; address1.Way = "La guenardiere"; address1.Number = "6"; client1.Address = address1; shop.Clients.Add(client1); Client client2 = new Client(); client2.Id = 2; client2.Money = new Decimal(50); client2.Name = "Marc"; client2.Surname = "Jack"; Address address2 = new Address(); address2.Id = 2; address2.City = "Rennes"; address2.Path = "Voie"; address2.Way = "La guenardiere"; address2.Number = "6"; client2.Address = address2; shop.Clients.Add(client2); Client client3 = new Client(); client3.Id = 3; client3.Money = new Decimal(30.80); client3.Name = "Ulé"; client3.Surname = "Ivon"; Address address3 = new Address(); address3.Id = 3; address3.City = "Rennes"; address3.Path = "Voie"; address3.Way = "La guenardiere"; address3.Number = "6"; client3.Address = address3; shop.Clients.Add(client3); Owner owner = new Owner(); owner.Id = 4; owner.Name = "Montant"; owner.Surname = "Ive"; Address address4 = new Address(); address4.Id = 4; address4.City = "Rennes"; address4.Path = "Voie"; address4.Way = "La guenardiere"; address4.Number = "6"; owner.Address = address4; shop.Owners.Add(owner); #region Products creation Product product1 = new Cold(); product1.Id = 1; product1.Name = "product 1"; product1.Price = new Decimal(10); shop.Products.Add(product1); Product product2 = new Consistant(); product2.Id = 2; product2.Name = "product 2"; product2.Price = new Decimal(20); shop.Products.Add(product2); Product product3 = new Fluid(); product3.Id = 3; product3.Name = "product 3"; product3.Price = new Decimal(30); shop.Products.Add(product3); Product product4 = new Hot(); product4.Id = 4; product4.Name = "product 4"; product4.Price = new Decimal(40); shop.Products.Add(product4); Product product5 = new Usefull(); product5.Id = 5; product5.Name = "product 5"; product5.Price = new Decimal(50); shop.Products.Add(product5); Product product6 = new Useless(); product6.Id = 6; product6.Name = "product 6"; product6.Price = new Decimal(60); shop.Products.Add(product6); Product product7 = new Usable(); product7.Id = 7; product7.Name = "product 7"; product7.Price = new Decimal(70); shop.Products.Add(product7); Product product8 = new Cold(); product8.Id = 8; product8.Name = "product 8"; product8.Price = new Decimal(80); shop.Products.Add(product8); Product product9 = new Cold(); product9.Id = 9; product9.Name = "product 9"; product9.Price = new Decimal(90); shop.Products.Add(product9); Product product10 = new Cold(); product10.Id = 10; product10.Name = "product 10"; product10.Price = new Decimal(100); shop.Products.Add(product10); #endregion #endregion #region Print object in console //Console.WriteLine(shop); shop.PrintItemCategories(); /*Console.WriteLine(owner); * Console.WriteLine(product1); * Console.WriteLine(product2); * Console.WriteLine(product3); * Console.WriteLine(product4); * Console.WriteLine(product5); * Console.WriteLine(product6); * Console.WriteLine(product7); * Console.WriteLine(product8); * Console.WriteLine(product9); * Console.WriteLine(product10); * Console.WriteLine(client1); * Console.WriteLine(client2); * Console.WriteLine(client3);*/ //shop.PrintItemCategories1(); Console.ReadKey(); #endregion }
public InterfaceObj InitializeBhWithTaylorBubble(Fluid fluidNom, Gas gasNom, PhysicsParam physicsParam, SimParam simParam, int inUse, out InternalObj internalObj, out PlotObj plotObj) { return(this._gasBubble.InitializeBhWithTaylorBubble(fluidNom, gasNom, physicsParam, simParam, inUse, out internalObj, out plotObj)); }
public static Block ParseBlock(XmlNode node, DFG <Block> dfg, ParserInfo parserInfo, bool allowDeclarationBlocks = false, bool canBeScheduled = true) { string id = node.GetAttributeValue(Block.ID_FIELD_NAME); string blockType = node.GetAttributeValue(Block.TYPE_FIELD_NAME); switch (blockType) { case ArithOP.XML_TYPE_NAME: return(ArithOP.Parse(node, dfg, parserInfo, canBeScheduled)); case Constant.XML_TYPE_NAME: return(Constant.Parse(node, parserInfo, canBeScheduled)); case FluidArray.XML_TYPE_NAME: return(FluidArray.Parse(node, dfg, parserInfo)); case SetArrayFluid.XML_TYPE_NAME: return(SetArrayFluid.Parse(node, dfg, parserInfo)); case Fluid.XML_TYPE_NAME: return(Fluid.Parse(node, dfg, parserInfo)); case InputDeclaration.XML_TYPE_NAME: if (!allowDeclarationBlocks) { parserInfo.ParseExceptions.Add(new ParseException(id, "Declaration blocks has to be at the top of the program.")); } return(InputDeclaration.Parse(node, parserInfo)); case OutputDeclaration.XML_TYPE_NAME: if (!allowDeclarationBlocks) { parserInfo.ParseExceptions.Add(new ParseException(id, "Declaration blocks has to be at the top of the program.")); } return(OutputDeclaration.Parse(node, parserInfo)); case WasteDeclaration.XML_TYPE_NAME: if (!allowDeclarationBlocks) { parserInfo.ParseExceptions.Add(new ParseException(id, "Declaration blocks has to be at the top of the program.")); } return(WasteDeclaration.Parse(node, parserInfo)); case HeaterDeclaration.XML_TYPE_NAME: if (!allowDeclarationBlocks) { parserInfo.ParseExceptions.Add(new ParseException(id, "Declaration blocks has to be at the top of the program.")); } return(HeaterDeclaration.Parse(node, parserInfo)); case OutputUsage.XML_TYPE_NAME: return(OutputUsage.Parse(node, dfg, parserInfo)); case WasteUsage.XML_TYPE_NAME: return(WasteUsage.Parse(node, dfg, parserInfo)); case DropletDeclaration.XML_TYPE_NAME: return(DropletDeclaration.Parse(node, parserInfo)); case BoolOP.XML_TYPE_NAME: return(BoolOP.Parse(node, dfg, parserInfo, canBeScheduled)); //case Sensor.XmlTypeName: // return Sensor.Parse(node); case GetNumberVariable.XML_TYPE_NAME: return(GetNumberVariable.Parse(node, parserInfo, canBeScheduled)); case SetNumberVariable.XML_TYPE_NAME: return(SetNumberVariable.Parse(node, dfg, parserInfo)); case GetDropletCount.XML_TYPE_NAME: return(GetDropletCount.Parser(node, parserInfo, canBeScheduled)); case GetArrayLength.XML_TYPE_NAME: return(GetArrayLength.Parse(node, parserInfo, canBeScheduled)); case ImportVariable.XML_TYPE_NAME: return(ImportVariable.Parse(node, parserInfo, canBeScheduled)); case NumberArray.XML_TYPE_NAME: return(NumberArray.Parse(node, dfg, parserInfo)); case GetArrayNumber.XML_TYPE_NAME: return(GetArrayNumber.Parse(node, dfg, parserInfo, canBeScheduled)); case SetArrayNumber.XML_TYPE_NAME: return(SetArrayNumber.Parse(node, dfg, parserInfo, canBeScheduled)); case RoundOP.XML_TYPE_NAME: return(RoundOP.Parse(node, dfg, parserInfo, canBeScheduled)); default: throw new UnknownBlockException(id); } }