123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- /**
- * @file kernel/pdevs/qss/GraphManager.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 QSS_GRAPH_MANAGER
- #define QSS_GRAPH_MANAGER
- #include <artis-star/kernel/pdevs/GraphManager.hpp>
- #include <artis-star/kernel/pdevs/qss/Integrator.hpp>
- #include <artis-star/kernel/pdevs/qss/Quantifier.hpp>
- namespace artis {
- namespace pdevs {
- namespace qss {
- template <class DerivativeParameters>
- struct QSSParameters {
- IntegratorParameters integrator;
- QuantifierParameters quantifier;
- DerivativeParameters derivative;
- };
- template<class Time,
- class Derivative,
- class DerivativeParameters = artis::common::NoParameters>
- class GraphManager :
- public artis::pdevs::GraphManager<Time, QSSParameters<DerivativeParameters>, artis::common::NoParameters> {
- public:
- enum submodels {
- S_Derivative, S_Integrator, S_Quantifier
- };
- enum outputs {
- OUT
- };
- GraphManager(common::Coordinator<Time>* coordinator,
- const QSSParameters<DerivativeParameters>& parameters,
- const artis::common::NoParameters& graph_parameters)
- :
- artis::pdevs::GraphManager<Time, QSSParameters<DerivativeParameters>, artis::common::NoParameters>(
- coordinator,
- parameters,
- graph_parameters
- ),
- _derivative("d", parameters.derivative),
- _integrator("i", parameters.integrator),
- _quantifier("q", parameters.quantifier)
- {
- this->add_child(S_Derivative, &_derivative);
- this->add_child(S_Integrator, &_integrator);
- this->add_child(S_Quantifier, &_quantifier);
- coordinator->output_port({OUT, "out"});
- this->out({&_derivative, Derivative::OUT})
- >> this->in({&_integrator, Integrator<Time>::X_DOT});
- this->out({&_integrator, Integrator<Time>::OUT})
- >> this->in({&_quantifier, Quantifier<Time>::IN});
- this->out({&_quantifier, Quantifier<Time>::OUT})
- >> this->in({&_integrator, Integrator<Time>::QUANTA});
- this->out({&_integrator, Integrator<Time>::OUT})
- >> this->out({coordinator, OUT});
- this->out({&_integrator, Integrator<Time>::OUT})
- >> this->in({&_derivative, Derivative::IN});
- }
- ~GraphManager() override = default;
- artis::pdevs::Simulator<Time, Derivative, DerivativeParameters>* derivative()
- { return &_derivative; }
- private:
- artis::pdevs::Simulator<Time, Derivative, DerivativeParameters> _derivative;
- artis::pdevs::Simulator<Time, artis::pdevs::qss::Integrator<Time>, artis::pdevs::qss::IntegratorParameters> _integrator;
- artis::pdevs::Simulator<Time, artis::pdevs::qss::Quantifier<Time>, artis::pdevs::qss::QuantifierParameters> _quantifier;
- };
- }
- }
- }
- #endif
|