openETCS
case study for the European Train Control System developed for the authors dissertation
Signals | Public Member Functions | Private Attributes | List of all members
oETCS::DF::PS::SIM::COdometer Class Reference

simulative odometer class More...

#include <Simulation.h>

Inheritance diagram for oETCS::DF::PS::SIM::COdometer:
Inheritance graph
Collaboration diagram for oETCS::DF::PS::SIM::COdometer:
Collaboration graph

Signals

void Error (const ::QString &ErrorMessage)
 signal for sending an error

Public Member Functions

 COdometer (const double &dInitialPosition=0.0, const double &dInitialVelocity=0.0) throw ()
 default/general constructor
virtual double GetAbsolutePosition ()
 gets the current absolute position
virtual double GetVelocity ()
 gets the current velocity
void ResetPosition (const double &dPosition=0) throw ()
 resets the position
void SetVelocity (const double &dVelocity) throw ()
 sets the current velocity
virtual ~COdometer () throw ()
 destructor

Private Attributes

double m_dPosition
 current position in [m]
double m_dVelocity
 value of the current velocity in [km/h]
oETCS::DF::TIME_POINT_T m_LastCalculation
 last calculation time point for the position
::std::recursive_mutex m_Mutex
 muteable exclusion for internal states

Detailed Description

simulative odometer class

Definition at line 53 of file Simulation.h.

Constructor & Destructor Documentation

oETCS::DF::PS::SIM::COdometer::COdometer ( const double &  dInitialPosition = 0.0,
const double &  dInitialVelocity = 0.0 
) throw ()
explicit

default/general constructor

Parameters
[in]dInitialPositionoptional initial position (default 0.0) in [m]
[in]dInitialVelocityoptional initial velocity (default 0.0) in [km/h]

Definition at line 39 of file Simulation.cpp.

oETCS::DF::PS::SIM::COdometer::~COdometer ( ) throw ()
virtual

destructor

Reimplemented from oETCS::DF::PS::COdometer.

Definition at line 54 of file Simulation.cpp.

Member Function Documentation

void oETCS::DF::COdometer::Error ( const ::QString &  ErrorMessage)
signalinherited

signal for sending an error

This signal should be emitted in the case that an error in the HW ocurres.

Parameters
[in]ErrorMessagetextual description of the error

Definition at line 802 of file PlatformSpecificClientsMOC.cpp.

double oETCS::DF::PS::SIM::COdometer::GetAbsolutePosition ( )
virtual

gets the current absolute position

Calculates the position by integrating the current speed over the time difference from the last calculation time point m_LastCalculation.

Returns
current absolute position in [m]

Reimplemented from oETCS::DF::PS::COdometer.

Definition at line 65 of file Simulation.cpp.

References m_dPosition, m_dVelocity, m_LastCalculation, and m_Mutex.

Referenced by GetPosition().

Here is the caller graph for this function:

double oETCS::DF::PS::SIM::COdometer::GetVelocity ( )
virtual

gets the current velocity

Returns
current velocity in [km/h]

Reimplemented from oETCS::DF::PS::COdometer.

Definition at line 97 of file Simulation.cpp.

References m_dVelocity, and m_Mutex.

Referenced by GetVelocity(), and oETCS::DF::PS::SIM::CServiceBrake::OdometerThread().

Here is the caller graph for this function:

void oETCS::DF::PS::SIM::COdometer::ResetPosition ( const double &  dPosition = 0) throw ()

resets the position

Also resets the last calculation time to now.

Parameters
[in]dPositionoptinal position in [m]

Definition at line 154 of file Simulation.cpp.

Referenced by ResetPosition().

Here is the caller graph for this function:

void oETCS::DF::PS::SIM::COdometer::SetVelocity ( const double &  dVelocity) throw ()

sets the current velocity

Also calculates the position by integrating the old speed over the time difference from the last calculation time point m_LastCalculation.

Parameters
[in]dVelocitynew velocity in [km/s]

Definition at line 122 of file Simulation.cpp.

Referenced by oETCS::DF::PS::SIM::CServiceBrake::OdometerThread(), and SetVelocity().

Here is the caller graph for this function:

Member Data Documentation

double oETCS::DF::PS::SIM::COdometer::m_dPosition
private

current position in [m]

Definition at line 129 of file Simulation.h.

Referenced by GetAbsolutePosition().

double oETCS::DF::PS::SIM::COdometer::m_dVelocity
private

value of the current velocity in [km/h]

Definition at line 122 of file Simulation.h.

Referenced by GetAbsolutePosition(), and GetVelocity().

oETCS::DF::TIME_POINT_T oETCS::DF::PS::SIM::COdometer::m_LastCalculation
private

last calculation time point for the position

Definition at line 136 of file Simulation.h.

Referenced by GetAbsolutePosition().

::std::recursive_mutex oETCS::DF::PS::SIM::COdometer::m_Mutex
private

muteable exclusion for internal states

Definition at line 143 of file Simulation.h.

Referenced by GetAbsolutePosition(), and GetVelocity().


The documentation for this class was generated from the following files:

Copyright (C) 2010-2012 Johannes Feuser (feuser@uni-bremen.de)
The openETCS library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
The openETCS library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with the openETCS library. If not, see "http://www.gnu.org/licenses/.