Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 3 : //* 4 : //* All rights reserved, see COPYRIGHT for full restrictions 5 : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT 6 : //* 7 : //* Licensed under LGPL 2.1, please see LICENSE for details 8 : //* https://www.gnu.org/licenses/lgpl-2.1.html 9 : 10 : #pragma once 11 : 12 : #include "GeneralPostprocessor.h" 13 : #include <iostream> 14 : using namespace std; 15 : #include "MooseRandom.h" 16 : 17 : /** 18 : * A generalized sensor Postprocessor 19 : */ 20 : class GeneralSensorPostprocessor : public GeneralPostprocessor 21 : { 22 : public: 23 : static InputParameters validParams(); 24 : 25 : GeneralSensorPostprocessor(const InputParameters & parameters); 26 : 27 : virtual void initialize() override; 28 3928 : virtual void execute() override {} 29 : using Postprocessor::getValue; 30 : virtual PostprocessorValue getValue() const override; 31 : 32 : protected: 33 : /// Function for element-wise multiplication of vectors 34 : std::vector<Real> elementwiseMultiply(std::vector<Real> & vec1, std::vector<Real> & vec2); 35 : /// Function to calculate delayed input signal 36 : Real getDelayedInputSignal(); 37 : /// Function to calculate R vector 38 : virtual vector<Real> getRVector(); 39 : /// Function to calculate integral term 40 : Real getIntegral(std::vector<Real> integrand); 41 : 42 : /// A postprocessor used as the sensor input signal 43 : const PostprocessorValue & _input_signal; 44 : /// The drift function to be evaluated and returned 45 : const Function & _drift_function; 46 : /// Size of vector to be stored 47 : const Real _vector_size; 48 : /// The old value of the postprocessor 49 : const PostprocessorValue & _pp_old; 50 : /// Efficiency function 51 : const Function & _efficiency_function; 52 : /// Noise standard deviation function 53 : const Function & _noise_std_dev_function; 54 : /// Delay function 55 : const Function & _delay_function; 56 : /// Signal to noise function 57 : const Function & _signalToNoise_function; 58 : /// Uncertainty std dev function 59 : const Function & _uncertainty_std_dev_function; 60 : /// Function R for integration term 61 : const Function & _R_function; 62 : /// A weighing factor for the proportional term 63 : const Real _proportional_weight; 64 : /// A weighing factor for the integral term 65 : const Real _integral_weight; 66 : /// Time vector for calculating delay 67 : std::vector<Real> & _time_values; 68 : /// Input Signal vector for calculating delay 69 : std::vector<Real> & _input_signal_values; 70 : /// Vector to store integrand data for numerical integration 71 : std::vector<Real> & _integrand; 72 : /// vector to store R function values 73 : std::vector<Real> & _R_function_values; 74 : /// The last time step this object was executed on 75 : int & _t_step_old; 76 : /// To get fixed seed random numbers 77 : const unsigned int _seed; 78 : MooseRandom _rng; 79 : /// for getValue() output 80 : Real _sensor_value; 81 : /// the output of the integrand 82 : Real _integration_value; 83 : /// Variable to store delay value 84 : Real _delay_value; 85 : };