Example #1
0
        public Tuple <ReagentMix, GasMix> Take(MixAndVolume InmixAndVolume, bool removeVolume = true)
        {
            if (Volume == 0)
            {
                Logger.LogError(" divide by 0 in Take ");
            }

            float Percentage      = InmixAndVolume.Volume / Volume;
            float RemoveGasVolume = gasMix.Volume;
            float GasVolume       = gasMix.Volume;

            if (removeVolume)
            {
                RemoveGasVolume = RemoveGasVolume * Percentage;
                GasVolume       = GasVolume * (1 - Percentage);
            }

            var ReturnMix = Mix.Take(Mix.Total * Percentage);

            var Newone       = new float[gasMix.Gases.Length];
            var RemoveNewone = new float[gasMix.Gases.Length];

            for (int i = 0; i < gasMix.Gases.Length; i++)
            {
                RemoveNewone[i] = gasMix.Gases[i] * Percentage;
                Newone[i]       = gasMix.Gases[i] * (1 - Percentage);
            }

            gasMix = GasMix.FromTemperature(Newone, gasMix.Temperature, GasVolume);

            return(new Tuple <ReagentMix, GasMix>(ReturnMix,
                                                  GasMix.FromTemperature(RemoveNewone, gasMix.Temperature, RemoveGasVolume)));
        }
Example #2
0
        public Tuple <ReagentMix, GasMix> Take(MixAndVolume InmixAndVolume, bool removeVolume = true)
        {
            if (InmixAndVolume.Volume == 0)
            {
                Logger.LogError(" divide by 0 in Take ");
            }

            float Percentage = Volume / InmixAndVolume.Volume;

            var ReturnMix = Mix.Take(Mix.Total * Percentage);

            if (removeVolume)
            {
                gasMix.ChangeVolumeValue(-InmixAndVolume.gasMix.Volume);
                Volume = Volume - InmixAndVolume.Volume;
            }

            var ReturnGasMix = gasMix.RemoveVolume(InmixAndVolume.gasMix.Volume);

            return(new Tuple <ReagentMix, GasMix>(ReturnMix, ReturnGasMix));
        }
Example #3
0
        public Tuple <ReagentMix, GasMix> Take(MixAndVolume InmixAndVolume, bool removeVolume = true)
        {
            float Percentage = Volume / InmixAndVolume.Volume;

            var ReturnMix = Mix.Take(Mix.Total * Percentage);

            if (removeVolume)
            {
                gasMix.ChangeVolumeValue(-InmixAndVolume.gasMix.Volume);
                Volume = Volume - InmixAndVolume.Volume;
            }

            var ReturnGasMix = gasMix.RemoveVolume(InmixAndVolume.gasMix.Volume);

            if (gasMix.Gases.Any(x => x < 0))
            {
                Logger.Log("0!!!");
            }

            return(new Tuple <ReagentMix, GasMix>(ReturnMix, ReturnGasMix));
        }