public double managedPowerSupplyWithMinimumRatio(ORSResourceSupplier pm, double power, double rat_min)
        {
            var maximum_available_power_per_second = power / TimeWarp.fixedDeltaTime;
            var minimum_power_per_second           = maximum_available_power_per_second * rat_min;
            var required_power_per_second          = Math.Max(GetRequiredResourceDemand(), minimum_power_per_second);
            var managed_supply_per_second          = Math.Min(maximum_available_power_per_second, required_power_per_second);

            currentPowerSupply += managed_supply_per_second;
            stable_supply      += maximum_available_power_per_second;

            if (power_max_supplies.ContainsKey(pm))
            {
                power_max_supplies[pm] += maximum_available_power_per_second;
            }
            else
            {
                power_max_supplies.Add(pm, maximum_available_power_per_second);
            }

            if (power_min_supplies.ContainsKey(pm))
            {
                power_min_supplies[pm] += minimum_power_per_second;
            }
            else
            {
                power_min_supplies.Add(pm, minimum_power_per_second);
            }

            return(managed_supply_per_second * TimeWarp.fixedDeltaTime);
        }
        public double powerSupply(ORSResourceSupplier pm, double power) {
            powersupply += (power / TimeWarp.fixedDeltaTime);
			stable_supply += (power / TimeWarp.fixedDeltaTime);
            if (power_supplies.ContainsKey(pm)) {
                power_supplies[pm] += (power / TimeWarp.fixedDeltaTime);
            } else {
                power_supplies.Add(pm, (power / TimeWarp.fixedDeltaTime));
            }
            return power;
        }
 public double powerSupply(ORSResourceSupplier pm, double power)
 {
     powersupply   += (power / TimeWarp.fixedDeltaTime);
     stable_supply += (power / TimeWarp.fixedDeltaTime);
     if (power_supplies.ContainsKey(pm))
     {
         power_supplies[pm] += (power / TimeWarp.fixedDeltaTime);
     }
     else
     {
         power_supplies.Add(pm, (power / TimeWarp.fixedDeltaTime));
     }
     return(power);
 }
        public double powerSupplyFixedMax(ORSResourceSupplier pm, double power, double maxpower)
        {
            currentPowerSupply += (power / TimeWarp.fixedDeltaTime);
            stable_supply      += (maxpower / TimeWarp.fixedDeltaTime);

            if (power_max_supplies.ContainsKey(pm))
            {
                power_max_supplies[pm] += (power / TimeWarp.fixedDeltaTime);
            }
            else
            {
                power_max_supplies.Add(pm, (power / TimeWarp.fixedDeltaTime));
            }
            return(power);
        }
        public double managedPowerSupplyWithMinimum(ORSResourceSupplier pm, double power, double rat_min)
        {
            double power_seconds_units     = power / TimeWarp.fixedDeltaTime;
            double power_min_seconds_units = power_seconds_units * rat_min;
            double managed_supply_val_add  = Math.Min(power_seconds_units, Math.Max(getCurrentUnfilledResourceDemand() + getSpareResourceCapacity() / TimeWarp.fixedDeltaTime, power_min_seconds_units));

            powersupply   += managed_supply_val_add;
            stable_supply += power_seconds_units;
            if (power_supplies.ContainsKey(pm))
            {
                power_supplies[pm] += (power / TimeWarp.fixedDeltaTime);
            }
            else
            {
                power_supplies.Add(pm, (power / TimeWarp.fixedDeltaTime));
            }
            return(managed_supply_val_add * TimeWarp.fixedDeltaTime);
        }
 public double managedPowerSupplyWithMinimum(ORSResourceSupplier pm, double power, double rat_min)
 {
     double power_seconds_units = power / TimeWarp.fixedDeltaTime;
     double power_min_seconds_units = power_seconds_units * rat_min;
     double managed_supply_val_add = Math.Min (power_seconds_units, Math.Max(getCurrentUnfilledResourceDemand()+getSpareResourceCapacity()/TimeWarp.fixedDeltaTime,power_min_seconds_units));
     powersupply += managed_supply_val_add;
     stable_supply += power_seconds_units;
     if (power_supplies.ContainsKey(pm)) {
         power_supplies[pm] += (power / TimeWarp.fixedDeltaTime);
     } else {
         power_supplies.Add(pm, (power / TimeWarp.fixedDeltaTime));
     }
     return managed_supply_val_add*TimeWarp.fixedDeltaTime;
 }
 public float managedPowerSupplyWithMinimum(ORSResourceSupplier pm, float power, float rat_min)
 {
     return (float) managedPowerSupplyWithMinimum(pm, (double)power, (double)rat_min);
 }
 public double managedPowerSupply(ORSResourceSupplier pm, double power)
 {
     return managedPowerSupplyWithMinimum (pm, power, 0);
 }
 public float managedPowerSupply(ORSResourceSupplier pm, float power)
 {
     return managedPowerSupplyWithMinimum (pm, power, 0);
 }
 public float powerSupply(ORSResourceSupplier pm, float power)
 {
     return((float)powerSupply(pm, (double)power));
 }
 public float managedPowerSupplyWithMinimum(ORSResourceSupplier pm, float power, float rat_min)
 {
     return((float)managedPowerSupplyWithMinimum(pm, (double)power, (double)rat_min));
 }
 public double managedPowerSupply(ORSResourceSupplier pm, double power)
 {
     return(managedPowerSupplyWithMinimum(pm, power, 0));
 }
 public float managedPowerSupply(ORSResourceSupplier pm, float power)
 {
     return(managedPowerSupplyWithMinimum(pm, power, 0));
 }
 public float powerSupplyFixedMax(ORSResourceSupplier pm, float power, float maxpower)
 {
     return((float)powerSupplyFixedMax(pm, (double)power, (double)maxpower));
 }
예제 #15
0
 public float powerSupply(ORSResourceSupplier pm, float power)
 {
     return (float) powerSupply (pm,(double)power);
 }
예제 #16
0
 public float powerSupplyFixedMax(ORSResourceSupplier pm, float power, float maxpower)
 {
     return (float) powerSupplyFixedMax (pm, (double)power,(double)maxpower);
 }
        public double powerSupplyFixedMax(ORSResourceSupplier pm, double power, double maxpower)
        {
            currentPowerSupply += (power / TimeWarp.fixedDeltaTime);
            stable_supply += (maxpower / TimeWarp.fixedDeltaTime);

            if (power_supplies.ContainsKey(pm))
                power_supplies[pm] += (power / TimeWarp.fixedDeltaTime);
            else
                power_supplies.Add(pm, (power / TimeWarp.fixedDeltaTime));
            return power;
        }