Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' into 'task-dispatch'
authorAdrien <adrien.gougeon@ens-rennes.fr>
Tue, 10 Oct 2023 14:30:21 +0000 (14:30 +0000)
committerAdrien <adrien.gougeon@ens-rennes.fr>
Tue, 10 Oct 2023 14:30:21 +0000 (14:30 +0000)
# Conflicts:
#   docs/source/app_s4u.rst
#   examples/cpp/CMakeLists.txt
#   include/simgrid/s4u/Task.hpp
#   src/s4u/s4u_Task.cpp

47 files changed:
ChangeLog
MANIFEST.in
docs/source/Plugins.rst
docs/source/Release_Notes.rst
docs/source/app_s4u.rst
examples/cpp/CMakeLists.txt
examples/cpp/clusters-multicpu/s4u-clusters-multicpu.cpp
examples/cpp/network-factors/s4u-network-factors.cpp
examples/cpp/photovoltaic-simple/s4u-photovoltaic-simple.cpp [deleted file]
examples/cpp/photovoltaic-simple/s4u-photovoltaic-simple.tesh [deleted file]
examples/cpp/plugin-jbod/s4u-plugin-jbod.cpp
examples/cpp/plugin-prodcons/s4u-plugin-prodcons.cpp
examples/cpp/solar-panel-simple/s4u-solar-panel-simple.cpp [new file with mode: 0644]
examples/cpp/solar-panel-simple/s4u-solar-panel-simple.tesh [new file with mode: 0644]
examples/platforms/griffon.cpp
examples/platforms/photovoltaic_platform.xml [deleted file]
examples/platforms/routing_cluster.cpp
examples/platforms/supernode.cpp
include/simgrid/forward.h
include/simgrid/kernel/routing/NetZoneImpl.hpp
include/simgrid/plugins/photovoltaic.hpp [deleted file]
include/simgrid/plugins/solar_panel.hpp [new file with mode: 0644]
include/simgrid/s4u/NetZone.hpp
src/kernel/activity/MailboxImpl.cpp
src/kernel/activity/MailboxImpl.hpp
src/kernel/resource/DiskImpl.hpp
src/kernel/resource/HostImpl.cpp
src/kernel/resource/HostImpl.hpp
src/kernel/routing/ClusterZone.cpp
src/kernel/routing/DijkstraZone_test.cpp
src/kernel/routing/FloydZone_test.cpp
src/kernel/routing/FullZone_test.cpp
src/kernel/routing/NetZoneImpl.cpp
src/kernel/routing/NetZone_test.hpp
src/kernel/routing/StarZone_test.cpp
src/kernel/xml/sg_platf.cpp
src/plugins/battery.cpp
src/plugins/chiller.cpp
src/plugins/photovoltaic.cpp [deleted file]
src/plugins/solar_panel.cpp [new file with mode: 0644]
src/s4u/s4u_Engine.cpp
src/s4u/s4u_Netzone.cpp
teshsuite/platforms/flatifier.tesh
teshsuite/s4u/io-stream/io-stream.cpp
teshsuite/s4u/seal-platform/seal-platform.cpp
teshsuite/s4u/seal-platform/seal-platform.tesh
tools/cmake/DefinePackages.cmake

index 77b01a3..893664d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -27,6 +27,7 @@ C API:
 Plugins:
  - Revamp the battery plugin: rewrite completely the API, for a better usability.
    The examples were updated accordingly.
+ - Revamp of the Photovoltaic plugin: now called SolarPanel and complete rewrite of the API 
  - Add chiller plugin: enable the management of chillers consuming electrical energy
    to compensate heat generated by hosts.
 
index 7612188..1b8ad27 100644 (file)
@@ -348,8 +348,8 @@ include examples/cpp/network-ns3/s4u-network-ns3-timed.tesh
 include examples/cpp/network-ns3/s4u-network-ns3.cpp
 include examples/cpp/network-wifi/s4u-network-wifi.cpp
 include examples/cpp/network-wifi/s4u-network-wifi.tesh
-include examples/cpp/photovoltaic-simple/s4u-photovoltaic-simple.cpp
-include examples/cpp/photovoltaic-simple/s4u-photovoltaic-simple.tesh
+include examples/cpp/solar-panel-simple/s4u-solar-panel-simple.cpp
+include examples/cpp/solar-panel-simple/s4u-solar-panel-simple.tesh
 include examples/cpp/platform-comm-serialize/s4u-platform-comm-serialize.cpp
 include examples/cpp/platform-comm-serialize/s4u-platform-comm-serialize.tesh
 include examples/cpp/platform-failures/s4u-platform-failures.cpp
@@ -1849,7 +1849,6 @@ include examples/platforms/onelink.xml
 include examples/platforms/optorsim/gridpp_grid_2004.conf
 include examples/platforms/optorsim/lcg_sept2004_grid.conf
 include examples/platforms/optorsim/transform_optorsim_platform.pl
-include examples/platforms/photovoltaic_platform.xml
 include examples/platforms/profiles/fafard_state.profile
 include examples/platforms/profiles/faulty_host.profile
 include examples/platforms/profiles/ginette_state.profile
@@ -1952,7 +1951,7 @@ include include/simgrid/plugins/jbod.hpp
 include include/simgrid/plugins/live_migration.h
 include include/simgrid/plugins/load.h
 include include/simgrid/plugins/ns3.hpp
-include include/simgrid/plugins/photovoltaic.hpp
+include include/simgrid/plugins/solar_panel.hpp
 include include/simgrid/s4u.hpp
 include include/simgrid/s4u/Activity.hpp
 include include/simgrid/s4u/ActivitySet.hpp
@@ -2330,7 +2329,7 @@ include src/plugins/jbod.cpp
 include src/plugins/link_energy.cpp
 include src/plugins/link_energy_wifi.cpp
 include src/plugins/link_load.cpp
-include src/plugins/photovoltaic.cpp
+include src/plugins/solar_panel.cpp
 include src/plugins/vm/VmLiveMigration.cpp
 include src/plugins/vm/VmLiveMigration.hpp
 include src/plugins/vm/dirty_page_tracking.cpp
index 87ba3a8..659e67c 100644 (file)
@@ -24,7 +24,7 @@ documents some of the plugins distributed with SimGrid:
   - :ref:`Link Energy <plugin_link_energy>`: models the energy dissipation of the network.
   - :ref:`WiFi Energy <plugin_link_energy_wifi>`: models the energy dissipation of wifi links.
   - :ref:`Battery <plugin_battery>`: models batteries that get discharged by the energy consumption of a given host.
-  - :ref:`Photovoltaic <plugin_photovoltaic>`: models photovoltaic panels which energy production depends on the solar irradiance.
+  - :ref:`Solar Panel <plugin_solar_panel>`: models solar panels which energy production depends on the solar irradiance.
 
 You can activate these plugins with the :ref:`--cfg=plugin <cfg=plugin>` command
 line option, for example with ``--cfg=plugin:host_energy``. You can get the full
@@ -220,20 +220,22 @@ File System
 .. _plugin_battery:
 
 Battery
-===========
+=======
 
 .. doxygengroup:: plugin_battery
 
-.. _plugin_photovoltaic:
+.. _plugin_solar_panel:
 
-Photovoltaic
+Solar Panel
 ===========
 
-.. doxygengroup:: plugin_photovoltaic
+.. doxygengroup:: plugin_solar_panel
 
 Chiller
-===========
+=======
 
 .. doxygengroup:: plugin_chiller
 
+   .. doxygentypedef:: ChillerPtr
+
 ..  LocalWords:  SimGrid
index 80cad37..55b0d5a 100644 (file)
@@ -627,8 +627,8 @@ completion) are now specialized by activity class. That is, callbacks registered
 Comms nor Ios
 
 Two new useful plugins were added: The :ref:`battery plugin<plugin_battery>` can be used to create batteries that get discharged
-by the energy consumption of a given host, while the :ref:`photovoltaic plugin <plugin_photovoltaic>` can be used to create
-photovoltaic panels which energy production depends on the solar irradiance. These plugins could probably be better integrated
+by the energy consumption of a given host, while the :ref:`solar panel plugin <plugin_solar_panel>` can be used to create
+solar panels which energy production depends on the solar irradiance. These plugins could probably be better integrated
 in the framework, but our goal is to include in SimGrid the building blocks upon which everybody would agree, while the model
 elements that are more arguable are provided as plugins, in the hope that the users will carefully assess the plugins and adapt
 them to their specific needs before usage. Here for example, there is several models of batteries (the one provided does not
index a44f8a1..8695720 100644 (file)
@@ -2592,7 +2592,7 @@ class Task
 **Known subclasses:**
 :ref:`Communication Tasks <API_s4u_CommTask>`,
 :ref:`Executions Tasks <API_s4u_ExecTask>`,
-:ref:`I/O Tasks <API_s4u_Task>`.
+:ref:`I/O Tasks <API_s4u_IoTask>`.
 See also the :ref:`section on activities <s4u_Tasks>` above.
 
 Basic management
@@ -2619,7 +2619,10 @@ Querying info
       .. doxygenfunction:: simgrid::s4u::Task::get_name() const
       .. doxygenfunction:: simgrid::s4u::Task::get_count() const
       .. doxygenfunction:: simgrid::s4u::Task::get_amount() const
+      .. doxygenfunction:: simgrid::s4u::Task::get_parallelism_degree() const
+      .. doxygenfunction:: simgrid::s4u::Task::set_name(std::string name)
       .. doxygenfunction:: simgrid::s4u::Task::set_amount(double amount)
+      .. doxygenfunction:: simgrid::s4u::Task::set_parallelism_degree(int n)
 
 Life cycle
 ----------
@@ -2646,8 +2649,8 @@ Managing Tokens
 .. tabs::
 
    .. group-tab:: C++
-      .. doxygenfunction:: simgrid::s4u::Task::set_token(std::shared_ptr<Token> token)
       .. doxygenfunction:: simgrid::s4u::Task::get_next_token_from(TaskPtr t)
+      .. doxygenfunction:: simgrid::s4u::Task::set_token(std::shared_ptr<Token> token)
 
 Signals
 -------
@@ -2662,9 +2665,9 @@ Signals
 
 .. _API_s4u_CommTask:
 
-================
+=================
 ⁣  class CommTask
-================
+=================
 .. tabs::
 
    .. group-tab:: C++
@@ -2691,19 +2694,19 @@ Querying info
 
    .. group-tab:: C++
 
-      .. doxygenfunction:: simgrid::s4u::Task::get_source() const
-      .. doxygenfunction:: simgrid::s4u::Task::get_destination() const
-      .. doxygenfunction:: simgrid::s4u::Task::get_bytes() const
-      .. doxygenfunction:: simgrid::s4u::Task::set_source(simgrid::s4u::Host* source);
-      .. doxygenfunction:: simgrid::s4u::Task::set_destination(simgrid::s4u::Host* destination);
-      .. doxygenfunction:: simgrid::s4u::Task::set_bytes(double bytes)
+      .. doxygenfunction:: simgrid::s4u::CommTask::get_source() const
+      .. doxygenfunction:: simgrid::s4u::CommTask::get_destination() const
+      .. doxygenfunction:: simgrid::s4u::CommTask::get_bytes() const
+      .. doxygenfunction:: simgrid::s4u::CommTask::set_source(Host* source);
+      .. doxygenfunction:: simgrid::s4u::CommTask::set_destination(Host* destination);
+      .. doxygenfunction:: simgrid::s4u::CommTask::set_bytes(double bytes)
 
 
 .. _API_s4u_ExecTask:
 
-================
+=================
 ⁣  class ExecTask
-================
+=================
 .. tabs::
 
    .. group-tab:: C++
@@ -2730,10 +2733,10 @@ Querying info
 
    .. group-tab:: C++
 
-      .. doxygenfunction:: simgrid::s4u::Task::get_host() const
-      .. doxygenfunction:: simgrid::s4u::Task::get_flops() const
-      .. doxygenfunction:: simgrid::s4u::Task::set_host(simgrid::s4u::Host* host);
-      .. doxygenfunction:: simgrid::s4u::Task::set_flops(double flops);
+      .. doxygenfunction:: simgrid::s4u::ExecTask::get_host() const
+      .. doxygenfunction:: simgrid::s4u::ExecTask::get_flops() const
+      .. doxygenfunction:: simgrid::s4u::ExecTask::set_host(Host* host);
+      .. doxygenfunction:: simgrid::s4u::ExecTask::set_flops(double flops);
 
 .. _API_s4u_IoTask:
 
@@ -2766,12 +2769,12 @@ Querying info
 
    .. group-tab:: C++
 
-     .. doxygenfunction:: simgrid::s4u::Task::get_disk() const
-     .. doxygenfunction:: simgrid::s4u::Task::get_bytes() const
-     .. doxygenfunction:: simgrid::s4u::Task::get_op_type() const
-     .. doxygenfunction:: simgrid::s4u::Task::set_disk(simgrid::s4u::Disk* disk);
-     .. doxygenfunction:: simgrid::s4u::Task::set_bytes(simgrid::double bytes);
-     .. doxygenfunction:: simgrid::s4u::Task::set_op_type(simgrid::s4u::Io::OpType type);
+     .. doxygenfunction:: simgrid::s4u::IoTask::get_disk() const
+     .. doxygenfunction:: simgrid::s4u::IoTask::get_bytes() const
+     .. doxygenfunction:: simgrid::s4u::IoTask::get_op_type() const
+     .. doxygenfunction:: simgrid::s4u::IoTask::set_disk(Disk* disk);
+     .. doxygenfunction:: simgrid::s4u::IoTask::set_bytes(double bytes);
+     .. doxygenfunction:: simgrid::s4u::IoTask::set_op_type(Io::OpType type);
 
 .. _API_s4u_Synchronizations:
 
index c2e2b14..b917540 100644 (file)
@@ -173,7 +173,7 @@ foreach (example activityset-testany activityset-waitany activityset-waitall act
                  network-ns3 network-ns3-wifi network-wifi
                  io-async io-priority io-degradation io-file-system io-file-remote io-disk-raw io-dependent
                  task-dispatch task-io task-microservice task-parallelism task-simple task-storm task-switch-host task-variable-load
-                 photovoltaic-simple
+                 solar-panel-simple
                  platform-comm-serialize platform-failures platform-profile platform-properties
                  plugin-host-load plugin-jbod plugin-link-load plugin-prodcons
                  replay-comm replay-io
index 2a98162..b2ca2e7 100644 (file)
@@ -87,8 +87,7 @@ public:
  * @param id Internal identifier in the torus (for information)
  * @return netpoint, gateway: the netpoint to the StarZone and CPU0 as gateway
  */
-static std::pair<simgrid::kernel::routing::NetPoint*, simgrid::kernel::routing::NetPoint*>
-create_hostzone(const sg4::NetZone* zone, const std::vector<unsigned long>& /*coord*/, unsigned long id)
+static sg4::NetZone* create_hostzone(const sg4::NetZone* zone, const std::vector<unsigned long>& /*coord*/, unsigned long id)
 {
   constexpr int num_cpus    = 8;     //!< Number of CPUs in the zone
   constexpr double speed    = 1e9;   //!< Speed of each CPU
@@ -101,24 +100,21 @@ create_hostzone(const sg4::NetZone* zone, const std::vector<unsigned long>& /*co
   /* setting my Torus parent zone */
   host_zone->set_parent(zone);
 
-  simgrid::kernel::routing::NetPoint* gateway = nullptr;
   /* create CPUs */
   for (int i = 0; i < num_cpus; i++) {
     std::string cpu_name  = hostname + "-cpu" + std::to_string(i);
-    const sg4::Host* host = host_zone->create_host(cpu_name, speed)->seal();
+    const sg4::Host* host = host_zone->create_host(cpu_name, speed);
     /* the first CPU is the gateway */
     if (i == 0)
-      gateway = host->get_netpoint();
+      host_zone->set_gateway(host->get_netpoint());
     /* create split-duplex link */
-    sg4::SplitDuplexLink* link = host_zone->create_split_duplex_link("link-" + cpu_name, link_bw);
-    link->set_latency(link_lat)->seal();
+    auto* link = host_zone->create_split_duplex_link("link-" + cpu_name, link_bw)->set_latency(link_lat);
     /* connecting CPU to outer world */
-    host_zone->add_route(host->get_netpoint(), nullptr, nullptr, nullptr, {{link, sg4::LinkInRoute::Direction::UP}},
-                         true);
+    host_zone->add_route(host, nullptr, {{link, sg4::LinkInRoute::Direction::UP}}, true);
   }
   /* seal newly created netzone */
   host_zone->seal();
-  return std::make_pair(host_zone->get_netpoint(), gateway);
+  return host_zone;
 }
 
 /*************************************************************************************************/
index 7cb9437..83b9cf2 100644 (file)
@@ -71,14 +71,14 @@ static void load_platform()
   for (int id = 0; id < 32; id++) {
     std::string hostname = prefix + std::to_string(id) + suffix;
     /* create host */
-    const sg4::Host* host = root->create_host(hostname, 1)->set_core_count(32)->seal();
+    const sg4::Host* host = root->create_host(hostname, 1)->set_core_count(32);
     /* create UP/DOWN link */
-    const sg4::Link* l = root->create_split_duplex_link(hostname, BW_REMOTE)->set_latency(LATENCY)->seal();
+    const sg4::Link* l = root->create_split_duplex_link(hostname, BW_REMOTE)->set_latency(LATENCY);
 
     /* add link UP/DOWN for communications from the host */
-    root->add_route(host->get_netpoint(), nullptr, nullptr, nullptr, {{l, sg4::LinkInRoute::Direction::UP}}, true);
+    root->add_route(host, nullptr, {{l, sg4::LinkInRoute::Direction::UP}}, true);
 
-    sg4::Link* loopback = root->create_link(hostname + "_loopback", BW_LOCAL)->set_latency(LATENCY)->seal();
+    sg4::Link* loopback = root->create_link(hostname + "_loopback", BW_LOCAL)->set_latency(LATENCY);
     root->add_route(host, host, {loopback});
   }
 
diff --git a/examples/cpp/photovoltaic-simple/s4u-photovoltaic-simple.cpp b/examples/cpp/photovoltaic-simple/s4u-photovoltaic-simple.cpp
deleted file mode 100644 (file)
index afb65f0..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (c) 2003-2023. The SimGrid Team. All rights reserved.          */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-#include "simgrid/plugins/photovoltaic.hpp"
-#include "simgrid/s4u.hpp"
-
-XBT_LOG_NEW_DEFAULT_CATEGORY(photovoltaic_simple, "Messages specific for this s4u example");
-
-static void manager()
-{
-  const auto* pv_panel = simgrid::s4u::Engine::get_instance()->host_by_name("pv_panel");
-  std::vector<std::pair<double, double>> solar_irradiance = {{1, 10}, {100, 5}, {200, 20}};
-  for (auto [t, s] : solar_irradiance) {
-    simgrid::s4u::this_actor::sleep_until(t);
-    sg_photovoltaic_set_solar_irradiance(pv_panel, s);
-    XBT_INFO("%s power: %f", pv_panel->get_cname(), sg_photovoltaic_get_power(pv_panel));
-  }
-}
-
-int main(int argc, char* argv[])
-{
-  simgrid::s4u::Engine e(&argc, argv);
-  e.load_platform(argv[1]);
-  sg_photovoltaic_plugin_init();
-  simgrid::s4u::Actor::create("manager", e.host_by_name("pv_panel"), manager);
-  e.run();
-  return 0;
-}
diff --git a/examples/cpp/photovoltaic-simple/s4u-photovoltaic-simple.tesh b/examples/cpp/photovoltaic-simple/s4u-photovoltaic-simple.tesh
deleted file mode 100644 (file)
index 1146cc8..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/usr/bin/env tesh
-
-$ ${bindir:=.}/s4u-photovoltaic-simple ${platfdir}/photovoltaic_platform.xml
-> [pv_panel:manager:(1) 1.000000] [photovoltaic_simple/INFO] pv_panel power: 8.000000
-> [pv_panel:manager:(1) 100.000000] [photovoltaic_simple/INFO] pv_panel power: 4.000000
-> [pv_panel:manager:(1) 200.000000] [photovoltaic_simple/INFO] pv_panel power: 16.000000
index 67e0b5c..5f6b4ab 100644 (file)
@@ -41,23 +41,23 @@ int main(int argc, char** argv)
 
   auto* jbod_raid0 =
     simgrid::plugin::Jbod::create_jbod(zone, "jbod_raid0", 1e9, 4, simgrid::plugin::Jbod::RAID::RAID0, 1e7, 5e6);
-  zone->add_route(host->get_netpoint(), jbod_raid0->get_netpoint(), nullptr, nullptr, {sg4::LinkInRoute(link)});
+  zone->add_route(host, jbod_raid0, {link});
 
   auto* jbod_raid1 =
     simgrid::plugin::Jbod::create_jbod(zone, "jbod_raid1", 1e9, 4, simgrid::plugin::Jbod::RAID::RAID1, 1e7, 5e6);
-  zone->add_route(host->get_netpoint(), jbod_raid1->get_netpoint(), nullptr, nullptr, {sg4::LinkInRoute(link)});
+  zone->add_route(host, jbod_raid1, {link});
 
   auto* jbod_raid4 =
     simgrid::plugin::Jbod::create_jbod(zone, "jbod_raid4", 1e9, 4, simgrid::plugin::Jbod::RAID::RAID4, 1e7, 5e6);
-  zone->add_route(host->get_netpoint(), jbod_raid4->get_netpoint(), nullptr, nullptr, {sg4::LinkInRoute(link)});
+  zone->add_route(host, jbod_raid4, {link});
 
   auto* jbod_raid5 =
     simgrid::plugin::Jbod::create_jbod(zone, "jbod_raid5", 1e9, 4, simgrid::plugin::Jbod::RAID::RAID5, 1e7, 5e6);
-  zone->add_route(host->get_netpoint(), jbod_raid5->get_netpoint(), nullptr, nullptr, {sg4::LinkInRoute(link)});
+  zone->add_route(host, jbod_raid5, {link});
 
   auto* jbod_raid6 =
     simgrid::plugin::Jbod::create_jbod(zone, "jbod_raid6", 1e9, 4, simgrid::plugin::Jbod::RAID::RAID6, 1e7, 5e6);
-  zone->add_route(host->get_netpoint(), jbod_raid6->get_netpoint(), nullptr, nullptr, {sg4::LinkInRoute(link)});
+  zone->add_route(host, jbod_raid6, {link});
 
   zone->seal();
 
index ee7a3ce..8d1ceeb 100644 (file)
@@ -65,13 +65,8 @@ int main(int argc, char* argv[])
     std::string linkname = "cluster_link_" + std::to_string(i);
     const auto* link     = cluster->create_split_duplex_link(linkname, "1Gbps");
 
-    cluster->add_route(host->get_netpoint(), nullptr, nullptr, nullptr, {{link, sg4::LinkInRoute::Direction::UP}},
-                       true);
+    cluster->add_route(host, nullptr,  {{link, sg4::LinkInRoute::Direction::UP}}, true);
   }
-
-  auto* router = cluster->create_router("cluster_router");
-  std::vector<sg4::LinkInRoute> links; // empty
-  cluster->add_route(router, nullptr, nullptr, nullptr, links);
   cluster->seal();
 
   simgrid::plugin::ProducerConsumerPtr<int> pc = simgrid::plugin::ProducerConsumer<int>::create(2);
diff --git a/examples/cpp/solar-panel-simple/s4u-solar-panel-simple.cpp b/examples/cpp/solar-panel-simple/s4u-solar-panel-simple.cpp
new file mode 100644 (file)
index 0000000..624d83e
--- /dev/null
@@ -0,0 +1,46 @@
+/* Copyright (c) 2003-2023. The SimGrid Team. All rights reserved.          */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include "simgrid/plugins/solar_panel.hpp"
+#include "simgrid/s4u.hpp"
+#include <simgrid/s4u/Actor.hpp>
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(solar_panel_simple, "Messages specific for this s4u example");
+
+static void manager()
+{
+  auto solar_panel = simgrid::plugins::SolarPanel::init("Solar Panel", 10, 0.9, 10, 0, 1e3);
+  simgrid::s4u::this_actor::sleep_for(1);
+  XBT_INFO("%s: area: %fm² efficiency: %f irradiance: %fW/m² power: %fW", solar_panel->get_cname(),
+           solar_panel->get_area(), solar_panel->get_conversion_efficiency(), solar_panel->get_solar_irradiance(),
+           solar_panel->get_power());
+
+  solar_panel->set_area(20);
+  simgrid::s4u::this_actor::sleep_for(1);
+  XBT_INFO("%s: area: %fm² efficiency: %f irradiance: %fW/m² power: %fW", solar_panel->get_cname(),
+           solar_panel->get_area(), solar_panel->get_conversion_efficiency(), solar_panel->get_solar_irradiance(),
+           solar_panel->get_power());
+
+  solar_panel->set_conversion_efficiency(0.8);
+  simgrid::s4u::this_actor::sleep_for(1);
+  XBT_INFO("%s: area: %fm² efficiency: %f irradiance: %fW/m² power: %fW", solar_panel->get_cname(),
+           solar_panel->get_area(), solar_panel->get_conversion_efficiency(), solar_panel->get_solar_irradiance(),
+           solar_panel->get_power());
+
+  solar_panel->set_solar_irradiance(20);
+  simgrid::s4u::this_actor::sleep_for(1);
+  XBT_INFO("%s: area: %fm² efficiency: %f irradiance: %fW/m² power: %fW", solar_panel->get_cname(),
+           solar_panel->get_area(), solar_panel->get_conversion_efficiency(), solar_panel->get_solar_irradiance(),
+           solar_panel->get_power());
+}
+
+int main(int argc, char* argv[])
+{
+  simgrid::s4u::Engine e(&argc, argv);
+  e.load_platform(argv[1]);
+  simgrid::s4u::Actor::create("manager", e.host_by_name("Tremblay"), manager);
+  e.run();
+  return 0;
+}
diff --git a/examples/cpp/solar-panel-simple/s4u-solar-panel-simple.tesh b/examples/cpp/solar-panel-simple/s4u-solar-panel-simple.tesh
new file mode 100644 (file)
index 0000000..53b64dc
--- /dev/null
@@ -0,0 +1,7 @@
+#!/usr/bin/env tesh
+
+$ ${bindir:=.}/s4u-solar-panel-simple ${platfdir}/small_platform.xml
+> [Tremblay:manager:(1) 1.000000] [solar_panel_simple/INFO] Solar Panel: area: 10.000000m² efficiency: 0.900000 irradiance: 10.000000W/m² power: 90.000000W
+> [Tremblay:manager:(1) 2.000000] [solar_panel_simple/INFO] Solar Panel: area: 20.000000m² efficiency: 0.900000 irradiance: 10.000000W/m² power: 180.000000W
+> [Tremblay:manager:(1) 3.000000] [solar_panel_simple/INFO] Solar Panel: area: 20.000000m² efficiency: 0.800000 irradiance: 10.000000W/m² power: 160.000000W
+> [Tremblay:manager:(1) 4.000000] [solar_panel_simple/INFO] Solar Panel: area: 20.000000m² efficiency: 0.800000 irradiance: 20.000000W/m² power: 320.000000W
index 8adfdc0..04a83e6 100644 (file)
@@ -16,18 +16,17 @@ namespace sg4 = simgrid::s4u;
  * @param root Root netzone
  * @param name Cabinet name
  * @param radicals IDs of nodes inside the cabinet
- * @return netzone,router the created netzone and its router
+ * @return netzone the created netzone
  */
-static std::pair<sg4::NetZone*, simgrid::kernel::routing::NetPoint*>
+static sg4::NetZone*
 create_cabinet(const sg4::NetZone* root, const std::string& name, const std::vector<int>& radicals)
 {
-  auto* cluster      = sg4::create_star_zone(name);
+  auto* cluster      = sg4::create_star_zone(name)->set_parent(root);
   std::string prefix = "griffon-";
   std::string suffix = ".nancy.grid5000.fr";
-  cluster->set_parent(root);
 
   /* create the backbone link */
-  const sg4::Link* l_bb = cluster->create_link("backbone-" + name, "1.25GBps")->seal();
+  const sg4::Link* l_bb = cluster->create_link("backbone-" + name, "1.25GBps");
   sg4::LinkInRoute backbone(l_bb);
 
   /* create all hosts and connect them to outside world */
@@ -36,18 +35,17 @@ create_cabinet(const sg4::NetZone* root, const std::string& name, const std::vec
     /* create host */
     const sg4::Host* host = cluster->create_host(hostname, "286.087kf");
     /* create UP/DOWN link */
-    const sg4::Link* link = cluster->create_split_duplex_link(hostname, "125MBps")->set_latency("24us")->seal();
+    const sg4::Link* link = cluster->create_split_duplex_link(hostname, "125MBps")->set_latency("24us");
 
     /* add link and backbone for communications from the host */
-    cluster->add_route(host->get_netpoint(), nullptr, nullptr, nullptr,
-                       {{link, sg4::LinkInRoute::Direction::UP}, backbone}, true);
+    cluster->add_route(host, nullptr, {{link, sg4::LinkInRoute::Direction::UP}, backbone}, true);
   }
 
-  /* create router */
-  auto* router = cluster->create_router(prefix + name + "-router" + suffix);
+  /* create gateway */
+  cluster->set_gateway(cluster->create_router(prefix + name + "-router" + suffix));
 
   cluster->seal();
-  return std::make_pair(cluster, router);
+  return cluster;
 }
 
 /** @brief Programmatic version of griffon.xml */
@@ -75,7 +73,6 @@ void load_platform(const sg4::Engine& /*e*/)
 
   auto* root = sg4::create_star_zone("AS_griffon");
   sg4::NetZone* cab_zone;
-  simgrid::kernel::routing::NetPoint* router;
 
   /* create top link */
   const sg4::Link* l_bb = root->create_link("backbone", "1.25GBps")->set_latency("24us")->seal();
@@ -84,23 +81,23 @@ void load_platform(const sg4::Engine& /*e*/)
   /* create cabinet1 */
   std::vector<int> rad(32);
   std::iota(rad.begin(), rad.end(), 1); // 1-29,58,59,60
-  rad[rad.size() - 1]        = 60;
-  rad[rad.size() - 2]        = 59;
-  rad[rad.size() - 3]        = 58;
-  std::tie(cab_zone, router) = create_cabinet(root, "cabinet1", rad);
-  root->add_route(cab_zone->get_netpoint(), nullptr, router, nullptr, {backbone});
+  rad[rad.size() - 1]  = 60;
+  rad[rad.size() - 2]  = 59;
+  rad[rad.size() - 3]  = 58;
+  cab_zone             = create_cabinet(root, "cabinet1", rad);
+  root->add_route(cab_zone, nullptr, {backbone});
 
   /* create cabinet2 */
   rad.resize(28);
   std::iota(rad.begin(), rad.end(), 30); // 30-57
-  std::tie(cab_zone, router) = create_cabinet(root, "cabinet2", rad);
-  root->add_route(cab_zone->get_netpoint(), nullptr, router, nullptr, {backbone});
+  cab_zone = create_cabinet(root, "cabinet2", rad);
+  root->add_route(cab_zone, nullptr, {backbone});
 
   /* create cabinet3 */
   rad.resize(32);
   std::iota(rad.begin(), rad.end(), 61); // 61-92
-  std::tie(cab_zone, router) = create_cabinet(root, "cabinet3", rad);
-  root->add_route(cab_zone->get_netpoint(), nullptr, router, nullptr, {backbone});
+  cab_zone = create_cabinet(root, "cabinet3", rad);
+  root->add_route(cab_zone, nullptr, {backbone});
 
   root->seal();
 }
diff --git a/examples/platforms/photovoltaic_platform.xml b/examples/platforms/photovoltaic_platform.xml
deleted file mode 100644 (file)
index 8e499e1..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version='1.0'?>
-<!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
-<platform version="4.1">
-  <zone id="world" routing="Floyd">
-    <host id="pv_panel" speed="0f">
-      <prop id="photovoltaic_area" value="4" />
-      <prop id="photovoltaic_conversion_efficiency" value="0.2" />
-    </host>
-  </zone>
-</platform>
index f3bd3cc..b7b218f 100644 (file)
@@ -16,40 +16,40 @@ namespace sg4 = simgrid::s4u;
  * @param host List of hostname inside the cluster
  * @param single_link_host Hostname of "special" node
  */
-static void create_cluster(const sg4::NetZone* root, const std::string& cluster_suffix,
+static sg4::NetZone* create_cluster(const sg4::NetZone* root, const std::string& cluster_suffix,
                            const std::vector<std::string>& hosts, const std::string& single_link_host)
 {
-  auto* cluster = sg4::create_star_zone("cluster" + cluster_suffix);
-  cluster->set_parent(root);
+  auto* cluster = sg4::create_star_zone("cluster" + cluster_suffix)->set_parent(root);
 
   /* create the backbone link */
-  const sg4::Link* l_bb = cluster->create_link("backbone" + cluster_suffix, 2.25e9)->set_latency(5e-4)->seal();
+  const sg4::Link* l_bb = cluster->create_link("backbone" + cluster_suffix, "20Gbps")->set_latency("500us");
 
   /* create all hosts and connect them to outside world */
   for (const auto& hostname : hosts) {
     /* create host */
-    const sg4::Host* host = cluster->create_host(hostname, 1e9);
+    const sg4::Host* host = cluster->create_host(hostname, "1Gf");
     /* create UP link */
-    const sg4::Link* l_up = cluster->create_link(hostname + "_up", 1.25e8)->set_latency(0.0001)->seal();
+    const sg4::Link* l_up = cluster->create_link(hostname + "_up", "1Gbps")->set_latency("100us");
     /* create DOWN link, if needed */
     const sg4::Link* l_down = l_up;
     if (hostname != single_link_host) {
-      l_down = cluster->create_link(hostname + "_down", 1.25e8)->set_latency(0.0001)->seal();
+      l_down = cluster->create_link(hostname + "_down", "1Gbps")->set_latency("100us");
     }
     sg4::LinkInRoute backbone{l_bb};
     sg4::LinkInRoute link_up{l_up};
     sg4::LinkInRoute link_down{l_down};
 
     /* add link UP and backbone for communications from the host */
-    cluster->add_route(host->get_netpoint(), nullptr, nullptr, nullptr, {link_up, backbone}, false);
+    cluster->add_route(host, nullptr, {link_up, backbone}, false);
     /* add backbone and link DOWN for communications to the host */
-    cluster->add_route(nullptr, host->get_netpoint(), nullptr, nullptr, {backbone, link_down}, false);
+    cluster->add_route(nullptr, host, {backbone, link_down}, false);
   }
 
-  /* create router */
-  cluster->create_router("router" + cluster_suffix);
+  /* create gateway*/
+  cluster->set_gateway(cluster->create_router("router" + cluster_suffix));
 
   cluster->seal();
+  return cluster;
 }
 
 /** @brief Programmatic version of routing_cluster.xml */
@@ -76,15 +76,14 @@ void load_platform(const sg4::Engine& e)
   auto* root = sg4::create_full_zone("AS0");
 
   /* create left cluster */
-  create_cluster(root, "1", {"host1", "host2", "host3"}, "host3");
+  auto* left_cluster = create_cluster(root, "1", {"host1", "host2", "host3"}, "host3");
   /* create right cluster */
-  create_cluster(root, "2", {"host4", "host5", "host6"}, "host6");
+  auto* right_cluster = create_cluster(root, "2", {"host4", "host5", "host6"}, "host6");
 
-  /* connect both cluster through their respective routers */
-  const sg4::Link* l = root->create_link("link1-2", 2.25e9)->set_latency(5e-4)->seal();
+  /* connect both clusters */
+  const sg4::Link* l = root->create_link("link1-2", "20Gbps")->set_latency("500us");
   sg4::LinkInRoute link{l};
-  root->add_route(e.netpoint_by_name_or_null("cluster1"), e.netpoint_by_name_or_null("cluster2"),
-                  e.netpoint_by_name_or_null("router1"), e.netpoint_by_name_or_null("router2"), {link});
+  root->add_route(left_cluster, right_cluster, {link});
 
   root->seal();
 }
index fa2c42d..033abe9 100644 (file)
@@ -26,8 +26,7 @@ static std::string int_string(int n)
  */
 static sg4::NetZone* create_node(const sg4::NetZone* root, const std::string& node_name, const int nb_cpu)
 {
-  auto* node = sg4::create_star_zone(node_name);
-  node->set_parent(root);
+  auto* node = sg4::create_star_zone(node_name)->set_parent(root);
 
   /* create all hosts and connect them to outside world */
   for (int i = 0; i < nb_cpu; i++) {
@@ -35,9 +34,8 @@ static sg4::NetZone* create_node(const sg4::NetZone* root, const std::string& no
     const auto& linkname = "link_" + cpuname;
 
     const sg4::Host* host = node->create_host(cpuname, 1e9);
-    const sg4::Link* l    = node->create_split_duplex_link(linkname, BW_CPU)->set_latency(LAT_CPU)->seal();
-
-    node->add_route(host->get_netpoint(), nullptr, nullptr, nullptr, {{l, sg4::LinkInRoute::Direction::UP}}, true);
+    const sg4::Link* l    = node->create_split_duplex_link(linkname, BW_CPU)->set_latency(LAT_CPU);
+    node->add_route(host, nullptr, {{l, sg4::LinkInRoute::Direction::UP}}, true);
   }
 
   return node;
@@ -50,8 +48,7 @@ static sg4::NetZone* create_node(const sg4::NetZone* root, const std::string& no
 static sg4::NetZone* create_supernode(const sg4::NetZone* root, const std::string& supernode_name, const int nb_nodes,
                                       const int nb_cpu)
 {
-  auto* supernode = sg4::create_star_zone(supernode_name);
-  supernode->set_parent(root);
+  auto* supernode = sg4::create_star_zone(supernode_name)->set_parent(root);
 
   /* create all nodes and connect them to outside world */
   for (int i = 0; i < nb_nodes; i++) {
@@ -59,11 +56,11 @@ static sg4::NetZone* create_supernode(const sg4::NetZone* root, const std::strin
     const auto& linkname  = "link_" + node_name;
 
     sg4::NetZone* node = create_node(supernode, node_name, nb_cpu);
-    auto* router       = node->create_router("router_" + node_name);
+    node->set_gateway(node->create_router("router_" + node_name));
     node->seal();
 
-    const sg4::Link* l = supernode->create_split_duplex_link(linkname, BW_NODE)->set_latency(LAT_NODE)->seal();
-    supernode->add_route(node->get_netpoint(), nullptr, router, nullptr, {{l, sg4::LinkInRoute::Direction::UP}}, true);
+    const sg4::Link* l = supernode->create_split_duplex_link(linkname, BW_NODE)->set_latency(LAT_NODE);
+    supernode->add_route(node, nullptr, {{l, sg4::LinkInRoute::Direction::UP}}, true);
   }
   return supernode;
 }
@@ -83,12 +80,11 @@ static sg4::NetZone* create_cluster(const std::string& cluster_name, const int n
     const auto& linkname       = "link_" + supernode_name;
 
     sg4::NetZone* supernode = create_supernode(cluster, supernode_name, nb_nodes, nb_cpu);
-    auto* router            = supernode->create_router("router_" + supernode_name);
+    supernode->set_gateway(supernode->create_router("router_" + supernode_name));
     supernode->seal();
 
-    const sg4::Link* l = cluster->create_split_duplex_link(linkname, BW_NETWORK)->set_latency(LAT_NETWORK)->seal();
-    cluster->add_route(supernode->get_netpoint(), nullptr, router, nullptr, {{l, sg4::LinkInRoute::Direction::UP}},
-                       true);
+    const sg4::Link* l = cluster->create_split_duplex_link(linkname, BW_NETWORK)->set_latency(LAT_NETWORK);
+    cluster->add_route(supernode, nullptr, {{l, sg4::LinkInRoute::Direction::UP}}, true);
   }
   return cluster;
 }
index 85fe6a7..2c1da4f 100644 (file)
@@ -197,6 +197,7 @@ class StandardLinkImpl;
 class SplitDuplexLinkImpl;
 class NetworkAction;
 class DiskImpl;
+using DiskImplPtr = boost::intrusive_ptr<DiskImpl>;
 class DiskModel;
 class VirtualMachineImpl;
 class VMModel;
index ffb4322..ed13e52 100644 (file)
@@ -74,12 +74,13 @@ class XBT_PUBLIC NetZoneImpl : public xbt::PropertyHolder {
   s4u::NetZone piface_;
 
   // our content, as known to our graph routing algorithm (maps vertex_id -> vertex)
-  std::vector<kernel::routing::NetPoint*> vertices_;
+  std::vector<NetPoint*> vertices_;
   std::map<std::string, resource::StandardLinkImpl*, std::less<>> links_;
   /* save split-duplex links separately, keep links_ with only LinkImpl* seen by the user
    * members of a split-duplex are saved in the links_ */
   std::map<std::string, std::unique_ptr<resource::SplitDuplexLinkImpl>, std::less<>> split_duplex_links_;
   std::map<std::string, resource::HostImpl*, std::less<>> hosts_;
+  std::map<std::string, NetPoint*, std::less<>> gateways_;
 
   NetZoneImpl* parent_ = nullptr;
   std::vector<NetZoneImpl*> children_; // sub-netzones
@@ -87,7 +88,7 @@ class XBT_PUBLIC NetZoneImpl : public xbt::PropertyHolder {
   bool sealed_ = false; // We cannot add more content when sealed
 
   std::map<std::pair<const NetPoint*, const NetPoint*>, BypassRoute*> bypass_routes_; // src x dst -> route
-  routing::NetPoint* netpoint_ = nullptr; // Our representative in the parent NetZone
+  NetPoint* netpoint_ = nullptr; // Our representative in the parent NetZone
 
 protected:
   explicit NetZoneImpl(const std::string& name);
@@ -142,7 +143,7 @@ public:
   const s4u::NetZone* get_iface() const { return &piface_; }
   s4u::NetZone* get_iface() { return &piface_; }
   unsigned int get_table_size() const { return vertices_.size(); }
-  std::vector<kernel::routing::NetPoint*> get_vertices() const { return vertices_; }
+  std::vector<NetPoint*> get_vertices() const { return vertices_; }
   NetZoneImpl* get_parent() const { return parent_; }
   /** @brief Returns the list of direct children (no grand-children). This returns the internal data, no copy.
    * Don't mess with it.*/
@@ -156,7 +157,12 @@ public:
   const char* get_cname() const { return name_.c_str(); };
 
   /** @brief Gets the netpoint associated to this netzone */
-  kernel::routing::NetPoint* get_netpoint() const { return netpoint_; }
+  NetPoint* get_netpoint() const { return netpoint_; }
+
+  void set_gateway(const std::string& name, NetPoint* router);
+  /** @brief Gets the gateway associated to this netzone */
+  NetPoint* get_gateway() const;
+  NetPoint* get_gateway(const std::string& name) const { return gateways_.at(name); }
 
   std::vector<s4u::Host*> get_all_hosts() const;
   size_t get_host_count() const;
diff --git a/include/simgrid/plugins/photovoltaic.hpp b/include/simgrid/plugins/photovoltaic.hpp
deleted file mode 100644 (file)
index 3941751..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright (c) 2023. The SimGrid Team. All rights reserved.          */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-#ifndef SIMGRID_PLUGINS_PHOTOVOLTAIC_H_
-#define SIMGRID_PLUGINS_PHOTOVOLTAIC_H_
-
-#include <simgrid/config.h>
-#include <simgrid/forward.h>
-#include <xbt/base.h>
-
-SG_BEGIN_DECL
-
-XBT_PUBLIC void sg_photovoltaic_plugin_init();
-
-XBT_PUBLIC void sg_photovoltaic_set_solar_irradiance(const_sg_host_t host, double s);
-
-XBT_PUBLIC double sg_photovoltaic_get_power(const_sg_host_t host);
-
-SG_END_DECL
-
-#endif
diff --git a/include/simgrid/plugins/solar_panel.hpp b/include/simgrid/plugins/solar_panel.hpp
new file mode 100644 (file)
index 0000000..b9097b4
--- /dev/null
@@ -0,0 +1,85 @@
+/* Copyright (c) 2023. The SimGrid Team. All rights reserved.          */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+#ifndef SIMGRID_PLUGINS_SOLAR_PANEL_H_
+#define SIMGRID_PLUGINS_SOLAR_PANEL_H_
+
+#include <simgrid/kernel/resource/Model.hpp>
+#include <simgrid/s4u/Activity.hpp>
+#include <xbt/Extendable.hpp>
+
+namespace simgrid::plugins {
+
+class SolarPanel;
+using SolarPanelPtr = boost::intrusive_ptr<SolarPanel>;
+XBT_PUBLIC void intrusive_ptr_release(SolarPanel* o);
+XBT_PUBLIC void intrusive_ptr_add_ref(SolarPanel* o);
+
+class SolarPanelModel : public kernel::resource::Model {
+  std::vector<SolarPanelPtr> solar_panels_;
+
+public:
+  explicit SolarPanelModel();
+
+  void add_solar_panel(SolarPanelPtr b);
+  void update_actions_state(double now, double delta) override;
+  double next_occurring_event(double now) override;
+};
+
+class SolarPanel {
+
+  friend SolarPanelModel;
+
+private:
+  static std::shared_ptr<SolarPanelModel> solar_panel_model_;
+
+  std::string name_;
+  double area_m2_;
+  double conversion_efficiency_;
+  double solar_irradiance_w_per_m2_;
+  double min_power_w_;
+  double max_power_w_;
+
+  double power_w_      = 0;
+  double last_updated_ = 0;
+
+  explicit SolarPanel(std::string name, double area_m2, double conversion_efficiency, double solar_irradiance_w_per_m2,
+                      double min_power_w, double max_power_w);
+  static void init_plugin();
+  void update();
+
+  std::atomic_int_fast32_t refcount_{0};
+#ifndef DOXYGEN
+  friend void intrusive_ptr_release(SolarPanel* o)
+  {
+    if (o->refcount_.fetch_sub(1, std::memory_order_release) == 1) {
+      std::atomic_thread_fence(std::memory_order_acquire);
+      delete o;
+    }
+  }
+  friend void intrusive_ptr_add_ref(SolarPanel* o) { o->refcount_.fetch_add(1, std::memory_order_relaxed); }
+#endif
+
+public:
+  static SolarPanelPtr init(const std::string& name, double area_m2, double conversion_efficiency,
+                            double solar_irradiance_w_per_m2, double min_power_w, double max_power_w);
+
+  SolarPanelPtr set_name(std::string name);
+  SolarPanelPtr set_area(double area_m2);
+  SolarPanelPtr set_conversion_efficiency(double e);
+  SolarPanelPtr set_solar_irradiance(double solar_irradiance_w_per_m2);
+  SolarPanelPtr set_min_power(double power_w);
+  SolarPanelPtr set_max_power(double power_w);
+
+  std::string get_name() { return name_; }
+  const char* get_cname() { return name_.c_str(); }
+  double get_area() { return area_m2_; }
+  double get_conversion_efficiency() { return conversion_efficiency_; }
+  double get_solar_irradiance() { return solar_irradiance_w_per_m2_; }
+  double get_min_power() { return min_power_w_; }
+  double get_max_power() { return max_power_w_; }
+  double get_power() { return power_w_; }
+};
+} // namespace simgrid::plugins
+#endif
index e9b909f..770b70a 100644 (file)
@@ -57,7 +57,12 @@ public:
   const char* get_property(const std::string& key) const;
   void set_property(const std::string& key, const std::string& value);
   /** @brief Get the netpoint associated to this netzone */
-  kernel::routing::NetPoint* get_netpoint();
+  kernel::routing::NetPoint* get_netpoint() const;
+  /** @brief Get the gateway associated to this netzone */
+  kernel::routing::NetPoint* get_gateway() const;
+  kernel::routing::NetPoint* get_gateway(const std::string& name) const;
+  void set_gateway(kernel::routing::NetPoint* router);
+  void set_gateway(const std::string& name, kernel::routing::NetPoint* router);
 
   void extract_xbt_graph(const s_xbt_graph_t* graph, std::map<std::string, xbt_node_t, std::less<>>* nodes,
                          std::map<std::string, xbt_edge_t, std::less<>>* edges);
@@ -65,6 +70,24 @@ public:
   /* Add content to the netzone, at parsing time. It should be sealed afterward. */
   unsigned long add_component(kernel::routing::NetPoint* elm); /* A host, a router or a netzone, whatever */
 
+
+/**
+   * @brief Add a route between 2 netzones, and same in other direction
+   * @param src Source netzone
+   * @param dst Destination netzone
+   * @param link_list List of links
+   */
+  void add_route(const NetZone* src, const NetZone* dst, const std::vector<const Link*>& links);
+
+/**
+   * @brief Add a route between 2 netzones, and same in other direction
+   * @param src Source netzone
+   * @param dst Destination netzone
+   * @param link_list List of links and their direction used in this communication
+   * @param symmetrical Bi-directional communication
+   */
+  void add_route(const NetZone* src, const NetZone* dst, const std::vector<LinkInRoute>& link_list, bool symmetrical = true);
+
   /**
    * @brief Add a route between 2 netpoints
    *
@@ -79,6 +102,7 @@ public:
    * @param link_list List of links and their direction used in this communication
    * @param symmetrical Bi-directional communication
    */
+  //XBT_ATTRIB_DEPRECATED_v339("Please call add_route either from Host to Host or NetZone to NetZone")
   void add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src,
                  kernel::routing::NetPoint* gw_dst, const std::vector<LinkInRoute>& link_list, bool symmetrical = true);
   /**
@@ -94,7 +118,8 @@ public:
    * @param gw_dst Netpoint of the gateway in the destination netzone
    * @param link_list List of links
    */
-  void add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src,
+ //XBT_ATTRIB_DEPRECATED_v339("Please call add_route either from Host to Host or NetZone to NetZone")
+ void add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src,
                  kernel::routing::NetPoint* gw_dst, const std::vector<const Link*>& links);
 
   /**
@@ -223,8 +248,29 @@ struct ClusterCallbacks {
    * @param id: Internal identifier of the element
    * @return pair<NetPoint*, NetPoint*>: returns a pair of netpoint and gateway.
    */
+  // XBT_ATTRIB_DEPRECATED_v339
   using ClusterNetPointCb = std::pair<kernel::routing::NetPoint*, kernel::routing::NetPoint*>(
       NetZone* zone, const std::vector<unsigned long>& coord, unsigned long id);
+
+   /**
+   * @brief Callback used to set the NetZone located at some leaf of clusters (Torus, FatTree, etc)
+   *
+   * @param zone: The parent zone, needed for creating new resources (hosts, links)
+   * @param coord: the coordinates of the element
+   * @param id: Internal identifier of the element
+   * @return NetZone*: returns newly created netzone
+   */
+  using ClusterNetZoneCb = NetZone*(NetZone* zone, const std::vector<unsigned long>& coord, unsigned long id);
+  /**
+   * @brief Callback used to set the Host located at some leaf of clusters (Torus, FatTree, etc)
+   *
+   * @param zone: The parent zone, needed for creating new resources (hosts, links)
+   * @param coord: the coordinates of the element
+   * @param id: Internal identifier of the element
+   * @return Host*: returns newly created host
+   */
+  using ClusterHostCb = Host*(NetZone* zone, const std::vector<unsigned long>& coord, unsigned long id);
+
   /**
    * @brief Callback used to set the links for some leaf of the cluster (Torus, FatTree, etc)
    *
@@ -242,14 +288,36 @@ struct ClusterCallbacks {
    */
   using ClusterLinkCb = Link*(NetZone* zone, const std::vector<unsigned long>& coord, unsigned long id);
 
-  std::function<ClusterNetPointCb> netpoint;
+  bool by_netzone_ = false;
+  bool is_by_netzone() const { return by_netzone_; }
+  bool by_netpoint_ = false; // XBT_ATTRIB_DEPRECATED_v339
+  bool is_by_netpoint() const { return by_netpoint_; } // XBT_ATTRIB_DEPRECATED_v339
+  std::function<ClusterNetPointCb> netpoint; // XBT_ATTRIB_DEPRECATED_v339
+  std::function<ClusterHostCb> host;
+  std::function<ClusterNetZoneCb> netzone;
   std::function<ClusterLinkCb> loopback = {};
   std::function<ClusterLinkCb> limiter  = {};
+  explicit ClusterCallbacks(const std::function<ClusterNetZoneCb>& set_netzone)
+      : by_netzone_(true), netzone(set_netzone){/* nothing to do */};
+
+  ClusterCallbacks(const std::function<ClusterNetZoneCb>& set_netzone,
+                   const std::function<ClusterLinkCb>& set_loopback, const std::function<ClusterLinkCb>& set_limiter)
+      :  by_netzone_(true), netzone(set_netzone), loopback(set_loopback), limiter(set_limiter){/* nothing to do */};
+
+  explicit ClusterCallbacks(const std::function<ClusterHostCb>& set_host)
+      : host(set_host) {/* nothing to do */};
+
+  ClusterCallbacks(const std::function<ClusterHostCb>& set_host,
+                   const std::function<ClusterLinkCb>& set_loopback, const std::function<ClusterLinkCb>& set_limiter)
+      :  host(set_host), loopback(set_loopback), limiter(set_limiter){/* nothing to do */};
+
+  XBT_ATTRIB_DEPRECATED_v339("Please use callback with either a Host/NetZone creation function as first parameter")
   explicit ClusterCallbacks(const std::function<ClusterNetPointCb>& set_netpoint)
-      : netpoint(set_netpoint){/*nothing to do */};
+      : by_netpoint_(true), netpoint(set_netpoint){/* nothing to do */};
+  XBT_ATTRIB_DEPRECATED_v339("Please use callback with either a Host/NetZone creation function as first parameter")
   ClusterCallbacks(const std::function<ClusterNetPointCb>& set_netpoint,
                    const std::function<ClusterLinkCb>& set_loopback, const std::function<ClusterLinkCb>& set_limiter)
-      : netpoint(set_netpoint), loopback(set_loopback), limiter(set_limiter){/*nothing to do */};
+      : by_netpoint_(true), netpoint(set_netpoint), loopback(set_loopback), limiter(set_limiter){/* nothing to do */};
 };
 /**
  * @brief Create a torus zone
index cb49f3b..aaeeb83 100644 (file)
@@ -46,7 +46,7 @@ void MailboxImpl::set_receiver(s4u::ActorPtr actor)
 /** @brief Pushes a communication activity into a mailbox
  *  @param comm What to add
  */
-void MailboxImpl::push(CommImplPtr comm)
+void MailboxImpl::push(const CommImplPtr& comm)
 {
   comm->set_mailbox(this);
   this->comm_queue_.push_back(std::move(comm));
@@ -61,12 +61,11 @@ void MailboxImpl::remove(const CommImplPtr& comm)
              (comm->get_mailbox() ? comm->get_mailbox()->get_cname() : "(null)"), this->get_cname());
 
   comm->set_mailbox(nullptr);
-  for (auto it = this->comm_queue_.begin(); it != this->comm_queue_.end(); it++)
-    if (*it == comm) {
-      this->comm_queue_.erase(it);
-      return;
-    }
-  xbt_die("Comm %p not found in mailbox %s", comm.get(), this->get_cname());
+  auto it = std::find(this->comm_queue_.begin(), this->comm_queue_.end(), comm);
+  if (it != this->comm_queue_.end())
+    this->comm_queue_.erase(it);
+  else
+    xbt_die("Comm %p not found in mailbox %s", comm.get(), this->get_cname());
 }
 
 /** @brief Removes all communication activities from a mailbox
@@ -74,7 +73,7 @@ void MailboxImpl::remove(const CommImplPtr& comm)
 void MailboxImpl::clear(bool do_finish)
 {
   // CommImpl::cancel() will remove the comm from the mailbox..
-  for (auto comm : done_comm_queue_) {
+  for (const auto& comm : done_comm_queue_) {
     comm->cancel();
     comm->set_state(State::FAILED);
     if (do_finish)
index 199fcd1..715e762 100644 (file)
 #include "src/kernel/activity/CommImpl.hpp"
 #include "src/kernel/actor/ActorImpl.hpp"
 
-#include <boost/circular_buffer.hpp>
-
 namespace simgrid::kernel::activity {
 
 /** @brief Implementation of the s4u::Mailbox */
 
 class MailboxImpl {
-  static constexpr size_t MAX_MAILBOX_SIZE = 10000000;
-
   s4u::Mailbox piface_;
   std::string name_;
   actor::ActorImplPtr permanent_receiver_; // actor to which the mailbox is attached
-  boost::circular_buffer_space_optimized<CommImplPtr> comm_queue_{MAX_MAILBOX_SIZE};
+  std::list<CommImplPtr> comm_queue_;
   // messages already received in the permanent receive mode
-  boost::circular_buffer_space_optimized<CommImplPtr> done_comm_queue_{MAX_MAILBOX_SIZE};
+  std::list<CommImplPtr> done_comm_queue_;
 
   friend s4u::Engine;
   friend s4u::Mailbox;
@@ -50,8 +46,8 @@ public:
   const std::string& get_name() const { return name_; }
   const char* get_cname() const { return name_.c_str(); }
   void set_receiver(s4u::ActorPtr actor);
-  void push(CommImplPtr comm);
-  void push_done(CommImplPtr done_comm) { done_comm_queue_.push_back(done_comm); }
+  void push(const CommImplPtr& comm);
+  void push_done(const CommImplPtr& done_comm) { done_comm_queue_.push_back(done_comm); }
   void remove(const CommImplPtr& comm);
   void clear(bool do_finish);
   CommImplPtr iprobe(int type, const std::function<bool(void*, void*, CommImpl*)>& match_fun, void* data);
@@ -61,9 +57,9 @@ public:
   actor::ActorImplPtr get_permanent_receiver() const { return permanent_receiver_; }
   bool empty() const { return comm_queue_.empty(); }
   size_t size() const { return comm_queue_.size(); }
-  CommImplPtr front() const { return comm_queue_.front(); }
+  const CommImplPtr& front() const { return comm_queue_.front(); }
   bool has_some_done_comm() const { return not done_comm_queue_.empty(); }
-  CommImplPtr done_front() const { return done_comm_queue_.front(); }
+  const CommImplPtr& done_front() const { return done_comm_queue_.front(); }
 };
 } // namespace simgrid::kernel::activity
 
index 55f6857..a1bdb8a 100644 (file)
@@ -50,6 +50,7 @@ class DiskImpl : public Resource_T<DiskImpl>, public xbt::PropertyHolder {
   Metric read_bw_      = {0.0, 0, nullptr};
   Metric write_bw_     = {0.0, 0, nullptr};
   double readwrite_bw_ = -1; /* readwrite constraint bound, usually max(read, write) */
+  std::atomic_int_fast32_t refcount_{0};
 
   void apply_sharing_policy_cfg();
 
@@ -60,6 +61,17 @@ public:
   explicit DiskImpl(const std::string& name, double read_bandwidth, double write_bandwidth);
   DiskImpl(const DiskImpl&) = delete;
   DiskImpl& operator=(const DiskImpl&) = delete;
+  friend void intrusive_ptr_add_ref(DiskImpl* disk)
+  {
+    disk->refcount_.fetch_add(1, std::memory_order_acq_rel);
+  }
+  friend void intrusive_ptr_release(DiskImpl* disk)
+  {
+    if (disk->refcount_.fetch_sub(1, std::memory_order_release) == 1) {
+      std::atomic_thread_fence(std::memory_order_acquire);
+      delete disk;
+    }
+  }
 
   /** @brief Public interface */
   const s4u::Disk* get_iface() const { return &piface_; }
index 614bf9e..4a0c728 100644 (file)
@@ -53,9 +53,6 @@ HostImpl::~HostImpl()
     delete arg;
   actors_at_boot_.clear();
 
-  for (auto const& [_, d] : disks_)
-    d->destroy();
-
   for (auto const& [_, vm] : vms_)
     vm->vm_destroy();
 }
@@ -216,7 +213,7 @@ s4u::Disk* HostImpl::create_disk(const std::string& name, double read_bandwidth,
 
 void HostImpl::add_disk(const s4u::Disk* disk)
 {
-  disks_[disk->get_name()] = disk->get_impl();
+  disks_[disk->get_name()] = kernel::resource::DiskImplPtr(disk->get_impl());
 }
 
 void HostImpl::remove_disk(const std::string& name)
index 0de2d0b..2701e3b 100644 (file)
@@ -49,7 +49,7 @@ class XBT_PRIVATE HostImpl : public xbt::PropertyHolder, public actor::ObjectAcc
   ActorList actor_list_;
   std::vector<actor::ProcessArg*> actors_at_boot_;
   s4u::Host piface_;
-  std::map<std::string, DiskImpl*, std::less<>> disks_;
+  std::map<std::string, DiskImplPtr, std::less<>> disks_;
   std::map<std::string, VirtualMachineImpl*, std::less<>> vms_;
   std::string name_{"noname"};
   routing::NetZoneImpl* englobing_zone_ = nullptr;
index 72f6dca..fa82dd4 100644 (file)
@@ -3,6 +3,7 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
+#include "simgrid/s4u/Host.hpp"
 #include "simgrid/kernel/routing/ClusterZone.hpp"
 #include "simgrid/kernel/routing/NetPoint.hpp"
 #include "src/kernel/resource/StandardLinkImpl.hpp"
@@ -82,7 +83,17 @@ void ClusterBase::fill_leaf_from_cb(unsigned long position, const std::vector<un
   kernel::routing::NetPoint* netpoint = nullptr;
   kernel::routing::NetPoint* gw       = nullptr;
   auto dims                           = index_to_dims(position);
-  std::tie(netpoint, gw)              = set_callbacks.netpoint(get_iface(), dims, position);
+  if (set_callbacks.is_by_netpoint()) { // XBT_ATTRIB_DEPRECATED_v339
+    std::tie(netpoint, gw) = set_callbacks.netpoint(get_iface(), dims, position); // XBT_ATTRIB_DEPRECATED_v339
+  } else if (set_callbacks.is_by_netzone()) {
+    s4u::NetZone* netzone = set_callbacks.netzone(get_iface(), dims, position);
+    netpoint              = netzone->get_netpoint();
+    gw                    = netzone->get_gateway();
+  } else {
+    s4u::Host* host = set_callbacks.host(get_iface(), dims, position);
+    netpoint        = host->get_netpoint();
+  }
+
   xbt_assert(netpoint, "set_netpoint(elem=%lu): Invalid netpoint (nullptr)", position);
   if (netpoint->is_netzone()) {
     xbt_assert(gw && not gw->is_netzone(),
index 379f431..9a1c89a 100644 (file)
@@ -30,7 +30,6 @@ TEST_CASE("kernel::routing::DijkstraZone: mix new routes and hosts", "")
   for (int i = 0; i < 10; i++) {
     std::string cpu_name          = "CPU" + std::to_string(i);
     const simgrid::s4u::Host* cpu = zone->create_host(cpu_name, 1e9)->seal();
-    REQUIRE_NOTHROW(zone->add_route(cpu->get_netpoint(), nic->get_netpoint(), nullptr, nullptr,
-                                    {simgrid::s4u::LinkInRoute(link)}, true));
+    REQUIRE_NOTHROW(zone->add_route(cpu, nic,{link}));
   }
 }
index e0c751b..f4fbe4a 100644 (file)
@@ -24,12 +24,11 @@ TEST_CASE("kernel::routing::FloydZone: mix new routes and hosts", "")
   simgrid::s4u::Engine e("test");
   auto* zone = simgrid::s4u::create_floyd_zone("test");
 
-  const simgrid::s4u::Host* nic  = zone->create_host("nic", 1e9)->seal();
-  const simgrid::s4u::Link* link = zone->create_link("my_link", 1e6)->seal();
+  const simgrid::s4u::Host* nic  = zone->create_host("nic", 1e9);
+  const simgrid::s4u::Link* link = zone->create_link("my_link", 1e6);
   for (int i = 0; i < 10; i++) {
     std::string cpu_name          = "CPU" + std::to_string(i);
-    const simgrid::s4u::Host* cpu = zone->create_host(cpu_name, 1e9)->seal();
-    REQUIRE_NOTHROW(zone->add_route(cpu->get_netpoint(), nic->get_netpoint(), nullptr, nullptr,
-                                    {simgrid::s4u::LinkInRoute(link)}, true));
+    const simgrid::s4u::Host* cpu = zone->create_host(cpu_name, 1e9);
+    REQUIRE_NOTHROW(zone->add_route(cpu, nic, {link}));
   }
 }
index 1be4da6..9ffcab7 100644 (file)
@@ -24,12 +24,11 @@ TEST_CASE("kernel::routing::FullZone: mix new routes and hosts", "[bug]")
   simgrid::s4u::Engine e("test");
   auto* zone = simgrid::s4u::create_full_zone("test");
 
-  const simgrid::s4u::Host* nic  = zone->create_host("nic", 1e9)->seal();
-  const simgrid::s4u::Link* link = zone->create_link("my_link", 1e6)->seal();
+  const simgrid::s4u::Host* nic  = zone->create_host("nic", 1e9);
+  const simgrid::s4u::Link* link = zone->create_link("my_link", 1e6);
   for (int i = 0; i < 10; i++) {
     std::string cpu_name          = "CPU" + std::to_string(i);
-    const simgrid::s4u::Host* cpu = zone->create_host(cpu_name, 1e9)->seal();
-    REQUIRE_NOTHROW(zone->add_route(cpu->get_netpoint(), nic->get_netpoint(), nullptr, nullptr,
-                                    {simgrid::s4u::LinkInRoute(link)}, true));
+    const simgrid::s4u::Host* cpu = zone->create_host(cpu_name, 1e9);
+    REQUIRE_NOTHROW(zone->add_route(cpu, nic, {link}));
   }
 }
index 5ed1d62..08df429 100644 (file)
@@ -669,6 +669,24 @@ void NetZoneImpl::get_graph(const s_xbt_graph_t* graph, std::map<std::string, xb
   }
 }
 
+void NetZoneImpl::set_gateway(const std::string& name, NetPoint* router)
+{
+  xbt_enforce(not sealed_, "Impossible to create gateway: %s. NetZone %s already sealed", name.c_str(), get_cname());
+  if (auto gateway_it = gateways_.find(name); gateway_it != gateways_.end())
+    xbt_die("Impossible to create a gateway named %s. It already exists", name.c_str());
+  else
+    gateways_[name] = router;
+}
+
+NetPoint* NetZoneImpl::get_gateway() const
+{
+  xbt_enforce(not gateways_.empty(), "No default gateway has been defined for NetZone '%s'. Try to seal it first", get_cname());
+  xbt_enforce(gateways_.size() < 2, "NetZone '%s' has more than one gateway, please provide a gateway name", get_cname());
+  auto gateway_it = gateways_.find("default");
+  xbt_enforce(gateway_it != gateways_.end(), "NetZone '%s' hasno default gateway, please define one", get_cname());
+  return gateway_it->second;
+}
+
 void NetZoneImpl::seal()
 {
   /* already sealed netzone */
@@ -676,6 +694,10 @@ void NetZoneImpl::seal()
     return;
   do_seal(); // derived class' specific sealing procedure
 
+  // for zone with a single host, this host is its own default gateway
+  if (gateways_.empty() && hosts_.size() == 1)
+    gateways_["default"] = hosts_.begin()->second->get_iface()->get_netpoint();
+
   /* seals sub-netzones and hosts */
   for (auto* host : get_all_hosts()) {
     host->seal();
index 3cc1c7a..76a955b 100644 (file)
@@ -6,17 +6,16 @@
 #ifndef NETZONE_TEST_HPP
 #define NETZONE_TEST_HPP
 
-#include "simgrid/kernel/routing/NetPoint.hpp"
-#include "simgrid/s4u/Host.hpp"
 #include "simgrid/s4u/NetZone.hpp"
+#include "xbt/log.h"
+XBT_LOG_EXTERNAL_CATEGORY(ker_platform);
 
 // Callback function common to several routing unit tests
 struct CreateHost {
-  std::pair<simgrid::kernel::routing::NetPoint*, simgrid::kernel::routing::NetPoint*>
-  operator()(simgrid::s4u::NetZone* zone, const std::vector<unsigned long>& /*coord*/, unsigned long id) const
+  simgrid::s4u::Host* operator()(simgrid::s4u::NetZone* zone, const std::vector<unsigned long>& /*coord*/,
+                                    unsigned long id) const
   {
-    const simgrid::s4u::Host* host = zone->create_host(std::to_string(id), 1e9)->seal();
-    return std::make_pair(host->get_netpoint(), nullptr);
+    return zone->create_host(std::to_string(id), "1Gf");
   }
 };
 
index 66dac29..4c7ff4d 100644 (file)
@@ -287,7 +287,6 @@ TEST_CASE("kernel::routing::StarZone: mix new routes and hosts", "")
   for (int i = 0; i < 10; i++) {
     std::string cpu_name          = "CPU" + std::to_string(i);
     const simgrid::s4u::Host* cpu = zone->create_host(cpu_name, 1e9)->seal();
-    REQUIRE_NOTHROW(
-        zone->add_route(cpu->get_netpoint(), nullptr, nullptr, nullptr, {simgrid::s4u::LinkInRoute(link)}, true));
+    REQUIRE_NOTHROW(zone->add_route(cpu, nullptr, {link}));
   }
 }
index 3d85fe3..d953e00 100644 (file)
@@ -149,7 +149,7 @@ void sg_platf_new_disk(const simgrid::kernel::routing::DiskCreationArgs* disk)
 
 /*************************************************************************************************/
 /** @brief Auxiliary function to create hosts */
-static std::pair<simgrid::kernel::routing::NetPoint*, simgrid::kernel::routing::NetPoint*>
+static simgrid::s4u::Host*
 sg_platf_cluster_create_host(const simgrid::kernel::routing::ClusterCreationArgs* cluster, simgrid::s4u::NetZone* zone,
                              const std::vector<unsigned long>& /*coord*/, unsigned long id)
 {
@@ -160,11 +160,10 @@ sg_platf_cluster_create_host(const simgrid::kernel::routing::ClusterCreationArgs
 
   std::string host_id = cluster->prefix + std::to_string(cluster->radicals[id]) + cluster->suffix;
   XBT_DEBUG("Cluster: creating host=%s speed=%f", host_id.c_str(), cluster->speeds.front());
-  const simgrid::s4u::Host* host = zone->create_host(host_id, cluster->speeds)
-                                       ->set_core_count(cluster->core_amount)
-                                       ->set_properties(cluster->properties)
-                                       ->seal();
-  return std::make_pair(host->get_netpoint(), nullptr);
+  simgrid::s4u::Host* host = zone->create_host(host_id, cluster->speeds)
+                                 ->set_core_count(cluster->core_amount)
+                                 ->set_properties(cluster->properties);
+  return host;
 }
 
 /** @brief Auxiliary function to create loopback links */
@@ -210,7 +209,8 @@ static void sg_platf_new_cluster_hierarchical(const simgrid::kernel::routing::Cl
   using simgrid::kernel::routing::FatTreeZone;
   using simgrid::kernel::routing::TorusZone;
 
-  auto set_host = std::bind(sg_platf_cluster_create_host, cluster, _1, _2, _3);
+  std::function<simgrid::s4u::ClusterCallbacks::ClusterHostCb> set_host =
+    std::bind(sg_platf_cluster_create_host, cluster, _1, _2, _3);
   std::function<simgrid::s4u::ClusterCallbacks::ClusterLinkCb> set_loopback{};
   std::function<simgrid::s4u::ClusterCallbacks::ClusterLinkCb> set_limiter{};
 
@@ -293,8 +293,7 @@ static void sg_platf_new_cluster_flat(simgrid::kernel::routing::ClusterCreationA
                                  ->set_latency(cluster->loopback_lat)
                                  ->seal();
 
-      zone->add_route(host->get_netpoint(), host->get_netpoint(), nullptr, nullptr,
-                      {simgrid::s4u::LinkInRoute(loopback)});
+      zone->add_route(host, host, {simgrid::s4u::LinkInRoute(loopback)});
     }
 
     // add a limiter link (shared link to account for maximal bandwidth of the node)
@@ -322,7 +321,7 @@ static void sg_platf_new_cluster_flat(simgrid::kernel::routing::ClusterCreationA
     if (backbone)
       links.emplace_back(backbone);
 
-    zone->add_route(host->get_netpoint(), nullptr, nullptr, nullptr, links, true);
+    zone->add_route(host, nullptr, links, true);
   }
 
   // Add a router.
@@ -330,9 +329,7 @@ static void sg_platf_new_cluster_flat(simgrid::kernel::routing::ClusterCreationA
   XBT_DEBUG("<router id=\"%s\"/>", cluster->router_id.c_str());
   if (cluster->router_id.empty())
     cluster->router_id = cluster->prefix + cluster->id + "_router" + cluster->suffix;
-  auto* router = zone->create_router(cluster->router_id);
-  std::vector<simgrid::s4u::LinkInRoute> links;
-  zone->add_route(router, nullptr, nullptr, nullptr, links);
+  zone->create_router(cluster->router_id);
 
   simgrid::kernel::routing::on_cluster_creation(*cluster);
 }
index 73da963..412b69e 100644 (file)
@@ -71,14 +71,14 @@ continuous use of the battery alternating between charge and discharge:
 The natural depletion of batteries over time is not taken into account.
 
 Loads & Hosts
-..............
+.............
 
 You can add named loads to a battery. Those loads may be positive and consume energy from the battery, or negative and
 provide energy to the battery. You can also connect hosts to a battery. Theses hosts will consume their energy from the
 battery until the battery is empty or until the connection between the hosts and the battery is set inactive.
 
 Handlers
-......
+........
 
 You can schedule handlers that will happen at specific SoC of the battery and trigger a callback.
 Theses handlers may be recurrent, for instance you may want to always set all loads to zero and deactivate all hosts
@@ -389,7 +389,7 @@ double Battery::get_energy_stored(std::string unit)
  *  @param state_of_charge The state of charge at which the Handler will happen.
  *  @param flow The flow in which the Handler will happen, either when the Battery is charging or discharging.
  *  @param callback The callable to trigger when the Handler happen.
- *  @param Persistancy If the Handler is recurrent or unique.
+ *  @param p If the Handler is recurrent or unique.
  *  @return A shared pointer of the new Handler.
  */
 std::shared_ptr<Battery::Handler> Battery::schedule_handler(double state_of_charge, Flow flow, Handler::Persistancy p,
index 8000377..501f155 100644 (file)
@@ -21,7 +21,7 @@ SIMGRID_REGISTER_PLUGIN(chiller, "Chiller management", nullptr)
 This is the chiller plugin, enabling management of chillers.
 
 Chiller
-....................
+.......
 
 A chiller is placed inside a room with several machines. The role of the chiller is to keep the temperature of the room
 below a threshold. This plugin and its equations are based on the paper "Co-simulation of FMUs and Distributed
diff --git a/src/plugins/photovoltaic.cpp b/src/plugins/photovoltaic.cpp
deleted file mode 100644 (file)
index 9d8a717..0000000
+++ /dev/null
@@ -1,291 +0,0 @@
-/* Copyright (c) 2023. The SimGrid Team. All rights reserved.          */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-#include <simgrid/Exception.hpp>
-#include <simgrid/plugins/photovoltaic.hpp>
-#include <simgrid/s4u/Actor.hpp>
-#include <simgrid/s4u/Engine.hpp>
-#include <simgrid/s4u/Host.hpp>
-#include <simgrid/s4u/VirtualMachine.hpp>
-#include <simgrid/simix.hpp>
-
-#include "src/kernel/resource/CpuImpl.hpp"
-#include "src/simgrid/module.hpp"
-
-#include <boost/algorithm/string/classification.hpp>
-#include <boost/algorithm/string/split.hpp>
-
-SIMGRID_REGISTER_PLUGIN(photovoltaic, "Photovoltaic management", &sg_photovoltaic_plugin_init)
-
-/** @defgroup plugin_photovoltaic plugin_photovoltaic Plugin photovoltaic
-
-  @beginrst
-
-This is the photovoltaic plugin, enabling management of photovoltaic panels on hosts.
-To activate this plugin, first call :cpp:func:`sg_photovoltaic_plugin_init()`.
-
-This plugin allows evaluation of photovoltaic panels power generation during simulation depending on size, solar
-irradiance and conversion factor.
-
-The power model is taken from the paper `"Reinforcement Learning Based Load Balancing for
-Geographically Distributed Data Centres" <https://dro.dur.ac.uk/33395/1/33395.pdf?DDD280+kkgc95+vbdv77>`_ by Max Mackie et. al.
-
-The cost model is taken from the chapter 4 of the thesis `Sizing and Operation of Multi-Energy Hydrogen-Based
-Microgrids <https://tel.archives-ouvertes.fr/tel-02077668/document>`_ by Bei Li.
-
-Photovoltaic Panel properties
-....................
-
-Properties of panels are defined as properties of hosts in the platform XML file.
-
-Here is an example of XML declaration where we consider a host as a photovoltaic panel:
-
-.. code-block:: xml
-
-   <host id="pv_panel" speed="0f">
-      <prop id="photovoltaic_area" value="4" />
-      <prop id="photovoltaic_conversion_efficiency" value="0.2" />
-    </host>
-
-The different properties are:
-
-- ``photovoltaic_area``: Set the area of the panel in m² (default=0)
-- ``photovoltaic_conversion_efficiency``: Set the conversion efficiency of the panel (default=0)
-- ``photovoltaic_solar_irradiance``: Set the initial solar irradiance in W/m² (default=0)
-- ``photovoltaic_min_power``: Set the minimum power of the panel in W (default=-1). Power generation below this value is automatically 0. Value is ignored if negative
-- ``photovoltaic_max_power``: Set the maximal power of the panel in W (default=-1). Power generation above this value is automatically truncated. Value is ignored if negative
-- ``photovoltaic_eval_cost``: Evaluate the cost of the panel during the simulation if set to 1 (defaulf=0)
-- ``photovoltaic_lifespan``: Set the lifespan of the panel in years (default=0)
-- ``photovoltaic_investment_cost``: Set the investment cost of the panel (default=0)
-- ``photovoltaic_maintenance_cost``: Set the maintenance cost of the panel (default=0)
-
-  @endrst
- */
-
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(photovoltaic, kernel, "Logging specific to the photovoltaic plugin");
-
-namespace simgrid::plugin {
-class Photovoltaic {
-private:
-  simgrid::s4u::Host* host_ = nullptr;
-
-  double area_m2_                   = 0;
-  double conversion_efficiency_     = 0;
-  double solar_irradiance_w_per_m2_ = 0;
-  double min_power_w_               = -1;
-  double max_power_w_               = -1;
-
-  double power_w_      = 0;
-  double last_updated_ = 0;
-
-  bool eval_cost_                 = false;
-  double cumulative_cost_         = 0;
-  int lifespan_years_             = 0;
-  double investment_cost_per_w_   = 0;
-  double maintenance_cost_per_wh_ = 0;
-
-  void init_photovoltaic_params();
-  void init_cost_params();
-  void update();
-
-  Photovoltaic* set_area(double a);
-  Photovoltaic* set_conversion_efficiency(double e);
-  Photovoltaic* set_min_power(double p);
-  Photovoltaic* set_max_power(double p);
-  Photovoltaic* set_eval_cost(bool eval);
-  Photovoltaic* set_lifespan(int l);
-  Photovoltaic* set_investment_cost(double c);
-  Photovoltaic* set_maintenance_cost(double c);
-
-public:
-  static simgrid::xbt::Extension<simgrid::s4u::Host, Photovoltaic> EXTENSION_ID;
-
-  explicit Photovoltaic(simgrid::s4u::Host* host);
-  ~Photovoltaic();
-
-  Photovoltaic* set_solar_irradiance(double s);
-
-  double get_power();
-};
-
-Photovoltaic* Photovoltaic::set_area(double a)
-{
-  xbt_assert(a > 0, " : area should be > 0 (provided: %f)", a);
-  simgrid::kernel::actor::simcall_answered([this, a] { area_m2_ = a; });
-  return this;
-}
-
-Photovoltaic* Photovoltaic::set_conversion_efficiency(double e)
-{
-  xbt_assert(e > 0 and e <= 1, " : conversion efficiency should be in [0,1] (provided: %f)", e);
-  simgrid::kernel::actor::simcall_answered([this, e] { conversion_efficiency_ = e; });
-  return this;
-}
-
-Photovoltaic* Photovoltaic::set_solar_irradiance(double s)
-{
-  xbt_assert(s > 0, " : solar irradiance should be > 0 (provided: %f)", s);
-  simgrid::kernel::actor::simcall_answered([this, s] { solar_irradiance_w_per_m2_ = s; });
-  return this;
-}
-
-Photovoltaic* Photovoltaic::set_min_power(double p)
-{
-  simgrid::kernel::actor::simcall_answered([this, p] { min_power_w_ = p; });
-  return this;
-}
-
-Photovoltaic* Photovoltaic::set_max_power(double p)
-{
-  simgrid::kernel::actor::simcall_answered([this, p] { max_power_w_ = p; });
-  return this;
-}
-
-Photovoltaic* Photovoltaic::set_eval_cost(bool e)
-{
-  simgrid::kernel::actor::simcall_answered([this, e] { eval_cost_ = e; });
-  return this;
-}
-
-Photovoltaic* Photovoltaic::set_lifespan(int l)
-{
-  xbt_assert(l > 0, " : lifespan should be > 0 (provided: %d)", l);
-  simgrid::kernel::actor::simcall_answered([this, l] { lifespan_years_ = l; });
-  return this;
-}
-
-Photovoltaic* Photovoltaic::set_investment_cost(double c)
-{
-  xbt_assert(c > 0, " : investment cost should be > 0 (provided: %f)", c);
-  simgrid::kernel::actor::simcall_answered([this, c] { investment_cost_per_w_ = c; });
-  return this;
-}
-
-Photovoltaic* Photovoltaic::set_maintenance_cost(double c)
-{
-  xbt_assert(c > 0, " : maintenance cost hould be > 0 (provided: %f)", c);
-  simgrid::kernel::actor::simcall_answered([this, c] { maintenance_cost_per_wh_ = c; });
-  return this;
-}
-
-double Photovoltaic::get_power()
-{
-  update();
-  return power_w_;
-}
-
-simgrid::xbt::Extension<simgrid::s4u::Host, Photovoltaic> Photovoltaic::EXTENSION_ID;
-
-void Photovoltaic::init_photovoltaic_params()
-{
-  const char* prop_chars;
-  prop_chars = host_->get_property("photovoltaic_area");
-  if (prop_chars)
-    set_area(xbt_str_parse_double(prop_chars, ("cannot parse double: " + std::string(prop_chars)).c_str()));
-  prop_chars = host_->get_property("photovoltaic_conversion_efficiency");
-  if (prop_chars)
-    set_conversion_efficiency(
-        xbt_str_parse_double(prop_chars, ("cannot parse double: " + std::string(prop_chars)).c_str()));
-  prop_chars = host_->get_property("photovoltaic_solar_irradiance");
-  if (prop_chars)
-    set_solar_irradiance(xbt_str_parse_double(prop_chars, ("cannot parse double: " + std::string(prop_chars)).c_str()));
-  prop_chars = host_->get_property("photovoltaic_min_power");
-  if (prop_chars)
-    set_min_power(xbt_str_parse_double(prop_chars, ("cannot parse double: " + std::string(prop_chars)).c_str()));
-  prop_chars = host_->get_property("photovoltaic_max_power");
-  if (prop_chars)
-    set_max_power(xbt_str_parse_double(prop_chars, ("cannot parse double: " + std::string(prop_chars)).c_str()));
-  prop_chars = host_->get_property("photovoltaic_eval_cost");
-  if (prop_chars)
-    set_eval_cost(xbt_str_parse_int(prop_chars, ("cannot parse int: " + std::string(prop_chars)).c_str()));
-  prop_chars = host_->get_property("photovoltaic_lifespan");
-  if (prop_chars)
-    set_lifespan(xbt_str_parse_int(prop_chars, ("cannot parse int: " + std::string(prop_chars)).c_str()));
-  prop_chars = host_->get_property("photovoltaic_investment_cost");
-  if (prop_chars)
-    set_investment_cost(xbt_str_parse_double(prop_chars, ("cannot parse double: " + std::string(prop_chars)).c_str()));
-  prop_chars = host_->get_property("photovoltaic_maintenance_cost");
-  if (prop_chars)
-    set_maintenance_cost(xbt_str_parse_double(prop_chars, ("cannot parse double: " + std::string(prop_chars)).c_str()));
-  simgrid::kernel::actor::simcall_answered([this] { last_updated_ = simgrid::s4u::Engine::get_clock(); });
-}
-
-void Photovoltaic::update()
-{
-  simgrid::kernel::actor::simcall_answered([this] {
-    double now = simgrid::s4u::Engine::get_clock();
-    if (now <= last_updated_)
-      return;
-    double power_w = conversion_efficiency_ * area_m2_ * solar_irradiance_w_per_m2_;
-    if (min_power_w_ > 0 && power_w_ < min_power_w_)
-      power_w = 0;
-    if (max_power_w_ > 0 && power_w_ > max_power_w_)
-      power_w = max_power_w_;
-    power_w_ = power_w;
-    if (eval_cost_) {
-      xbt_assert(max_power_w_ > 0, " : max power must be > 0 (provided: %f)", max_power_w_);
-      cumulative_cost_ += max_power_w_ * (now - last_updated_) *
-                          (investment_cost_per_w_ / (lifespan_years_ * 8760 * 3600) + maintenance_cost_per_wh_ / 3600);
-    }
-    last_updated_ = now;
-  });
-}
-
-Photovoltaic::Photovoltaic(simgrid::s4u::Host* host) : host_(host)
-{
-  init_photovoltaic_params();
-}
-
-Photovoltaic::~Photovoltaic() = default;
-} // namespace simgrid::plugin
-
-using simgrid::plugin::Photovoltaic;
-
-/* **************************** events  callback *************************** */
-
-static void on_creation(simgrid::s4u::Host& host)
-{
-  if (dynamic_cast<simgrid::s4u::VirtualMachine*>(&host)) // Ignore virtual machines
-    return;
-  host.extension_set(new Photovoltaic(&host));
-}
-
-/* **************************** Public interface *************************** */
-
-static void ensure_plugin_inited()
-{
-  if (not Photovoltaic::EXTENSION_ID.valid())
-    throw simgrid::xbt::InitializationError(
-        "The Photovoltaic plugin is not active. Please call sg_photovoltaic_plugin_init() "
-        "before calling any function related to that plugin.");
-}
-
-/** @ingroup plugin_photovoltaic
- *  @brief Enable photovoltaic plugin.
- */
-void sg_photovoltaic_plugin_init()
-{
-  if (Photovoltaic::EXTENSION_ID.valid())
-    return;
-  Photovoltaic::EXTENSION_ID = simgrid::s4u::Host::extension_create<Photovoltaic>();
-  simgrid::s4u::Host::on_creation_cb(&on_creation);
-}
-
-/** @ingroup plugin_photovoltaic
- *  @param s The solar irradiance to set in W/m².
- */
-void sg_photovoltaic_set_solar_irradiance(const_sg_host_t host, double s)
-{
-  ensure_plugin_inited();
-  host->extension<Photovoltaic>()->set_solar_irradiance(s);
-}
-
-/** @ingroup plugin_photovoltaic
- *  @return Power generation in W.
- */
-double sg_photovoltaic_get_power(const_sg_host_t host)
-{
-  ensure_plugin_inited();
-  return host->extension<Photovoltaic>()->get_power();
-}
diff --git a/src/plugins/solar_panel.cpp b/src/plugins/solar_panel.cpp
new file mode 100644 (file)
index 0000000..8e44734
--- /dev/null
@@ -0,0 +1,207 @@
+/* Copyright (c) 2023. The SimGrid Team. All rights reserved.          */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+#include <simgrid/Exception.hpp>
+#include <simgrid/plugins/solar_panel.hpp>
+#include <simgrid/simix.hpp>
+#include <xbt/asserts.h>
+#include <xbt/log.h>
+
+#include "src/kernel/resource/CpuImpl.hpp"
+#include "src/simgrid/module.hpp"
+
+SIMGRID_REGISTER_PLUGIN(solar_panel, "Solar Panel management", nullptr)
+
+/** @defgroup plugin_solar_panel Plugin Solar Panel
+
+  @beginrst
+
+This is the solar panel plugin, enabling management of solar panels on hosts.
+
+This plugin allows the use of solar panels to generate power during simulation depending on size, solar
+irradiance and conversion factor.
+
+The power model is taken from the paper `"Reinforcement Learning Based Load Balancing for
+Geographically Distributed Data Centres" <https://dro.dur.ac.uk/33395/1/33395.pdf?DDD280+kkgc95+vbdv77>`_ by Max Mackie
+et. al.
+
+Solar Panel
+....................
+
+A solar panel has an area :math:`A` in m², a conversion efficiency :math:`\eta` and a solar irradiance :math:`S` in
+W/m². The power generated :math:`P` in W by a solar panel is given by the following equation:
+
+.. math::
+
+  P = A \times \eta \times S
+
+  @endrst
+ */
+
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(SolarPanel, kernel, "Logging specific to the solar panel plugin");
+
+namespace simgrid::plugins {
+
+/* SolarPanelModel */
+
+SolarPanelModel::SolarPanelModel() : Model("SolarPanelModel") {}
+
+void SolarPanelModel::add_solar_panel(SolarPanelPtr b)
+{
+  solar_panels_.push_back(b);
+}
+
+void SolarPanelModel::update_actions_state(double now, double delta)
+{
+  for (auto solar_panel : solar_panels_)
+    solar_panel->update();
+}
+
+double SolarPanelModel::next_occurring_event(double now)
+{
+  return -1;
+}
+
+/* SolarPanel */
+
+std::shared_ptr<SolarPanelModel> SolarPanel::solar_panel_model_;
+
+void SolarPanel::init_plugin()
+{
+  auto model = std::make_shared<SolarPanelModel>();
+  simgrid::s4u::Engine::get_instance()->add_model(model);
+  SolarPanel::solar_panel_model_ = model;
+}
+
+void SolarPanel::update()
+{
+  simgrid::kernel::actor::simcall_answered([this] {
+    double now = simgrid::s4u::Engine::get_clock();
+    if (now <= last_updated_)
+      return;
+    double power_w = conversion_efficiency_ * area_m2_ * solar_irradiance_w_per_m2_;
+    if (power_w_ < min_power_w_)
+      power_w = 0;
+    if (power_w_ > max_power_w_)
+      power_w = max_power_w_;
+    power_w_      = power_w;
+    last_updated_ = now;
+  });
+}
+
+SolarPanel::SolarPanel(std::string name, double area_m2, double conversion_efficiency, double solar_irradiance_w_per_m2,
+                       double min_power_w, double max_power_w)
+    : name_(name)
+    , area_m2_(area_m2)
+    , conversion_efficiency_(conversion_efficiency)
+    , solar_irradiance_w_per_m2_(solar_irradiance_w_per_m2)
+    , min_power_w_(min_power_w)
+    , max_power_w_(max_power_w)
+{
+  xbt_assert(area_m2 >= 0, " : area must be >= 0 (provided: %f)", area_m2);
+  xbt_assert(conversion_efficiency >= 0 and conversion_efficiency <= 1,
+             " : conversion efficiency must be in [0,1] (provided: %f)", conversion_efficiency);
+  xbt_assert(solar_irradiance_w_per_m2 >= 0, " : solar irradiance must be >= 0 (provided: %f)",
+             solar_irradiance_w_per_m2);
+  xbt_assert(min_power_w >= 0, " : minimal power must be >= 0 (provided: %f)", min_power_w);
+  xbt_assert(max_power_w > 0, " : maximal power must be > 0 (provided: %f)", max_power_w);
+  xbt_assert(max_power_w > min_power_w, " : maximal power must be above minimal power (provided: %f, %f)", max_power_w,
+             min_power_w);
+}
+
+/** @ingroup plugin_solar_panel
+ *  @param name The name of the Solar Panel.
+ *  @param area_m2 The area of the Solar Panel in m² (> 0).
+ *  @param conversion_efficiency The conversion efficiency of the Solar Panel [0,1].
+ *  @param solar_irradiance_w_per_m2 The solar irradiance of the Solar Panel in W/m² (> 0).
+ *  @param min_power_w The minimal power delivered by the Solar Panel in W (> 0 and < max_power_w).
+ *  @param max_power_w The maximal power delivered by the Solar Panel in W (> 0 and > min_power_w).
+ *  @return A SolarPanelPtr pointing to the new SolarPanel.
+ */
+SolarPanelPtr SolarPanel::init(const std::string& name, double area_m2, double conversion_efficiency,
+                               double solar_irradiance_w_per_m2, double min_power_w, double max_power_w)
+{
+  static bool plugin_inited = false;
+  if (not plugin_inited) {
+    init_plugin();
+    plugin_inited = true;
+  }
+  auto solar_panel = SolarPanelPtr(
+      new SolarPanel(name, area_m2, conversion_efficiency, solar_irradiance_w_per_m2, min_power_w, max_power_w));
+  solar_panel_model_->add_solar_panel(solar_panel);
+  return solar_panel;
+}
+
+/** @ingroup plugin_solar_panel
+ *  @param name The new name of the Solar Panel.
+ *  @return A SolarPanelPtr pointing to the modified SolarPanel.
+ */
+SolarPanelPtr SolarPanel::set_name(std::string name)
+{
+  kernel::actor::simcall_answered([this, name] { name_ = name; });
+  return this;
+}
+
+/** @ingroup plugin_solar_panel
+ *  @param area_m2 The new area of the Solar Panel in m².
+ *  @return A SolarPanelPtr pointing to the modified SolarPanel.
+ */
+SolarPanelPtr SolarPanel::set_area(double area_m2)
+{
+  xbt_assert(area_m2 >= 0, " : area must be > 0 (provided: %f)", area_m2);
+  kernel::actor::simcall_answered([this, area_m2] { area_m2_ = area_m2; });
+  return this;
+}
+
+/** @ingroup plugin_solar_panel
+ *  @param e The new convesion efficiency of the Solar Panel.
+ *  @return A SolarPanelPtr pointing to the modified SolarPanel.
+ */
+SolarPanelPtr SolarPanel::set_conversion_efficiency(double e)
+{
+  xbt_assert(e >= 0 and e <= 1, " : conversion efficiency must be in [0,1] (provided: %f)", e);
+  kernel::actor::simcall_answered([this, e] { conversion_efficiency_ = e; });
+  return this;
+}
+
+/** @ingroup plugin_solar_panel
+ *  @param solar_irradiance_w_per_m2 The new solar irradiance of the Solar Panel in W/m².
+ *  @return A SolarPanelPtr pointing to the modified SolarPanel.
+ */
+SolarPanelPtr SolarPanel::set_solar_irradiance(double solar_irradiance_w_per_m2)
+{
+  xbt_assert(solar_irradiance_w_per_m2 >= 0, " : solar irradiance must be >= 0 (provided: %f)",
+             solar_irradiance_w_per_m2);
+  kernel::actor::simcall_answered(
+      [this, solar_irradiance_w_per_m2] { solar_irradiance_w_per_m2_ = solar_irradiance_w_per_m2; });
+  return this;
+}
+
+/** @ingroup plugin_solar_panel
+ *  @param power_w The new minimal power of the Solar Panel in W.
+ *  @return A SolarPanelPtr pointing to the modified SolarPanel.
+ */
+SolarPanelPtr SolarPanel::set_min_power(double power_w)
+{
+  xbt_assert(power_w >= 0, " : minimal power must be >= 0 (provided: %f)", power_w);
+  xbt_assert(max_power_w_ > power_w, " : maximal power must be above minimal power (provided: %f, max: %f)", power_w,
+             max_power_w_);
+  kernel::actor::simcall_answered([this, power_w] { min_power_w_ = power_w; });
+  return this;
+}
+
+/** @ingroup plugin_solar_panel
+ *  @param power_w The new maximal power of the Solar Panel in W.
+ *  @return A SolarPanelPtr pointing to the modified SolarPanel.
+ */
+SolarPanelPtr SolarPanel::set_max_power(double power_w)
+{
+  xbt_assert(power_w > 0, " : maximal power must be > 0 (provided: %f)", power_w);
+  xbt_assert(min_power_w_ < power_w, " : maximal power must be above minimal power (provided: %f, min: %f)", power_w,
+             min_power_w_);
+  kernel::actor::simcall_answered([this, power_w] { max_power_w_ = power_w; });
+  return this;
+}
+
+} // namespace simgrid::plugins
\ No newline at end of file
index 4bb9afd..dc7e77f 100644 (file)
@@ -243,13 +243,13 @@ std::string Engine::flatify_platform() const
   ss << "<?xml version='1.0'?>\n";
   ss << "<!DOCTYPE platform SYSTEM \"https://simgrid.org/simgrid.dtd\">\n";
   ss << "<platform version=\"" << version << "\">\n";
-  ss << "<AS id=\"" << get_netzone_root()->get_name() << "\" routing=\"Full\">\n";
+  ss << "<zone id=\"" << get_netzone_root()->get_name() << "\" routing=\"Full\">\n";
 
   flatify_hosts(*this, ss);
   flatify_links(*this, ss);
   flatify_routes(*this, ss);
 
-  ss << "</AS>\n";
+  ss << "</zone>\n";
   ss << "</platform>\n";
   return ss.str();
 }
index 49b23a0..48377bb 100644 (file)
@@ -85,15 +85,39 @@ unsigned long NetZone::add_component(kernel::routing::NetPoint* elm)
   return pimpl_->add_component(elm);
 }
 
+void NetZone::add_route(const NetZone* src, const NetZone* dst, const std::vector<const Link*>& links)
+{
+  std::vector<LinkInRoute> links_direct;
+  std::vector<LinkInRoute> links_reverse;
+  for (auto* l : links) {
+    links_direct.emplace_back(LinkInRoute(l, LinkInRoute::Direction::UP));
+    links_reverse.emplace_back(LinkInRoute(l, LinkInRoute::Direction::DOWN));
+  }
+  pimpl_->add_route(src ? src->get_netpoint() : nullptr, dst ? dst->get_netpoint(): nullptr,
+                    src ? src->get_gateway() : nullptr, dst ? dst->get_gateway() : nullptr,
+                    links_direct, false);
+  pimpl_->add_route(src ? src->get_netpoint() : nullptr, dst ? dst->get_netpoint(): nullptr,
+                    src ? src->get_gateway() : nullptr, dst ? dst->get_gateway() : nullptr,
+                    links_reverse, false);
+}
+
+void NetZone::add_route(const NetZone* src, const NetZone* dst, const std::vector<LinkInRoute>& link_list, bool symmetrical)
+{
+  pimpl_->add_route(src ? src->get_netpoint() : nullptr, dst ? dst->get_netpoint(): nullptr,
+                    src ? src->get_gateway() : nullptr, dst ? dst->get_gateway() : nullptr,
+                    link_list, symmetrical);
+}
+
 void NetZone::add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
                         kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
-                        const std::vector<LinkInRoute>& link_list, bool symmetrical)
+                        const std::vector<LinkInRoute>& link_list, bool symmetrical) //XBT_ATTRIB_DEPRECATED_v339
 {
   pimpl_->add_route(src, dst, gw_src, gw_dst, link_list, symmetrical);
 }
+
 void NetZone::add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
                         kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
-                        const std::vector<const Link*>& links)
+                        const std::vector<const Link*>& links) //XBT_ATTRIB_DEPRECATED_v339
 {
   std::vector<LinkInRoute> links_direct;
   std::vector<LinkInRoute> links_reverse;
@@ -107,8 +131,11 @@ void NetZone::add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoin
 
 void NetZone::add_route(const Host* src, const Host* dst, const std::vector<LinkInRoute>& link_list, bool symmetrical)
 {
-  pimpl_->add_route(src->get_netpoint(), dst->get_netpoint(), nullptr, nullptr, link_list, symmetrical);
+  pimpl_->add_route(src ? src->get_netpoint(): nullptr, dst ? dst->get_netpoint(): nullptr, nullptr, nullptr,
+                    link_list, symmetrical);
+
 }
+
 void NetZone::add_route(const Host* src, const Host* dst, const std::vector<const Link*>& links)
 {
   std::vector<LinkInRoute> links_direct;
@@ -117,8 +144,10 @@ void NetZone::add_route(const Host* src, const Host* dst, const std::vector<cons
     links_direct.emplace_back(LinkInRoute(l, LinkInRoute::Direction::UP));
     links_reverse.emplace_back(LinkInRoute(l, LinkInRoute::Direction::DOWN));
   }
-  pimpl_->add_route(src->get_netpoint(), dst->get_netpoint(), nullptr, nullptr, links_direct, false);
-  pimpl_->add_route(dst->get_netpoint(), src->get_netpoint(), nullptr, nullptr, links_reverse, false);
+  pimpl_->add_route(src ? src->get_netpoint(): nullptr, dst ? dst->get_netpoint(): nullptr, nullptr, nullptr,
+                    links_direct, false);
+  pimpl_->add_route(dst ? dst->get_netpoint(): nullptr, src ? src->get_netpoint(): nullptr, nullptr, nullptr,
+                    links_reverse, false);
 }
 
 void NetZone::add_bypass_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
@@ -231,11 +260,31 @@ kernel::routing::NetPoint* NetZone::create_router(const std::string& name)
   return kernel::actor::simcall_answered([this, &name] { return pimpl_->create_router(name); });
 }
 
-kernel::routing::NetPoint* NetZone::get_netpoint()
+kernel::routing::NetPoint* NetZone::get_netpoint() const
 {
   return pimpl_->get_netpoint();
 }
 
+kernel::routing::NetPoint* NetZone::get_gateway() const
+{
+  return pimpl_->get_gateway();
+}
+
+kernel::routing::NetPoint* NetZone::get_gateway(const std::string& name) const
+{
+  return pimpl_->get_gateway(name);
+}
+
+void NetZone::set_gateway(kernel::routing::NetPoint* router)
+{
+  set_gateway("default", router);
+}
+
+void NetZone::set_gateway(const std::string& name, kernel::routing::NetPoint* router)
+{
+  kernel::actor::simcall_answered([this, name, router] { pimpl_->set_gateway(name, router); });
+}
+
 kernel::resource::NetworkModel* NetZone::get_network_model() const
 {
   return pimpl_->get_network_model().get();
index 75836a0..b9e1ff2 100644 (file)
@@ -3,7 +3,7 @@ $ ${bindir:=.}/flatifier ./one_cluster.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
 > <platform version="4.1">
-> <AS id="AS0" routing="Full">
+> <zone id="AS0" routing="Full">
 >   <host id="bob0.hamburger.edu" speed="1e+09"/>
 >   <host id="bob2.hamburger.edu" speed="1e+09"/>
 >   <host id="bob3.hamburger.edu" speed="1e+09"/>
@@ -127,14 +127,14 @@ $ ${bindir:=.}/flatifier ./one_cluster.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%
 >   <route src="bobbob_cluster_router.hamburger.edu" dst="bob6.hamburger.edu">
 >   <link_ctn id="bob_cluster_backbone"/><link_ctn id="bob_cluster_link_6_DOWN"/>
 >   </route>
-> </AS>
+> </zone>
 > </platform>
 
 $ ${bindir:=.}/flatifier ./one_cluster_multicore.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
 > <platform version="4.1">
-> <AS id="AS0" routing="Full">
+> <zone id="AS0" routing="Full">
 >   <host id="bob0.hamburger.edu" speed="1e+09" core="6"/>
 >   <host id="bob2.hamburger.edu" speed="1e+09" core="6"/>
 >   <host id="bob3.hamburger.edu" speed="1e+09" core="6"/>
@@ -257,14 +257,14 @@ $ ${bindir:=.}/flatifier ./one_cluster_multicore.xml "--log=root.fmt:[%10.6r]%e[
 >   <route src="bobbob_cluster_router.hamburger.edu" dst="bob6.hamburger.edu">
 >   <link_ctn id="bob_cluster_link_6_DOWN"/>
 >   </route>
-> </AS>
+> </zone>
 > </platform>
 
 $ ${bindir:=.}/flatifier ./host_attributes.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
 > <platform version="4.1">
-> <AS id="AS0" routing="Full">
+> <zone id="AS0" routing="Full">
 >   <host id="alice" speed="1e+09"/>
 >   <host id="bob" speed="1e+09"/>
 >   <host id="carol" speed="5e+08"/>
@@ -290,14 +290,14 @@ $ ${bindir:=.}/flatifier ./host_attributes.xml "--log=root.fmt:[%10.6r]%e[%i:%a@
 >   <route src="erin" dst="erin">
 >   <link_ctn id="__loopback__"/>
 >   </route>
-> </AS>
+> </zone>
 > </platform>
 
 $ ${bindir:=.}/flatifier ./link_attributes.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
 > <platform version="4.1">
-> <AS id="AS0" routing="Full">
+> <zone id="AS0" routing="Full">
 >   <host id="bob" speed="5e+08"/>
 >   <link id="__loopback__" bandwidth="1e+10" latency="0" sharing_policy="FATPIPE"/>
 >   <link id="link1" bandwidth="1.25e+08" latency="5e-05"/>
@@ -307,14 +307,14 @@ $ ${bindir:=.}/flatifier ./link_attributes.xml "--log=root.fmt:[%10.6r]%e[%i:%a@
 >   <route src="bob" dst="bob">
 >   <link_ctn id="__loopback__"/>
 >   </route>
-> </AS>
+> </zone>
 > </platform>
 
 $ ${bindir:=.}/flatifier ./three_hosts_non_symmetric_route.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
 > <platform version="4.1">
-> <AS id="AS0" routing="Full">
+> <zone id="AS0" routing="Full">
 >   <host id="alice" speed="5e+08"/>
 >   <host id="bob" speed="1e+09"/>
 >   <host id="trudy" speed="2.5e+08"/>
@@ -349,14 +349,14 @@ $ ${bindir:=.}/flatifier ./three_hosts_non_symmetric_route.xml "--log=root.fmt:[
 >   <route src="trudy" dst="trudy">
 >   <link_ctn id="__loopback__"/>
 >   </route>
-> </AS>
+> </zone>
 > </platform>
 
 $ ${bindir:=.}/flatifier ./two_clusters.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
 > <platform version="4.1">
-> <AS id="AS0" routing="Full">
+> <zone id="AS0" routing="Full">
 >   <host id="alice0.crepe.fr" speed="1e+09"/>
 >   <host id="alice1.crepe.fr" speed="1e+09"/>
 >   <host id="bob0.hamburger.edu" speed="1e+09"/>
@@ -477,14 +477,14 @@ $ ${bindir:=.}/flatifier ./two_clusters.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]
 >   <route src="bobbob_cluster_router.hamburger.edu" dst="bob1.hamburger.edu">
 >   <link_ctn id="bob_cluster_backbone"/><link_ctn id="bob_cluster_link_1_DOWN"/>
 >   </route>
-> </AS>
+> </zone>
 > </platform>
 
 $ ${bindir:=.}/flatifier ./two_hosts_multi_hop.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
 > <platform version="4.1">
-> <AS id="AS0" routing="Full">
+> <zone id="AS0" routing="Full">
 >   <host id="alice" speed="5e+08"/>
 >   <host id="bob" speed="1e+09"/>
 >   <link id="__loopback__" bandwidth="1e+10" latency="0" sharing_policy="FATPIPE"/>
@@ -503,14 +503,14 @@ $ ${bindir:=.}/flatifier ./two_hosts_multi_hop.xml "--log=root.fmt:[%10.6r]%e[%i
 >   <route src="bob" dst="bob">
 >   <link_ctn id="__loopback__"/>
 >   </route>
-> </AS>
+> </zone>
 > </platform>
 
 $ ${bindir:=.}/flatifier ./two_hosts_one_link.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
 > <platform version="4.1">
-> <AS id="AS0" routing="Full">
+> <zone id="AS0" routing="Full">
 >   <host id="alice" speed="5e+08"/>
 >   <host id="bob" speed="1e+09"/>
 >   <link id="__loopback__" bandwidth="1e+10" latency="0" sharing_policy="FATPIPE"/>
@@ -527,14 +527,14 @@ $ ${bindir:=.}/flatifier ./two_hosts_one_link.xml "--log=root.fmt:[%10.6r]%e[%i:
 >   <route src="bob" dst="bob">
 >   <link_ctn id="__loopback__"/>
 >   </route>
-> </AS>
+> </zone>
 > </platform>
 
 $ ${bindir:=.}/flatifier ${srcdir:=.}/examples/platforms/bypassZoneRoute.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
 > <platform version="4.1">
-> <AS id="AS0" routing="Full">
+> <zone id="AS0" routing="Full">
 >   <host id="1" speed="1e+09"/>
 >   <host id="2" speed="1e+09"/>
 >   <host id="3" speed="1e+09"/>
@@ -651,14 +651,14 @@ $ ${bindir:=.}/flatifier ${srcdir:=.}/examples/platforms/bypassZoneRoute.xml "--
 >   <route src="my_cluster_3_router" dst="3">
 >   <link_ctn id="my_cluster_3_link_3_DOWN"/>
 >   </route>
-> </AS>
+> </zone>
 > </platform>
 
 $ ${bindir:=.}/flatifier ${srcdir:=.}/examples/platforms/cluster_torus.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
 > <platform version="4.1">
-> <AS id="world" routing="Full">
+> <zone id="world" routing="Full">
 >   <host id="node-0.simgrid.org" speed="1e+09"/>
 >   <host id="node-1.simgrid.org" speed="1e+09"/>
 >   <host id="node-10.simgrid.org" speed="1e+09"/>
@@ -1188,14 +1188,14 @@ $ ${bindir:=.}/flatifier ${srcdir:=.}/examples/platforms/cluster_torus.xml "--lo
 >   <route src="node-9.simgrid.org" dst="node-9.simgrid.org">
 >   <link_ctn id="bob_cluster_link_9_loopback"/>
 >   </route>
-> </AS>
+> </zone>
 > </platform>
 
 $ ${bindir:=.}/flatifier ./cluster_dragonfly_noncontiguous_rad.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
 > <platform version="4.1">
-> <AS id="world" routing="Full">
+> <zone id="world" routing="Full">
 >   <host id="node-0.simgrid.org" speed="1e+09"/>
 >   <host id="node-1002.simgrid.org" speed="1e+09"/>
 >   <host id="node-1003.simgrid.org" speed="1e+09"/>
@@ -1277,14 +1277,14 @@ $ ${bindir:=.}/flatifier ./cluster_dragonfly_noncontiguous_rad.xml "--log=root.f
 >   <route src="node-1004.simgrid.org" dst="node-1004.simgrid.org">
 >   <link_ctn id="bob_cluster_link_1004_loopback"/>
 >   </route>
-> </AS>
+> </zone>
 > </platform>
 
 $ ${bindir:=.}/flatifier ./cluster_fat_tree_noncontiguous_rad.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
 > <platform version="4.1">
-> <AS id="world" routing="Full">
+> <zone id="world" routing="Full">
 >   <host id="node-100.simgrid.org" speed="1e+09"/>
 >   <host id="node-101.simgrid.org" speed="1e+09"/>
 >   <host id="node-119.simgrid.org" speed="1e+09"/>
@@ -1374,14 +1374,14 @@ $ ${bindir:=.}/flatifier ./cluster_fat_tree_noncontiguous_rad.xml "--log=root.fm
 >   <route src="node-120.simgrid.org" dst="node-120.simgrid.org">
 >   <link_ctn id="bob_cluster_link_120_loopback"/>
 >   </route>
-> </AS>
+> </zone>
 > </platform>
 
 $ ${bindir:=.}/flatifier ./cluster_torus_noncontiguous_rad.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
 > <platform version="4.1">
-> <AS id="world" routing="Full">
+> <zone id="world" routing="Full">
 >   <host id="node-0.simgrid.org" speed="1e+09"/>
 >   <host id="node-1.simgrid.org" speed="1e+09"/>
 >   <host id="node-102.simgrid.org" speed="1e+09"/>
@@ -1467,14 +1467,14 @@ $ ${bindir:=.}/flatifier ./cluster_torus_noncontiguous_rad.xml "--log=root.fmt:[
 >   <route src="node-103.simgrid.org" dst="node-103.simgrid.org">
 >   <link_ctn id="bob_cluster_link_103_loopback"/>
 >   </route>
-> </AS>
+> </zone>
 > </platform>
 
 $ ${bindir:=.}/flatifier ./two_hosts_one_link_splitduplex.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
 > <platform version="4.1">
-> <AS id="AS0" routing="Full">
+> <zone id="AS0" routing="Full">
 >   <host id="alice" speed="5e+08"/>
 >   <host id="bob" speed="1e+09"/>
 >   <link id="__loopback__" bandwidth="1e+10" latency="0" sharing_policy="FATPIPE"/>
@@ -1492,5 +1492,5 @@ $ ${bindir:=.}/flatifier ./two_hosts_one_link_splitduplex.xml "--log=root.fmt:[%
 >   <route src="bob" dst="bob">
 >   <link_ctn id="__loopback__"/>
 >   </route>
-> </AS>
+> </zone>
 > </platform>
index e3eb658..6977fbc 100644 (file)
@@ -106,8 +106,8 @@ int main(int argc, char** argv)
   auto* bob  = zone->create_host("bob", 1e6);
   auto* alice  = zone->create_host("alice", 1e6);
 
-  sg4::LinkInRoute link(zone->create_link("link", "2MBps")->set_latency("50us")->seal());
-  zone->add_route(bob->get_netpoint(), alice->get_netpoint(), nullptr, nullptr, {link}, true);
+  auto* link = zone->create_link("link", "2MBps")->set_latency("50us");
+  zone->add_route(bob, alice, {link});
 
   bob->create_disk("bob_disk", "1MBps", "500kBps");
   alice->create_disk("alice_disk", "4MBps", "4MBps");
index 3b7d79a..d32d2d9 100644 (file)
@@ -6,7 +6,7 @@
 #include "simgrid/s4u.hpp"
 namespace sg4 = simgrid::s4u;
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_torus_multicpu, "Messages specific for this s4u example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(seal_platform, "Messages specific for this s4u example");
 
 class Sender {
   long msg_size = 1e6; /* message size in bytes */
@@ -58,17 +58,16 @@ public:
 /*************************************************************************************************/
 static sg4::NetZone* create_zone(const sg4::NetZone* root, const std::string& id)
 {
-  auto* zone = sg4::create_floyd_zone(id);
-  zone->set_parent(root);
+  auto* zone = sg4::create_star_zone(id)->set_parent(root);
   constexpr int n_host = 2;
 
-  auto* router = zone->create_router("router" + id);
+  zone->set_gateway(zone->create_router("router" + id));
   for (int i = 0; i < n_host; i++) {
     std::string hostname = id + "-cpu-" + std::to_string(i);
     auto* host           = zone->create_host(hostname, 1e9);
     host->create_disk("disk-" + hostname, 1e9, 1e6);
     const auto* link = zone->create_link("link-" + hostname, 1e9);
-    zone->add_route(host->get_netpoint(), router, nullptr, nullptr, {link});
+    zone->add_route(host, nullptr, {link});
   }
   return zone;
 }
@@ -84,8 +83,7 @@ int main(int argc, char* argv[])
   auto* zoneA = create_zone(root, "A");
   auto* zoneB = create_zone(root, "B");
   const auto* link = root->create_link("root-link", 1e10);
-  root->add_route(zoneA->get_netpoint(), zoneB->get_netpoint(), e.netpoint_by_name("routerA"),
-                  e.netpoint_by_name("routerB"), {sg4::LinkInRoute(link)});
+  root->add_route(zoneA, zoneB, {sg4::LinkInRoute(link)}, true);
 
   std::vector<sg4::Host*> host_list = e.get_all_hosts();
   /* create the sender actor running on first host */
index 11ea6df..187501c 100644 (file)
@@ -1,11 +1,11 @@
 $ ./seal-platform
-> [A-cpu-0:sender:(1) 0.000000] [s4u_torus_multicpu/INFO] Done dispatching all messages
-> [A-cpu-0:receiver-A-cpu-0:(2) 0.000103] [s4u_torus_multicpu/INFO] I got a 'Hello, I'm alive and running on A-cpu-0'.
-> [B-cpu-1:receiver-B-cpu-1:(5) 0.003247] [s4u_torus_multicpu/INFO] I got a 'Hello, I'm alive and running on A-cpu-0'.
-> [B-cpu-0:receiver-B-cpu-0:(4) 0.003247] [s4u_torus_multicpu/INFO] I got a 'Hello, I'm alive and running on A-cpu-0'.
-> [A-cpu-1:receiver-A-cpu-1:(3) 0.003247] [s4u_torus_multicpu/INFO] I got a 'Hello, I'm alive and running on A-cpu-0'.
-> [A-cpu-0:sender:(1) 0.003247] [s4u_torus_multicpu/INFO] Goodbye now!
-> [A-cpu-0:receiver-A-cpu-0:(2) 4.000103] [s4u_torus_multicpu/INFO] Wrote 4000000 bytes on 'disk-A-cpu-0'
-> [B-cpu-1:receiver-B-cpu-1:(5) 4.003247] [s4u_torus_multicpu/INFO] Wrote 4000000 bytes on 'disk-B-cpu-1'
-> [B-cpu-0:receiver-B-cpu-0:(4) 4.003247] [s4u_torus_multicpu/INFO] Wrote 4000000 bytes on 'disk-B-cpu-0'
-> [A-cpu-1:receiver-A-cpu-1:(3) 4.003247] [s4u_torus_multicpu/INFO] Wrote 4000000 bytes on 'disk-A-cpu-1'
+> [A-cpu-0:sender:(1) 0.000000] [seal_platform/INFO] Done dispatching all messages
+> [B-cpu-1:receiver-B-cpu-1:(5) 0.004330] [seal_platform/INFO] I got a 'Hello, I'm alive and running on A-cpu-0'.
+> [B-cpu-0:receiver-B-cpu-0:(4) 0.004330] [seal_platform/INFO] I got a 'Hello, I'm alive and running on A-cpu-0'.
+> [A-cpu-1:receiver-A-cpu-1:(3) 0.004330] [seal_platform/INFO] I got a 'Hello, I'm alive and running on A-cpu-0'.
+> [A-cpu-0:receiver-A-cpu-0:(2) 0.004330] [seal_platform/INFO] I got a 'Hello, I'm alive and running on A-cpu-0'.
+> [A-cpu-0:sender:(1) 0.004330] [seal_platform/INFO] Goodbye now!
+> [B-cpu-1:receiver-B-cpu-1:(5) 4.004330] [seal_platform/INFO] Wrote 4000000 bytes on 'disk-B-cpu-1'
+> [B-cpu-0:receiver-B-cpu-0:(4) 4.004330] [seal_platform/INFO] Wrote 4000000 bytes on 'disk-B-cpu-0'
+> [A-cpu-1:receiver-A-cpu-1:(3) 4.004330] [seal_platform/INFO] Wrote 4000000 bytes on 'disk-A-cpu-1'
+> [A-cpu-0:receiver-A-cpu-0:(2) 4.004330] [seal_platform/INFO] Wrote 4000000 bytes on 'disk-A-cpu-0'
\ No newline at end of file
index 59ef88e..cee3e25 100644 (file)
@@ -454,7 +454,7 @@ set(PLUGINS_SRC
   src/plugins/vm/dirty_page_tracking.cpp
   src/plugins/battery.cpp
   src/plugins/chiller.cpp
-  src/plugins/photovoltaic.cpp
+  src/plugins/solar_panel.cpp
   )
 
 
@@ -665,7 +665,7 @@ set(headers_to_install
   include/simgrid/plugins/jbod.hpp
   include/simgrid/plugins/live_migration.h
   include/simgrid/plugins/load.h
-  include/simgrid/plugins/photovoltaic.hpp
+  include/simgrid/plugins/solar_panel.hpp
   include/simgrid/plugins/ProducerConsumer.hpp
   include/simgrid/instr.h
   include/simgrid/mailbox.h
@@ -1143,7 +1143,6 @@ set(PLATFORMS_EXAMPLES
   examples/platforms/optorsim/gridpp_grid_2004.conf
   examples/platforms/optorsim/lcg_sept2004_grid.conf
   examples/platforms/optorsim/transform_optorsim_platform.pl
-  examples/platforms/photovoltaic_platform.xml
   examples/platforms/profiles/fafard_state.profile
   examples/platforms/profiles/faulty_host.profile
   examples/platforms/profiles/ginette_state.profile