Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of framagit.org:simgrid/simgrid
[simgrid.git] / src / plugins / photovoltaic.cpp
index 5131dd5..9d8a717 100644 (file)
@@ -1,3 +1,7 @@
+/* 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>
@@ -24,6 +28,12 @@ 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
 ....................
 
@@ -53,11 +63,6 @@ The different properties are:
   @endrst
  */
 
-/*These equations are taken from  the paper "Reinforcement Learning Based Load Balancing for
-Geographically Distributed Data Centres"  of Max Mackie et. al
-https://dro.dur.ac.uk/33395/1/33395.pdf?DDD280+kkgc95+vbdv77
-*/
-
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(photovoltaic, kernel, "Logging specific to the photovoltaic plugin");
 
 namespace simgrid::plugin {
@@ -74,7 +79,6 @@ private:
   double power_w_      = 0;
   double last_updated_ = 0;
 
-  // Calculation of costs from Bei Li thesis (link :https://tel.archives-ouvertes.fr/tel-02077668/document) (chapter 4)
   bool eval_cost_                 = false;
   double cumulative_cost_         = 0;
   int lifespan_years_             = 0;
@@ -214,9 +218,9 @@ void Photovoltaic::update()
     if (now <= last_updated_)
       return;
     double power_w = conversion_efficiency_ * area_m2_ * solar_irradiance_w_per_m2_;
-    if (min_power_w_ > 0 and power_w_ < min_power_w_)
+    if (min_power_w_ > 0 && power_w_ < min_power_w_)
       power_w = 0;
-    if (max_power_w_ > 0 and power_w_ > max_power_w_)
+    if (max_power_w_ > 0 && power_w_ > max_power_w_)
       power_w = max_power_w_;
     power_w_ = power_w;
     if (eval_cost_) {
@@ -284,4 +288,4 @@ double sg_photovoltaic_get_power(const_sg_host_t host)
 {
   ensure_plugin_inited();
   return host->extension<Photovoltaic>()->get_power();
-}
\ No newline at end of file
+}