/// <summary> /// Calc u prime for substrate feed of all substrates saved in sensors at the /// current time /// </summary> /// <param name="mySensors"></param> /// <param name="mySubstrates"></param> /// <returns>|| u'(t) ||_2^2, where u is the vector of substrate feeds</returns> private double calcudot(biogas.sensors mySensors, biogas.substrates mySubstrates) { double t2 = mySensors.getCurrentTime(); if (t2 < 0) // no recorded value yet in no sensor { return(0); } double t1 = mySensors.getPreviousTime(); double[] Q1, Q2; // TODO // wenn init substrate feed nicht gegeben ist, dann ist am anfang der simulation // Q2 = Q1 // aktuell berechne ich in MATLAb noch init_substrate feed und addiere das am ende // zu udot hinzu, sollte erstmal ok sein mySensors.getMeasurementsAt("Q", "Q", t1, mySubstrates, out Q1); mySensors.getMeasurementsAt("Q", "Q", t2, mySubstrates, out Q2); // double udot = 0; for (int isubstrate = 0; isubstrate < mySubstrates.getNumSubstrates(); isubstrate++) { double u1 = Q1[isubstrate]; double u2 = Q2[isubstrate]; double udot1 = calcudot(t1, t2, u1, u2); udot += udot1 * udot1; } return(udot); }