-
Notifications
You must be signed in to change notification settings - Fork 13
9. Running Simulations
Román Cárdenas edited this page Jul 23, 2022
·
6 revisions
Simulating DEVS (and Cell-DEVS) models is Cadmium is pretty straightforward.
We will illustrate it with the GPT model.
We will run the simulation
#include <cadmium/core/logger/csv.hpp>
#include <cadmium/core/simulation/root_coordinator.hpp>
#include <limits>
#include "gpt.hpp"
using namespace cadmium::example::gpt;
int main(int argc, char *argv[]) {
// model-related configuration parameters
int jobPeriod = 3;
int processingTime = 1;
double obsTime = 102.;
// Then, we create the model and start the simulation
auto model = std::make_shared<GPT>("gpt", jobPeriod, processingTime, obsTime);
auto rootCoordinator = cadmium::RootCoordinator(model);
auto logger = std::make_shared<cadmium::CSVLogger>("log_gpt.csv", ";");
rootCoordinator.setLogger(logger);
rootCoordinator.start();
rootCoordinator.simulate(std::numeric_limits<double>::infinity());
rootCoordinator.stop();
return 0;
}