Пример #1
0
        /// <summary>
        /// Create network of sensors, which are inside the simulation model
        /// </summary>
        /// <param name="myPlant"></param>
        /// <param name="mySubstrates"></param>
        /// <param name="plant_network"></param>
        /// <param name="plant_network_max"></param>
        /// <returns>
        /// sensors object containing all sensor and sensor_array objects inside the simulation model
        /// </returns>
        /// <exception cref="exception">Unknown sensor array id</exception>
        public static sensors create_sensor_network(plant myPlant, substrates mySubstrates,
                                                    double[,] plant_network, double[,] plant_network_max)
        {
            sensors mySensors = new sensors();

            for (int idigester = 0; idigester < myPlant.getNumDigesters(); idigester++)
            {
                string digester_id = myPlant.getDigesterID(idigester + 1);

                //

                mySensors.addSensor(new biogas.VFA_TAC_sensor(digester_id + "_3"));

                mySensors.addSensor(new biogas.aceto_hydro_sensor(digester_id));

                mySensors.addSensor(new biogas.AcVsPro_sensor(digester_id + "_3"));

                mySensors.addSensor(new biogas.HRT_sensor(digester_id));

                mySensors.addSensor(new biogas.faecal_sensor(digester_id));

                mySensors.addSensor(new biogas.inhibition_sensor(digester_id));

                mySensors.addSensor(new biogas.energyProdMicro_sensor(digester_id));

                mySensors.addSensor(new biogas.biogas_sensor(digester_id));

                mySensors.addSensor(new biogas.VFA_sensor(digester_id + "_2"));
                mySensors.addSensor(new biogas.VFA_sensor(digester_id + "_3"));

                mySensors.addSensor(new biogas.VFAmatrix_sensor(digester_id + "_2"));
                mySensors.addSensor(new biogas.VFAmatrix_sensor(digester_id + "_3"));

                mySensors.addSensor(new biogas.Sva_sensor(digester_id + "_2"));
                mySensors.addSensor(new biogas.Sva_sensor(digester_id + "_3"));
                mySensors.addSensor(new biogas.Sbu_sensor(digester_id + "_2"));
                mySensors.addSensor(new biogas.Sbu_sensor(digester_id + "_3"));
                mySensors.addSensor(new biogas.Spro_sensor(digester_id + "_2"));
                mySensors.addSensor(new biogas.Spro_sensor(digester_id + "_3"));
                mySensors.addSensor(new biogas.Sac_sensor(digester_id + "_2"));
                mySensors.addSensor(new biogas.Sac_sensor(digester_id + "_3"));

                mySensors.addSensor(new biogas.VS_sensor(digester_id + "_2"));
                mySensors.addSensor(new biogas.VS_sensor(digester_id + "_3"));

                mySensors.addSensor(new biogas.Q_sensor(digester_id + "_2"));
                mySensors.addSensor(new biogas.Q_sensor(digester_id + "_3"));

                mySensors.addSensor(new biogas.NH3_sensor(digester_id + "_2"));
                mySensors.addSensor(new biogas.NH3_sensor(digester_id + "_3"));

                mySensors.addSensor(new biogas.NH4_sensor(digester_id + "_2"));
                mySensors.addSensor(new biogas.NH4_sensor(digester_id + "_3"));

                mySensors.addSensor(new biogas.Norg_sensor(digester_id + "_2"));
                mySensors.addSensor(new biogas.Norg_sensor(digester_id + "_3"));

                mySensors.addSensor(new biogas.TKN_sensor(digester_id + "_2"));
                mySensors.addSensor(new biogas.TKN_sensor(digester_id + "_3"));

                mySensors.addSensor(new biogas.Ntot_sensor(digester_id + "_2"));
                mySensors.addSensor(new biogas.Ntot_sensor(digester_id + "_3"));

                mySensors.addSensor(new biogas.pH_stream_sensor(digester_id + "_2"));
                mySensors.addSensor(new biogas.pH_sensor(digester_id + "_3"));

                mySensors.addSensor(new biogas.biomassAciAce_sensor(digester_id + "_3"));

                mySensors.addSensor(new biogas.biomassMeth_sensor(digester_id + "_3"));

                mySensors.addSensor(new biogas.TAC_sensor(digester_id + "_2"));
                mySensors.addSensor(new biogas.TAC_sensor(digester_id + "_3"));

                mySensors.addSensor(new biogas.SS_COD_sensor(digester_id + "_2"));
                mySensors.addSensor(new biogas.SS_COD_sensor(digester_id + "_3"));

                mySensors.addSensor(new biogas.VS_COD_sensor(digester_id + "_2"));
                mySensors.addSensor(new biogas.VS_COD_sensor(digester_id + "_3"));

                // heating
                mySensors.addSensor(new biogas.heatConsumption_sensor(digester_id));

                // stirrers - all stirrer in the digester
                mySensors.addSensor(new biogas.stirrer_sensor(digester_id));

                //

                mySensors.addSensor(new biogas.TS_sensor(digester_id + "_2")); // TS messung des Fermenterinputs
                mySensors.addSensor(new biogas.TS_sensor(digester_id + "_3")); // TS im fermenter

                mySensors.addSensor(new biogas.OLR_sensor(digester_id));

                // measures density of sludge inside the digester
                mySensors.addSensor(new biogas.density_sensor(digester_id));

                //

                mySensors.addSensor(new biogas.ADMstate_sensor(digester_id));

                mySensors.addSensor(new biogas.ADMstream_sensor(digester_id + "_2"));
                mySensors.addSensor(new biogas.ADMstream_sensor(digester_id + "_3"));

                //

                mySensors.addSensor(new biogas.ADMintvars_sensor(digester_id));

                mySensors.addSensor(new biogas.ADMparams_sensor(digester_id));
            }

            //

            mySensors.addSensor(new biogas.SS_COD_sensor("finalstorage_2"));
            mySensors.addSensor(new biogas.VS_COD_sensor("finalstorage_2"));
            mySensors.addSensor(new biogas.Q_sensor("finalstorage_2"));

            mySensors.addSensor(new biogas.SS_COD_sensor("total_mix_2"));
            mySensors.addSensor(new biogas.VS_COD_sensor("total_mix_2"));
            mySensors.addSensor(new biogas.Q_sensor("total_mix_2"));
            mySensors.addSensor(new biogas.VS_sensor("total_mix_2"));

            mySensors.addSensor(new biogas.substrate_sensor("cost"));

            // fitness sensors

            mySensors.addSensor(new biogas.fitness_sensor());

            mySensors.addSensor(new biogas.AcVsPro_fit_sensor());
            mySensors.addSensor(new biogas.VFA_fit_sensor());
            mySensors.addSensor(new biogas.VFA_TAC_fit_sensor());
            mySensors.addSensor(new biogas.TS_fit_sensor());
            mySensors.addSensor(new biogas.pH_fit_sensor());
            mySensors.addSensor(new biogas.OLR_fit_sensor());
            mySensors.addSensor(new biogas.TAC_fit_sensor());
            mySensors.addSensor(new biogas.HRT_fit_sensor());
            mySensors.addSensor(new biogas.N_fit_sensor());
            mySensors.addSensor(new biogas.CH4_fit_sensor());
            mySensors.addSensor(new biogas.SS_COD_fit_sensor());
            mySensors.addSensor(new biogas.VS_COD_fit_sensor());
            mySensors.addSensor(new biogas.gasexcess_fit_sensor());
            mySensors.addSensor(new biogas.setpoint_fit_sensor());
            mySensors.addSensor(new biogas.manurebonus_sensor());
            mySensors.addSensor(new biogas.udot_sensor());

            //

            mySensors.addSensor(new biogas.total_biogas_sensor("", myPlant));

            //

            mySensors.addSensorArray(new biogas.sensor_array("Q"));

            for (int isubstrate = 0; isubstrate < mySubstrates.getNumSubstrates(); isubstrate++)
            {
                try
                {
                    mySensors.getArray("Q").addSensor(new biogas.Q_sensor(mySubstrates.getID(isubstrate + 1)));
                }
                catch (exception e)
                {
                    Console.WriteLine("Could not add Q_sensor to substrate array!");
                    throw (e);
                }

                mySensors.addSensor(new biogas.substrateparams_sensor(mySubstrates.getID(isubstrate + 1)));
            }

            //


            // nº of Columms -> Inputs to the fermenter
            for (int ifermenterIn = 0; ifermenterIn < myPlant.getNumDigesters() + 1; ifermenterIn++)
            {
                // nº of Rows -> Outputs to the fermenter
                for (int ifermenterOut = 0; ifermenterOut < myPlant.getNumDigesters(); ifermenterOut++)
                {
                    // TODO - es gibt bestimmt auch eine funktion in matlab, welche diese schleife
                    // schon implementiert hat als funktion
                    // Connection condition within fermenters
                    if ((plant_network[ifermenterOut, ifermenterIn] > 0) &&
                        (plant_network_max[ifermenterOut, ifermenterIn] < Double.PositiveInfinity))
                    {
                        //
                        // Fermenter Name for Input
                        String fermenter_id_in = myPlant.getDigesterID(ifermenterIn + 1);
                        // Fermenter Name for Output
                        String fermenter_id_out = myPlant.getDigesterID(ifermenterOut + 1);

                        //

                        mySensors.getArray("Q").addSensor(
                            new biogas.Q_sensor(fermenter_id_out + "_" + fermenter_id_in));
                    }
                }
            }

            //

            for (int ibhkw = 0; ibhkw < myPlant.getNumCHPs(); ibhkw++)
            {
                String bhkw_id = myPlant.getCHPID(ibhkw + 1);

                mySensors.addSensor(new biogas.energyProduction_sensor(bhkw_id));
            }

            //

            mySensors.addSensor(new biogas.energyProdSum_sensor());

            //

            // TODO - könnte man evtl. auch in transportation rein schieben

            for (int ipump = 0; ipump < myPlant.getNumPumps(); ipump++)
            {
                String pump_id = myPlant.getPumpID(ipump + 1);

                mySensors.addSensor(new biogas.pumpEnergy_sensor(pump_id));
            }

            //

            for (int isubstrate_transport = 0;
                 isubstrate_transport < myPlant.getNumSubstrateTransports();
                 isubstrate_transport++)
            {
                String substrate_transport_id = myPlant.getSubstrateTransportID(isubstrate_transport + 1);

                // for liquid substrates
                mySensors.addSensor(new biogas.pumpEnergy_sensor(substrate_transport_id));

                // for non-liquid substrates
                mySensors.addSensor(new biogas.transportEnergy_sensor(substrate_transport_id));
            }

            //



            //

            return(mySensors);
        }