コード例 #1
0
        /// <summary>
        /// Calculates given symbol out of state vector x. The symbol in the state vector
        /// must be measured in the unit of the ADM state vector (as defined in variable
        /// unitsADMstate) and is returned in ToUnit
        ///
        /// </summary>
        /// <param name="x"></param>
        /// <param name="symbol"></param>
        /// <param name="ToUnit"></param>
        /// <returns></returns>
        public static physValueBounded calcFromADMstate(double[] x, string symbol,
                                                        string ToUnit)
        {
            // nicht so gut den defaultUnit von physValue zu holen, da ein anderes AD
            // Model andere Einheiten haben könnte
            //string FromUnit= physValue.getDefaultUnit(symbol);
            // so ist es OK!
            string FromUnit = ADMstate.getUnitOfADMstatevariable(symbol);

            return(calcFromADMstate(x, symbol, FromUnit, ToUnit));
        }
コード例 #2
0
        // -------------------------------------------------------------------------------------
        //                            !!! PROTECTED METHODS !!!
        // -------------------------------------------------------------------------------------

        /// <summary>
        /// Measure ADM stream vector in default units of the model
        ///
        /// is a type 0, because u is the stream vector
        /// </summary>
        /// <param name="u">33 or 34 dim stream vector</param>
        /// <param name="par">not used</param>
        /// <returns>measured ADM stream vector</returns>
        /// <exception cref="exception">u.Length &lt; ADMstate.dim_stream - 1</exception>
        override protected physValue[] doMeasurement(double[] u, params double[] par)
        {
            physValue[] values = new physValue[dimension];

            if (u.Length < ADMstate.dim_stream - 1)
            {
                throw new exception(String.Format(
                                        "u has not the correct dimension! is: {0}, must be at least: {1}!",
                                        u.Length, ADMstate.dim_stream - 1));
            }

            for (int idim = 0; idim < dimension; idim++)
            {
                values[idim] = new physValue(ADMstate.symADMstate[idim], u[idim],
                                             ADMstate.getUnitOfADMstatevariable(idim + 1));
            }

            return(values);
        }
コード例 #3
0
        // -------------------------------------------------------------------------------------
        //                            !!! PROTECTED METHODS !!!
        // -------------------------------------------------------------------------------------
        /// <summary>
        /// Measure ADM state vector in default units of the model
        /// 
        /// not type 0, because x is not the stream vector, but the 37 dim state vector
        /// </summary>
        /// <param name="x">37 dim state vector</param>
        /// <param name="par">not used</param>
        /// <returns>measured ADM state vector</returns>
        /// <exception cref="exception">x.Length != ADMstate.dim_state</exception>
        protected override physValue[] doMeasurement(double[] x, params double[] par)
        {
            physValue[] values= new physValue[dimension];

              if (x.Length != ADMstate.dim_state)
              {
            throw new exception(String.Format(
                "x has not the correct dimension! is: {0}, must be: {1}!",
                x.Length, ADMstate.dim_state));
              }

              for (int idim= 0; idim < dimension; idim++)
              {
            values[idim]= new physValue(ADMstate.symADMstate[idim], x[idim],
                                    ADMstate.getUnitOfADMstatevariable(idim + 1));
              }

              return values;
        }