![]() |
User Manual, Developers Guide and API Documentation |
![]() |
#include <distribution/TimeDependent.hpp>


Public Member Functions | |
| virtual double | operator() () |
| Draw value from current Distribution. | |
| virtual std::string | paramString () const |
| returns a string describing distribution and parameters | |
| TimeDependent (wns::rng::RNGen *rng, const wns::pyconfig::View &view) | |
| pyconfig::View Constructor with RNGen | |
| TimeDependent (const wns::pyconfig::View &view) | |
| pyconfig::View Constructor | |
| virtual | ~TimeDependent () |
| Destructor. | |
Private Types | |
| typedef std::map< simTimeType, DistributionEvent > | EventContainer |
Private Member Functions | |
| void | init () |
| void | queueNextDistribution () |
| Queue Event to create next Distribution (if events left). | |
| void | removeDistribution () |
| Deletes a Distribution and sets pointer to NULL. | |
| void | setDistribution (const wns::pyconfig::View &distConfig) |
| Set new distribution according to pyconfig::View. | |
Private Attributes | |
| wns::pyconfig::View | config_ |
| Distribution * | distribution_ |
| Current distribution. | |
| EventContainer | events_ |
| Stores events with new distributions. | |
Classes | |
| class | DistributionEvent |
| Carries the View to create new Distribution from. More... | |
The class works as follows: It reads a list of Events from the pyconfig::View. The Events will be queued into the EventContainer "events". Each event holds a configuration for a distribution. At the time the event will be executed, it will set a new distribution in this class.
Here are two examples. One for configuration:
import openwns.distributio
dist = openwns.distribution.TimeDependent()
dist.eventList.append(openwns.distribution.Event(0.0, openwns.distribution.Fixed(47)))
dist.eventList.append(openwns.distribution.Event(2.0, openwns.distribution.Fixed(11)))
dist.eventList.append(openwns.distribution.Event(5.0, openwns.distribution.Fixed(8)))
dist.eventList.append(openwns.distribution.Event(11.0, openwns.distribution.Fixed(15)))
This will create values like this:
|
|
47-|----|
| |
| |
15-| | |---------------------
| | |
11-| |---------| |
| | | |
8 -| | |-----------------------|
___|____|_________|_______________________|_____________________
| | | | (t)
2 5 11
Usage in C++:
TimeDependent t(config.get("dist")); WNS_ASSERT_MAX_REL_ERROR(47.0, t(), 1E-6); wns::simulator::getEventScheduler()->processOneEvent(); WNS_ASSERT_MAX_REL_ERROR(11.0, t(), 1E-6); WNS_ASSERT_MAX_REL_ERROR(simTimeType(2.0), wns::simulator::getEventScheduler()->getTime(), 1E-6); wns::simulator::getEventScheduler()->processOneEvent(); WNS_ASSERT_MAX_REL_ERROR(8.0, t(), 1E-6); WNS_ASSERT_MAX_REL_ERROR(simTimeType(5.0), wns::simulator::getEventScheduler()->getTime(), 1E-6); wns::simulator::getEventScheduler()->processOneEvent(); WNS_ASSERT_MAX_REL_ERROR(15.0, t(), 1E-6); WNS_ASSERT_MAX_REL_ERROR(simTimeType(11.0), wns::simulator::getEventScheduler()->getTime(), 1E-6);
Definition at line 75 of file TimeDependent.hpp.
typedef std::map<simTimeType, DistributionEvent> wns::distribution::TimeDependent::EventContainer [private] |
Definition at line 110 of file TimeDependent.hpp.
| TimeDependent::TimeDependent | ( | const wns::pyconfig::View & | view | ) | [explicit] |
Definition at line 70 of file TimeDependent.cpp.
| TimeDependent::TimeDependent | ( | wns::rng::RNGen * | rng, | |
| const wns::pyconfig::View & | view | |||
| ) | [explicit] |
Definition at line 79 of file TimeDependent.cpp.
| TimeDependent::~TimeDependent | ( | ) | [virtual] |
Definition at line 114 of file TimeDependent.cpp.
| void TimeDependent::init | ( | ) | [private] |
Definition at line 89 of file TimeDependent.cpp.
| double TimeDependent::operator() | ( | ) | [virtual] |
| std::string TimeDependent::paramString | ( | ) | const [virtual] |
| void TimeDependent::queueNextDistribution | ( | ) | [private] |
Definition at line 135 of file TimeDependent.cpp.
| void TimeDependent::removeDistribution | ( | ) | [private] |
Definition at line 155 of file TimeDependent.cpp.
| void TimeDependent::setDistribution | ( | const wns::pyconfig::View & | distConfig | ) | [private] |
Definition at line 146 of file TimeDependent.cpp.
Definition at line 172 of file TimeDependent.hpp.
Definition at line 162 of file TimeDependent.hpp.
Definition at line 170 of file TimeDependent.hpp.
1.5.5