1 //#**************************************************************
2 //#
3 //# filename:             sensorProcessors.h
4 //#
5 //# author:               Gerstmayr Johannes
6 //#												Vetyukov Yury
7 //#
8 //# generated:						February-June 2012
9 //# description:
10 //#
11 //# remarks:						  HotInt sensors - sensor processor class
12 //#
13 //# Copyright (c) 2003-2013 Johannes Gerstmayr, Linz Center of Mechatronics GmbH, Austrian
14 //# Center of Competence in Mechatronics GmbH, Institute of Technical Mechanics at the
15 //# Johannes Kepler Universitaet Linz, Austria. All rights reserved.
16 //#
17 //# This file is part of HotInt.
18 //# HotInt is free software: you can redistribute it and/or modify it under the terms of
19 //# the HOTINT license. See folder 'licenses' for more details.
20 //#
21 //# bug reports are welcome!!!
22 //# WWW:		www.hotint.org
23 //# email:	bug_reports@hotint.org or support@hotint.org
24 //#**************************************************************
25 
26 #pragma once
27 
28 #include "sensors.h"
29 
30 // - base class for a processor of a time signal measured by a sensor
31 // - both instant processing of the present sensor values (min-max, scale-shift, etc.)
32 //	 and final sensor computation (fft, reference data, etc.) are possible
33 class SensorProcessor
34 {
35 public:
36 	// a virtual destructor will be needed when a derived class needs some clean up in its destructor
~SensorProcessor()37 	virtual ~SensorProcessor() {}
38 	// processing of a single physically measured value - one after another, returns the processed value
39 	// may also store data in the local variables of the sensor processor and give it out at the postcomputation stage
ProcessCurrentValue(double time,double value)40 	virtual double ProcessCurrentValue(double time, double value) { return value; }
41 	// tells whether this processor performs operation on the whole time history of the signal;
42 	// if yes, then the sensor must store data in memory
NeedsSignalTimeHistoryForPostComputationProcessing()43 	virtual bool NeedsSignalTimeHistoryForPostComputationProcessing() { return false; }
44 	// tells whether this processor needs a file opened for writing
45 	// to store the results of the postcomputation processing
46 	// if yes, then the sensor must store data in memory
NeedsFileForPostComputationProcessing()47 	virtual bool NeedsFileForPostComputationProcessing() { return false; }
48 	// - performes postcomputation signal processing
49 	// - may process the whole time signal of the sensor or give out data, accumulated during the computation
50 	//   (the first two arguments are empty if none of the sensor processors has requested time history)
51 	// - output is the vector of values,
52 	//   which are then assembled into "SignalProcessingEvaluationData" and may be used for optimization or sensitivity analysis
53 	// - may write the results to the provided file stream
54 	//   (the last argument is NULL if none of the sensor processors has requested a file stream)
DoPostComputationProcessing(TArray<double> & sensorHistoryTimes,TArray<double> & sensorHistoryValues,ofstream * outputFile)55 	virtual TArray<double> DoPostComputationProcessing(TArray<double> & sensorHistoryTimes, TArray<double> & sensorHistoryValues, ofstream * outputFile) { return TArray<double>(); }
56 	// a sensor processor must be able to clone itself
57 	virtual SensorProcessor * GetCopy() = 0;
58 };