ICEACE Model: Closed Economy  1.0.0
Design Documentation of ICEACE Model
 All Data Structures Files Functions Variables Typedefs Macros Pages
firm_functions_consumption.c
Go to the documentation of this file.
1 #include "../header.h"
2 #include "../firm_agent_header.h"
3 
4 /*
5  * \fn: int firm_consumption_supply()
6  * \brief:
7  */
9 {
10 
11  if (UNIT_GOODS_PRICE == 0) {
12  return 0;
13  }
14  if (INVENTORY > 0 && UNIT_GOODS_PRICE > 0) {
16  if (PRINT_DEBUG_MODE) {
17  printf("Firm Id = %d Sends = %d Goods to Mall with a price = %f\n", ID, INVENTORY, UNIT_GOODS_PRICE);
18  }
19  }
20 
21  return 0; /* Returning zero means the agent is not removed */
22 }
23 
24 /*
25  * \fn: int firm_consumption_recieve_sales()
26  * \brief:
27  */
29 {
30  int quantity_sold = 0;
31  double weekly_sales_income = 0;
32 
34  quantity_sold += sold_message->sold_quantities;
36  weekly_sales_income = quantity_sold * UNIT_GOODS_PRICE;
37  /* Updating the inventory. */
38  INVENTORY -= quantity_sold;
39  if (INVENTORY < 0){
40  if (WARNING_MODE) {
41  printf("Warning @firm_consumption_receive_sales(): More than available goods were sold Firm ID = %d, Inventory =%d \n", ID, INVENTORY);
42  }
43  INVENTORY = 0;
44  }
45 
46  /* Updating the sales. */
47  SALES += quantity_sold;
48  LIQUIDITY += weekly_sales_income;
49  REVENUES += weekly_sales_income;
50 
51  if (PRINT_DEBUG_MODE) {
52  printf("Firm ID = %d Quantity Sold = %d Weekly Revenue = %f\n", ID, quantity_sold, weekly_sales_income);
53  }
54 
55 
56  return 0; /* Returning zero means the agent is not removed */
57 }
58 
59 /*
60  * \fn: int firm_consumption_update_market_price()
61  * \brief: The producer firm gets average market price per good.
62  */
64 {
65  if (PRINT_DEBUG_MODE) {
66  printf("Firm ID = %d checks average goods price at the market\n", ID);
67  }
68 
72 
73 
74  return 0; /* Returning zero means the agent is not removed */
75 }