|
@@ -49,7 +49,8 @@ namespace artis {
|
|
|
typedef Parameters parameters_type;
|
|
|
typedef GraphParameters graph_parameters_type;
|
|
|
|
|
|
- Coordinator(const std::string& name, const Parameters& parameters, const GraphParameters& graph_parameters)
|
|
|
+ Coordinator(const std::string& name, const Parameters& parameters,
|
|
|
+ const GraphParameters& graph_parameters)
|
|
|
:
|
|
|
common::Model<Time>(name),
|
|
|
common::Coordinator<Time>(name),
|
|
@@ -79,13 +80,20 @@ namespace artis {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- typename Time::type start(const typename Time::type& t)
|
|
|
+ typename Time::type start(const typename Time::type& t)
|
|
|
{
|
|
|
+// When receive (START,t)
|
|
|
+// send (START,t) to {I | I ∈ C}
|
|
|
+// tl ← t
|
|
|
+// tn ← min{t N,I | I ∈ C}
|
|
|
+// End
|
|
|
|
|
|
#ifdef WITH_TRACE
|
|
|
common::Trace<Time>::trace()
|
|
|
<< common::TraceElement<Time>(type::get_name(), t,
|
|
|
- common::TraceType::I_MESSAGE)
|
|
|
+ common::FormalismType::PDEVS,
|
|
|
+ common::FunctionType::I_MESSAGE,
|
|
|
+ common::LevelType::FORMALISM)
|
|
|
<< ": BEFORE => " << "tl = " << type::_tl << " ; tn = "
|
|
|
<< type::_tn;
|
|
|
common::Trace<Time>::trace().flush();
|
|
@@ -102,7 +110,9 @@ namespace artis {
|
|
|
#ifdef WITH_TRACE
|
|
|
common::Trace<Time>::trace()
|
|
|
<< common::TraceElement<Time>(type::get_name(), t,
|
|
|
- common::TraceType::I_MESSAGE)
|
|
|
+ common::FormalismType::PDEVS,
|
|
|
+ common::FunctionType::I_MESSAGE,
|
|
|
+ common::LevelType::FORMALISM)
|
|
|
<< ": AFTER => " << "tl = " << type::_tl
|
|
|
<< " ; tn = " << type::_tn;
|
|
|
common::Trace<Time>::trace().flush();
|
|
@@ -111,22 +121,23 @@ namespace artis {
|
|
|
return type::_tn;
|
|
|
}
|
|
|
|
|
|
-/**************************************************
|
|
|
- * when *-message(t)
|
|
|
- * calculate IMM (models with tn = t in scheduler
|
|
|
- * calculate INF from IMM
|
|
|
- * for each e in IMM U INF
|
|
|
- * calculate influencer
|
|
|
- * ...
|
|
|
- * send done to parent
|
|
|
- **************************************************/
|
|
|
void output(const typename Time::type& t)
|
|
|
{
|
|
|
+// When *-message(t)
|
|
|
+// calculate IMM (models with tn = t in scheduler
|
|
|
+// calculate INF from IMM
|
|
|
+// for each e in IMM U INF
|
|
|
+// calculate influencer
|
|
|
+// ...
|
|
|
+// send done to parent
|
|
|
+// End
|
|
|
|
|
|
#ifdef WITH_TRACE
|
|
|
common::Trace<Time>::trace()
|
|
|
<< common::TraceElement<Time>(type::get_name(), t,
|
|
|
- common::TraceType::OUTPUT)
|
|
|
+ common::FormalismType::PDEVS,
|
|
|
+ common::FunctionType::OUTPUT,
|
|
|
+ common::LevelType::FORMALISM)
|
|
|
<< ": BEFORE => " << "tl = " << type::_tl << " ; tn = "
|
|
|
<< type::_tn << " ; scheduler = " << _event_table.to_string();
|
|
|
common::Trace<Time>::trace().flush();
|
|
@@ -140,7 +151,9 @@ namespace artis {
|
|
|
#ifdef WITH_TRACE
|
|
|
common::Trace<Time>::trace()
|
|
|
<< common::TraceElement<Time>(type::get_name(), t,
|
|
|
- common::TraceType::OUTPUT)
|
|
|
+ common::FormalismType::PDEVS,
|
|
|
+ common::FunctionType::OUTPUT,
|
|
|
+ common::LevelType::FORMALISM)
|
|
|
<< ": IMM = " << IMM.to_string();
|
|
|
common::Trace<Time>::trace().flush();
|
|
|
#endif
|
|
@@ -152,7 +165,9 @@ namespace artis {
|
|
|
#ifdef WITH_TRACE
|
|
|
common::Trace<Time>::trace()
|
|
|
<< common::TraceElement<Time>(type::get_name(), t,
|
|
|
- common::TraceType::OUTPUT)
|
|
|
+ common::FormalismType::PDEVS,
|
|
|
+ common::FunctionType::OUTPUT,
|
|
|
+ common::LevelType::FORMALISM)
|
|
|
<< ": AFTER => " << "tl = " << type::_tl << " ; tn = "
|
|
|
<< type::_tn << " ; scheduler = " << _event_table.to_string();
|
|
|
common::Trace<Time>::trace().flush();
|
|
@@ -160,24 +175,25 @@ namespace artis {
|
|
|
|
|
|
}
|
|
|
|
|
|
-/*******************************************************************
|
|
|
- * when x-message(t)
|
|
|
- * receivers = { r | r in children, N in Ir, Z(N,r)(x) isn't empty
|
|
|
- * for each r in receivers
|
|
|
- * send x-message(Z(N,r)(x), t) with input value Z(N,r)(x) to r
|
|
|
- * for each r in IMM and not in receivers
|
|
|
- * send x-message(empty, t) to r
|
|
|
- * sort event list according to tn
|
|
|
- * tl = t
|
|
|
- * tn = min(tn_d | d in D)
|
|
|
- *******************************************************************/
|
|
|
typename Time::type transition(const typename Time::type& t)
|
|
|
{
|
|
|
+// When x-message(t)
|
|
|
+// receivers = { r | r in children, N in Ir, Z(N,r)(x) isn't empty }
|
|
|
+// for each r in receivers
|
|
|
+// send x-message(Z(N,r)(x), t) with input value Z(N,r)(x) to r
|
|
|
+// for each r in IMM and not in receivers
|
|
|
+// send x-message(empty, t) to r
|
|
|
+// sort event list according to tn
|
|
|
+// tl = t
|
|
|
+// tn = min(tn_d | d in D)
|
|
|
+// End
|
|
|
|
|
|
#ifdef WITH_TRACE
|
|
|
common::Trace<Time>::trace()
|
|
|
<< common::TraceElement<Time>(type::get_name(), t,
|
|
|
- common::TraceType::S_MESSAGE)
|
|
|
+ common::FormalismType::PDEVS,
|
|
|
+ common::FunctionType::S_MESSAGE,
|
|
|
+ common::LevelType::FORMALISM)
|
|
|
<< ": BEFORE => " << "tl = " << type::_tl << " ; tn = "
|
|
|
<< type::_tn << " ; scheduler = " << _event_table.to_string();
|
|
|
common::Trace<Time>::trace().flush();
|
|
@@ -193,7 +209,9 @@ namespace artis {
|
|
|
#ifdef WITH_TRACE
|
|
|
common::Trace<Time>::trace()
|
|
|
<< common::TraceElement<Time>(type::get_name(), t,
|
|
|
- common::TraceType::S_MESSAGE)
|
|
|
+ common::FormalismType::PDEVS,
|
|
|
+ common::FunctionType::S_MESSAGE,
|
|
|
+ common::LevelType::FORMALISM)
|
|
|
<< ": receivers = " << receivers.to_string();
|
|
|
common::Trace<Time>::trace().flush();
|
|
|
#endif
|
|
@@ -210,7 +228,9 @@ namespace artis {
|
|
|
#ifdef WITH_TRACE
|
|
|
common::Trace<Time>::trace()
|
|
|
<< common::TraceElement<Time>(type::get_name(), t,
|
|
|
- common::TraceType::S_MESSAGE)
|
|
|
+ common::FormalismType::PDEVS,
|
|
|
+ common::FunctionType::S_MESSAGE,
|
|
|
+ common::LevelType::FORMALISM)
|
|
|
<< ": AFTER => " << "tl = " << type::_tl << " ; tn = "
|
|
|
<< type::_tn << " ; scheduler = " << _event_table.to_string();
|
|
|
common::Trace<Time>::trace().flush();
|
|
@@ -226,7 +246,9 @@ namespace artis {
|
|
|
#ifdef WITH_TRACE
|
|
|
common::Trace<Time>::trace()
|
|
|
<< common::TraceElement<Time>(type::get_name(), t,
|
|
|
- common::TraceType::POST_EVENT)
|
|
|
+ common::FormalismType::PDEVS,
|
|
|
+ common::FunctionType::POST_EVENT,
|
|
|
+ common::LevelType::FORMALISM)
|
|
|
<< ": BEFORE => " << event.to_string();
|
|
|
common::Trace<Time>::trace().flush();
|
|
|
#endif
|
|
@@ -239,7 +261,9 @@ namespace artis {
|
|
|
#ifdef WITH_TRACE
|
|
|
common::Trace<Time>::trace()
|
|
|
<< common::TraceElement<Time>(type::get_name(), t,
|
|
|
- common::TraceType::POST_EVENT)
|
|
|
+ common::FormalismType::PDEVS,
|
|
|
+ common::FunctionType::POST_EVENT,
|
|
|
+ common::LevelType::FORMALISM)
|
|
|
<< ": AFTER => " << event.to_string();
|
|
|
common::Trace<Time>::trace().flush();
|
|
|
#endif
|
|
@@ -257,7 +281,9 @@ namespace artis {
|
|
|
#ifdef WITH_TRACE
|
|
|
common::Trace<Time>::trace()
|
|
|
<< common::TraceElement<Time>(type::get_name(), t,
|
|
|
- common::TraceType::Y_MESSAGE)
|
|
|
+ common::FormalismType::PDEVS,
|
|
|
+ common::FunctionType::Y_MESSAGE,
|
|
|
+ common::LevelType::FORMALISM)
|
|
|
<< ": BEFORE => " << "tl = " << type::_tl << " ; tn = "
|
|
|
<< type::_tn << " ; bag = " << bag.to_string()
|
|
|
<< " ; " << _event_table.to_string();
|
|
@@ -271,7 +297,9 @@ namespace artis {
|
|
|
#ifdef WITH_TRACE
|
|
|
common::Trace<Time>::trace()
|
|
|
<< common::TraceElement<Time>(type::get_name(), t,
|
|
|
- common::TraceType::Y_MESSAGE)
|
|
|
+ common::FormalismType::PDEVS,
|
|
|
+ common::FunctionType::Y_MESSAGE,
|
|
|
+ common::LevelType::FORMALISM)
|
|
|
<< ": AFTER => " << "tl = " << type::_tl << " ; tn = " << type::_tn
|
|
|
<< " ; " << _event_table.to_string();
|
|
|
common::Trace<Time>::trace().flush();
|