|
@@ -1,5 +1,5 @@
|
|
/**
|
|
/**
|
|
- * @file kernel/qss/MultiGraphManager.hpp
|
|
|
|
|
|
+ * @file qss/MultiGraphManager.hpp
|
|
* @author The ARTIS Development Team
|
|
* @author The ARTIS Development Team
|
|
* See the AUTHORS or Authors.txt file
|
|
* See the AUTHORS or Authors.txt file
|
|
*/
|
|
*/
|
|
@@ -8,7 +8,7 @@
|
|
* ARTIS - the multimodeling and simulation environment
|
|
* ARTIS - the multimodeling and simulation environment
|
|
* This file is a part of the ARTIS environment
|
|
* This file is a part of the ARTIS environment
|
|
*
|
|
*
|
|
- * Copyright (C) 2013-2019 ULCO http://www.univ-littoral.fr
|
|
|
|
|
|
+ * Copyright (C) 2013-2023 ULCO http://www.univ-littoral.fr
|
|
*
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* 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
|
|
* it under the terms of the GNU General Public License as published by
|
|
@@ -24,46 +24,39 @@
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
*/
|
|
|
|
|
|
-#ifndef QSS_MULTI_GRAPH_MANAGER
|
|
|
|
-#define QSS_MULTI_GRAPH_MANAGER
|
|
|
|
|
|
+#ifndef ARTIS_STAR_ADDONS_QSS_MULTI_GRAPH_MANAGER
|
|
|
|
+#define ARTIS_STAR_ADDONS_QSS_MULTI_GRAPH_MANAGER
|
|
|
|
|
|
#include <artis-star/kernel/pdevs/GraphManager.hpp>
|
|
#include <artis-star/kernel/pdevs/GraphManager.hpp>
|
|
#include <artis-star/kernel/qss/MultiDerivative.hpp>
|
|
#include <artis-star/kernel/qss/MultiDerivative.hpp>
|
|
#include <artis-star/kernel/qss/Integrator.hpp>
|
|
#include <artis-star/kernel/qss/Integrator.hpp>
|
|
#include <artis-star/kernel/qss/Quantifier.hpp>
|
|
#include <artis-star/kernel/qss/Quantifier.hpp>
|
|
|
|
|
|
-namespace artis {
|
|
|
|
-namespace qss {
|
|
|
|
|
|
+namespace artis::addons::qss {
|
|
|
|
|
|
template<class DerivativeParameters>
|
|
template<class DerivativeParameters>
|
|
-struct MultiQSSParameters
|
|
|
|
-{
|
|
|
|
|
|
+struct MultiQSSParameters {
|
|
std::vector <artis::qss::IntegratorParameters> integrators;
|
|
std::vector <artis::qss::IntegratorParameters> integrators;
|
|
std::vector <artis::qss::QuantifierParameters> quantifiers;
|
|
std::vector <artis::qss::QuantifierParameters> quantifiers;
|
|
DerivativeParameters derivative;
|
|
DerivativeParameters derivative;
|
|
};
|
|
};
|
|
|
|
|
|
template<class Time,
|
|
template<class Time,
|
|
- class Derivative,
|
|
|
|
- class DerivativeParameters = artis::common::NoParameters>
|
|
|
|
|
|
+ class Derivative,
|
|
|
|
+ class DerivativeParameters = artis::common::NoParameters>
|
|
class MultiGraphManager :
|
|
class MultiGraphManager :
|
|
- public artis::pdevs::GraphManager<Time,
|
|
|
|
- MultiQSSParameters<DerivativeParameters>,
|
|
|
|
- artis::common::NoParameters>
|
|
|
|
-{
|
|
|
|
|
|
+ public artis::pdevs::GraphManager<Time,
|
|
|
|
+ MultiQSSParameters<DerivativeParameters>,
|
|
|
|
+ artis::common::NoParameters> {
|
|
public:
|
|
public:
|
|
- struct submodel
|
|
|
|
- {
|
|
|
|
- enum values
|
|
|
|
- {
|
|
|
|
|
|
+ struct submodel {
|
|
|
|
+ enum values {
|
|
S_Derivative = 0, S_Integrator = 1, S_Quantifier = 1000
|
|
S_Derivative = 0, S_Integrator = 1, S_Quantifier = 1000
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
|
|
- struct input
|
|
|
|
- {
|
|
|
|
- enum values
|
|
|
|
- {
|
|
|
|
|
|
+ struct input {
|
|
|
|
+ enum values {
|
|
RESET
|
|
RESET
|
|
};
|
|
};
|
|
};
|
|
};
|
|
@@ -71,17 +64,16 @@ public:
|
|
MultiGraphManager(common::Coordinator <Time> *coordinator,
|
|
MultiGraphManager(common::Coordinator <Time> *coordinator,
|
|
const MultiQSSParameters<DerivativeParameters> ¶meters,
|
|
const MultiQSSParameters<DerivativeParameters> ¶meters,
|
|
const artis::common::NoParameters &graph_parameters)
|
|
const artis::common::NoParameters &graph_parameters)
|
|
- :
|
|
|
|
- artis::pdevs::GraphManager<Time,
|
|
|
|
- MultiQSSParameters<DerivativeParameters>,
|
|
|
|
- artis::common::NoParameters>(
|
|
|
|
- coordinator, parameters, graph_parameters),
|
|
|
|
- _derivative("d", parameters.derivative)
|
|
|
|
- {
|
|
|
|
|
|
+ :
|
|
|
|
+ artis::pdevs::GraphManager<Time,
|
|
|
|
+ MultiQSSParameters<DerivativeParameters>,
|
|
|
|
+ artis::common::NoParameters>(
|
|
|
|
+ coordinator, parameters, graph_parameters),
|
|
|
|
+ _derivative("d", parameters.derivative) {
|
|
this->add_child(submodel::S_Derivative, &_derivative);
|
|
this->add_child(submodel::S_Derivative, &_derivative);
|
|
coordinator->input_port({input::RESET, "reset"});
|
|
coordinator->input_port({input::RESET, "reset"});
|
|
this->in({coordinator, input::RESET})
|
|
this->in({coordinator, input::RESET})
|
|
- >> this->in({&_derivative, Derivative::input::RESET});
|
|
|
|
|
|
+ >> this->in({&_derivative, Derivative::input::RESET});
|
|
for (unsigned int index = 0; index < _derivative.dynamics().variable_number(); ++index) {
|
|
for (unsigned int index = 0; index < _derivative.dynamics().variable_number(); ++index) {
|
|
_integrators.push_back(new IntegratorSimulator("i_" + std::to_string(index),
|
|
_integrators.push_back(new IntegratorSimulator("i_" + std::to_string(index),
|
|
parameters.integrators[index]));
|
|
parameters.integrators[index]));
|
|
@@ -91,44 +83,36 @@ public:
|
|
this->add_child(submodel::S_Quantifier + index, _quantifiers.back());
|
|
this->add_child(submodel::S_Quantifier + index, _quantifiers.back());
|
|
coordinator->output_port({index, "out_" + std::to_string(index)});
|
|
coordinator->output_port({index, "out_" + std::to_string(index)});
|
|
this->in({coordinator, input::RESET})
|
|
this->in({coordinator, input::RESET})
|
|
- >> this->in({_integrators.back(), Integrator<Time>::input::RESET});
|
|
|
|
|
|
+ >> this->in({_integrators.back(), Integrator<Time>::input::RESET});
|
|
this->in({coordinator, input::RESET})
|
|
this->in({coordinator, input::RESET})
|
|
- >> this->in({_quantifiers.back(), Quantifier<Time>::input::RESET});
|
|
|
|
|
|
+ >> this->in({_quantifiers.back(), Quantifier<Time>::input::RESET});
|
|
|
|
|
|
this->out({&_derivative, index})
|
|
this->out({&_derivative, index})
|
|
- >> this->in({_integrators.back(), Integrator<Time>::input::X_DOT});
|
|
|
|
|
|
+ >> this->in({_integrators.back(), Integrator<Time>::input::X_DOT});
|
|
this->out({_integrators.back(), Integrator<Time>::output::OUT})
|
|
this->out({_integrators.back(), Integrator<Time>::output::OUT})
|
|
- >> this->in({_quantifiers.back(), Quantifier<Time>::input::IN});
|
|
|
|
|
|
+ >> this->in({_quantifiers.back(), Quantifier<Time>::input::IN});
|
|
this->out({_quantifiers.back(), Quantifier<Time>::output::OUT})
|
|
this->out({_quantifiers.back(), Quantifier<Time>::output::OUT})
|
|
- >> this->in({_integrators.back(), Integrator<Time>::input::QUANTA});
|
|
|
|
|
|
+ >> this->in({_integrators.back(), Integrator<Time>::input::QUANTA});
|
|
this->out({_integrators.back(), Integrator<Time>::output::OUT})
|
|
this->out({_integrators.back(), Integrator<Time>::output::OUT})
|
|
- >> this->out({coordinator, index});
|
|
|
|
|
|
+ >> this->out({coordinator, index});
|
|
this->out({_integrators.back(), Integrator<Time>::output::OUT})
|
|
this->out({_integrators.back(), Integrator<Time>::output::OUT})
|
|
- >> this->in({&_derivative, Derivative::input::INTERNAL + index});
|
|
|
|
|
|
+ >> this->in({&_derivative, Derivative::input::INTERNAL + index});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- ~MultiGraphManager() override
|
|
|
|
- {
|
|
|
|
- std::for_each(_integrators.begin(),
|
|
|
|
- _integrators.end(),
|
|
|
|
- std::default_delete<IntegratorSimulator>());
|
|
|
|
- std::for_each(_quantifiers.begin(),
|
|
|
|
- _quantifiers.end(),
|
|
|
|
- std::default_delete<QuantifierSimulator>());
|
|
|
|
|
|
+ ~MultiGraphManager() override {
|
|
|
|
+ std::for_each(_integrators.begin(), _integrators.end(), std::default_delete<IntegratorSimulator>());
|
|
|
|
+ std::for_each(_quantifiers.begin(), _quantifiers.end(), std::default_delete<QuantifierSimulator>());
|
|
}
|
|
}
|
|
|
|
|
|
- artis::pdevs::Simulator<Time, Derivative, DerivativeParameters> *derivative()
|
|
|
|
- { return &_derivative; }
|
|
|
|
|
|
+ artis::pdevs::Simulator<Time, Derivative, DerivativeParameters> *derivative() { return &_derivative; }
|
|
|
|
|
|
private:
|
|
private:
|
|
- typedef artis::pdevs::Simulator<Time,
|
|
|
|
- artis::qss::Integrator<Time>,
|
|
|
|
- artis::qss::IntegratorParameters> IntegratorSimulator;
|
|
|
|
|
|
+ typedef artis::pdevs::Simulator<Time, artis::qss::Integrator<Time>,
|
|
|
|
+ artis::qss::IntegratorParameters> IntegratorSimulator;
|
|
typedef std::vector<IntegratorSimulator *> IntegratorSimulators;
|
|
typedef std::vector<IntegratorSimulator *> IntegratorSimulators;
|
|
- typedef artis::pdevs::Simulator<Time,
|
|
|
|
- artis::qss::Quantifier<Time>,
|
|
|
|
- artis::qss::QuantifierParameters> QuantifierSimulator;
|
|
|
|
|
|
+ typedef artis::pdevs::Simulator<Time, artis::qss::Quantifier<Time>,
|
|
|
|
+ artis::qss::QuantifierParameters> QuantifierSimulator;
|
|
typedef std::vector<QuantifierSimulator *> QuantifierSimulators;
|
|
typedef std::vector<QuantifierSimulator *> QuantifierSimulators;
|
|
|
|
|
|
artis::pdevs::Simulator<Time, Derivative, DerivativeParameters> _derivative;
|
|
artis::pdevs::Simulator<Time, Derivative, DerivativeParameters> _derivative;
|
|
@@ -136,7 +120,6 @@ private:
|
|
QuantifierSimulators _quantifiers;
|
|
QuantifierSimulators _quantifiers;
|
|
};
|
|
};
|
|
|
|
|
|
-}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
#endif
|
|
#endif
|