Exemplo n.º 1
0
        /// <summary>
        /// calculates fitness values that have to do with biogas production
        /// at the moment two fitness values are calculated:
        /// - methane concentration smaller 50 %
        /// - biogas excess
        ///
        /// TODO: erweitern um H2_fitness? use a H2_max boundary
        /// / da simulation für h2 bisher teilweise recht ungenau, macht
        /// die nutzun einer upper boundary momentan nicht so viel sinn
        /// </summary>
        /// <param name="mySensors"></param>
        /// <param name="CH4_fitness">1 if CH4 concentration is smaller 50 %</param>
        private static void getBiogas_fitness(biogas.sensors mySensors, out double CH4_fitness)
        {
            // Calculation of methane amount in Biogas

            physValue[] biogas_v = mySensors.getCurrentMeasurementVector("total_biogas_");

            double methaneConcentration = biogas_v[2].Value;


            CH4_fitness = Convert.ToDouble(methaneConcentration < 50) *
                          (0 * 1 + math.tukeybiweight(methaneConcentration - 50));

            //CH4_fitness = Convert.ToDouble(methaneConcentration < 50);
        }
Exemplo n.º 2
0
        /// <summary>
        /// ...
        ///
        /// type 8
        /// </summary>
        /// <param name="myPlant"></param>
        /// <param name="myFitnessParams"></param>
        /// <param name="mySensors"></param>
        /// <param name="par">not used</param>
        /// <returns></returns>
        override protected physValue[] doMeasurement(biogas.plant myPlant,
                                                     biooptim.fitness_params myFitnessParams, biogas.sensors mySensors, params double[] par)
        {
            physValue[] values = new physValue[1];

            //

            // <param name="biogasExcess_fitness">lost money due to biogas excess [1000 €/d]</param>
            // <param name="biogasExcess">in excess produced biogas [m^3/d]</param>
            // <param name="lossBiogasExcess">lost money due to biogas excess [€/d]</param>

            physValue[] biogas_v = mySensors.getCurrentMeasurementVector("total_biogas_");

            //
            // excess biogas in [m^3/d]
            double biogasExcess;// = biogas_v[biogas_v.Length - 1].Value;

            //
            // Calculation of costs of substrate inflow
            // € / d
            double substrate_costs;

            mySensors.getCurrentMeasurementD("substrate_cost", out substrate_costs);


            // loss of excess methane prod. in €/d
            // if there is a loss, then positive value
            // if there is a gain, then negative value, should not be the case
            double lossBiogasExcess = calcLossDueToBiogasExcess(biogas_v, substrate_costs, myPlant,
                                                                myFitnessParams, out biogasExcess);

            // tausend € / d
            double biogasExcess_fitness = lossBiogasExcess / 1000;

            //

            values[0] = new physValue("biogasExcess_fitness", biogasExcess_fitness, "-");

            return(values);
        }