ICEACE Model: Closed Economy
1.0.0
Design Documentation of ICEACE Model
Main Page
Related Pages
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Macros
Pages
IceaceModel1.0
Market_Consumption
centralbank_functions_consumption.c
Go to the documentation of this file.
1
#include "../header.h"
2
#include "../centralbank_agent_header.h"
3
4
5
/*
6
* \fn: int centralbank_trace_goods_prices()
7
* \brief:
8
*/
9
int
centralbank_trace_goods_prices
()
10
{
11
START_GOODS_TRANSACTIONS_SUMMARY_MESSAGE_LOOP
12
GOODS
.quantity =
goods_transactions_summary_message
->
quantity
;
13
GOODS
.avg_price =
goods_transactions_summary_message
->
avg_price
;
14
FINISH_GOODS_TRANSACTIONS_SUMMARY_MESSAGE_LOOP
15
16
for
(
int
i = 0; i < 3; i++) {
17
WEEKLY_PRICE_AVERAGES
[i] =
WEEKLY_PRICE_AVERAGES
[i+1];
18
}
19
WEEKLY_PRICE_AVERAGES
[3] =
GOODS
.avg_price;
20
21
return
0;
/* Returning zero means the agent is not removed */
22
}
23
24
/*
25
* \fn: int centralbank_update_price_indices()()
26
* \brief: The function updates monthly consumption goods prices.
27
*/
28
int
centralbank_update_price_indices
(){
29
double
price_avg, prices, quarterly_price_change;
30
int
i;
31
32
prices = 0;
33
for
(i = 0; i < 4; i++){
34
prices +=
WEEKLY_PRICE_AVERAGES
[i];
35
}
36
price_avg = prices / 4;
37
38
for
(i = 0; i < 11; i++){
39
CONSUMPTION_GOODS_PRICES
[i] =
CONSUMPTION_GOODS_PRICES
[i+1];
40
}
41
CONSUMPTION_GOODS_PRICES
[11] = price_avg;
42
43
if
(
CONSUMPTION_GOODS_PRICES
[8] == 0){
44
quarterly_price_change = 0;
45
}
46
else
{
47
quarterly_price_change = (
CONSUMPTION_GOODS_PRICES
[11] -
CONSUMPTION_GOODS_PRICES
[8]) /
CONSUMPTION_GOODS_PRICES
[8];
48
}
49
50
// MONTHLY_PRICE_INDEX = MONTHLY_PRICE_INDEX + MONTHLY_PRICE_INDEX * monthly_price_change;
51
52
add_centralbank_households_quarterly_cpi_message
(quarterly_price_change);
53
54
return
0;
/* Returning zero means the agent is not removed */
55
}
Generated on Tue Apr 8 2014 13:25:19 for ICEACE Model: Closed Economy by
1.8.3.1