|
@@ -90,10 +90,6 @@ public:
|
|
|
// delay();
|
|
|
++_value.x;
|
|
|
--_value.y;
|
|
|
-
|
|
|
- // std::cout << t << ": " << get_name() << " => dint -> "
|
|
|
- // << _value.x << " " << _value.y << std::endl;
|
|
|
-
|
|
|
if (_phase == SEND) {
|
|
|
_phase = WAIT;
|
|
|
}
|
|
@@ -109,13 +105,6 @@ public:
|
|
|
(void)msgs;
|
|
|
#endif
|
|
|
|
|
|
- // for (common::Bag < common::DoubleTime >::const_iterator it =
|
|
|
- // msgs.begin(); it != msgs.end(); ++it) {
|
|
|
- // std::cout << t << ": " << get_name()
|
|
|
- // << " => " << it->get_content().get_content < double >()
|
|
|
- // << std::endl;
|
|
|
- // }
|
|
|
-
|
|
|
#ifdef WITH_TRACE
|
|
|
common::Trace < common::DoubleTime >::trace()
|
|
|
<< common::TraceElement < common::DoubleTime >(
|
|
@@ -138,9 +127,6 @@ public:
|
|
|
(void)msgs;
|
|
|
#endif
|
|
|
|
|
|
- // std::cout << t << ": " << get_name() << " => " << msgs.to_string()
|
|
|
- // << std::endl;
|
|
|
-
|
|
|
#ifdef WITH_TRACE
|
|
|
common::Trace < common::DoubleTime >::trace()
|
|
|
<< common::TraceElement < common::DoubleTime >(
|
|
@@ -206,8 +192,6 @@ public:
|
|
|
common::ExternalEvent < common::DoubleTime >(
|
|
|
"out", common::Value(_value)));
|
|
|
|
|
|
- // std::cout << t << ": " << get_name() << " => lambda" << std::endl;
|
|
|
-
|
|
|
#ifdef WITH_TRACE
|
|
|
common::Trace < common::DoubleTime >::trace()
|
|
|
<< common::TraceElement < common::DoubleTime >(
|
|
@@ -256,11 +240,6 @@ public:
|
|
|
common::Trace < common::DoubleTime >::trace().flush();
|
|
|
#endif
|
|
|
|
|
|
- // delay();
|
|
|
-
|
|
|
- // std::cout << t << ": " << get_name() << " => dint -> "
|
|
|
- // << _value << std::endl;
|
|
|
-
|
|
|
if (_phase == SEND) {
|
|
|
_phase = WAIT;
|
|
|
}
|
|
@@ -276,14 +255,6 @@ public:
|
|
|
(void)msgs;
|
|
|
#endif
|
|
|
|
|
|
- // for (common::Bag < common::DoubleTime >::const_iterator it =
|
|
|
- // msgs.begin(); it != msgs.end(); ++it) {
|
|
|
- // std::cout << t << ": " << get_name()
|
|
|
- // << " => " << it->get_content().get_content < data >().x
|
|
|
- // << " " << it->get_content().get_content < data >().y
|
|
|
- // << std::endl;
|
|
|
- // }
|
|
|
-
|
|
|
#ifdef WITH_TRACE
|
|
|
common::Trace < common::DoubleTime >::trace()
|
|
|
<< common::TraceElement < common::DoubleTime >(
|
|
@@ -367,8 +338,6 @@ public:
|
|
|
#endif
|
|
|
common::Bag < common::DoubleTime > msgs;
|
|
|
|
|
|
- // std::cout << t << ": " << get_name() << " => lambda" << std::endl;
|
|
|
-
|
|
|
msgs.push_back(common::ExternalEvent <
|
|
|
common::DoubleTime >(
|
|
|
"out", common::Value(_value)));
|
|
@@ -461,6 +430,81 @@ public:
|
|
|
virtual ~ThreeStateModel()
|
|
|
{ }
|
|
|
|
|
|
+ void dconf(typename common::DoubleTime::type t,
|
|
|
+ typename common::DoubleTime::type e,
|
|
|
+ const common::Bag < common::DoubleTime >& msgs)
|
|
|
+ {
|
|
|
+ dext(t, e, msgs);
|
|
|
+ }
|
|
|
+
|
|
|
+ void dext(typename common::DoubleTime::type /* t */,
|
|
|
+ typename common::DoubleTime::type /* e */,
|
|
|
+ const common::Bag < common::DoubleTime >& msgs)
|
|
|
+ {
|
|
|
+ for (common::Bag < common::DoubleTime >::const_iterator
|
|
|
+ it = msgs.begin(); it != msgs.end(); ++it) {
|
|
|
+ ++n;
|
|
|
+ }
|
|
|
+ if (sigma == 1) {
|
|
|
+ if (n > 3) {
|
|
|
+ ++index;
|
|
|
+ if (index == scales.size()) {
|
|
|
+ index = 0;
|
|
|
+ }
|
|
|
+ sigma = std::numeric_limits < double >::max();
|
|
|
+ if (scales[index] == 1) {
|
|
|
+ scales[index] = 2;
|
|
|
+ } else {
|
|
|
+ scales[index] = 1;
|
|
|
+ }
|
|
|
+ n = 0;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ sigma = 1;
|
|
|
+ n = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ void dint(typename common::DoubleTime::type t)
|
|
|
+ {
|
|
|
+ mark_full(t);
|
|
|
+ if (full_N()) {
|
|
|
+ raz();
|
|
|
+ }
|
|
|
+ compute();
|
|
|
+ }
|
|
|
+
|
|
|
+ typename common::DoubleTime::type start(
|
|
|
+ typename common::DoubleTime::type t)
|
|
|
+ {
|
|
|
+ heights = { 0, 0, 0, 0, 0 };
|
|
|
+ speeds = { 0.21, 0.3, 0.7, 0.56, 0.14 };
|
|
|
+ scales = { 1, 1, 1, 1, 1 };
|
|
|
+ index = 0;
|
|
|
+ n = 0;
|
|
|
+ sigma = 1;
|
|
|
+ _last_time = t;
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ typename common::DoubleTime::type ta(
|
|
|
+ typename common::DoubleTime::type /* t */) const
|
|
|
+ { return sigma; }
|
|
|
+
|
|
|
+ common::Bag < common::DoubleTime > lambda(
|
|
|
+ typename common::DoubleTime::type /* t */) const
|
|
|
+ {
|
|
|
+ common::Bag < common::DoubleTime > msgs;
|
|
|
+
|
|
|
+ if (full()) {
|
|
|
+ msgs.push_back(common::ExternalEvent < common::DoubleTime >(
|
|
|
+ "out", 0));
|
|
|
+ }
|
|
|
+ return msgs;
|
|
|
+ }
|
|
|
+
|
|
|
+private:
|
|
|
+
|
|
|
void compute()
|
|
|
{
|
|
|
for (unsigned int i = 0; i < heights.size(); ++i) {
|
|
@@ -539,43 +583,12 @@ public:
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- void dint(typename common::DoubleTime::type t)
|
|
|
- {
|
|
|
- mark_full(t);
|
|
|
- if (full_N()) {
|
|
|
- raz();
|
|
|
- }
|
|
|
- compute();
|
|
|
- }
|
|
|
-
|
|
|
- typename common::DoubleTime::type start(
|
|
|
- typename common::DoubleTime::type t)
|
|
|
- {
|
|
|
- heights = { 0, 0, 0, 0, 0 };
|
|
|
- speeds = { 0.21, 0.3, 0.7, 0.56, 0.14 };
|
|
|
- scales = { 1, 1, 1, 1, 1 };
|
|
|
- _last_time = t;
|
|
|
- return 0;
|
|
|
- }
|
|
|
-
|
|
|
- typename common::DoubleTime::type ta(
|
|
|
- typename common::DoubleTime::type /* t */) const
|
|
|
- { return 1; }
|
|
|
-
|
|
|
- common::Bag < common::DoubleTime > lambda(
|
|
|
- typename common::DoubleTime::type t) const
|
|
|
- {
|
|
|
- if (full()) {
|
|
|
- std::cout << (t - _last_time) << " ";
|
|
|
- // display_full();
|
|
|
- }
|
|
|
- return common::Bag < common::DoubleTime >();
|
|
|
- }
|
|
|
-
|
|
|
-private:
|
|
|
std::vector < double > heights;
|
|
|
std::vector < double > speeds;
|
|
|
std::vector < double > scales;
|
|
|
+ unsigned int index;
|
|
|
+ unsigned int n;
|
|
|
+ typename common::DoubleTime::type sigma;
|
|
|
|
|
|
typename common::DoubleTime::type _last_time;
|
|
|
};
|