예제 #1
0
        /// <summary>
        /// Calculates the slduge input of the given digester. It checks for each digester
        /// whether it is connected to the input of the given digester. If so the flow
        /// coming from the digester is returned in the vector at the corresponding position.
        /// </summary>
        /// <param name="t">some simulation time in days</param>
        /// <param name="mySubstrates"></param>
        /// <param name="myPlant"></param>
        /// <param name="mySensors"></param>
        /// <param name="substrate_network"></param>
        /// <param name="plant_network"></param>
        /// <param name="digester_id">
        /// digester for which the sludge input is calculated
        /// </param>
        /// <returns>dimension: number of digesters</returns>
        private physValue[] getPumpedInputFlowForFermenter(double t, biogas.substrates mySubstrates,
                                                           biogas.plant myPlant, sensors mySensors,
                                                           double[,] substrate_network, double[,] plant_network,
                                                           string digester_id)
        {
            int digester_index = myPlant.getDigesterIndex(digester_id) - 1;

            // vector tells us what input connections the given fermenter has
            double[] digester_network = new double[myPlant.getNumDigesters()];

            for (int idigester = 0; idigester < plant_network.GetLength(0); idigester++)
            {
                digester_network[idigester] = plant_network[idigester, digester_index];
            }

            string digester_id_in = digester_id;// myPlant.getDigesterID(digester_index + 1);

            int n_digester = myPlant.getNumDigesters();

            physValue[] Q = physValue.zeros(n_digester);

            //

            for (int idigester = 0; idigester < n_digester; idigester++)
            {
                if ((digester_network[idigester] > 0) && (digester_index != idigester))
                {
                    string digester_id_out = myPlant.getDigesterID(idigester + 1);

                    string digester_conn = digester_id_out + "_" + digester_id_in;

                    try
                    {
                        // wenn wir eine pumpverbindung mit einem split haben, dann gibt es diese
                        // messung, weil diese aus datei geholt wird: volumeflow_...mat
                        Q[idigester] = mySensors.getMeasurementAt("Q", "Q_" + digester_conn, t);
                    }
                    catch
                    {
                        // macht hier die Annahme, dass das was in fermenter_id_out rein geht
                        // auch mengenmaäßig raus geht und dann in fermenter_id_in rein geht.
                        // diee annahme geht nur, wenn volumen constant ist.
                        // TODO: und biogasstrom vernachlässigt wird
                        //Q[idigester]=
                        //physValue.sum(getInputVolumeflowForFermenter(
                        //              t, mySubstrates, myPlant, mySensors,
                        //              substrate_network, plant_network, digester_id_out));

                        // das sollte so viel einfacher möglich sein, und vor allem auch korrekt
                        Q[idigester] = mySensors.getMeasurementAt("Q_" + digester_id_out + "_3", "", t);
                    }
                }
                else
                {
                    Q[idigester] = new physValue(0, "m^3/d");
                }
            }

            //

            return(Q);
        }