Virtual Laboratory Environment

Version 2.1.0

A Modeling & Simulation Environment

Debug and Log model

Debug model

To debug your model, you may use the debug option when you right click on an atomic model under GVLE.

Default, the debug file is located at $VLE_HOME/vle-2.0.log but it can be redirected to the standard output with the command line option --log-to- stdout or --log-to-stderr.

Warning, in order to have the debug service available, make sure that vle is built with the debug option for example like this(Unix case):

cd vle-your_release
mkdir build && cd build
export QT_SELECT=qt5


make -j4
make install
make test

Log model

For example the following atomic model will show always the string “MyModel constructor” but show the string “time is odd” only when time is odd and VLE is launched with vle -v x with x equal 1, 2 or 3.

#include <vle/devs/Dynamics.hpp>
#include <vle/devs/DynamicsDbg.hpp>
#include <vle/utils/Debug.hpp>
#include <vle/utils/Trace.hpp>

class MyModel : public vle::devs::Dynamics
    MyModel(const vle::devs::DynamicsInit& init
            const vle::devs::InitEvents& events)
        : vle::devs::Dynamics(init, events)
        Trace(context(), 1, "MyModel constructor");

    virtual void internalTransition(vle::devs::Time time)
        if (static_cast<int>(time) % 2 == 0)
            Trace(context(), 7, "time is odd: %f", time);
Last updated on 16 Dec 2016, 12:32
Published on 16 Dec 2016, 12:32
 Edit on GitHub