Parcourir la source

Add two items in trace (formalism and level)

Eric Ramat il y a 4 ans
Parent
commit
044f94d936

+ 2 - 8
src/artis-star/common/Coordinator.hpp

@@ -95,10 +95,7 @@ namespace artis {
                 }
             }
 
-            void input_port(common::Port p)
-            {
-                Coordinator<Time>::add_in_port(p);
-            }
+            void input_port(common::Port p) { Coordinator<Time>::add_in_port(p); }
 
             void input_ports(std::initializer_list<common::Port> list)
             {
@@ -111,10 +108,7 @@ namespace artis {
 
             virtual bool is_atomic() const { return false; }
 
-            void output_port(common::Port p)
-            {
-                Coordinator<Time>::add_out_port(p);
-            }
+            void output_port(common::Port p) { Coordinator<Time>::add_out_port(p); }
 
             void output_ports(std::initializer_list<common::Port> list)
             {

+ 11 - 0
src/artis-star/common/RootCoordinator.hpp

@@ -73,6 +73,17 @@ namespace artis {
 
             void run(const common::context::Context<Time>& context)
             {
+//             DSDE synchroniser
+//               When receive (START,t)
+//                  send (START,0) to child
+//                  while (t N,child ≠ ∞) do
+//                    "Computes the output of all the models"
+//                    send (OUTPUT,t N,child ) to child
+//                    "Makes the transition"
+//                    send (TRANSITION,t N,child ,φ) to child
+//                  endWhile
+//               end
+
                 _observer.init();
                 if (context.valid()) {
                     _root.restore(context.state());

+ 1 - 1
src/artis-star/common/utils/CMakeLists.txt

@@ -6,7 +6,7 @@ INCLUDE_DIRECTORIES(
 LINK_DIRECTORIES(
         ${Boost_LIBRARY_DIRS})
 
-SET(COMMON_UTILS_HPP Multithreading.hpp String.hpp Trace.hpp)
+SET(COMMON_UTILS_HPP FormalismType.hpp FunctionType.hpp LevelType.hpp Multithreading.hpp String.hpp Trace.hpp)
 
 INSTALL(FILES ${COMMON_UTILS_HPP} DESTINATION
         ${ARTIS_INCLUDE_DIRS}/common/utils)

+ 74 - 0
src/artis-star/common/utils/FormalismType.hpp

@@ -0,0 +1,74 @@
+/**
+ * @file FormalismType.hpp
+ * @author The ARTIS Development Team
+ * See the AUTHORS or Authors.txt file
+ */
+
+/*
+ * ARTIS - the multimodeling and simulation environment
+ * This file is a part of the ARTIS environment
+ *
+ * Copyright (C) 2013-2019 ULCO http://www.univ-littoral.fr
+ *
+ * This program 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
+ * (at your option) any later version.
+ *
+ * This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef COMMON_UTILS_FORMALISM_TYPE
+#define COMMON_UTILS_FORMALISM_TYPE 1
+
+#include <string>
+
+namespace artis {
+    namespace common {
+
+        class FormalismType {
+        public:
+            enum Values {
+                NONE = 0, DEVS, DSDE, PDEVS, QSS, DTSS, GDEVS, CELLDEVS, FDDEVS, DESS, SSS
+            };
+
+            static std::string to_string(const FormalismType::Values& s)
+            {
+                switch (s) {
+                case NONE:
+                    return "none";
+                case DEVS:
+                    return "devs";
+                case DSDE:
+                    return "dsde";
+                case PDEVS:
+                    return "pdevs";
+                case QSS:
+                    return "qss";
+                case DTSS:
+                    return "dtss";
+                case GDEVS:
+                    return "gdevs";
+                case CELLDEVS:
+                    return "celldevs";
+                case FDDEVS:
+                    return "fddevs";
+                case DESS:
+                    return "dess";
+                case SSS:
+                    return "sss";
+                };
+                return "";
+            }
+        };
+
+    }
+}
+
+#endif

+ 81 - 0
src/artis-star/common/utils/FunctionType.hpp

@@ -0,0 +1,81 @@
+/**
+ * @file TraceType.hpp
+ * @author The ARTIS Development Team
+ * See the AUTHORS or Authors.txt file
+ */
+
+/*
+ * ARTIS - the multimodeling and simulation environment
+ * This file is a part of the ARTIS environment
+ *
+ * Copyright (C) 2013-2019 ULCO http://www.univ-littoral.fr
+ *
+ * This program 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
+ * (at your option) any later version.
+ *
+ * This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef COMMON_UTILS_FUNCTION_TYPE
+#define COMMON_UTILS_FUNCTION_TYPE 1
+
+#include <string>
+
+namespace artis {
+    namespace common {
+
+        class FunctionType {
+        public:
+            enum Values {
+                NONE = 0, CONSTRUCTOR, I_MESSAGE, POST_EVENT, S_MESSAGE, Y_MESSAGE,
+                DELTA_INT, DELTA_EXT, DELTA_CONF, TA, LAMBDA, START, OUTPUT, TRANSITION
+            };
+
+            static std::string to_string(const FunctionType::Values& s)
+            {
+                switch (s) {
+                case NONE:
+                    return "none";
+                case CONSTRUCTOR:
+                    return "constructor";
+                case I_MESSAGE:
+                    return "i_message";
+                case POST_EVENT:
+                    return "post_event";
+                case S_MESSAGE:
+                    return "s_message";
+                case Y_MESSAGE:
+                    return "y_message";
+                case DELTA_INT:
+                    return "delta_int";
+                case DELTA_EXT:
+                    return "delta_ext";
+                case DELTA_CONF:
+                    return "delta_conf";
+                case TA:
+                    return "ta";
+                case LAMBDA:
+                    return "lambda";
+                case START:
+                    return "start";
+                case OUTPUT:
+                    return "output";
+                case TRANSITION:
+                    return "transition";
+                };
+                return "";
+            }
+        };
+
+    }
+}
+
+#endif

+ 60 - 0
src/artis-star/common/utils/LevelType.hpp

@@ -0,0 +1,60 @@
+/**
+ * @file LevelType.hpp
+ * @author The ARTIS Development Team
+ * See the AUTHORS or Authors.txt file
+ */
+
+/*
+ * ARTIS - the multimodeling and simulation environment
+ * This file is a part of the ARTIS environment
+ *
+ * Copyright (C) 2013-2019 ULCO http://www.univ-littoral.fr
+ *
+ * This program 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
+ * (at your option) any later version.
+ *
+ * This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef COMMON_UTILS_LEVEL_TYPE
+#define COMMON_UTILS_LEVEL_TYPE 1
+
+#include <string>
+
+namespace artis {
+    namespace common {
+
+        class LevelType {
+        public:
+            enum Values {
+                NONE = 0, COMMON, FORMALISM, USER
+            };
+
+            static std::string to_string(const LevelType::Values& s)
+            {
+                switch (s) {
+                case NONE:
+                    return "none";
+                case COMMON:
+                    return "common";
+                case FORMALISM:
+                    return "formalism";
+                case USER:
+                    return "user";
+                };
+                return "";
+            }
+        };
+
+    }
+}
+
+#endif

+ 44 - 50
src/artis-star/common/utils/Trace.hpp

@@ -27,66 +27,32 @@
 #ifndef COMMON_UTILS_TRACE
 #define COMMON_UTILS_TRACE 1
 
+#include <artis-star/common/utils/FormalismType.hpp>
+#include <artis-star/common/utils/FunctionType.hpp>
+#include <artis-star/common/utils/LevelType.hpp>
+
 #include <algorithm>
 #include <iterator>
 #include <memory>
 #include <mutex>
 #include <sstream>
-#include <string>
 #include <vector>
 
 namespace artis {
     namespace common {
 
-        class TraceType {
-        public:
-            enum Values {
-                NONE = 0, I_MESSAGE, POST_EVENT, S_MESSAGE, Y_MESSAGE,
-                DELTA_INT, DELTA_EXT, DELTA_CONF, TA, LAMBDA, START, OUTPUT, TRANSITION
-            };
-
-            static std::string to_string(const TraceType::Values& s)
-            {
-                switch (s) {
-                case NONE:
-                    return "none";
-                case I_MESSAGE:
-                    return "i_message";
-                case POST_EVENT:
-                    return "post_event";
-                case S_MESSAGE:
-                    return "s_message";
-                case Y_MESSAGE:
-                    return "y_message";
-                case DELTA_INT:
-                    return "delta_int";
-                case DELTA_EXT:
-                    return "delta_ext";
-                case DELTA_CONF:
-                    return "delta_conf";
-                case TA:
-                    return "ta";
-                case LAMBDA:
-                    return "lambda";
-                case START:
-                    return "start";
-                case OUTPUT:
-                    return "output";
-                case TRANSITION:
-                    return "transition";
-                };
-                return "";
-            }
-        };
-
         template<class Time>
         class TraceElement {
         public:
             TraceElement()
-                    :_time(Time::null), _type(TraceType::NONE) { }
+                    :_time(Time::null), _formalism_type(FormalismType::NONE),
+                     _function_type(FunctionType::NONE), _level_type(LevelType::NONE) { }
 
-            TraceElement(const std::string& model_name, typename Time::type time, const TraceType::Values& type)
-                    :_model_name(model_name), _time(time), _type(type) { }
+            TraceElement(const std::string& model_name, typename Time::type time,
+                    const FormalismType::Values& formalism_type,
+                    const FunctionType::Values& function_type, const LevelType::Values& level_type)
+                    :_model_name(model_name), _time(time), _formalism_type(formalism_type),
+                     _function_type(function_type), _level_type(level_type) { }
 
             virtual ~TraceElement() { }
 
@@ -96,14 +62,20 @@ namespace artis {
 
             typename Time::type get_time() const { return _time; }
 
-            const TraceType::Values& get_type() const { return _type; }
+            const FormalismType::Values& get_formalism_type() const { return _formalism_type; }
+
+            const FunctionType::Values& get_function_type() const { return _function_type; }
+
+            const LevelType::Values& get_level_type() const { return _level_type; }
 
             void set_comment(const std::string& comment) { _comment = comment; }
 
         private:
             std::string _model_name;
             typename Time::type _time;
-            TraceType::Values _type;
+            FormalismType::Values _formalism_type;
+            FunctionType::Values _function_type;
+            LevelType::Values _level_type;
             std::string _comment;
         };
 
@@ -136,13 +108,33 @@ namespace artis {
                 return result;
             }
 
-            TraceElements filter_type(const TraceType::Values& type) const
+            TraceElements filter_formalism_type(const FormalismType::Values& type) const
+            {
+                TraceElements result;
+
+                std::copy_if(TraceElements<Time>::begin(),
+                        TraceElements<Time>::end(), std::back_inserter(result),
+                        [type](TraceElement<Time> const& x) { return x.get_formalism_type() == type; });
+                return result;
+            }
+
+            TraceElements filter_function_type(const FunctionType::Values& type) const
+            {
+                TraceElements result;
+
+                std::copy_if(TraceElements<Time>::begin(),
+                        TraceElements<Time>::end(), std::back_inserter(result),
+                        [type](TraceElement<Time> const& x) { return x.get_function_type() == type; });
+                return result;
+            }
+
+            TraceElements filter_level_type(const LevelType::Values& type) const
             {
                 TraceElements result;
 
                 std::copy_if(TraceElements<Time>::begin(),
                         TraceElements<Time>::end(), std::back_inserter(result),
-                        [type](TraceElement<Time> const& x) { return x.get_type() == type; });
+                        [type](TraceElement<Time> const& x) { return x.get_level_type() == type; });
                 return result;
             }
 
@@ -153,7 +145,9 @@ namespace artis {
                 for (typename TraceElements<Time>::const_iterator it = TraceElements<Time>::begin();
                      it != TraceElements<Time>::end(); ++it) {
                     ss << "TRACE: " << it->get_model_name() << " at " << it->get_time() << " <";
-                    ss << TraceType::to_string(it->get_type()) << ">";
+                    ss << FormalismType::to_string(it->get_formalism_type()) << ", ";
+                    ss << FunctionType::to_string(it->get_function_type()) << ", ";
+                    ss << LevelType::to_string(it->get_level_type()) << ">";
                     if (not it->get_comment().empty()) {
                         ss << " => " << it->get_comment();
                     }

+ 30 - 10
src/artis-star/kernel/dtss/Coordinator.hpp

@@ -74,7 +74,9 @@ namespace artis {
 #ifdef WITH_TRACE
                 common::Trace<Time>::trace()
                         << common::TraceElement<Time>(type::get_name(), t,
-                                common::TraceType::I_MESSAGE)
+                                    common::FormalismType::DTSS,
+                                    common::FunctionType::I_MESSAGE,
+                                    common::LevelType::FORMALISM)
                         << ": BEFORE => " << "tl = " << type::_tl << " ; tn = "
                         << type::_tn;
                 common::Trace<Time>::trace().flush();
@@ -91,7 +93,9 @@ namespace artis {
 #ifdef WITH_TRACE
                 common::Trace<Time>::trace()
                         << common::TraceElement<Time>(type::get_name(), t,
-                                common::TraceType::I_MESSAGE)
+                                    common::FormalismType::DTSS,
+                                    common::FunctionType::I_MESSAGE,
+                                    common::LevelType::FORMALISM)
                         << ": AFTER => " << "tl = " << type::_tl << " ; tn = "
                         << type::_tn;
                 common::Trace<Time>::trace().flush();
@@ -107,7 +111,9 @@ namespace artis {
 #ifdef WITH_TRACE
                 common::Trace<Time>::trace()
                         << common::TraceElement<Time>(type::get_name(), t,
-                                common::TraceType::Y_MESSAGE)
+                                    common::FormalismType::DTSS,
+                                    common::FunctionType::Y_MESSAGE,
+                                    common::LevelType::FORMALISM)
                         << ": BEFORE => " << "tl = " << type::_tl << " ; tn = "
                         << type::_tn << " ; bag = " << bag.to_string();
                 common::Trace<Time>::trace().flush();
@@ -118,7 +124,9 @@ namespace artis {
 #ifdef WITH_TRACE
                 common::Trace<Time>::trace()
                         << common::TraceElement<Time>(type::get_name(), t,
-                                common::TraceType::Y_MESSAGE)
+                                    common::FormalismType::DTSS,
+                                    common::FunctionType::Y_MESSAGE,
+                                    common::LevelType::FORMALISM)
                         << ": BEFORE => " << "tl = " << type::_tl << " ; tn = "
                         << type::_tn;
                 common::Trace<Time>::trace().flush();
@@ -140,7 +148,9 @@ namespace artis {
 #ifdef WITH_TRACE
                 common::Trace<Time>::trace()
                         << common::TraceElement<Time>(type::get_name(), t,
-                                common::TraceType::OUTPUT)
+                                    common::FormalismType::DTSS,
+                                    common::FunctionType::LAMBDA,
+                                    common::LevelType::FORMALISM)
                         << ": BEFORE => " << "tl = " << type::_tl << " ; tn = "
                         << type::_tn;
                 common::Trace<Time>::trace().flush();
@@ -155,7 +165,9 @@ namespace artis {
 #ifdef WITH_TRACE
                 common::Trace<Time>::trace()
                         << common::TraceElement<Time>(type::get_name(), t,
-                                common::TraceType::OUTPUT)
+                                    common::FormalismType::DTSS,
+                                    common::FunctionType::LAMBDA,
+                                    common::LevelType::FORMALISM)
                         << ": AFTER => " << "tl = " << type::_tl << " ; tn = " << type::_tn;
                 common::Trace<Time>::trace().flush();
 #endif
@@ -169,7 +181,9 @@ namespace artis {
 #ifdef WITH_TRACE
                 common::Trace<Time>::trace()
                         << common::TraceElement<Time>(type::get_name(), t,
-                                common::TraceType::POST_EVENT)
+                                    common::FormalismType::DTSS,
+                                    common::FunctionType::POST_EVENT,
+                                    common::LevelType::FORMALISM)
                         << ": BEFORE => " << event.to_string();
                 common::Trace<Time>::trace().flush();
 #endif
@@ -183,7 +197,9 @@ namespace artis {
 #ifdef WITH_TRACE
                 common::Trace<Time>::trace()
                         << common::TraceElement<Time>(type::get_name(), t,
-                                common::TraceType::POST_EVENT)
+                                    common::FormalismType::DTSS,
+                                    common::FunctionType::POST_EVENT,
+                                    common::LevelType::FORMALISM)
                         << ": AFTER => " << event.to_string();
                 common::Trace<Time>::trace().flush();
 #endif
@@ -196,7 +212,9 @@ namespace artis {
 #ifdef WITH_TRACE
                 common::Trace<Time>::trace()
                         << common::TraceElement<Time>(type::get_name(), t,
-                                common::TraceType::S_MESSAGE)
+                                    common::FormalismType::DTSS,
+                                    common::FunctionType::S_MESSAGE,
+                                    common::LevelType::FORMALISM)
                         << ": BEFORE => " << "tl = " << type::_tl << " ; tn = "
                         << type::_tn;
                 common::Trace<Time>::trace().flush();
@@ -218,7 +236,9 @@ namespace artis {
 #ifdef WITH_TRACE
                 common::Trace<Time>::trace()
                         << common::TraceElement<Time>(type::get_name(), t,
-                                common::TraceType::S_MESSAGE)
+                                    common::FormalismType::DTSS,
+                                    common::FunctionType::S_MESSAGE,
+                                    common::LevelType::FORMALISM)
                         << ": AFTER => " << "tl = " << type::_tl << " ; tn = " << type::_tn;
                 common::Trace<Time>::trace().flush();
 #endif

+ 26 - 8
src/artis-star/kernel/dtss/Simulator.hpp

@@ -92,7 +92,9 @@ namespace artis {
 #ifdef WITH_TRACE
                 common::Trace<Time>::trace()
                         << common::TraceElement<Time>(type::get_name(), t,
-                                common::TraceType::I_MESSAGE)
+                                    common::FormalismType::DTSS,
+                                    common::FunctionType::I_MESSAGE,
+                                    common::LevelType::FORMALISM)
                         << ": BEFORE => " << "tl = " << type::_tl << " ; tn = "
                         << type::_tn;
                 common::Trace<Time>::trace().flush();
@@ -105,7 +107,9 @@ namespace artis {
 #ifdef WITH_TRACE
                 common::Trace<Time>::trace()
                         << common::TraceElement<Time>(type::get_name(), t,
-                                common::TraceType::I_MESSAGE)
+                                    common::FormalismType::DTSS,
+                                    common::FunctionType::I_MESSAGE,
+                                    common::LevelType::FORMALISM)
                         << ": AFTER => " << "tl = " << type::_tl << " ; tn = "
                         << type::_tn;
                 common::Trace<Time>::trace().flush();
@@ -123,7 +127,10 @@ namespace artis {
 #ifdef WITH_TRACE
                 common::Trace<Time>::trace()
                         << common::TraceElement<Time>(type::get_name(), t,
-                                common::TraceType::OUTPUT) << ": BEFORE";
+                                    common::FormalismType::DTSS,
+                                    common::FunctionType::LAMBDA,
+                                    common::LevelType::FORMALISM)
+                                << ": BEFORE";
                 common::Trace<Time>::trace().flush();
 #endif
 
@@ -142,7 +149,10 @@ namespace artis {
 #ifdef WITH_TRACE
                 common::Trace<Time>::trace()
                         << common::TraceElement<Time>(type::get_name(), t,
-                                common::TraceType::OUTPUT) << ": AFTER";
+                                    common::FormalismType::DTSS,
+                                    common::FunctionType::LAMBDA,
+                                    common::LevelType::FORMALISM)
+                                << ": AFTER";
                 common::Trace<Time>::trace().flush();
 #endif
 
@@ -159,7 +169,9 @@ namespace artis {
 #ifdef WITH_TRACE
                 common::Trace<Time>::trace()
                         << common::TraceElement<Time>(type::get_name(), t,
-                                common::TraceType::POST_EVENT)
+                                    common::FormalismType::DTSS,
+                                    common::FunctionType::POST_EVENT,
+                                    common::LevelType::FORMALISM)
                         << ": BEFORE => " << event.to_string();
                 common::Trace<Time>::trace().flush();
 #endif
@@ -169,7 +181,9 @@ namespace artis {
 #ifdef WITH_TRACE
                 common::Trace<Time>::trace()
                         << common::TraceElement<Time>(type::get_name(), t,
-                                common::TraceType::POST_EVENT)
+                                    common::FormalismType::DTSS,
+                                    common::FunctionType::POST_EVENT,
+                                    common::LevelType::FORMALISM)
                         << ": AFTER => " << event.to_string();
                 common::Trace<Time>::trace().flush();
 #endif
@@ -182,7 +196,9 @@ namespace artis {
 #ifdef WITH_TRACE
                 common::Trace<Time>::trace()
                         << common::TraceElement<Time>(type::get_name(), t,
-                                common::TraceType::S_MESSAGE)
+                                    common::FormalismType::DTSS,
+                                    common::FunctionType::S_MESSAGE,
+                                    common::LevelType::FORMALISM)
                         << ": BEFORE => " << "tl = " << type::_tl << " ; tn = "
                         << type::_tn;
                 common::Trace<Time>::trace().flush();
@@ -198,7 +214,9 @@ namespace artis {
 #ifdef WITH_TRACE
                 common::Trace<Time>::trace()
                         << common::TraceElement<Time>(type::get_name(), t,
-                                common::TraceType::S_MESSAGE)
+                                    common::FormalismType::DTSS,
+                                    common::FunctionType::S_MESSAGE,
+                                    common::LevelType::FORMALISM)
                         << ": AFTER => " << "tl = " << type::_tl << " ; tn = "
                         << type::_tn;
                 common::Trace<Time>::trace().flush();

+ 62 - 34
src/artis-star/kernel/pdevs/Coordinator.hpp

@@ -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();

+ 48 - 34
src/artis-star/kernel/pdevs/Simulator.hpp

@@ -99,31 +99,33 @@ namespace artis {
                 return ss.str();
             }
 
-/*************************************************
- * when i-message(t)
- *   tl = t - e
- *   tn = tl + ta(s)
- *************************************************/
             typename Time::type start(const typename Time::type& t)
             {
+//                When i-message(t)
+//                  tl = t - e
+//                  tn = tl + ta(s)
+//                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();
 #endif
 
                 type::_tl = t;
-                type::_tn =
-                        type::_tl + _dynamics.start(t);
+                type::_tn = type::_tl + _dynamics.start(t);
 
 #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();
@@ -140,19 +142,21 @@ namespace artis {
                 return _dynamics.observable_name(observable_index);
             }
 
-/*************************************************
- * when *-message(t)
- *   if (t = tn) then
- *     y = lambda(s)
- *     send y-message(y,t) to parent
- *************************************************/
             void output(const typename Time::type& t)
             {
+//                When *-message(t)
+//                  if (t = tn) then
+//                    y = lambda(s)
+//                    send y-message(y,t) to parent
+//                End
 
 #ifdef WITH_TRACE
                 common::Trace<Time>::trace()
                         << common::TraceElement<Time>(type::get_name(), t,
-                                common::TraceType::OUTPUT) << ": BEFORE";
+                                common::FormalismType::PDEVS,
+                                common::FunctionType::OUTPUT,
+                                common::LevelType::FORMALISM)
+                                << ": BEFORE";
                 common::Trace<Time>::trace().flush();
 #endif
 
@@ -171,7 +175,10 @@ namespace artis {
 #ifdef WITH_TRACE
                 common::Trace<Time>::trace()
                         << common::TraceElement<Time>(type::get_name(), t,
-                                common::TraceType::OUTPUT) << ": AFTER";
+                                common::FormalismType::PDEVS,
+                                common::FunctionType::OUTPUT,
+                                common::LevelType::FORMALISM)
+                                << ": AFTER";
                 common::Trace<Time>::trace().flush();
 #endif
 
@@ -182,13 +189,15 @@ namespace artis {
             {
 
 #ifndef WITH_TRACE
-                (void)t;
+                (void) t;
 #endif
 
 #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
@@ -198,32 +207,35 @@ 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
 
             }
 
-/*************************************************
- * when x-message(t)
- *   if (x is empty and t = tn) then
- *       s = delta_int(s)
- *  else if (x isn't empty and t = tn)
- *       s = delta_conf(s,x)
- *  else if (x isn't empty and t < tn)
- *    e = t - tl
- *    s = delta_ext(s,e,x)
- *  tn = t + ta(s)
- *  tl = t
- *************************************************/
             typename Time::type transition(const typename Time::type& t)
             {
+//                When x-message(t)
+//                  if (x is empty and t = tn) then
+//                    s = delta_int(s)
+//                  else if (x isn't empty and t = tn)
+//                    s = delta_conf(s,x)
+//                  else if (x isn't empty and t < tn)
+//                    e = t - tl
+//                    s = delta_ext(s,e,x)
+//                  tn = t + ta(s)
+//                  tl = t
+//                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;
                 common::Trace<Time>::trace().flush();
@@ -247,7 +259,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;
                 common::Trace<Time>::trace().flush();
 #endif

+ 6 - 6
src/artis-star/kernel/pdevs/qss/Derivative.hpp

@@ -37,20 +37,20 @@ namespace artis {
             template<class Time, class Dyn, class Parameters = common::NoParameters>
             class Derivative : public artis::pdevs::Dynamics<Time, Dyn, Parameters> {
                 typedef enum {
-                    INIT, WAIT, RESPONSE
+                    INIT = 0, WAIT, RESPONSE
                 } State;
 
             public:
                 enum inputs {
-                    IN
+                    IN = 0
                 };
 
                 enum outputs {
-                    OUT
+                    OUT = 0
                 };
 
                 enum states {
-                    STATE, INPUT_NUMBER, OUTPUT_VALUE, LAST_OUTPUT
+                    STATE = 0, INPUT_NUMBER, OUTPUT_VALUE, LAST_OUTPUT
                 };
 
                 typedef Derivative<Time, Dyn, Parameters> type;
@@ -191,8 +191,8 @@ namespace artis {
                 }
 
             private:
-                size_t _external_number;
-                size_t _internal_number;
+                unsigned int _external_number;
+                unsigned int _internal_number;
 
                 // state
                 int _state;

+ 8 - 8
src/artis-star/kernel/sss/Simulator.hpp

@@ -79,7 +79,7 @@ namespace artis {
 #ifdef WITH_TRACE
                 common::Trace<Time>::trace()
                         << common::TraceElement<Time>(type::get_name(), t,
-                                common::TraceType::I_MESSAGE)
+                                common::FunctionType::I_MESSAGE)
                         << ": BEFORE => " << "tl = " << type::_tl << " ; tn = "
                         << type::_tn;
                 common::Trace<Time>::trace().flush();
@@ -92,7 +92,7 @@ namespace artis {
 #ifdef WITH_TRACE
                 common::Trace<Time>::trace()
                         << common::TraceElement<Time>(type::get_name(), t,
-                                common::TraceType::I_MESSAGE)
+                                common::FunctionType::I_MESSAGE)
                         << ": AFTER => " << "tl = " << type::_tl << " ; tn = "
                         << type::_tn;
                 common::Trace<Time>::trace().flush();
@@ -112,7 +112,7 @@ namespace artis {
 #ifdef WITH_TRACE
                 common::Trace<Time>::trace()
                         << common::TraceElement<Time>(type::get_name(), t,
-                                common::TraceType::OUTPUT) << ": BEFORE";
+                                common::FunctionType::OUTPUT) << ": BEFORE";
                 common::Trace<Time>::trace().flush();
 #endif
 
@@ -131,7 +131,7 @@ namespace artis {
 #ifdef WITH_TRACE
                 common::Trace<Time>::trace()
                         << common::TraceElement<Time>(type::get_name(), t,
-                                common::TraceType::OUTPUT) << ": AFTER";
+                                common::FunctionType::OUTPUT) << ": AFTER";
                 common::Trace<Time>::trace().flush();
 #endif
 
@@ -148,7 +148,7 @@ namespace artis {
 #ifdef WITH_TRACE
                 common::Trace<Time>::trace()
                         << common::TraceElement<Time>(type::get_name(), t,
-                                common::TraceType::POST_EVENT)
+                                common::FunctionType::POST_EVENT)
                         << ": BEFORE => " << event.to_string();
                 common::Trace<Time>::trace().flush();
 #endif
@@ -158,7 +158,7 @@ namespace artis {
 #ifdef WITH_TRACE
                 common::Trace<Time>::trace()
                         << common::TraceElement<Time>(type::get_name(), t,
-                                common::TraceType::POST_EVENT)
+                                common::FunctionType::POST_EVENT)
                         << ": AFTER => " << event.to_string();
                 common::Trace<Time>::trace().flush();
 #endif
@@ -171,7 +171,7 @@ namespace artis {
 #ifdef WITH_TRACE
                 common::Trace<Time>::trace()
                         << common::TraceElement<Time>(type::get_name(), t,
-                                common::TraceType::S_MESSAGE)
+                                common::FunctionType::S_MESSAGE)
                         << ": BEFORE => " << "tl = " << type::_tl << " ; tn = "
                         << type::_tn;
                 common::Trace<Time>::trace().flush();
@@ -192,7 +192,7 @@ namespace artis {
 #ifdef WITH_TRACE
                 common::Trace<Time>::trace()
                         << common::TraceElement<Time>(type::get_name(), t,
-                                common::TraceType::S_MESSAGE)
+                                common::FunctionType::S_MESSAGE)
                         << ": AFTER => " << "tl = " << type::_tl << " ; tn = "
                         << type::_tn;
                 common::Trace<Time>::trace().flush();