Index: simulacion/ModuloDinamico/Makefile
===================================================================
--- simulacion/ModuloDinamico/Makefile	(revision 8eb9820ef185234df4f4d4947a3e4ef6cd50e5ac)
+++ simulacion/ModuloDinamico/Makefile	(revision 4b459a71f72c425396d545c0dcf9ec6dca20171a)
@@ -24,5 +24,4 @@
 FLAGS += -DDEBUG -D_GLIBCXX__PTHREADS $(WARN) $(XML)
 
-
 INCLUDE = -I $(ALEPH) -I . -I $(DB) -I $(PQ)
 
@@ -38,12 +37,17 @@
 SGB = sigesic_graph_builder
 
+CEV = compute_exchange
+
 SGB_WRAP = $(SGB)_wrap
 SIM_WRAP = $(SIM)_wrap
+CEV_WRAP = $(CEV)_wrap
 
 SOURCES = good.C product.C input.C imported_product.C ip_relationship.C \
-          io_manager.C queries.C utils.C exogenous_variables.C simulator.C
+          io_manager.C queries.C utils.C exogenous_variables.C simulator.C \
+          compute_exchange.C
 
 OBJECTS = good.o product.o input.o imported_product.o ip_relationship.o \
-          io_manager.o queries.o utils.o exogenous_variables.o simulator.o
+          io_manager.o queries.o utils.o exogenous_variables.o simulator.o \
+          compute_exchange.o
 
 test: obj
@@ -54,4 +58,8 @@
 	$(RM) $(SIM)
 	$(CXX) $(INCLUDE) $(SIM).C -o $(SIM) $(OBJECTS) $(LIBS) $(FLAGS)
+
+cev: obj
+	$(RM) $(CEV)
+	$(CXX) $(INCLUDE) $(CEV).C -o $(CEV) $(OBJECTS) $(LIBS) $(FLAGS)
 
 python:
@@ -65,9 +73,15 @@
 	$(CXX) -c $(INCLUDE) -I $(PYTHONINC) $(SIM_WRAP).cxx $(FLAGS) -fPIC
 	$(CXX) -shared $(INCLUDE) *.o -o _$(SIM).so $(LIBS) $(XML) $(FLAGS) -fPIC
+	$(SWIG) $(CEV).i
+	$(CXX) -c $(INCLUDE) -I $(PYTHONINC) $(CEV_WRAP).cxx $(FLAGS) -fPIC
+	$(CXX) -shared $(INCLUDE) *.o -o _$(CEV).so $(LIBS) $(XML) $(FLAGS) -fPIC
 
 obj:
 	$(CXX) -c $(INCLUDE) $(SOURCES) $(FLAGS)
+
 clean:
-	$(RM) *~ *.o $(WRAP).cxx $(SGB).py *.pyc
-clean-all:
+	$(RM) *~ *.o *.cxx $(SGB).py *.pyc
 
+clean-all: clean
+	$(RM) *.so $(SIM).py $(SGB).py $(CEV).py
+
Index: simulacion/ModuloDinamico/compute_exchange.C
===================================================================
--- simulacion/ModuloDinamico/compute_exchange.C	(revision 4b459a71f72c425396d545c0dcf9ec6dca20171a)
+++ simulacion/ModuloDinamico/compute_exchange.C	(revision 4b459a71f72c425396d545c0dcf9ec6dca20171a)
@@ -0,0 +1,72 @@
+# include <limits>
+# include <iostream>
+
+# include <dbProperties.H>
+
+# include <compute_exchange.H>
+
+double compute_exchange_by_product(const unsigned long long & product_id,
+                                   const char * const year,
+                                   const double & exchange_type,
+                                   const char * const host,
+                                   const char * const port,
+                                   const char * const dbname,
+                                   const char * const username,
+                                   const char * const password)
+{
+  DBProperties & dbProp = DBProperties::getInstance();
+
+  dbProp.setHost(host);
+  dbProp.setPort(port);
+  dbProp.setDbname(dbname);
+  dbProp.setUser(username);
+  dbProp.setPassword(password);
+
+  IO_Manager io_manager;
+
+  const int levels_up = std::numeric_limits<int>::max();
+
+  const int levels_down = 0;
+
+  char * const xml_root = "temp.xml";
+
+  io_manager.create_xml_root_file(year, product_id, levels_up, levels_down,
+                                  xml_root);
+
+  double ret_val = 0.0;
+
+  try
+  {
+    Graph graph;
+
+    io_manager.build_graph(xml_root, graph);
+
+    for (Graph::Node_Iterator it(graph); it.has_current(); it.next())
+      {
+        Graph::Node * node = it.get_current();
+
+        if (node->get_info()->get_type() != IMPORTED_PRODUCT)
+          continue;
+
+        for (Graph::Node_Arc_Iterator arc_it(node); arc_it.has_current();
+             arc_it.next())
+          {
+            Graph::Arc * arc = arc_it.get_current();
+
+            IP_Relationship & ip_rel = arc->get_info();
+
+            ret_val += (ip_rel.get_bought_quantity() *
+                        ip_rel.get_purchase_price()) / exchange_type;
+          }
+      }
+  }
+  catch (const std::exception & e)
+  {
+    std::cout << "Excepción capturada: " << e.what() << std::endl;
+  }
+
+  remove(xml_root);
+
+  return ret_val;  
+}
+
Index: simulacion/ModuloDinamico/compute_exchange.H
===================================================================
--- simulacion/ModuloDinamico/compute_exchange.H	(revision 4b459a71f72c425396d545c0dcf9ec6dca20171a)
+++ simulacion/ModuloDinamico/compute_exchange.H	(revision 4b459a71f72c425396d545c0dcf9ec6dca20171a)
@@ -0,0 +1,16 @@
+# ifndef COMPUTE_EXCHANGE_H
+# define COMPUTE_EXCHANGE_H
+
+# include <io_manager.H>
+
+double compute_exchange_by_product(const unsigned long long & product_id,
+                                   const char * const year,
+                                   const double & exchange_type,
+                                   const char * const host,
+                                   const char * const port,
+                                   const char * const dbname,
+                                   const char * const username,
+                                   const char * const password);
+
+# endif // COMPUTE_EXCHANGE_H
+
Index: simulacion/ModuloDinamico/compute_exchange.i
===================================================================
--- simulacion/ModuloDinamico/compute_exchange.i	(revision 4b459a71f72c425396d545c0dcf9ec6dca20171a)
+++ simulacion/ModuloDinamico/compute_exchange.i	(revision 4b459a71f72c425396d545c0dcf9ec6dca20171a)
@@ -0,0 +1,6 @@
+%module compute_exchange
+%{
+#include <compute_exchange.H>
+%}
+
+%include "compute_exchange.H"
Index: simulacion/ModuloDinamico/queries.C
===================================================================
--- simulacion/ModuloDinamico/queries.C	(revision c9dd3b4a9834a2945e89dc8c045824fd0914b250)
+++ simulacion/ModuloDinamico/queries.C	(revision 4b459a71f72c425396d545c0dcf9ec6dca20171a)
@@ -132,5 +132,5 @@
 }
 
-std::string id_to_str(const size_t & id)
+std::string id_to_str(const db_id_t & id)
 {
   std::stringstream sstr;
Index: simulacion/ModuloDinamico/queries.H
===================================================================
--- simulacion/ModuloDinamico/queries.H	(revision 6217e66a8996705bda938723a64c643e835efdd3)
+++ simulacion/ModuloDinamico/queries.H	(revision 4b459a71f72c425396d545c0dcf9ec6dca20171a)
@@ -161,5 +161,5 @@
  * @return valor del id convertido en cadena.
  */
-std::string id_to_str(const size_t & id);
+std::string id_to_str(const db_id_t & id);
 
 
