1 /* Copyright (c) 2003-2023. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #include "simgrid/plugins/photovoltaic.hpp"
7 #include "simgrid/s4u.hpp"
9 XBT_LOG_NEW_DEFAULT_CATEGORY(photovoltaic_simple, "Messages specific for this s4u example");
13 auto pv_panel = simgrid::s4u::Engine::get_instance()->host_by_name("pv_panel");
14 std::vector<std::pair<double, double>> solar_irradiance = {{0, 10}, {100, 5}, {200, 20}};
15 for (auto [t, s] : solar_irradiance) {
16 simgrid::s4u::this_actor::sleep_until(t);
17 sg_photovoltaic_set_solar_irradiance(pv_panel, s);
18 XBT_INFO("%s power: %f", pv_panel->get_cname(), sg_photovoltaic_get_power(pv_panel));
22 int main(int argc, char* argv[])
24 simgrid::s4u::Engine e(&argc, argv);
25 e.load_platform(argv[1]);
26 sg_photovoltaic_plugin_init();
27 simgrid::s4u::Actor::create("manager", e.host_by_name("pv_panel"), manager);