コード例 #1
0
        public void InitializeGraph()
        {
            gs = new GraphSolver();
            plainWater.Add(FluidType.WATER, 1.0);
            seaWater.Add(FluidType.SEA_WATER, 1.0);

            Tank t1 = new Tank("T1", 1000.0, plainWater, 500.0, new string[] { "V1" }, false);
            gs.addComponent(t1);
            t1.currentTemperature = 20.0;
            Tank t2 = new Tank("T2", 1000.0, seaWater, 500.0, new string[] { "V2" }, false);
            gs.addComponent(t2);
            t2.currentTemperature = 10.0;
            FlowLine v1 = new FlowLine("V1", "S1");
            gs.addComponent(v1);
            FlowLine v2 = new FlowLine("V2", "S1");
            gs.addComponent(v2);
            Junction s1 = new Junction("S1", new string[] { "P1" }, new string[] { "V1", "V2" }, "", new double[] { 0.5, 0.5 }, new double[] { 1.0, 1.0 });
            gs.addComponent(s1);
            FlowDriver p1 = new FlowDriver("P1", 300.0, 3.2, "S2");
            gs.addComponent(p1);
            Junction s2 = new Junction("S2", new string[] { "V3", "V4" }, new string[] { "P1" }, "C2", new double[] { 0.5, 0.5 }, new double[] { 1.0, 1.0 });
            gs.addComponent(s2);
            FlowLine v3 = new FlowLine("V3", "C2");
            gs.addComponent(v3);
            FlowLine v4 = new FlowLine("V4", "C2");
            gs.addComponent(v4);
            Junction c2 = new Junction("C2", new string[] { "T3" }, new string[] { "V3", "V4" });
            gs.addComponent(c2);
            Tank t3 = new Tank("T3", 1000.0, plainWater, 500.0, new string[] { }, false);          //We have no sinks, since we are the bottom of this food-chain.
            t3.currentTemperature = 30.0;
            gs.addComponent(t3);

            gs.connectComponents();
        }
コード例 #2
0
        public void InitializeGraph()
        {
            gs = new GraphSolver();
            plainAir.Add(FluidType.AIR, 1.0);

            Tank t1 = new Tank("T1", double.MaxValue, plainAir, double.MaxValue, new string[] { "V1" }, false);             //Infinite tank!
            gs.addComponent(t1);
            FlowLine v1 = new FlowLine("V1", "P1");
            gs.addComponent(v1);
            FlowDriver p1 = new FlowDriver("P1", 100.0, 4.0, "V2");
            gs.addComponent(p1);
            FlowLine v2 = new FlowLine("V2", "T2");
            gs.addComponent(v2);
            Tank t2 = new Tank("T2", 1000.0, plainAir, 1000.0, new string[] { "P2" }, true);             //Sealed tanks should start full of air, so currentVolume = capacity.
            gs.addComponent(t2);

            PressureDifferentialFlowDriver p2 = new PressureDifferentialFlowDriver("P2", 100.0, 0.0, "V3", 1.0, 2.0);
            gs.addComponent(p2);
            FlowLine v3 = new FlowLine("V3", "T3");
            v3.setFlowAllowedPercent(0.0);
            gs.addComponent(v3);
            Tank t3 = new Tank("T3", 1000.0, plainAir, 1000.0, new string[] { }, true);             //Sealed tanks should start full of air, so currentVolume = capacity.
            gs.addComponent(t3);

            gs.connectComponents();
        }
コード例 #3
0
        public void InitializeGraph()
        {
            gs = new GraphSolver();
            plainWater.Add(FluidType.WATER, 1.0);

            Tank t1 = new Tank("T1", 1000.0, plainWater, 500.0, new string[] { "V1" }, false);
            gs.addComponent(t1);
            FlowLine v1 = new FlowLine("V1", "P1");
            gs.addComponent(v1);
            FlowDriver p1 = new FlowDriver("P1", 100.0, 3.2, "V2");
            gs.addComponent(p1);
            FlowLine v2 = new FlowLine("V2", "T2");
            gs.addComponent(v2);
            Tank t2 = new Tank("T2", 1000.0, plainWater, 500.0, new string[] { }, false);          //We have no sinks, since we are the bottom of this food-chain.
            gs.addComponent(t2);

            gs.connectComponents();
        }
コード例 #4
0
        public void InitializeGraph()
        {
            gs = new GraphSolver();
            plainWater.Add(FluidType.WATER, 1.0);

            Tank t1 = new Tank("T1", 1000.0, plainWater, 500.0, new string[] { "V1" }, false);
            gs.addComponent(t1);
            FlowLine v1 = new FlowLine("V1", "S1");
            gs.addComponent(v1);
            Tank t2 = new Tank("T2", 1000.0, plainWater, 500.0, new string[] { "V2" }, false);          //We have no sinks, since we are the bottom of this food-chain.
            gs.addComponent(t2);
            FlowLine v2 = new FlowLine("V2", "S1");
            gs.addComponent(v2);
            Junction s1 = new Junction("S1", new string[] { "P1" }, new string[] { "V1", "V2" }, "", new double[] { 0.5, 0.5 }, new double[] { 0.6, 1.0 });
            gs.addComponent(s1);
            FlowDriver p1 = new FlowDriver("P1", 200.0, 3.2, "V3");
            gs.addComponent(p1);
            FlowLine v3 = new FlowLine("V3", "T3");
            gs.addComponent(v3);
            Tank t3 = new Tank("T3", 1000.0, plainWater, 500.0, new string[] { }, false);          //We have no sinks, since we are the bottom of this food-chain.
            gs.addComponent(t3);

            gs.connectComponents();
        }
コード例 #5
0
 public AppriPumpWrapper(string name)
     : base(name)
 {
     pump = new FlowDriver(name, 100.0, 3.2, "");
 }
コード例 #6
0
ファイル: DualPumpTests.cs プロジェクト: appritech/appriphys
        public void InitializeGraph()
        {
            gs = new GraphSolver();
            plainWater.Add(FluidType.WATER, 1.0);

            Tank t1 = new Tank("T1", 1000.0, plainWater, 500.0, new string[] { "V0" }, false);
            gs.addComponent(t1);
            FlowLine v0 = new FlowLine("V0", "C1");
            gs.addComponent(v0);
            Junction c1 = new Junction("C1", new string[] { "V1", "V2" }, new string[] { "V0" });
            gs.addComponent(c1);
            FlowLine v1 = new FlowLine("V1", "P1");
            gs.addComponent(v1);
            FlowLine v2 = new FlowLine("V2", "P2");
            gs.addComponent(v2);
            FlowDriver p1 = new FlowDriver("P1", 100.0, 3.2, "V3");
            gs.addComponent(p1);
            FlowDriver p2 = new FlowDriver("P2", 100.0, 3.2, "V4");
            gs.addComponent(p2);
            FlowLine v3 = new FlowLine("V3", "C2");
            gs.addComponent(v3);
            FlowLine v4 = new FlowLine("V4", "C2");
            gs.addComponent(v4);
            Junction c2 = new Junction("C2", new string[] { "V5" }, new string[] { "V3", "V4" });
            gs.addComponent(c2);
            FlowLine v5 = new FlowLine("V5", "T2");
            gs.addComponent(v5);
            Tank t2 = new Tank("T2", 1000.0, plainWater, 500.0, new string[] { }, false);          //We have no sinks, since we are the bottom of this food-chain.
            gs.addComponent(t2);

            gs.connectComponents();
        }
コード例 #7
0
ファイル: GraphSolver.cs プロジェクト: appritech/appriphys
        private bool attemptSolve(FlowDriver p, int attempt)
        {
            double flowModifier = flowDriverModifiers[p.name].flowPercent;

            FlowCalculationData baseData = new FlowCalculationData(p, angerMap, attempt);
            FlowResponseData sourceAbility = p.getFlowDriverSourcePossibleValues(baseData, flowDriverModifiers[p.name]);
            baseData.fluidTypeMap = sourceAbility.fluidTypeMap;             //Pass the mixture stuff from source to delivery
            FlowResponseData deliveryAbility = p.getFlowDriverDeliveryPossibleValues(baseData, flowDriverModifiers[p.name]);

            if (flowDriverModifiers[p.name].updateStateRequiresNewSolution(sourceAbility, deliveryAbility))
                return false;

            return true;
        }