Coding Guideline: Fixes.
Sorry, for the small changesets. Change-Id: I12e7b1b4efff0c63020613e399f8185ace97aec7
This commit is contained in:
@ -16,7 +16,6 @@
|
|||||||
*/
|
*/
|
||||||
class RealtimeLogger : public fail::ExperimentFlow
|
class RealtimeLogger : public fail::ExperimentFlow
|
||||||
{
|
{
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const fail::ElfSymbol m_symbol; //!< the target's memory symbol the plugin is listening on
|
const fail::ElfSymbol m_symbol; //!< the target's memory symbol the plugin is listening on
|
||||||
std::string m_outputfile; //!< the output filename
|
std::string m_outputfile; //!< the output filename
|
||||||
|
|||||||
@ -37,11 +37,13 @@ uint8_t SignalGenerator::handleEvent(void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Sine::Sine(const SineParams_t param) {
|
Sine::Sine(const SineParams_t param)
|
||||||
|
{
|
||||||
m_params.push_back(param);
|
m_params.push_back(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
double Sine::calculate() const {
|
double Sine::calculate() const
|
||||||
|
{
|
||||||
simtime_t tps = ticksPerSecond();
|
simtime_t tps = ticksPerSecond();
|
||||||
if(tps == 0){
|
if(tps == 0){
|
||||||
// Simulator speed not valid.
|
// Simulator speed not valid.
|
||||||
|
|||||||
@ -24,17 +24,18 @@ class SignalForm {
|
|||||||
|
|
||||||
mutable fail::Logger m_log;
|
mutable fail::Logger m_log;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Signalgenerator just calls the calculate method of a derived signal
|
* Signalgenerator just calls the calculate method of a derived signal
|
||||||
* form.
|
* form.
|
||||||
*/
|
*/
|
||||||
virtual double calculate(void) const = 0;
|
virtual double calculate(void) const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
SignalForm() : m_log("SigForm", false) {};
|
SignalForm() : m_log("SigForm", false) {};
|
||||||
|
|
||||||
fail::simtime_t ticksPerSecond(void) const {
|
fail::simtime_t ticksPerSecond(void) const
|
||||||
|
{
|
||||||
fail::simtime_t ticksPerSec = fail::simulator.getTimerTicksPerSecond();
|
fail::simtime_t ticksPerSec = fail::simulator.getTimerTicksPerSecond();
|
||||||
if(ticksPerSec == 0){
|
if(ticksPerSec == 0){
|
||||||
m_log << "Warning: Timer ticks per second equals 0" << std::endl;
|
m_log << "Warning: Timer ticks per second equals 0" << std::endl;
|
||||||
@ -84,8 +85,9 @@ private:
|
|||||||
* Generating superimposed sine waves,
|
* Generating superimposed sine waves,
|
||||||
* according to the SineParams_t parameters.
|
* according to the SineParams_t parameters.
|
||||||
*/
|
*/
|
||||||
class Sine : public SignalForm {
|
class Sine : public SignalForm
|
||||||
public:
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
//! Parameter set for a single wave
|
//! Parameter set for a single wave
|
||||||
struct SineParams_t {
|
struct SineParams_t {
|
||||||
@ -106,7 +108,8 @@ class Sine : public SignalForm {
|
|||||||
* simulator time t (in seconds):
|
* simulator time t (in seconds):
|
||||||
* \f$x = sin(2 pi f t)\f$
|
* \f$x = sin(2 pi f t)\f$
|
||||||
**/
|
**/
|
||||||
double sinus(double freq_hertz, double t) const {
|
double sinus(double freq_hertz, double t) const
|
||||||
|
{
|
||||||
return sin((2. * MYPI * freq_hertz) * t);
|
return sin((2. * MYPI * freq_hertz) * t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user