LSD Report - Model: "tr4-1"Automatically generated LSD report.

Model: tr4-1


Model Structure

Object tree

Root—>Stats—>Country—>Supply—>Firm—>PNeed—>Ch
                    |             |          
                    |             —>Capital
                    |             |        
                    |             —>Labor
                    |             |      
                    |             —>blItem
                    |             |       
                    |             —>BankF
                    |             |      
                    |             —>Engineers
                    |                        
                    —>Demand—>Class—>Need—>DCh
                    |              |          
                    |              —>BankC
                    |                     
                    —>Machinery—>KFirm—>KLabor
                    |                 |       
                    |                 —>KEngineers
                    |                 |           
                    |                 —>KCapital
                    |                 |         
                    |                 —>Order
                    |                 |      
                    |                 —>BankK
                    |                        
                    —>Sectors—>sFirm
                    |               
                    —>Bank
                    |     
                    —>Energy—>EnergyFirm—>CapitalEF
                            |           |          
                            |           —>LaborEF
                            |                    
                            —>PP
                                

Variables

Parameters


Object:  Root

Containing:  Stats

Variables:  (none)
Parameters:  (none)


Object:  Stats

Contained in:  Root
Containing:  Country

Variables:  
Parameters:  
Description:
Object with aggregate statistics across runs

Element
Lags
Description and initial values comments
Init_Init Requires first to initialise all the simulation runs
Av_Computations Activate the equation for income distribution HI, Lorenz curve
CheckFinBalanceLag Comment
CheckFinBalance
GlobalFlows Check the global flows among modules of the model
stopPlaceOrder Par. All 1 instances equal to 25.
stopPlaceOrderEF Par. All 1 instances equal to 25.
TotKFirm Par. All 1 instances equal to 0.
TotKEF Par. All 1 instances equal to 0.
CheckFinBalanceRatio


Object:  Country

Contained in:  Root—>Stats
Containing:  Supply, Demand, Machinery, Sectors, Bank, Energy

Variables:  
Parameters:  
Description:
(no description available )

Element
Lags
Description and initial values comments
AggProductivity 1 All 5 instances equal to 1.
Andre Generates values of the income shares to compute the Lorentz curve in the analysis of results (cross section with sequence data of the Par 'Lorenz')
AvAge Par.
AvCurrentProductivity Par.
AvKProfit Par. Average of the capital firms profits
AvMarkup Averege consumer firms markup
AvMaxLProd Average max theoretical productivity
AvMkup Par. Average markup in final good firms
All 1 instances equal to 1.25.
AvPrice 1
AvProfit Par. Average profits across firms

'AvProfit' appears in the equation for: Av_Computations, Av_AvProfit, Sd_AvProfit.
AvRatioVacancies Par.
AvWagecoeff Average of the wage multiplier, in case they are different between firms (or capital and final good firms), to be used as a multiplier of the `minimum' parameter for consumers classes of executives
Aversion Par. parmeter for the aversion to inequality (changes which end of the income distribution has a higher weight in the index computation) in the atkinson index
All 1 instances equal to 0.
Avx Average value of the quality characteristic (non price characteristic)
BaseMinWage Par. Initial (base) minimum wage
BaseP Par. Initial (base) Price
BaseProd Par. Initial (base) level of average firm productivity
CPI Consumer Price Index
ClearExitRecord
ConsumptionConcentration
ConsumptionGdpRatio Par.
EmploymentConcentration
FinancialTrading
GDPConcentration Par. All 1 instances equal to 0.
GDPCapita
GDPg 1 All 1 instances equal to -1.
GDP Par. All 1 instances equal to 10.
GDPF Par. All 1 instances equal to -1.
GDPK Par. All 1 instances equal to -1.
GDPl Par. All 1 instances equal to -1.
GDPnomg
GDPnom 1 All 1 instances equal to 1.
Gini
Hired Par. 'Hired' appears in the equation for: Vacancies.
All 1 instances equal to 100.
InProgress Par. All 1 instances equal to 0.
IncrAggProd Par. All 1 instances equal to 0.01.
IncrAvPrice Par. All 1 instances equal to 0.01.
IndexYear Par. All 1 instances equal to 2.
Inflation 1
Init
InitAggProd Par. All 5 instances equal to 1.
InitAvPrice Par.
InitInProgress
InitMinWage Par. All 1 instances equal to 1.
Init_x
InvSalesRatio Ration between inventories and sales (total economy)
InventGrowth Par. Growth rate of inventories
InvestmentGdpRatio Par.
JobLoss Par.
KaNW Par. All 1 instances equal to 0.1.
LTUnemployment 1
LowerMinWage Par.
MaxNumWorkers 1 All 1 instances equal to 100000.
Max_x Par. Maximum value of the initial level of x for quality charachteristics
Mechanisation
MinWage 1 All 1 instances equal to 10.
MinWageIndex Indexed change in minimum wage
Min_x Par. Minum level of the initial value of x
MinimumCMaxE Par. maximum value of the minimum parameter on any quality characteristic for engineers
All 1 instances equal to 10.
MinimumCMaxW Par. maximum value of the minimum parameter on any quality characteristic for workers
MinimumCMinE Par. minimum value of the minimum parameter on any quality characteristic for engineers
All 1 instances equal to 0.
MinimumCMinW Par. minimum value of the minimum parameter on any quality characteristic for workers
MinimumInit Initialisation of the minimum parameter across classes, needs and chars
MinimumPMaxE Par. maximum value of the minimum parameter on price for engineers
All 1 instances equal to 10000.
MinimumPMaxW Par. maximum value of the minimum parameter on price for workers
All 1 instances equal to 0.
MinimumPMinE Par. minimum value of the minimum parameter on price for engineers
All 1 instances equal to 0.
MinimumPMinW Par. minimum value of the minimum parameter on price for workers
All 1 instances equal to 1000.
MinimumPriceSet
MoAvGDPc 1 All 1 instances equal to -1.
MoAvInvestment 1 All 1 instances equal to 1000.
MoAvInvestmentGr 1 All 1 instances equal to 0.
MoAvMinWageGr 1 Moving average of Minimum wage growth
All 1 instances equal to 0.
MovAvAggProd 1 All 5 instances equal to 1.
MovAvMaxLProd 1 Moving average of the theoreticla max productivity
All 1 instances equal to 1.
MovAvNbrWork 1
MovAvPrice 1
MovAvTotHired Par. All 1 instances equal to 100.
MovAvTotVac 1
NaturalUR Par.
NbrWorkers 1 All 1 instances equal to -1.
OutputConcentration Par. All 1 instances equal to 0.
PTrend Par. Price trend
All 1 instances equal to 0.
ProdIndex Productivity Index
Production
Redistribute Par. All 1 instances equal to 0.
STUnemployment 1
ShareInit Par. Initialise the expenditure shares of the needs for the classes above the first one
TTB_multiplWinner Par. All 1 instances equal to 0.
TauInit Par. Set the initial values for the preferences (tolerance toward difference from max char in the market) across classes, needs and characteristics
TotAvWage Par.
TotConsConst Total consumption at costant prices
TotDConsConst Total desired level of consumption (before smoothing)
TotEnergyConsumption 1 Total Energy Consumption (Firms+Kfirms)
All 1 instances equal to 0.
TotHired Par.
TotHiredLag Par. 'TotHiredLag' appears in the equation for: Vacancies, MovAvTotHired.
TotIncomeCapitaReal
TotInventories Total amount of firms inventories
TotUSales
TotVacancies 1
TotalKProduction Par.
Trade
UnemploymentRate 1 All 1 instances equal to 0.1.
UpperMinWage Par.
WageGrowth Par.
aAgProd Par. All 1 instances equal to 0.01.
aAvPrice Par. All 1 instances equal to 0.01.
aLTUR Par.
aMWA Par. All 1 instances equal to 0.5.
aMWL Par.
aMWP Par. All 1 instances equal to 0.5.
aNbrWork Par.
aSTUR Par.
aTotHir Par.
aTotVac Par.
beta Par. 'beta' appears in the equation for: MovAvUnemp1, MovAvUnemp2, Unemp.
All 1 instances equal to 4.
c Par. All 1 instances equal to 5.
elasMWPrice Par. All 1 instances equal to 0.
elasMWProd Par. All 1 instances equal to 0.
elasMinWage Par. All 1 instances equal to 0.001.
maxMinWage Par.
minAgeExit Par. All 1 instances equal to 100.
minMinWage Par.
minRRoKExit Par. All 1 instances equal to 0.005.
tauMax Par. Maximum level that can be reached by the tolerance level relative to maximum quality of a good
All 1 instances equal to 0.8.
tauMaxE Par. maximum level of tolerance toward the best product in the market, for engineers
tauMaxW Par. maximum level of tolerance toward the best product in the market, for wokers: it should be set diffrently for price and quality features
All 1 instances equal to 0.95.
tauMin Par. The minimum level that can be reached by tolerance level toward price
All 1 instances equal to 0.2.
tauMinE Par. minimum level of tolerance toward the best product in the market, for engineers
tauMinW Par. minimum level of tolerance toward the best product in the market, for workers: it should be set differently for the price and quality goods
All 1 instances equal to 0.85.
tauMultiplier Par. Differences in the tolerance level between classes
All 6 instances equal to 0.2.
totNeeds Par. Total number of needs in the market
All 1 instances equal to 2.
zero Par. All 1 instances equal to 0.
EnergyGdpRatio Par. All 1 instances equal to 0.
MinWageGr
ExtraCapacity Par. All 1 instances equal to 2.
minVisibility Par. All 1 instances equal to 0.01.
MaxQGrowth Par. All 1 instances equal to 10.
ControlPremiaIncome
ControlLaborCost
ControlTotEN
ControlRdExpenditure
MinWageMA 1 Moving average of minwage
All 1 instances equal to 10.
SpeedMinWageMA Par. All 1 instances equal to 0.9.
MinWageMAGr 1 All 1 instances equal to 0.
PriceENMAGr 1 All 1 instances equal to 0.
ControlShareENPP
roPremia Par. 'roPremia' appears in the equation for: WagePrem, KWagePrem
All 1 instances equal to 0.45.
roCash Par. 'roCash' appears in the equation for: WagePremEF, WagePrem, KWagePrem
All 1 instances equal to 0.005.
test
maxMinWageGr Par. All 1 instances equal to 0.01.
FreezeEmployment Par. All 1 instances equal to 0.
PopGrowth Par. All 1 instances equal to 0.001.
ControlWorkers
WorkersEFRatio
WorkersKRatio
WorkersRatio
NegUnemp Par. All 1 instances equal to 0.
TotBacklogRatio
UnempTarget Par. All 1 instances equal to 0.05.
sGDPnom 1 All 1 instances equal to -1.
StatKFirms
BrownI Par. Real brown investment
All 1 instances equal to -1.
BrownInom Par. Nominal brown investment
All 1 instances equal to -1.
GreenI Par. Real green investment
All 1 instances equal to -1.
GreenInom Par. Nominal green investment
All 1 instances equal to -1.
FirmsI Par. Final good firms real investment
All 1 instances equal to -1.
FirmsInom Par. Final good firms nominal investment
All 1 instances equal to -1.
BrownIGdpRatio Par. All 1 instances equal to -1.
BrownInomGdpRatio Par. All 1 instances equal to -1.
GreenIGdpRatio Par. All 1 instances equal to -1.
GreenInomGdpRatio Par. All 1 instances equal to -1.
FirmsIGdpRatio Par. All 1 instances equal to -1.
FirmsInomGdpRatio Par. All 1 instances equal to -1.
TotSavings Total savings as the difference between TotIncome and TotConsumption
SavingsIncomeRatio Savings / Income
ExcessEnergyRatio
AvUtilisationRate Average utilisation rate of capital weighted by CapitalCapacity
AvUtilisationBrown Average utilisation rate of capital in the energy sector weighted by capacity
AvUtilisationGreen Average utilisation rate of capital in the energy sector weighted by capacity
TimeWaitedBrown Par. All 1 instances equal to -1.
TimeWaitedFirms Par. All 1 instances equal to -1.
TimeWaitedGreen Par. All 1 instances equal to -1.
WaitTimeBrown Par. All 1 instances equal to 0.
WaitTimeFirms Par. All 1 instances equal to 0.
WaitTimeGreen Par. All 1 instances equal to 0.
BrownGOSKShare Par. All 1 instances equal to -1.
GreenGOSKShare Par. All 1 instances equal to -1.
FirmsGOSKShare Par. All 1 instances equal to -1.
StatEF
BrownGOSShare Par. All 1 instances equal to -1.
GreenGOSShare Par. All 1 instances equal to -1.
StatFirms
FirmsGOSShare Par. All 1 instances equal to -1.
dGDP Gross domestic product (log) growth rate
Unemployment Par. All 1 instances equal to 0.
VacancyRate number of vacancies over employment
BrownKprice Par. Average price of brown capital solde by KFirms weighted by KProductionFlow
All 1 instances equal to -1.
GreenKprice Par. Average price of green capital solde by KFirms weighted by KProductionFlow
All 1 instances equal to -1.
FirmsKprice Par. Average price of final good capital solde by KFirms weighted by KProductionFlow
All 1 instances equal to -1.
BrownKProductivity Par. Average labor productivity of brown KFirms weighted by KProductionFlow
All 1 instances equal to -1.
GreenKProductivity Par. Average labor productivity of green KFirms weighted by KProductionFlow
All 1 instances equal to -1.
FirmsKProductivity Par. Average labor productivity of final goods KFirms weighted by KProductionFlow
All 1 instances equal to -1.
BrownWaitTime Par. Average WaitTime of brown KFirms weighted by KProductionFlow
All 1 instances equal to -1.
GreenWaitTime Par. Average WaitTime of green KFirms weighted by KProductionFlow
All 1 instances equal to -1.
FirmsWaitTime Par. Average WaitTime of final goods KFirms weighted by KProductionFlow
All 1 instances equal to -1.
TotProfit Par. All 1 instances equal to 0.
TaxRevenues 1 All 1 instances equal to 0.
taxrate Par. All 1 instances equal to 0.45.
GovernmentExpenses Par. All 1 instances equal to 0.
GovernmentFund 1 Money available to the government
All 1 instances equal to 0.
minShareGovGDP Par. All 1 instances equal to 0.01.
maxShareGovGDP Par. All 1 instances equal to 0.5.
shareGovGDP Par. All 1 instances equal to 0.
InterestGovFund 1 Interest paid on gov. debt
All 1 instances equal to 0.
ENGDP
GovDemTot 1 Total government demand
All 1 instances equal to 1e+07.
shareGDdown Par. All 1 instances equal to 0.01.
shareGDup Par. All 1 instances equal to 0.2.
IncomeTaxShare Par. All 1 instances equal to 0.75.


Object:  Supply

Contained in:  Root—>Stats—>Country
Containing:  Firm

Variables:  
Parameters:  
Description:
(no description available )

Element
Lags
Description and initial values comments
aES Par. All 1 instances equal to 0.9.
InvHerfIndex
TotalSales Par. All 1 instances equal to 0.
innoInterval Par. Minimum inteval of time between the introduction of two product innovations
All 1 instances equal to 10.
aLearningK Par.
Entry
Exit 1 All 1 instances equal to 0.
CounterIdFirm 1
coefMarkupVar Par. All 1 instances equal to 0.05.
CapitalIntens Par. Unit of capital you need to produce 1 unit of good.
2
ExitFlag Par. All 1 instances equal to 0.
DivisorLiquidityFinance Par.
capMinWage Par.
TotEN
ControlWaiting Par. If activated this variable checks the consistency between the orders for new capital and the conditions of the final good firms. For debugging purposes only, does not modify any result in the model.
All 1 instances equal to 0.
AvDiffCapacity
DiffCapacity
NbrFirms
NbrNotWaiting
NbrWaiting
TotBacklog
AvMaxLaborProductivity
TotLaborForce
NumWorkersMaxGr Par. All 1 instances equal to 0.005.
NumWorkersMinInc Par. All 1 instances equal to 5.
TotNumWorkers
TotUnitDemand
TotQ
sPrice Par. All 1 instances equal to 0.
aClearingPrice Par. All 1 instances equal to 0.5.
aaNW Par. All 1 instances equal to 0.02.
AvMaxEfficiency
aNWmin Par. All 1 instances equal to 0.8.
aNWmax Par. All 1 instances equal to 0.9.
aNWsmooth Par. All 1 instances equal to 1.
SumWagePrem Sum of Premia distributed by Firms
SumLaborCost Sum of wages distributed by Firms
SumInvestment Sum of investment spending of Firms
TotEN2 Total Energy Consumption of FIRMS
TotStocks
SumRevenues
SumBacklogSales
SumBacklogCh
SumBacklogValueCh
SumRdExpenditure
TimeRepayment Par. All 1 instances equal to 50.
CapitalDestroyed Par. All 1 instances equal to 0.
SumCashF 1 All 1 instances equal to 0.
SumOutstandingDebtFCh
SumMonetarySales
SumInterestDepositsF
SumOverdraftPaymentF
SumInterestPaymentF
UpdateExpenses
SumCashFCh
SumWaiting
WaitingRatio
SumBacklog
SumFirmControlCurrent
aVisibility Par. All 1 instances equal to 0.1.
LTGDP Par. All 1 instances equal to 0.
aLTGDP Par. All 1 instances equal to 0.95.
aLTProfit Par. All 1 instances equal to 0.95.
RatioProfitGDP Par. Short term average profit
All 1 instances equal to 1.
minMarkup Par. All 1 instances equal to 1.7.
maxMarkup Par. All 1 instances equal to 3.
LTTotProfit Par. Long term average profit
All 1 instances equal to 1.
markup Par. All 1 instances equal to 1.7.
SumTaxF


Object:  Firm

Contained in:  Root—>Stats—>Country—>Supply
Containing:  PNeed, Capital, Labor, blItem, BankF, Engineers

Variables:  
Parameters:  
Description:
(no description available )

Element
Lags
Description and initial values comments
Age 1 All 100 instances equal to 0.
AvWage
CapitalCapacity Par. All 100 instances equal to -1.
CapitalDepress Par. All 100 instances equal to 0.001.
CapitalStock 1 All 100 instances equal to 1.
ConstPrice Par. All 106 instances equal to 100.
DesiredQ
DesiredStocks Par. All 106 instances equal to 0.1.
DesiredUnusedCapacity Par. All 106 instances equal to 1.05.
EN 1 Energy used by Firm
All 106 instances equal to 0.
ExpectedProfit Profits perceied by looking at expected sales, and not unit sales
ExpectedProfit2 Perceived profits as a difference between desired quantity and costs
ExpectedProfit3
ExpectedSales 1 All 50 instances equal to 1.
Health 1 Measure the sustainability of the firm comparing the ratio of (smoothed) monetary sales to cumulated profits.
Values close to 0 approach exit, 1 is perfect health.

'Health' appears in the equation for: Entry, Exit, Avx
All 100 instances equal to 1.
IdFirm Par. All 100 instances increasing from 1 with steps 1. The value is increased every 1 instances.
IdTech Par. All 100 instances equal to 1. Instances from 1 to 50 equal to 1. Instances from 51 to 100 equal to 2.
InvestmentDecision 1 Place on order of K if you need it and did not place an order as yet

'InvestmentDecision' appears in the equation for: WagePrem.
All 683 instances equal to 0.
KapitalNeed Decide whether to order new capital.

'KapitalNeed' appears in the equation for: InvestmentDecision, PlaceOrder.
LaborCapacity
LaborCost
LaborForce Par. All 100 instances equal to 0.
LaborForceL Par. Lagged number of firm workers
LaborGrowth Par. Growth of firms
MaxLaborProductivity 1 All 250 instances equal to 1.
MonetarySales Par. All 100 instances equal to 0.
MonetarySalesL Par. Monetary sales in t-1 (computed before setting to 0 mon sales in t=0)
All 5 instances equal to 4.
MovAvExpSales 1 Moving average of the expected sales
All 683 instances equal to 0.
MovAvProfit 1 Moving average of the firm's profits
All 683 instances equal to 0.
Ms 1 All 100 instances equal to 0.01.
MsSector Par. Market share of the firm in its sector
All 50 instances equal to 0.07.
NumK Par. All 100 instances equal to 0.
ProdInno Actual change in the quality characteristic, and definition of the prototipe
ProdShockP Par. Determines the variance of the change in the quality of the product
All 100 instances equal to 0.1.
Profit 1 All 100 instances equal to 1.
Q 1 All 50 instances equal to 1.
RatioVacancies Par.
RationingRatioFirm Par.
RdExpenditure Amount of resources spent in product R&D (and not devoted to dividends)
Revenues 1 All 683 instances equal to 0.
SmoothProfit 1 All 100 instances equal to -1.
Stocks 1 All 683 instances equal to 0.
UnitDemand 1 All 106 instances equal to 0.
UnitEnergyCost
UnitLaborCost
UnitSales 1 All 106 instances equal to 0.
Vacancies Par.
Visibility 1 All 100 instances equal to 1.
WagePrem
Waiting Par. 'Waiting' appears in the equation for: InvestmentDecision, KProductionFlow.
aExpSales Par. Smoothing factor for the moving average of expected sales
All 5 instances equal to 0.05.
aHealth Par. All 100 instances equal to 0.9.
aMonSales Par. Smoothing parameter of the moving average
All 100 instances equal to 0.9.
aProfit Par. Decay parameter of the moving average
All 5 instances equal to 0.05.
app Par.
backlog 1 All 683 instances equal to 0.
backlogSales Par. All 683 instances equal to 0.
betaEff 1 All 106 instances equal to 0.25.
betaPrice Par. All 106 instances equal to 0.4.
betaProd
betaTime Par. All 106 instances equal to 0.2.
numBLI Par.
price 1 All 100 instances equal to 0.2.
product Par. Defines the good the firm is producing (i.e. which consmer need the good satisfies)
All 100 instances increasing from 1 with steps 1. The value is increased every 10 instances.
psi Par. adjustment speed of betaEff
All 106 instances equal to 0.01.
roRD Par. All 683 instances equal to 0.2.
smoothMonSales 1 All 100 instances equal to 100.
tInno Par. Indicates how many periods before an innvoation had been introduced
All 5 instances equal to 0.
zInno Par. Pobability to introduce a prototipe when sales are reducing
All 100 instances equal to 0.01.
ClearingPrice
aNW 1 All 49 instances equal to 0.5.
MaxEfficiency Par. All 49 instances equal to 0.
backlogSalesL Par. All 683 instances equal to 0.
ControlPremia
InvestmentSpending Par. All 683 instances equal to 0.
Control Control the allocation of production
backlogCh
backlogValue Par. All 683 instances equal to 0.
backlogValueCh Par. All 683 instances equal to 0.
backlogValueL Par. All 683 instances equal to 0.
ENCost
MaxKExpenditureF Maximum costs of purchasing capital.
It is computed assuming a flow of free cash available represented by sBalanceF for the foreseeable future to finance additional capital interests and repayment.
We approximate the single time repayment cost of borrowing K to be repayed in L periods at interest i as:
R=K [ i / z]

where

z=(1-(1/(1+i)^L))

Consequently, the maximum K the firm can expect to pay is:
K=sBalanceF/[i/z]
CapitalCostF Cost of repayment loans
CapitalPaymentF Cost of repayment principal
OutstandingDebtF 1 Stock of existing debt
All 683 instances equal to 0.
InterestPaymentF 1 Interest payments on outstanding debt
All 683 instances equal to 0.
FirmControlCapital
FirmControlCurrent
OutstandingDebtFCh
ControlRevenues
flagNewEntrant Par. All 100 instances equal to 0.
VacanciesRatio
UtilisationRate Utilisation rate of capital
GOS Gross Operating Surplus, difference between revenues, labor costs, energy costs and R&D
GOSShare GOS / MonetarySales
UnitELdiff Difference between UnitEnergyCost and UnitLaborCost, must always be negative
IncomeBeforeDebtPaymentsF
sIncomeBeforeDebtPaymentsF 1 All 100 instances equal to 0.
LiabilitiesF
sLiabilitiesF 1 All 100 instances equal to 0.
TaxF Tax paid on profit of F firm


Object:  PNeed

Contained in:  Root—>Stats—>Country—>Supply—>Firm
Containing:  Ch

Variables:  (none)
Parameters:  
Description:
(no description available )

Element
Lags
Description and initial values comments
IdPNeed Par. All 20 instances equal to 0.


Object:  Ch

Contained in:  Root—>Stats—>Country—>Supply—>Firm—>PNeed

Variables:  
Parameters:  
Description:
(no description available )

Element
Lags
Description and initial values comments
IdCh Par. All 2500 instances increasing from 1 with steps 1 re-starting for each group of Objects.
x 1 All 2 instances equal to 0.
obs_x Par. All 2 instances equal to 0.


Object:  Capital

Contained in:  Root—>Stats—>Country—>Supply—>Firm

Variables:  
Parameters:  
Description:
(no description available )

Element
Lags
Description and initial values comments
IncProductivity Par. All 250 instances equal to 1.
IncSkillBiais Par. All 100 instances equal to 0.5.
K Par. All 100 instances equal to 10.
KAge 1 All 100 instances equal to -1.
KExpenditures Par. All 100 instances equal to 0.
MaxKQ
IncLearningK 1 All 100 instances equal to 1.
IncEfficiency Par. All 16356 instances equal to 0.5.
PrincipalF 1 All 16356 instances equal to 0.
InterestF Total interest to pay on the loan
InstallmentF SHare of loans returned


Object:  Labor

Contained in:  Root—>Stats—>Country—>Supply—>Firm

Variables:  
Parameters:  
Description:
(no description available )

Element
Lags
Description and initial values comments
NumWorkers 1 All 200 instances equal to 1.
wage 1 All 6367 instances equal to 0.
wagecoeff Par. All 911 instances equal to 1.6.
IdLabor Par. All 200 instances increasing from 1 with steps 1 re-starting for each group of objects.
nu Par. All 200 instances equal to 3.
Premia Par. 'Premia' appears in the equation for: ControlPremia, WagePrem, Dump, GlobalFlows
NumWorkersGr
flagShowWage Par. All 200 instances equal to 0.


Object:  blItem

Contained in:  Root—>Stats—>Country—>Supply—>Firm

Variables:  (none)
Parameters:  
Description:
(no description available )

Element
Lags
Description and initial values comments
blQ Par.
blPrice Par.


Object:  BankF

Contained in:  Root—>Stats—>Country—>Supply—>Firm

Variables:  
Parameters:  
Description:
(no description available )

Element
Lags
Description and initial values comments
BalanceF 1 All 683 instances equal to 0.
DebtF Par. All 683 instances equal to 0.
KPresentValue
NetWorth 1 All 100 instances equal to 0.
BacklogValue 1 All 683 instances equal to 0.
sBalanceF 1 All 683 instances equal to 0.
RRoK 1 All 100 instances equal to 0.
DebtFL Lagged value of DebtF
DebtFCh Change of DebtF
DistributedProfits Par. All 683 instances equal to 0.
CashF 1 All 683 instances equal to 0.
InterestDepositsF 1 Cash obtained as interest on deposits
All 683 instances equal to 0.
sCashF 1 All 683 instances equal to 0.
OverdraftPaymentF 1 Interest paid on overdraft
All 683 instances equal to 0.
CashFCh
BacklogValueCh 1 All 683 instances equal to 0.
sProfit 1 All 100 instances equal to 0.
OrganicCashF Par. All 100 instances equal to 0.
CashFAdjustment Variation of CashC due to Bank's actions


Object:  Engineers

Contained in:  Root—>Stats—>Country—>Supply—>Firm

Variables:  
Parameters:  

Element
Lags
Description and initial values comments
EWagecoeff Par. All 683 instances equal to 2.
NbrEngineers 1 All 683 instances equal to 0.
WageEngineers Wage of engineers


Object:  Demand

Contained in:  Root—>Stats—>Country
Containing:  Class

Variables:  
Parameters:  
Description:
(no description available )

Element
Lags
Description and initial values comments
IncomeDistribution
HerfTotalIncome Par. All 1 instances equal to 0.
HerfWageIncome Par. All 1 instances equal to 0.
HerfNonWageIncome Par. All 1 instances equal to 0.
eta Par. Relation between changes in the expenditure shares
All 1 instances equal to 0.5.
PayTime
TotWage
TotPremia
TotIncome
TotIndividuals Total number of consumers
Atkinson Atkinson index of inequality for income in period t-1
AvIncome Average income across classes in time t-1
TotIncomeCapita
ShareSavingsConsumed Par.
SRMultiplier Par. All 1 instances equal to 0.8.
TopSavingRate Par. All 1 instances equal to 0.9.
AtkinsonClass Par. All 1 instances equal to 0.
TotConsumption
MargPropConsume
WageIncomeRatio Par.
PremiaIncomeRatio Par.
TopBotInc
TopBotEarn
GlobalIncome
DecilesRatios
IncomeTop1 Par.
IncomeTop10 Par.
IncomeBottom90 Par.
Ratio190 Par.
Ratio1090 Par.
ShareIncomeTop01 Par.
ShareIncomeTop10 Par.
ShareIncomeBottom90 Par.
SumPremiaIncome Sum of Premia distributed to classes
SumExpenditures
SumBalanceC
MaxNumClass
SumCashC 1 All 1 instances equal to 0.
aCashC Par. 'aCashC' appears in the equation for: Consumption
All 1 instances equal to 0.005.
SumExpenditure
SumInterestDepositsC
SumOverdraftPaymentC
SumCashCCh
brakeExpenditure Par. All 1 instances equal to 0.99.
IncomeTaxTot 1 Sum of total income tax
All 1 instances equal to 0.


Object:  Class

Contained in:  Root—>Stats—>Country—>Demand
Containing:  Need, BankC

Variables:  
Parameters:  
Description:
(no description available )

Element
Lags
Description and initial values comments
NumClass Par. All 3 instances increasing from 0 with steps 1. The value is increased every 1 instances.
Expenditure 1 All 18 instances equal to 100.
ShareWageIncome 1 All 18 instances equal to 0.
aEx Par. All 3 instances equal to 0.8.
SharePremiaIncome 1 All 18 instances equal to 0.
Lorenz Par. Data to anlayse fot he Lorent curve
All 18 instances equal to 0.
ShareIncome 1 Share of income for each individual

'ShareIncome' appears in the equation for: NumWorkers, KNbrWorkers, Andre, TotIndividuals, AvIncome, Atkinson, Gini.
All 18 instances equal to 0.
Individuals Par. All 18 instances equal to 0.
LorenzInd Par. All 18 instances equal to 0.
ComputeShare Function called to initialise the shares of the different needs
TotIterations Total number of iterations (used to compute the consumption share of each need - i.e. the number of iterations for each need)
Income 1 All 18 instances equal to 100000.
PremiaIncome Par. All 18 instances equal to 0.
WageIncome Par. All 18 instances equal to 0.
tempWage Par.
IncomeCapita
Consumption
SavingRate Par. All 18 instances equal to 0.2.
ShareIndividuals
shareConsumption
Competitiveness Par. 'Competitiveness' appears in the equation for: Trade


'Competitiveness' appears in the equation for: Trade
All 18 instances equal to 3.
CashC 1 All 18 instances equal to 0.
InterestDepositsC 1 Cash obtained as interest on deposits
All 18 instances equal to 0.
BankProfitIncome 1 All 18 instances equal to 0.
AutonomousC Par. All 18 instances equal to 500.
ControlDemand
ExcessCostIncome Excess energy cost due to overutilization distrubuted to classes
SumShare
appCtrlWage Par. All 18 instances equal to 0.
appCtrlPremia Par. All 18 instances equal to 0.
CumBPI 1 All 18 instances equal to 0.
OrganicCashC Par. All 18 instances equal to 0.
CashCAdjustment Variation of CashC due to Bank's actions
HHWealth 1 All 18 instances equal to 0.
CashCShare
AutComp Par. All 18 instances equal to 0.
Subsidies Par. Gov. subsidies
All 18 instances equal to 0.
IncomeTax 1 Income tax
All 18 instances equal to 0.
GovDemHH 1 Government demand expressed by the class
All 18 instances equal to 10000.


Object:  Need

Contained in:  Root—>Stats—>Country—>Demand—>Class
Containing:  DCh

Variables:  
Parameters:  
Description:
(no description available )

Element
Lags
Description and initial values comments
IdNeed Par. All 30 instances increasing from 1 with steps 1 re-starting for each group of Objects.
Share Par. Instances from 3 to 6 equal to 0.1. Instances from 1 to 10 equal to 0.2. Instances from 1 to 10 equal to 0.1.
NumIterations Par. All 3 instances equal to 50. Instances from 1 to 10 equal to 20. Instances from 1 to 10 equal to 10.
ExpShare Function that computes the share of each need with respect to the share in the same need in the previous class
endExpShare Par. Asymptotic share towards which the share tends as the class becomes richer
Instances from 3 to 6 equal to 0.1. Instances from 4 to 6 equal to 0.9. Instances from 1 to 10 equal to 0.2. Instances from 11 to 30 equal to 0.0142892. Instances from 12 to 30 equal to 0.0295163. Instances from 13 to 30 equal to 0.0320707. Instances from 14 to 30 equal to 0.0391915. Instances from 15 to 30 equal to 0.0676229. Instances from 16 to 30 equal to 0.0980039. Instances from 17 to 30 equal to 0.126654. Instances from 18 to 30 equal to 0.151125. Instances from 19 to 30 equal to 0.171327. Instances from 20 to 30 equal to 0.2702. Instances from 1 to 10 equal to 0.1.
ProdExists Par. All 9 instances equal to 1.
TempIterations Par. All 9 instances equal to 0.


Object:  DCh

Contained in:  Root—>Stats—>Country—>Demand—>Class—>Need

Variables:  (none)
Parameters:  
Description:
(no description available )

Element
Lags
Description and initial values comments
IdDCh Par.
tau Par. 'tau' appears in the equation for: NumWorkersEF, TTB_multiplWinner, Trade, NumWorkers, KNbrWorkers, TauInit
All 6 instances equal to 0.95.
Delta Par. 'Delta' appears in the equation for: TTB_multiplWinner, MinimumPriceSet, MinimumInit.
All 6 instances equal to 0.05.
Minimum Par. All 75 instances equal to 98.
temp Par.
NegativeQuality Par. All 6 instances equal to -1.


Object:  BankC

Contained in:  Root—>Stats—>Country—>Demand—>Class

Variables:  
Parameters:  (none)
Description:
(no description available )

Element
Lags
Description and initial values comments
BalanceC 1 All 18 instances equal to 0.
OverdraftPaymentC 1 Interest paid on overdraft
All 18 instances equal to 0.


Object:  Machinery

Contained in:  Root—>Stats—>Country
Containing:  KFirm

Variables:  
Parameters:  
Description:
(no description available )

Element
Lags
Description and initial values comments
AvCurrEff Par. All 1 instances equal to 0.
AvCurrProd Par. All 1 instances equal to 10.
AvGreenKPrice Par. All 1 instances equal to 1.
AvKPrice Par.
AvLocalPriceProd
AvWaitTime Par.
DiscountUsedK Par.
IsEnergyK Par. All 1 instances equal to 0.
KEmployment Par. All 1 instances equal to 0.
KEmploymentShare Par. All 1 instances equal to 0.
KFirmSeeRoW Par. KFirm proba to see RoW
All 3 instances equal to 0.01.
KNomGDPShare Par. All 1 instances equal to 0.
KOutputShare Par. All 1 instances equal to 0.
PlaceOrder
PlaceOrderEF Place the order from the calling firm to a Kapital producer adopting the technology of the firm
PrudenceLending Par.
RemoveEFOrders
SumCashKF 1 All 1 instances equal to 0.
SumKLaborCost Sum of wages distributed by KFirms
SumKRdExpenditure
SumKRevenues Sum of revenues of KFirms (Investment of Firms and EnergyFirms)
SumKWagePrem Sum of Premia distributed by KFirms
TotInvestment
TotKEN
TotKEN2 Total Energy Consumption of KFIRMS
TotKLaborForce
TotLocalGreenInvestment
psi_spe Par. All 1 instances equal to 0.01.
SumInterestDepositsKF
SumOverdraftPaymentKF
SumKFirmControlCurrent
SumCashKFCh
NumActiveOrders Comment
SumNbrOrders
speedSO Par. All 1 instances equal to 0.95.
SumCashInjectionKF 1 All 1 instances equal to 0.
EnergyFrontierProd 1 Energy productivity frontier
KExtraCapacity Par. All 1 instances equal to 2.
SumTaxK
KPriceOverCharge Par. All 1 instances equal to 0.1.


Object:  KFirm

Contained in:  Root—>Stats—>Country—>Machinery
Containing:  KLabor, KEngineers, KCapital, Order, BankK

Variables:  
Parameters:  
Description:
(no description available )

Element
Lags
Description and initial values comments
IdKTech Par. All 10 instances equal to 1. Instances from 6 to 10 equal to 2.
KQ
NumOrders Par. All 16 instances equal to 0.
kapp Par. All 2 instances equal to 0.
KProductionFlow
KPrice 1 All 16 instances equal to 100.
z Par. All 10 instances equal to 0.01.
ProductivityShock Par. All 16 instances equal to 0.015.
SkillBiaisShock Par. All 10 instances equal to 0.
KProfit
EngineersHiring Par. All 10 instances equal to 0.05.
Kmarkup Par. All 16 instances equal to 5.
KCumProfit Par. All 16 instances equal to 0.
EngineersShare Par. All 16 instances equal to 0.1.
kselect Par. All 16 instances equal to 0.
WaitTime Par. All 16 instances equal to 1.
AvKWage Par. All 4 instances equal to 0.
KConstPrice Par. All 16 instances equal to 1.
KWagePrem
KLaborCost
KVacancies Par. All 16 instances equal to 0.
KRatioVacancies Par. All 16 instances equal to 0.
KLaborForce Par. Firm number of workers
All 16 instances equal to 0.
KLaborForceL Par. Lagged number of firm workers
All 16 instances equal to 0.
KLaborGrowth Par. Griwth of capital firm
All 16 instances equal to 0.
KEN 1 All 16 instances equal to 0.
KUnitEnergyCost 1 All 16 instances equal to 0.
KMaxEnergyEfficiency 1 All 10 instances equal to 0.510028980938797.
EfficiencyShock Par. All 16 instances equal to 0.001.
EnergyEfficiencyShock Par. All 16 instances equal to 0.001.
GreenKProdShock Par. All 30 instances equal to 0.00045.
IdKFirm Par. All 10 instances increasing from 1 with steps 1. The value is increased every 1 instances.
LocalGreenInvestment Par. All 20 instances equal to 0.
ControlKPremia
KRdExpenditure
KENCost
KDelivered Par. All 10 instances equal to 0.
KType Par. All 16 instances equal to 2.
ExpCostENK Expected cost to produce energy without margin and management
KFirmControlCurrent
KProcessShock Par. All 16 instances equal to 0.01.
KExpCostEN 1 All 16 instances equal to 1.
KExpCostLabor 1 All 16 instances equal to 1.
SumKNbrWorkers
GOSK Gross Operating Surplus of KFirm, difference between revenues, labor costs and energy costs
GOSKShare GOS / MonetarySales
IncomeBeforeDebtPaymentsKF
sIncomeBeforeDebtPaymentsKF 1 All 16 instances equal to 0.
LiabilitiesKF
sLiabilitiesKF 1 All 16 instances equal to 0.
TaxK Tax paid on profit of F firm


Object:  KLabor

Contained in:  Root—>Stats—>Country—>Machinery—>KFirm

Variables:  
Parameters:  
Description:
(no description available )

Element
Lags
Description and initial values comments
KNbrWorkers 1 All 32 instances equal to 4.
KWage 1 All 51 instances equal to 100.
KWagecoeff Par. All 20 instances equal to 1.6.
KDesiredUnusedCapacity Par. All 10 instances equal to 1.2.
KLaborProductivity 1 All 32 instances equal to 1.
IdKLabor Par. All 32 instances increasing from 1 with steps 1 re-starting for each group of objects.
knu Par. All 20 instances equal to 3.
KPremia Par. All 51 instances equal to 0.


Object:  KEngineers

Contained in:  Root—>Stats—>Country—>Machinery—>KFirm

Variables:  
Parameters:  
Description:
(no description available )

Element
Lags
Description and initial values comments
KNbrEngineers 1 All 16 instances equal to 10.
KWageEngineers 1 All 16 instances equal to 200.
KEWagecoeff Par. All 10 instances equal to 2.
KNbrEngiEff
KNbrEngiProd
KShareEngiEff
KShareEngiProd 1 All 16 instances equal to 0.5.
KShareEngiProcessEff Par. All 16 instances equal to 0.1.
KNbrEngiProcessEff
KShareEngiProcess
ControlKShareEngi
KNbrEngiProcess Defines the number of engineers working on process


Object:  KCapital

Contained in:  Root—>Stats—>Country—>Machinery—>KFirm

Variables:  
Parameters:  
Description:
(no description available )

Element
Lags
Description and initial values comments
CurrentProductivity 1 All 16 instances equal to 1.
CurrentEfficiency 1 All 10 instances equal to 0.5.
GreenEnergyCost Compute the investment cost to produce one unit of green energy during the whole life of the vintage.
MaxENProduction Par. Compute the energy production of a vintage for its whole lifespan
All 10 instances equal to 1.


Object:  Order

Contained in:  Root—>Stats—>Country—>Machinery—>KFirm

Variables:  (none)
Parameters:  
Description:
(no description available )

Element
Lags
Description and initial values comments
KAmount Par. All 16 instances equal to 0.
KCompletion Par. All 16 instances equal to 0.
TimeWaited Par. All 16 instances equal to 0.
Kproductivity Par. All 16 instances equal to 0.
KP Par. All 16 instances equal to 0.
IdClient Par. All 16 instances equal to -1.
KEfficiency Par. All 16 instances equal to 0.
GreenKProd Par. All 1 instances equal to 1.
OrderAlpha Par. All 25 instances equal to 0.
EnergyKOrder Par. All 16 instances equal to 0.


Object:  BankK

Contained in:  Root—>Stats—>Country—>Machinery—>KFirm

Variables:  
Parameters:  
Description:
(no description available )

Element
Lags
Description and initial values comments
BalanceK 1 All 16 instances equal to 0.
KRevenues Par. All 10 instances equal to 0.
DebtK Par. All 16 instances equal to 0.
DebtKL Lagged value of DebtK
KDistributedProfits Par. All 10 instances equal to 0.
DebtKCh Change of DebtF
KRevenues2
CashKF 1 All 16 instances equal to 0.
InterestDepositsKF 1 Cash obtained as interest on deposits
All 10 instances equal to 0.
OverdraftPaymentKF 1 Interest paid on overdraft
All 10 instances equal to 0.
sProfitKF 1 All 16 instances equal to 0.
RRoKKF 1 All 16 instances equal to 0.
CashInjectionKF 1 All 16 instances equal to 0.
OrganicCashKF Par. All 16 instances equal to 0.
CashKFAdjustment Variation of CashKF due to Bank's actions


Object:  Sectors

Contained in:  Root—>Stats—>Country
Containing:  sFirm

Variables:  
Parameters:  
Description:
(no description available )

Element
Lags
Description and initial values comments
IdGood Par. All 10 instances increasing from 1 with steps 1. The value is increased every 1 instances.
NFirmsS Par. Number of firms in a sector
All 10 instances equal to 0.
SInvHerf Par. Herfindhal index for each sector
All 10 instances equal to 0.
TotSalesS Par. Total sales in the sector
All 10 instances equal to 0.
AvxS Par. Averge quality of the good within a sector, weighted by firms market share
All 10 instances equal to 0.
AvpS Par. Averge price of the good within a sector, weighted by firms market share
All 10 instances equal to 0.
FrontierX 1 All 10 instances equal to 0.
maxXS Par. All 10 instances equal to 0.
aFrontierX Par. All 10 instances equal to 0.9.
probEntry Par. All 10 instances equal to 0.01.
minHealth Par. All 10 instances equal to 0.05.
Demography
SUnitSales Par. All 10 instances equal to 0.
SQ Par. All 10 instances equal to 0.
SRevenues Par. All 10 instances equal to 0.
SProfits Par. All 10 instances equal to 0.
SNumFirms Par.
SMonetarySales Par. All 10 instances equal to 0.
SAvHealth Par.
SAvBacklog Par. All 10 instances equal to 0.
SAvStock Par. All 10 instances equal to 0.
numExit Par.
AvAgeDeath Par. All 10 instances equal to 0.
SKProductivity Par. All 10 instances equal to 0.
SULC Par. All 10 instances equal to 0.
Sapp Par. All 10 instances equal to 0.
SnumBLI Par. All 10 instances equal to 0.
SNetWorth Par. All 10 instances equal to 0.
SAvAge Par. All 10 instances equal to 0.
SectEmploymentShare Par. All 10 instances equal to 0.
SectEmployment
SectSales Par. All 10 instances equal to 0.
SectNomGDPShare Par. All 10 instances equal to 0.
SectOutputShare Par. All 10 instances equal to 0.
SectSalesShare Par. All 10 instances equal to 0.
SectMechanisation Par. All 10 instances equal to 0.
RedistributeSales Par. All 10 instances equal to 0.
SBacklogShare Par. All 10 instances equal to 0.
newFirmKNeed Estimation of the capital newly entered firm need to order
msEntrants


Object:  sFirm

Contained in:  Root—>Stats—>Country—>Sectors

Variables:  (none)
Parameters:  
Description:
(no description available )

Element
Lags
Description and initial values comments
IdsFirm Par. All 10 instances equal to -1.
app1 Par.
app2 Par.
app3 Par.
app4 Par.


Object:  Bank

Contained in:  Root—>Stats—>Country

Variables:  
Parameters:  
Description:
(no description available )

Element
Lags
Description and initial values comments
InterestRateDeposits Par. All 1 instances equal to 0.001.
TotalDeposits Par. All 1 instances equal to 0.
TotalOverdraft Par. All 1 instances equal to 0.
TotalOutstandingDebt Par. All 1 instances equal to 0.
TotalInterestCollected Par. All 1 instances equal to 0.
TotalCapitalPayment Par. All 1 instances equal to 0.
TotalInterestDeposits Share of interests collected distributed to deposits
TotalAssets 1 Total values of assets
All 1 instances equal to 1.
OwnFundsBank 1 All 1 instances equal to 0.
TotalProfitsBank
RetainedProfitsBank
DistributedProfitsBank 1 All 1 instances equal to 0.
ProfitShareTargetBank Par. 'ProfitShareTargetBank' appears in the equation for: DistributedProfitsBank
All 1 instances equal to 0.05.
OwnFundsTargetLRBank
CapitalAdequacyRatioTargetBank Par. All 1 instances equal to 0.2.
OwnFundsTargetSRBank
OwnFundsParameterBank Par. All 1 instances equal to 0.01.
RetainedProfitsTargetBank
TotalOutstandingDebtV 1 All 1 instances equal to 0.
ExpectedLoanDefaultsPC 1 currently set to zero, needs to be changed to a variable later
All 1 instances equal to 0.
TotalProfitsTargetBank
InterestRateSpread
InterestRate 1 'InterestRate' appears in the equation for: OverdraftPaymentC, OverdraftPaymentF, OverdraftPaymentKF, OverdraftPaymentEF, MaxKExpenditureEF, MaxKExpenditureF, InterestF, InterestEF, KapitalNeed
All 1 instances equal to 0.01.
CapitalAdequacyRatio
TotalInterestCollectedV 1 All 1 instances equal to 0.
TotalInterestDepositsV 1 All 1 instances equal to 0.
TotalDepositsV 1 All 1 instances equal to 0.
BankControlCapital
BankControlCurrent
TotalDepositsLag Par. All 1 instances equal to 0.
BankCapital 1 Bank capital buffer increased by interest rate differences and reduced by non-returned loans
All 1 instances equal to 0.
MinInterestRateSpread Par. All 1 instances equal to 0.005.
NonPerformingLoansTotal Par. All 1 instances equal to 0.
ShareBankKonAssets Par. All 1 instances equal to 0.5.
MaxInterestRateSpread Par. All 1 instances equal to 0.01.
TotPCLiabilitiesEF Par. All 1 instances equal to 0.
TotPCLiabilitiesF Par. All 1 instances equal to 0.
TotPCLiabilitiesHH Par. All 1 instances equal to 0.
TotPCLiabilitiesKF Par. All 1 instances equal to 0.
TotLiabilitiesEF Par.
TotLiabilitiesF Par.
TotLiabilitiesHH Par.
TotLiabilitiesKF Par.
ControlBankBS
sInterestRate 1 All 1 instances equal to 0.01.
TotLiabilitiesEFV 1 All 1 instances equal to 0.
TotLiabilitiesFV 1 All 1 instances equal to 0.
TotLiabilitiesKFV 1 All 1 instances equal to 0.
sTotLiabilitiesEFV 1 All 1 instances equal to 0.
sTotLiabilitiesFV 1 All 1 instances equal to 0.
sTotLiabilitiesKFV 1 All 1 instances equal to 0.
NPLE Par. All 1 instances equal to 0.
NPLF Par. All 1 instances equal to 0.
Adjustment Par. 'Adjustment' appears in the equation for: BankCapital
All 1 instances equal to 0.
RatioAdjGDPm Par. All 1 instances equal to 0.
RelAdj Par. All 1 instances equal to 0.


Object:  Energy

Contained in:  Root—>Stats—>Country
Containing:  EnergyFirm, PP

Variables:  
Parameters:  

Element
Lags
Description and initial values comments
CallalphaBrown Decreasing return to scale
CallalphaGreen Decreasing return to scale
CapitalDepressEN Par. All 1 instances equal to 0.
CapitalDestroyedEF Par. All 1 instances equal to 0.
CopyTotalEnergy Par. 'CopyTotalEnergy' appears in the equation for: TotENCapacity, PriceEN
All 1 instances equal to 0.
DemographyEN Comment
EntryEF Entry of new energy firms
ExcessEnergy Par. All 1 instances equal to 0.
ExcessEnergyL Par. All 1 instances equal to 0.
ExitEF 1 Remove energy firms with too poor Health
All 1 instances equal to 0.
FactorBrown Par. All 1 instances equal to 0.
FactorGreen Par. All 1 instances equal to 0.
FactorSize Par. All 1 instances equal to 1000.
FirstOrderEF
FirstOrderEFFrac Par. All 1 instances equal to 0.01.
GPstep Par. All 1 instances equal to -0.5.
GreenPremium 1 All 1 instances equal to 1.5.
HistoricalCapitalEN Par. All 10 instances equal to 0.
InitPP
InterestLoansEF Par. All 1 instances equal to 0.
InvestmentProportionEF Par. 'InvestmentProportionEF' appears in the equation for: InvestmentDecisionEF
All 1 instances equal to 0.01.
MaxGrowthEF Par. All 1 instances equal to 2.
MaxMUEF Par. All 1 instances equal to 3.
MinMUEF Par. All 1 instances equal to 2.
MinUtilization Par. All 1 instances equal to 0.05.
MultiplierCapacityENBrown Par. All 1 instances equal to 2.
MultiplierCapacityENGreen Par. All 1 instances equal to 1.
MultiplierProductivityEN Par. All 1 instances equal to 100.
NbrBrown Par. All 1 instances equal to 0.
NbrEF
NbrGreen Par. All 1 instances equal to 0.
NbrPP
OverCostMarkup Par. All 1 instances equal to 0.
PriceEN 1 All 1 instances equal to 8.13436256240891.
PriceENMA 1 Moving average of PriceEN
All 1 instances equal to 8.13436256240891.
ShareBrownEnergy Par. All 1 instances equal to 0.
ShareGreenEnergy Par. All 1 instances equal to 0.
SpeedMA Par. All 1 instances equal to 0.99.
SpeedPriceENMA Par. All 1 instances equal to 0.9.
StepGreenPremium Par. All 1 instances equal to 1500.
SumCashEF 1 All 1 instances equal to 0.
SumCashEFCh
SumEFirmControlCapital
SumEFirmControlCurrent
SumEnergyProductionEF
SumEnergyProductionPP 1 All 1 instances equal to 0.
SumInterestDepositsEF
SumInterestPaymentEF
SumInvestmentEF Sum of investment spending of EnergyFirms
SumInvestmentSpendingEF
SumLaborCostEF Sum of wages distributed by Energy Firms
SumMaxEnergyCapacity
SumOutstandingDebtEFCh
SumOverdraftPaymentEF
SumTotNumWorkersEF
SumWagePremEF Sum of Premia distributed by EnergyFirms
SumWaitingEF
ThresholdCapacityEF Par. 'ThresholdCapacityEF' appears in the equation for: (never used)
All 1 instances equal to 0.6.
TimeRepaymentEF Par. All 1 instances equal to 300.
TotBrownCapacity Par. All 1 instances equal to 1.
TotENCapacity Function computing Green and Brown capacities
TotExcessCost Total excess cost to be distrubuted to classes
TotGreenCapacity Par. All 1 instances equal to 1.
WaitingEFRatio
alphaBrown Par. Decreasing return to scale
All 1 instances equal to 1.
alphaGreen Par. Decreasing return to scale
All 1 instances equal to 1.
alphaMUEF Par. All 1 instances equal to 0.
betaPriceEN Par. All 1 instances equal to 0.4.
betaProdEN Par. All 1 instances equal to 0.3.
betaTimeEN Par. All 1 instances equal to 0.4.
minAgeExitEF Par. All 1 instances equal to 10.
minRRoKExitEF Par. All 1 instances equal to 0.005.
probEntryEF
probEntryEFbase Par. All 1 instances equal to 0.1.
minGPremium Par. All 1 instances equal to 0.1.
AvBrownProductivity Par. All 1 instances equal to 0.
AvGreenProductivity Par. All 1 instances equal to 0.
RatioNPLEBC Par. All 1 instances equal to 0.
reductionKENC Par. All 1 instances equal to 0.
OrderedKEN Sum of capital ordered by EN firms waiting to be delivered
maxCapacityProductionEN Par. All 1 instances equal to 1.2.
minSize Par. All 1 instances equal to 0.005.
FairEnergy Share of energy demand distributed in proportion to capacity and not on competitive bidding process
shareFairEnergy Par. All 1 instances equal to 0.05.
MarketEnergyCapacity Total Energy Capacity
ExitFlagEF Par. All 1 instances equal to 0.
PermissionInv Permission to invest, allowed only to the firm with the longest time since last investment and if no other firm is waiting for K
smoothPPP Par. All 1 instances equal to 0.
PercUnusedENCapacity Percentage of unused EN capacity
expPREF Par. All 1 instances equal to 60.
MaxEFirms Par. All 1 instances equal to 200.
MinEFirms Par. All 1 instances equal to 10.
minTimeEntryEF Par. All 1 instances equal to 2.
CounterEntryEF Par. All 1 instances equal to 0.
SumTaxEF
minShareKEN Par. All 1 instances equal to 0.01.
PriceENBrown Par. All 1 instances equal to 0.
PriceENGreen Par. All 1 instances equal to 0.
FrequencyInvEF Par. All 1 instances equal to 1.


Object:  EnergyFirm

Contained in:  Root—>Stats—>Country—>Energy
Containing:  CapitalEF, LaborEF

Variables:  
Parameters:  

Element
Lags
Description and initial values comments
AgeEF 1 All 10 instances equal to 1.
AvUtilization Comment
BalanceEF 1 Comulative profits of energy firms

Cash revenues for energy firms

'BalanceEF' appears in the equation for: CashEF, EntryEF, sBalanceEF
All 10 instances equal to 0.
CapitalCostEF Cost of capital, temporary computed proportional to capacity
and fixed overtime
CapitalPaymentEF
CashEF 1 Comulative cash of energy firms
All 10 instances equal to 0.
CashEFCh
ControlENEF
ControlPremiaEF
DebtEF Par. All 10 instances equal to 0.
EFType Par. All 10 instances equal to 0.
EFirmControlCapital
EFirmControlCurrent
EnergyProductionEF
ExcessCostEF Par. Excess cost due to overutilization
ExpectedIncomePP
FossilFuel Par. All 1 instances equal to 0.
IdFirmEN Par. All 10 instances increasing from 1 with steps 1. The value is increased every 1 instances.
IdTechEN Par. All 10 instances equal to 1.
InterestDepositsEF 1 Cash obtained as interest on deposits
All 10 instances equal to 0.
InterestPaymentEF 1 All 10 instances equal to 0.
InvestmentDecisionEF
InvestmentSpendingEF Par. 'InvestmentSpendingEF' appears in the equation for: SumInvestmentSpendingEF, EntryEF, EFirmControlCapital, SumInvestmentEF, KProductionFlow, InvestmentDecisionEF
All 10 instances equal to 0.
KapitalNeedEF Par. All 10 instances equal to 0.
LaborCostEF Comment
MaxEnergyCapacity
MaxKExpenditureEF Maximum costs of purchasing capital for energy firms.
It is computed assuming a flow of free cash available represented by sBalanceF plus a share of the available unused cash for the foreseeable future to finance additional capital interests and repayment.
We approximate the single time repayment cost of borrowing K to be repayed in L periods at interest i as:
R=K [ i / z]

where

z=(1-(1/(1+i)^L))

Consequently, the maximum K the firm can expect to pay is:
K=sBalanceF/[i/z]
NumPP Par. All 10 instances equal to 1.
OutstandingDebtEF 1 All 10 instances equal to 0.
OutstandingDebtEFCh
OverdraftPaymentEF 1 Interest paid on overdraft
All 10 instances equal to 0.
ProfitEF 1 Energy firm profits
All 10 instances equal to 0.
RRoKEF 1 All 10 instances equal to 0.
RequiredWorkersEF Compute the number of workers for the energy firms
RevenuesEF Revenues of Energy Firms
SafetyCoefEF Par. All 10 instances equal to 0.2.
TotalCapacityEF Par. All 10 instances equal to 0.
UnitKENCost Par. All 10 instances equal to 10.
WagePremEF
WaitingEF Par. All 10 instances equal to 0.
alphaSize
markupEF 1 All 10 instances equal to 1.6.
sBalanceEF 1 All 10 instances equal to 0.
sCashEF 1 All 10 instances equal to 0.
NbrLaborEF
TotNumWorkersEF
sProfitEF 1 All 10 instances equal to 0.
GOSEF Gross Operating Surplus of energy firm, difference between revenues and labor costs
CashEFAdjustment
OrganicCashEF Par. All 10 instances equal to 0.
sInterestPaymentEF 1 All 10 instances equal to 0.
sCapitalCostEF
AvKENProductivity Average productivity of K for EN firms
msEN Market share of EN firms
msENCapacity Par. All 10 instances equal to 0.
TimeSinceLastInv 1 Time steps since last investment
All 10 instances equal to 0.
TimeDeliveryPP Par. All 10 instances increasing from -9 with step 1.
IncomeBeforeDebtPaymentsEF
sIncomeBeforeDebtPaymentsEF 1 All 10 instances equal to 0.
LiabilitiesEF
sLiabilitiesEF 1 All 10 instances equal to 0.
PPremoved Par. All 10 instances equal to 0.
TaxEF Tax paid on profit of F firm


Object:  CapitalEF

Contained in:  Root—>Stats—>Country—>Energy—>EnergyFirm

Variables:  
Parameters:  

Element
Lags
Description and initial values comments
PPKAge 1 All 10 instances equal to 1.
KENCapacity
KENProductivity Par. All 10 instances equal to 100.
EnergyProductionPP Par. All 10 instances equal to 0.
MAUtilizationPP 1 Moving average of PP utilization

'MAUtilizationPP' appears in the equation for: EntryEF, DemographyEN, MAUtilizationPP, AvUtilization, Init
All 30 instances equal to 1.
InitKENCapacity
KExpendituresEN Par. All 10 instances equal to 0.
CapitalEN Par. All 10 instances equal to 10000.
InterestEF
PrincipalEF 1 All 10 instances equal to 10000.
InstallmentEF Remaining loan to be returned
alphaSizePP Par. All 57 instances equal to 1.
ShareENPP Par. All 57 instances equal to 0.
ExcessCostPP Excess cost due to overutilization
ExcessENPP Excess production due to overutilization
ShareCapacityPP
sInterestEF
alphaPP Par. All 10 instances equal to 1.
FairEnergyPP FairEnergy for capital unit, a PP
PriceEK Price of the power plant
shareLaborKEN Share of workers used in the capital
UnitCostKEN Cost of units of energy computing labor and capital


Object:  LaborEF

Contained in:  Root—>Stats—>Country—>Energy—>EnergyFirm

Variables:  
Parameters:  

Element
Lags
Description and initial values comments
IdLaborEF Par. All 20 instances increasing from 1 with steps 1 re-starting for each group of objects.
nuEF Par. All 10 instances equal to 3.
NumWorkersEF 1 All 20 instances equal to 0.
wageEF 1 Wage of the workers in this layer of the firm
wagecoeffEF Par. All 10 instances equal to 1.6.
PremiaEF Par. All 20 instances equal to 0.


Object:  PP

Contained in:  Root—>Stats—>Country—>Energy

Variables:  
Parameters:  

Element
Lags
Description and initial values comments
PricePP 1 All 1 instances equal to 1.
IdEF Par. All 57 instances equal to 1.
PricePPDoped Competitive price of energy producers.
It is based on the standard price reduced in case it uses green capital


Initial values

Object tree

Root—>Stats—>Country—>Supply—>Firm—>PNeed—>Ch
                    |             |          
                    |             —>Capital
                    |             |        
                    |             —>Labor
                    |             |      
                    |             —>blItem
                    |             |       
                    |             —>BankF
                    |             |      
                    |             —>Engineers
                    |                        
                    —>Demand—>Class—>Need—>DCh
                    |              |          
                    |              —>BankC
                    |                     
                    —>Machinery—>KFirm—>KLabor
                    |                 |       
                    |                 —>KEngineers
                    |                 |           
                    |                 —>KCapital
                    |                 |         
                    |                 —>Order
                    |                 |      
                    |                 —>BankK
                    |                        
                    —>Sectors—>sFirm
                    |               
                    —>Bank
                    |     
                    —>Energy—>EnergyFirm—>CapitalEF
                            |           |          
                            |           —>LaborEF
                            |                    
                            —>PP
                                

Variables

Parameters


Object:  Stats

Instances number:  1
Instances group(s):  1

Element
Lag
Initial values (by instance)
stopPlaceOrder Par. 1e+07
stopPlaceOrderEF Par. 1e+09
TotKFirm Par. 0
TotKEF Par. 0


Object:  Country

Instances number:  1
Instances group(s):  1

Element
Lag
Initial values (by instance)
AggProductivity 1 -1
AvAge Par. -1
AvCurrentProductivity Par. -1
AvKProfit Par. -1
AvMkup Par. -1
AvPrice 1 -1
AvProfit Par. -1
AvRatioVacancies Par. -1
Aversion Par. 0.5
BaseMinWage Par. -1
BaseP Par. -1
BaseProd Par. -1
ConsumptionGdpRatio Par. -1
GDPConcentration Par. -1
GDPg 1 -1
GDP Par. 10
GDPF Par. -1
GDPK Par. -1
GDPl Par. -1
GDPnom 1 -1
Hired Par. 0.2
InProgress Par. 0
IncrAggProd Par. 0.01
IncrAvPrice Par. 0.01
IndexYear Par. 2
Inflation 1 -1
InitAggProd Par. 1
InitAvPrice Par. 10
InitMinWage Par. 10
InventGrowth Par. 0
InvestmentGdpRatio Par. -1
JobLoss Par. 0
KaNW Par. 0.1
LTUnemployment 1 -1
LowerMinWage Par. -1
MaxNumWorkers 1 100000
Max_x Par. 102
MinWage 1 10
Min_x Par. 98
MinimumCMaxE Par. 10
MinimumCMaxW Par. 10
MinimumCMinE Par. 0
MinimumCMinW Par. 0
MinimumPMaxE Par. 500
MinimumPMaxW Par. 1000
MinimumPMinE Par. 100
MinimumPMinW Par. 100
MoAvGDPc 1 -1
MoAvInvestment 1 -1
MoAvInvestmentGr 1 -1
MoAvMinWageGr 1 -1
MovAvAggProd 1 -1
MovAvMaxLProd 1 -1
MovAvNbrWork 1 -1
MovAvPrice 1 -1
MovAvTotHired Par. -1
MovAvTotVac 1 -1
NaturalUR Par. 20
NbrWorkers 1 -1
OutputConcentration Par. -1
PTrend Par. 0
Redistribute Par. 0
STUnemployment 1 1
ShareInit Par. 1
TTB_multiplWinner Par. 0
TauInit Par. 1
TotAvWage Par. 2263
TotEnergyConsumption 1 0
TotHired Par. 20
TotHiredLag Par. 20
TotVacancies 1 2.791e+07
TotalKProduction Par. 4.306e-314
UnemploymentRate 1 -1
UpperMinWage Par. 1.02
WageGrowth Par. 0.0006369
aAgProd Par. 0.01
aAvPrice Par. 0.9
aLTUR Par. 0.995
aMWA Par. 0.05
aMWL Par. 0.05
aMWP Par. 0.05
aNbrWork Par. 0.05
aSTUR Par. 0.99
aTotHir Par. 0.05
aTotVac Par. 0.05
beta Par. 20
c Par. 1
elasMWPrice Par. 0.2
elasMWProd Par. 0.2
elasMinWage Par. 0.001
maxMinWage Par. 1.351
minAgeExit Par. 10
minMinWage Par. 0
minRRoKExit Par. 0.005
tauMax Par. 0.9
tauMaxE Par. 1
tauMaxW Par. 0.95
tauMin Par. 0.1
tauMinE Par. 0
tauMinW Par. 0.85
tauMultiplier Par. 0.25
totNeeds Par. 10
zero Par. 0
EnergyGdpRatio Par. 0.05369
ExtraCapacity Par. 2
minVisibility Par. 0.01
MaxQGrowth Par. 10
MinWageMA 1 10
SpeedMinWageMA Par. 0.9
MinWageMAGr 1 0
PriceENMAGr 1 0
roPremia Par. 0.45
roCash Par. 0.005
maxMinWageGr Par. 0.01
FreezeEmployment Par. 0
PopGrowth Par. 0.001
NegUnemp Par. 0
UnempTarget Par. 0.05
sGDPnom 1 -1
BrownI Par. -1
BrownInom Par. -1
GreenI Par. -1
GreenInom Par. -1
FirmsI Par. -1
FirmsInom Par. -1
BrownIGdpRatio Par. -1
BrownInomGdpRatio Par. -1
GreenIGdpRatio Par. -1
GreenInomGdpRatio Par. -1
FirmsIGdpRatio Par. -1
FirmsInomGdpRatio Par. -1
TimeWaitedBrown Par. -1
TimeWaitedFirms Par. -1
TimeWaitedGreen Par. -1
WaitTimeBrown Par. 0
WaitTimeFirms Par. 0
WaitTimeGreen Par. 0
BrownGOSKShare Par. -1
GreenGOSKShare Par. -1
FirmsGOSKShare Par. -1
BrownGOSShare Par. -1
GreenGOSShare Par. -1
FirmsGOSShare Par. -1
Unemployment Par. 0
BrownKprice Par. -1
GreenKprice Par. -1
FirmsKprice Par. -1
BrownKProductivity Par. -1
GreenKProductivity Par. -1
FirmsKProductivity Par. -1
BrownWaitTime Par. -1
GreenWaitTime Par. -1
FirmsWaitTime Par. -1
TotProfit Par. 0
TaxRevenues 1 0
taxrate Par. 0.45
GovernmentExpenses Par. 0
GovernmentFund 1 0
minShareGovGDP Par. 0.01
maxShareGovGDP Par. 0.9
shareGovGDP Par. 0
InterestGovFund 1 0
GovDemTot 1 1e+07
shareGDdown Par. 0.01
shareGDup Par. 0.2
IncomeTaxShare Par. 0.75


Object:  Supply

Instances number:  1
Instances group(s):  1

Element
Lag
Initial values (by instance)
aES Par. 0.9
TotalSales Par. -1
innoInterval Par. 10
aLearningK Par. 0
Exit 1 0
CounterIdFirm 1 100
coefMarkupVar Par. 0.05
CapitalIntens Par. 2
ExitFlag Par. 0
DivisorLiquidityFinance Par. 20
capMinWage Par. 0.04
ControlWaiting Par. 0
NumWorkersMaxGr Par. 0.005
NumWorkersMinInc Par. 5
sPrice Par. 0
aClearingPrice Par. 0.5
aaNW Par. 0.02
aNWmin Par. 0.8
aNWmax Par. 0.9
aNWsmooth Par. 1
TimeRepayment Par. 50
CapitalDestroyed Par. 0
SumCashF 1 0
aVisibility Par. 0.1
LTGDP Par. 0
aLTGDP Par. 0.95
aLTProfit Par. 0.95
RatioProfitGDP Par. 0
minMarkup Par. 1.7
maxMarkup Par. 1.7
LTTotProfit Par. 0
markup Par. 1.7


Object:  Firm

Instances number:  100
Instances group(s):  100

Element
Lag
Initial values (by instance)
Age 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
CapitalCapacity Par. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
CapitalDepress Par. 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001
CapitalStock 1 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
ConstPrice Par. 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100
DesiredStocks Par. 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1
DesiredUnusedCapacity Par. 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05, 1.05
EN 1 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
ExpectedSales 1 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
Health 1 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
IdFirm Par. 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100
IdTech Par. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
InvestmentDecision 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
LaborForce Par. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
LaborForceL Par. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
LaborGrowth Par. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
MaxLaborProductivity 1 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
MonetarySales Par. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
MonetarySalesL Par. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
MovAvExpSales 1 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
MovAvProfit 1 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
Ms 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
MsSector Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
NumK Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
ProdShockP Par. 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1
Profit 1 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
Q 1 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
RatioVacancies Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
RationingRatioFirm Par. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
Revenues 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
SmoothProfit 1 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
Stocks 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
UnitDemand 1 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
UnitSales 1 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
Vacancies Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Visibility 1 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
Waiting Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
aExpSales Par. 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05
aHealth Par. 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9
aMonSales Par. 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9
aProfit Par. 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05
app Par. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
backlog 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
backlogSales Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
betaEff 1 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1
betaPrice Par. 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4
betaTime Par. 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2
numBLI Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
price 1 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10
product Par. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10
psi Par. 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01
roRD Par. 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2
smoothMonSales 1 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
tInno Par. -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7
zInno Par. 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01
aNW 1 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8
MaxEfficiency Par. 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005
backlogSalesL Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
InvestmentSpending Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
backlogValue Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
backlogValueCh Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
backlogValueL Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
OutstandingDebtF 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
InterestPaymentF 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
flagNewEntrant Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
sIncomeBeforeDebtPaymentsF 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
sLiabilitiesF 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0


Object:  PNeed

Instances number:  100
Instances group(s):  1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Element
Lag
Initial values (by instance)
IdPNeed Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0


Object:  Ch

Instances number:  200
Instances group(s):  2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2

Element
Lag
Initial values (by instance)
IdCh Par. 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, ...
x 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
obs_x Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...


Object:  Capital

Instances number:  100
Instances group(s):  1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Element
Lag
Initial values (by instance)
IncProductivity Par. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
IncSkillBiais Par. 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1
K Par. 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000
KAge 1 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
KExpenditures Par. 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000
IncLearningK 1 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
IncEfficiency Par. 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5
PrincipalF 1 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000


Object:  Labor

Instances number:  200
Instances group(s):  2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2

Element
Lag
Initial values (by instance)
NumWorkers 1 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ...
wage 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
wagecoeff Par. 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, ...
IdLabor Par. 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, ...
nu Par. 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, ...
Premia Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
flagShowWage Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...


Object:  blItem

Instances number:  100
Instances group(s):  1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Element
Lag
Initial values (by instance)
blQ Par. 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5, 15929.5
blPrice Par. 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359, 532.359


Object:  BankF

Instances number:  100
Instances group(s):  1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Element
Lag
Initial values (by instance)
BalanceF 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
DebtF Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
NetWorth 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
BacklogValue 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
sBalanceF 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
RRoK 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
DistributedProfits Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
CashF 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
InterestDepositsF 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
sCashF 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
OverdraftPaymentF 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
BacklogValueCh 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
sProfit 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
OrganicCashF Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0


Object:  Engineers

Instances number:  100
Instances group(s):  1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Element
Lag
Initial values (by instance)
EWagecoeff Par. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
NbrEngineers 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0


Object:  Demand

Instances number:  1
Instances group(s):  1

Element
Lag
Initial values (by instance)
HerfTotalIncome Par. -1
HerfWageIncome Par. -1
HerfNonWageIncome Par. -1
eta Par. 0.4
ShareSavingsConsumed Par. 0.03
SRMultiplier Par. 0.85
TopSavingRate Par. 0.9
AtkinsonClass Par. 1
WageIncomeRatio Par. -1
PremiaIncomeRatio Par. -1
IncomeTop1 Par. -1
IncomeTop10 Par. -1
IncomeBottom90 Par. -1
Ratio190 Par. -1
Ratio1090 Par. -1
ShareIncomeTop01 Par. 0
ShareIncomeTop10 Par. 0
ShareIncomeBottom90 Par. 0
SumCashC 1 0
aCashC Par. 0.005
brakeExpenditure Par. 0.999
IncomeTaxTot 1 0


Object:  Class

Instances number:  18
Instances group(s):  18

Element
Lag
Initial values (by instance)
NumClass Par. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17
Expenditure 1 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100
ShareWageIncome 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
aEx Par. 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8
SharePremiaIncome 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Lorenz Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
ShareIncome 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Individuals Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
LorenzInd Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Income 1 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000
PremiaIncome Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
WageIncome Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
tempWage Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
SavingRate Par. 0.05, 0.05, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2
Competitiveness Par. 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
CashC 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
InterestDepositsC 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
BankProfitIncome 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
AutonomousC Par. 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500
appCtrlWage Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
appCtrlPremia Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
CumBPI 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
OrganicCashC Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
HHWealth 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
AutComp Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Subsidies Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
IncomeTax 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
GovDemHH 1 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000


Object:  Need

Instances number:  180
Instances group(s):  10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10

Element
Lag
Initial values (by instance)
IdNeed Par. 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...
Share Par. 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.212, 0.098, 0.262, 0.03, 0.035, 0.051, 0.021, 0.136, 0.1, 0.055, 0.209611, 0.0962986, 0.250536, 0.0307948, 0.0355577, 0.0541527, 0.0213687, 0.138885, 0.107522, 0.0552734, 0.206983, 0.0944792, 0.240196, 0.0315292, 0.0360346, 0.0573012, 0.0216916, 0.141348, 0.11502, 0.0554165, 0.204203, 0.0925802, 0.230831, 0.0322079, 0.0364387, 0.0604398, 0.0219729, 0.14343, 0.12245, 0.0554468, 0.20134, 0.090633, 0.222319, 0.0328353, 0.0367775, 0.0635631, 0.0222168, 0.145169, 0.129765, 0.0553802, 0.198449, 0.0886631, 0.214559, 0.0334158, 0.037058, 0.0666664, 0.0224271, 0.146604, 0.136927, 0.0552312, 0.19557, 0.0866912, 0.207464, 0.0339536, 0.0372868, 0.069745, 0.0226074, 0.147773, 0.143897, 0.0550127, 0.192735, 0.0847336, 0.200963, 0.0344528, 0.0374703, 0.0727949, 0.0227611, 0.148708, 0.150644, 0.0547365, 0.189971, 0.0828035, 0.194995, 0.0349172, 0.0376139, 0.0758126, 0.0228914, 0.149443, 0.15714, 0.0544129, ...
NumIterations Par. 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 27, 17, 15, 13, 10, 7, 4, 3, 3, 1, 32, 15, 38, 5, 5, 8, 3, 21, 16, 8, 31, 14, 36, 5, 5, 9, 3, 21, 17, 8, 31, 14, 35, 5, 6, 9, 3, 22, 18, 8, 30, 14, 34, 5, 6, 10, 3, 22, 20, 8, 30, 13, 32, 5, 6, 10, 3, 22, 21, 8, 30, 13, 31, 5, 6, 11, 3, 22, 22, 8, 29, 13, 30, 5, 6, 11, 3, 22, 23, 8, 29, 13, 29, 5, 6, 11, 3, 23, 24, 8, ...
endExpShare Par. 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.147, 0.018, 0.117, 0.058, 0.037, 0.166, 0.027, 0.151, 0.248, 0.03, 0.147, 0.018, 0.117, 0.058, 0.037, 0.166, 0.027, 0.151, 0.248, 0.03, 0.147, 0.018, 0.117, 0.058, 0.037, 0.166, 0.027, 0.151, 0.248, 0.03, 0.147, 0.018, 0.117, 0.058, 0.037, 0.166, 0.027, 0.151, 0.248, 0.03, 0.147, 0.018, 0.117, 0.058, 0.037, 0.166, 0.027, 0.151, 0.248, 0.03, 0.147, 0.018, 0.117, 0.058, 0.037, 0.166, 0.027, 0.151, 0.248, 0.03, 0.147, 0.018, 0.117, 0.058, 0.037, 0.166, 0.027, 0.151, 0.248, 0.03, 0.147, 0.018, 0.117, 0.058, 0.037, 0.166, 0.027, 0.151, 0.248, 0.03, 0.147, 0.018, 0.117, 0.058, 0.037, 0.166, 0.027, 0.151, 0.248, 0.03, ...
ProdExists Par. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
TempIterations Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...


Object:  DCh

Instances number:  360
Instances group(s):  2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

Element
Lag
Initial values (by instance)
IdDCh Par. 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, ...
tau Par. 0.997185, 0.932557, 0.128124, 0.999041, 0.236089, 0.396581, 0.387911, 0.669746, 0.935539, 0.846311, 0.313274, 0.524548, 0.443453, 0.229577, 0.534414, 0.913962, 0.457205, 0.430699, 0.939128, 0.778389, 0.921597, 0.0697242, 0.85928, 0.0981847, 0.936502, 0.0670853, 0.93296, 0.122695, 0.855924, 0.0829472, 0.909307, 0.0828346, 0.891179, 0.130245, 0.878963, 0.135788, 0.928331, 0.108746, 0.853417, 0.087597, 0.716198, 0.277293, 0.66946, 0.298639, 0.727377, 0.275314, 0.72472, 0.317021, 0.666943, 0.28721, 0.70698, 0.287126, 0.693384, 0.322684, 0.684222, 0.326841, 0.721249, 0.30656, 0.665063, 0.290698, 0.562148, 0.43297, 0.527095, 0.448979, 0.570532, 0.431485, 0.56854, 0.462766, 0.525207, 0.440408, 0.555235, 0.440344, 0.545038, 0.467013, 0.538167, 0.470131, 0.565936, 0.45492, 0.523797, 0.443023, 0.446611, 0.549727, 0.420321, 0.561734, 0.452899, 0.548614, 0.451405, 0.572074, 0.418906, 0.555306, 0.441426, 0.555258, 0.433779, 0.57526, 0.428625, 0.577598, 0.449452, 0.56619, 0.417848, 0.557267, ...
Delta Par. 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, 0.05, 0.1, ...
Minimum Par. 351.313, 3.04117, 387.217, 2.95066, 148.855, 8.17533, 151.034, 2.8364, 252.622, 1.80217, 499.742, 3.19535, 409.39, 1.29797, 26.4821, 9.10818, 275.039, 1.81981, 461.173, 3.02507, 979.326, 2.52062, 531.839, 4.25503, 797.906, 9.6661, 263.319, 6.06146, 256.936, 8.94974, 167.147, 7.71629, 867.695, 0.325839, 671.571, 6.91963, 201.063, 8.75795, 794.167, 3.24397, 1566.92, 3.99514, 1566.92, 5.74425, 1566.92, 3.73545, 1566.92, 3.62692, 1566.92, 3.03292, 1566.92, 9.52864, 1566.92, 2.84042, 1566.92, 3.59185, 1566.92, 4.30497, 1566.92, 8.03347, 2507.07, 3.99514, 2507.07, 5.74425, 2507.07, 3.73545, 2507.07, 3.62692, 2507.07, 3.03292, 2507.07, 9.52864, 2507.07, 2.84042, 2507.07, 3.59185, 2507.07, 4.30497, 2507.07, 8.03347, 4011.32, 3.99514, 4011.32, 5.74425, 4011.32, 3.73545, 4011.32, 3.62692, 4011.32, 3.03292, 4011.32, 9.52864, 4011.32, 2.84042, 4011.32, 3.59185, 4011.32, 4.30497, 4011.32, 8.03347, ...
temp Par. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ...
NegativeQuality Par. -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, ...


Object:  BankC

Instances number:  18
Instances group(s):  1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Element
Lag
Initial values (by instance)
BalanceC 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
OverdraftPaymentC 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0


Object:  Machinery

Instances number:  1
Instances group(s):  1

Element
Lag
Initial values (by instance)
AvCurrEff Par. 0.005
AvCurrProd Par. 3.291
AvGreenKPrice Par. 1
AvKPrice Par. 10510
AvWaitTime Par. 1.131
DiscountUsedK Par. 1
IsEnergyK Par. 1
KEmployment Par. -1
KEmploymentShare Par. -1
KFirmSeeRoW Par. -1
KNomGDPShare Par. -1
KOutputShare Par. 0
PrudenceLending Par. 1
SumCashKF 1 0
psi_spe Par. 0.01
speedSO Par. 0.95
SumCashInjectionKF 1 0
EnergyFrontierProd 1 100
KExtraCapacity Par. 2
KPriceOverCharge Par. 0.1


Object:  KFirm

Instances number:  16
Instances group(s):  16

Element
Lag
Initial values (by instance)
IdKTech Par. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
NumOrders Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
kapp Par. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
KPrice 1 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100
z Par. 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01
ProductivityShock Par. 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015, 0.015
SkillBiaisShock Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
EngineersHiring Par. 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05
Kmarkup Par. 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
KCumProfit Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
EngineersShare Par. 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1
kselect Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
WaitTime Par. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
AvKWage Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
KConstPrice Par. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
KVacancies Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
KRatioVacancies Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
KLaborForce Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
KLaborForceL Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
KLaborGrowth Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
KEN 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
KUnitEnergyCost 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
KMaxEnergyEfficiency 1 0.51, 0.51, 0.51, 0.51, 0.51, 0.51, 0.51, 0.51, 0.51, 0.51, 0.51, 0.51, 0.51, 0.51, 0.51, 0.51
EfficiencyShock Par. 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001
EnergyEfficiencyShock Par. 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001
GreenKProdShock Par. 0.00045, 0.00045, 0.00045, 0.00045, 0.00045, 0.00045, 0.00045, 0.00045, 0.00045, 0.00045, 0.00045, 0.00045, 0.00045, 0.00045, 0.00045, 0.00045
IdKFirm Par. 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
LocalGreenInvestment Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
KDelivered Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
KType Par. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 1, 1, 1
KProcessShock Par. 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01
KExpCostEN 1 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
KExpCostLabor 1 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
sIncomeBeforeDebtPaymentsKF 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
sLiabilitiesKF 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0


Object:  KLabor

Instances number:  32
Instances group(s):  2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2

Element
Lag
Initial values (by instance)
KNbrWorkers 1 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1
KWage 1 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100
KWagecoeff Par. 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6
KDesiredUnusedCapacity Par. 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2
KLaborProductivity 1 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
IdKLabor Par. 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2
knu Par. 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
KPremia Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0


Object:  KEngineers

Instances number:  16
Instances group(s):  1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Element
Lag
Initial values (by instance)
KNbrEngineers 1 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10
KWageEngineers 1 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200
KEWagecoeff Par. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
KShareEngiProd 1 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5
KShareEngiProcessEff Par. 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1


Object:  KCapital

Instances number:  16
Instances group(s):  1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Element
Lag
Initial values (by instance)
CurrentProductivity 1 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 100, 100, 100, 100, 100, 100
CurrentEfficiency 1 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5
MaxENProduction Par. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1


Object:  Order

Instances number:  16
Instances group(s):  1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Element
Lag
Initial values (by instance)
KAmount Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
KCompletion Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
TimeWaited Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Kproductivity Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
KP Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
IdClient Par. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
KEfficiency Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
GreenKProd Par. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
OrderAlpha Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
EnergyKOrder Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0


Object:  BankK

Instances number:  16
Instances group(s):  1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Element
Lag
Initial values (by instance)
BalanceK 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
KRevenues Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
DebtK Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
KDistributedProfits Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
CashKF 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
InterestDepositsKF 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
OverdraftPaymentKF 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
sProfitKF 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
RRoKKF 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
CashInjectionKF 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
OrganicCashKF Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0


Object:  Sectors

Instances number:  10
Instances group(s):  10

Element
Lag
Initial values (by instance)
IdGood Par. 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
NFirmsS Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
SInvHerf Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
TotSalesS Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
AvxS Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
AvpS Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
FrontierX 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
maxXS Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
aFrontierX Par. 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9
probEntry Par. 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01
minHealth Par. 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05
SUnitSales Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
SQ Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
SRevenues Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
SProfits Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
SNumFirms Par. 64, 49, 66, 57, 54, 61, 55, 77, 51, 149
SMonetarySales Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
SAvHealth Par. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
SAvBacklog Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
SAvStock Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
numExit Par. 0, 0, 0, 0, 0, 0, 0, 0, 1, 0
AvAgeDeath Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
SKProductivity Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
SULC Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Sapp Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
SnumBLI Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
SNetWorth Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
SAvAge Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
SectEmploymentShare Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
SectSales Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
SectNomGDPShare Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
SectOutputShare Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
SectSalesShare Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
SectMechanisation Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
RedistributeSales Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
SBacklogShare Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0


Object:  sFirm

Instances number:  10
Instances group(s):  1 1 1 1 1 1 1 1 1 1

Element
Lag
Initial values (by instance)
IdsFirm Par. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
app1 Par. 0.286163, 0.286163, 0.286163, 0.286163, 0.286163, 0.286163, 0.286163, 0.286163, 0.286163, 0.286163
app2 Par. 136634, 97722.6, 154327, 124525, 92637.9, 105476, 80614.3, 1.64924e+06, 104985, 1.29138e+06
app3 Par. 0.0159342, 0.0189689, 0.0190417, 0.0209055, 0.0259991, 0.0201621, 0.0140863, 0.016961, 0.0263985, 0.0061268
app4 Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0


Object:  Bank

Instances number:  1
Instances group(s):  1

Element
Lag
Initial values (by instance)
InterestRateDeposits Par. 0.001
TotalDeposits Par. 0
TotalOverdraft Par. 0
TotalOutstandingDebt Par. 0
TotalInterestCollected Par. 0
TotalCapitalPayment Par. 0
TotalAssets 1 1
OwnFundsBank 1 0
DistributedProfitsBank 1 0
ProfitShareTargetBank Par. 0.05
CapitalAdequacyRatioTargetBank Par. 0.2
OwnFundsParameterBank Par. 0.01
TotalOutstandingDebtV 1 0
ExpectedLoanDefaultsPC 1 0
InterestRate 1 0.01
TotalInterestCollectedV 1 0
TotalInterestDepositsV 1 0
TotalDepositsV 1 0
TotalDepositsLag Par. 0
BankCapital 1 0
MinInterestRateSpread Par. 0
NonPerformingLoansTotal Par. 0
ShareBankKonAssets Par. 0.5
MaxInterestRateSpread Par. 0.01
TotPCLiabilitiesEF Par. 0
TotPCLiabilitiesF Par. 0
TotPCLiabilitiesHH Par. 0
TotPCLiabilitiesKF Par. 0
TotLiabilitiesEF Par. 0
TotLiabilitiesF Par. 0
TotLiabilitiesHH Par. 0
TotLiabilitiesKF Par. 0
sInterestRate 1 0.01
TotLiabilitiesEFV 1 0
TotLiabilitiesFV 1 0
TotLiabilitiesKFV 1 0
sTotLiabilitiesEFV 1 0
sTotLiabilitiesFV 1 0
sTotLiabilitiesKFV 1 0
NPLE Par. 0
NPLF Par. 0
Adjustment Par. 0
RatioAdjGDPm Par. 0
RelAdj Par. 0


Object:  Energy

Instances number:  1
Instances group(s):  1

Element
Lag
Initial values (by instance)
CapitalDepressEN Par. 0
CapitalDestroyedEF Par. 0
CopyTotalEnergy Par. 1.506e+09
ExcessEnergy Par. 0
ExcessEnergyL Par. 0
ExitEF 1 0
FactorBrown Par. 0
FactorGreen Par. 0
FactorSize Par. 1000
FirstOrderEFFrac Par. 0.01
GPstep Par. -0.5
GreenPremium 1 1.5
HistoricalCapitalEN Par. 0
InterestLoansEF Par. 0
InvestmentProportionEF Par. 0.01
MaxGrowthEF Par. 2
MaxMUEF Par. 4
MinMUEF Par. 4
MinUtilization Par. 0.05
MultiplierCapacityENBrown Par. 2
MultiplierCapacityENGreen Par. 1
MultiplierProductivityEN Par. 100
NbrBrown Par. 0
NbrGreen Par. 0
OverCostMarkup Par. 0
PriceEN 1 8.134
PriceENMA 1 8.134
ShareBrownEnergy Par. 0
ShareGreenEnergy Par. 0
SpeedMA Par. 0.8
SpeedPriceENMA Par. 0.9
StepGreenPremium Par. 1500
SumCashEF 1 0
SumEnergyProductionPP 1 0
ThresholdCapacityEF Par. 0.9
TimeRepaymentEF Par. 300
TotBrownCapacity Par. 1
TotGreenCapacity Par. 1
alphaBrown Par. 1
alphaGreen Par. 1
alphaMUEF Par. 0.8
betaPriceEN Par. 0.4
betaProdEN Par. 0.3
betaTimeEN Par. 0.4
minAgeExitEF Par. 10
minRRoKExitEF Par. 0.005
probEntryEFbase Par. 0.1
minGPremium Par. 0.1
AvBrownProductivity Par. 0
AvGreenProductivity Par. 0
RatioNPLEBC Par. 0
reductionKENC Par. 0
maxCapacityProductionEN Par. 1.2
minSize Par. 0.005
shareFairEnergy Par. 0.05
ExitFlagEF Par. 0
smoothPPP Par. 0
expPREF Par. 60
MaxEFirms Par. 200
MinEFirms Par. 10
minTimeEntryEF Par. 2
CounterEntryEF Par. 0
minShareKEN Par. 0.01
PriceENBrown Par. 0
PriceENGreen Par. 0
FrequencyInvEF Par. 1


Object:  EnergyFirm

Instances number:  10
Instances group(s):  10

Element
Lag
Initial values (by instance)
AgeEF 1 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
BalanceEF 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
CashEF 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
DebtEF Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
EFType Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
ExcessCostEF Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
FossilFuel Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
IdFirmEN Par. 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
IdTechEN Par. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
InterestDepositsEF 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
InterestPaymentEF 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
InvestmentSpendingEF Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
KapitalNeedEF Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
NumPP Par. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
OutstandingDebtEF 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
OverdraftPaymentEF 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
ProfitEF 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
RRoKEF 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
SafetyCoefEF Par. 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2
TotalCapacityEF Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
UnitKENCost Par. 10, 10, 10, 10, 10, 10, 10, 10, 10, 10
WaitingEF Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
markupEF 1 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
sBalanceEF 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
sCashEF 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
sProfitEF 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
OrganicCashEF Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
sInterestPaymentEF 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
msENCapacity Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
TimeSinceLastInv 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
TimeDeliveryPP Par. -9, -8, -7, -6, -5, -4, -3, -2, -1, 0
sIncomeBeforeDebtPaymentsEF 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
sLiabilitiesEF 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
PPremoved Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0


Object:  CapitalEF

Instances number:  10
Instances group(s):  1 1 1 1 1 1 1 1 1 1

Element
Lag
Initial values (by instance)
PPKAge 1 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
KENProductivity Par. 100, 100, 100, 100, 100, 100, 100, 100, 100, 100
EnergyProductionPP Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
MAUtilizationPP 1 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
KExpendituresEN Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
CapitalEN Par. 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000
PrincipalEF 1 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000
alphaSizePP Par. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
ShareENPP Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
alphaPP Par. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1


Object:  LaborEF

Instances number:  20
Instances group(s):  2 2 2 2 2 2 2 2 2 2

Element
Lag
Initial values (by instance)
IdLaborEF Par. 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2
nuEF Par. 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
NumWorkersEF 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
wageEF 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
wagecoeffEF Par. 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 1.6
PremiaEF Par. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0


Object:  PP

Instances number:  1
Instances group(s):  1

Element
Lag
Initial values (by instance)
PricePP 1 1
IdEF Par. 1


Equations code

Object tree

Root—>Stats—>Country—>Supply—>Firm—>PNeed—>Ch
                    |             |          
                    |             —>Capital
                    |             |        
                    |             —>Labor
                    |             |      
                    |             —>blItem
                    |             |       
                    |             —>BankF
                    |             |      
                    |             —>Engineers
                    |                        
                    —>Demand—>Class—>Need—>DCh
                    |              |          
                    |              —>BankC
                    |                     
                    —>Machinery—>KFirm—>KLabor
                    |                 |       
                    |                 —>KEngineers
                    |                 |           
                    |                 —>KCapital
                    |                 |         
                    |                 —>Order
                    |                 |      
                    |                 —>BankK
                    |                        
                    —>Sectors—>sFirm
                    |               
                    —>Bank
                    |     
                    —>Energy—>EnergyFirm—>CapitalEF
                            |           |          
                            |           —>LaborEF
                            |                    
                            —>PP
                                

Variables

Parameters


Equation file:  fun_tr6GD.cpp


Object:  Stats

Contained in:  Root
Containing:  Country

Variables:  
Parameters:  

Variable:  Init_Init

Contained in:  Stats
Used in:  (never used)
Using:  InProgress, Init, InitInProgress

Equation code:

EQUATION("Init_Init")
/*
Requires first to initialise all the simulation runs
*/
CYCLE(cur, "Country")
 {
  v[0]=VS(cur,"InProgress");
  if(v[0]==0)
    VS(cur,"Init");
  else
    VS(cur,"InitInProgress");
 }
PARAMETER
RESULT(1 )


Variable:  Av_Computations

Contained in:  Stats
Used in:  (never used)
Using:  Andre, AvProfit, Production, TradeIncomeDistribution

Equation code:

EQUATION("Av_Computations")
/*
Activate the equation for income distribution HI, Lorenz curve
*/

CYCLE(cur, "Country")
 {VS(cur,"AvProfit");
  VS(cur,"Trade");
  VS(cur,"Production");
  cur1=SEARCHS(cur,"Demand");
  VS(cur1,"IncomeDistribution");
  VS(cur,"Andre");
 }

RESULT(1 )


Function:  CheckFinBalanceLag

Contained in:  Stats
Used in:  (never used)
Using:  PrincipalF, CashFCashCCashKFCashEFPrincipalEF

Equation code:

EQUATION("CheckFinBalanceLag")
/*
Comment
*/
v[0]=v[1]=0;
CYCLE(cur, "Firm")
 {
v[2] = VLS(cur, "CashF",1);
if(v[2]>0)
v[1]+=v[2];
else
v[0]+=-v[2];
CYCLES(cur, cur1, "Capital")
{
v[2] = VLS(cur1, "PrincipalF",1);
v[0]+=v[2];
}
 }

CYCLE(cur, "Class")
{
v[2] = VLS(cur, "CashC",1);
if(v[2]>0)
v[1]+=v[2];
else
v[0]+=-v[2];

}

CYCLE(cur, "KFirm")
{
v[2] = VLS(cur, "CashKF",1);
if(v[2]>0)
v[1]+=v[2];
else
v[0]+=-v[2];

}

CYCLE(cur, "EnergyFirm")
{
v[2] = VLS(cur, "CashEF",1);
if(v[2]>0)
v[1]+=v[2];
else
v[0]+=-v[2];
CYCLES(cur, cur1, "CapitalEF")
{
v[2] = VLS(cur1, "PrincipalEF",1);
v[0]+=v[2];

}
 

}
PLOG("\nDep[1].=%lf\nAss[1].=%lf\n", v[1],v[0]);
RESULT(v[1]-v[0] )


Function:  CheckFinBalance

Contained in:  Stats
Used in:  CheckFinBalanceRatio, BankControlCurrent
Using:  TotKFirm, TotKEFGovernmentFundMonetarySales, WagePrem, InterestPaymentFPrincipalF, NumWorkers, wage, CashF, InterestDepositsF, OverdraftPaymentF, NbrEngineers, WageEngineersExpenditure, PremiaIncome, WageIncome, CashC, InterestDepositsCOverdraftPaymentCKWagePremKNbrWorkers, KWage, KNbrEngineers, KWageEngineers, CashKF, InterestDepositsKF, OverdraftPaymentKFBankCapitalCashEF, InterestDepositsEF, InterestPaymentEF, OverdraftPaymentEF, WagePremEFPrincipalEF, NumWorkersEF, wageEF

Equation code:

EQUATION("CheckFinBalance")
/*
Comment
*/
v[0]=v[1]=v[3]=v[4]=v[5]=v[6]=v[7]=v[8]=v[9]=v[10]=v[11]=v[12]=v[13]=v[33]=v[34]=0;
CYCLE(cur, "Firm")
 {
  v[4] += VS(cur, "MonetarySales");
v[2] = VS(cur, "CashF");
if(v[2]>0)
v[1]+=v[2];
else
{v[0]+=-v[2];
v[3]+=-v[2];
}

CYCLES(cur, cur1, "Capital")
{
v[2] = VS(cur1, "PrincipalF");
v[0]+=v[2];
v[13]+=v[2];
v[33]+=v[2];
}
  CYCLES(cur, cur1, "Labor")
  {
   v[6]+=VS(cur1, "wage")*VS(cur1, "NumWorkers");
  }
   v[6]+=VS(cur, "NbrEngineers")*VS(cur, "WageEngineers");
   v[8] += VS(cur, "InterestPaymentF");
   v[9] += VS(cur, "OverdraftPaymentF");
   v[10] += VS(cur, "InterestDepositsF");
  v[11] += VS(cur, "WagePrem");
 }

CYCLE(cur, "Class")
{
 v[5] += VS(cur, "Expenditure");
v[2] = VS(cur, "CashC");
if(v[2]>0)
v[1]+=v[2];
else
{
v[0]+=-v[2];
v[3]+=-v[2];
}
v[7] += VS(cur, "WageIncome");
v[9] += VS(cur, "OverdraftPaymentC");
v[10] += VS(cur, "InterestDepositsC");
  v[12] += VS(cur, "PremiaIncome");

}

CYCLE(cur, "KFirm")
{
v[2] = VS(cur, "CashKF");
if(v[2]>0)
v[1]+=v[2];
else
{
v[0]+=-v[2];
v[3]+=-v[2];
}

  v[6]+=VS(cur, "KNbrEngineers")*VS(cur, "KWageEngineers");
  CYCLES(cur, cur1, "KLabor")
  {
   v[6]+=VS(cur1, "KWage")*VS(cur1, "KNbrWorkers");
  
  }
  v[9] += VS(cur, "OverdraftPaymentKF");
  v[10] += VS(cur, "InterestDepositsKF");
  v[11] += VS(cur, "KWagePrem");
}

CYCLE(cur, "EnergyFirm")
{
v[2] = VS(cur, "CashEF");
if(v[2]>0)
v[1]+=v[2];
else
{
v[0]+=-v[2];
v[3]+=-v[2];
}
CYCLES(cur, cur1, "CapitalEF")
  {
   v[2] = VS(cur1, "PrincipalEF");
v[0]+=v[2];
v[13]+=v[2];
v[34]+=v[2];
  }
CYCLES(cur, cur1, "LaborEF")
  {
   v[6]+=VS(cur1, "wageEF")*VS(cur1, "NumWorkersEF");
  }
  v[8] += VS(cur, "InterestPaymentEF");
  v[9] += VS(cur, "OverdraftPaymentEF");
  v[10] += VS(cur, "InterestDepositsEF");
  v[11] += VS(cur, "WagePremEF");

}

v[60] = V("GovernmentFund");

WRITE("TotKFirm", v[33]);
WRITE("TotKEF", v[34]);
v[35] = VL("BankCapital",0);

//PLOG("\nDep.=%lf\nAss.=%lf\nOvd.=%lf\nDeb.=%lf\nMoS.=%lf\nExp.=%lf\nWag.=%lf\nInc.=%lf\nInP.=%lf\nOvP.=%lf\nInD.=%lf\nNetInterest=%lf\nPrm.=%lf\nInP.=%lf\nBanK=%lf\nNetB=%lf\n", v[1],v[0],v[3],v[13],v[4],v[5],v[6],v[7],v[8],v[9],v[10],(v[8]+v[9]-v[10]),v[11],v[12],v[35],v[35]+v[1]-v[0]);
RESULT(v[35]+v[1]-v[0]+v[60] )


Variable:  GlobalFlows

Contained in:  Stats
Used in:  (never used)
Using:  FinancialTrading, ProductionNumWorkers, wage, Premia, NbrEngineers, WageEngineersPremiaIncome, WageIncome, appCtrlWage, appCtrlPremiaKNbrWorkers, KWage, KPremia, KNbrEngineers, KWageEngineersNumWorkersEF, wageEF, PremiaEF

Equation code:

EQUATION("GlobalFlows")
/*
Check the global flows among modules of the model
*/

V("Production");
V("FinancialTrading");

v[0]=v[1]=v[2]=v[3]=v[4]=v[5]=v[6];

CYCLE(cur, "Class")
{
WRITES(cur, "appCtrlWage", 0);
WRITES(cur, "appCtrlPremia", 0);
}

CYCLE(cur, "Firm")
{
CYCLES(cur, cur1, "Labor")
{
v[20] = VS(cur1, "wage");
v[21] = VS(cur1, "NumWorkers");
    v[22] = VS(cur1, "Premia");
    if(cur1->hook==NULL)
     INTERACTS(cur1, "null class", v[22]);
    INCRS(cur1->hook, "appCtrlWage", v[20]*v[21]);
INCRS(cur1->hook, "appCtrlPremia", v[22]);

}
 cur2 = SEARCHS(cur, "Engineers");
 v[23] = VS(cur2, "NbrEngineers");
 v[24] = VS(cur2, "WageEngineers");
     if(cur2->hook==NULL)
     INTERACTS(cur2, "null class", v[23]);

 INCRS(cur2->hook, "appCtrlWage", v[23]*v[24]);
 
}

CYCLE(cur, "KFirm")
{
CYCLES(cur, cur1, "KLabor")
{
v[20] = VS(cur1, "KWage");
v[21] = VS(cur1, "KNbrWorkers");
    v[22] = VS(cur1, "KPremia");
INCRS(cur1->hook, "appCtrlWage", v[20]*v[21]);
INCRS(cur1->hook, "appCtrlPremia", v[22]);
}
 cur2 = SEARCHS(cur, "KEngineers");
 v[23] = VS(cur2, "KNbrEngineers");
 v[24] = VS(cur2, "KWageEngineers");
  if(cur2->hook==NULL)
     INTERACTS(cur2, "null class", v[23]);
 INCRS(cur2->hook, "appCtrlWage", v[23]*v[24]);

}

CYCLE(cur, "EnergyFirm")
{
CYCLES(cur, cur1, "LaborEF")
{
v[20] = VS(cur1, "wageEF");
v[21] = VS(cur1, "NumWorkersEF");
    v[22] = VS(cur1, "PremiaEF");
     if(cur1->hook==NULL)
     INTERACTS(cur1, "null class", v[23]);
INCRS(cur1->hook, "appCtrlWage", v[20]*v[21]);
INCRS(cur1->hook, "appCtrlPremia", v[22]);
}

}

v[29]=v[30]=0;
CYCLE(cur, "Class")
{
v[25] = VS(cur, "appCtrlWage");
v[26] = VS(cur, "WageIncome");
/*
if(abs(v[25]-v[26])>10)
INTERACTS(cur,"CtrlWage", v[25]-v[26]);
*/
v[27] = VS(cur, "PremiaIncome");
v[28] = VS(cur, "appCtrlPremia");
/*
if(abs(v[28]-v[27])>10)
INTERACTS(cur,"CtrlPremia", v[28]-v[27]);
  */
v[29]+=v[25]-v[26];
v[30]+=v[28]-v[27];
}

RESULT(v[29]+v[30] )


Parameter:  stopPlaceOrder

Contained in:  Stats
Used in:  PlaceOrder


Parameter:  stopPlaceOrderEF

Contained in:  Stats
Used in:  PlaceOrderEF


Parameter:  TotKFirm

Contained in:  Stats
Used in:  CheckFinBalance


Parameter:  TotKEF

Contained in:  Stats
Used in:  CheckFinBalance


Variable:  CheckFinBalanceRatio

Contained in:  Stats
Used in:  (never used)
Using:  CheckFinBalanceTotalAssets

Equation code:

EQUATION("CheckFinBalanceRatio")
/*
*/
v[1]=V("CheckFinBalance");
v[2]=V("TotalAssets");
RESULT(v[1]/v[2] )


Object:  Country

Contained in:  Root—>Stats
Containing:  Supply, Demand, Machinery, Sectors, Bank, Energy

Variables:  
Parameters:  

Variable:  AggProductivity

Contained in:  Country
Used in:  LTTotProfit, Init
Using:  AvCurrentProductivity, AvKProfit, AvMkup, AvProfit, TotalKProduction, TotProfitmarkupProfit, QNumWorkersKProductionFlow, KProfit, KCumProfitKNbrWorkers, KNbrEngineers, CurrentProductivity

Equation code:

EQUATION("AggProductivity")
/*
Comment
*/
v[0]=0;
v[1]=v[30]=v[31]=v[32]=v[33]=0;
CYCLE(cur2, "Supply")
 {
  CYCLES(cur2, cur, "Firm")
   {
    v[2]=VS(cur,"Q");
    v[0]+=v[2];
    v[30]++;
    v[31]+=VS(cur,"Profit");
    v[33]+=VS(cur,"markup");
// v[32]+=VS(cur,"CumProfit");
    CYCLES(cur, cur1, "Labor")
     {
      v[3]=VS(cur1,"NumWorkers");
      v[1]+=v[3];
     }
   }
 }

WRITE("AvProfit",v[31]/v[30]);
WRITE("TotProfit", v[31]);
WRITE("AvMkup",v[33]/v[30]);
//WRITE("AvCumProfit",v[32]/v[30]);
v[4]=0;
v[5]=0;
v[10]=v[20]=v[21]=v[22]=v[23]=0;
CYCLE(cur, "KFirm")
 {v[20]++;
  v[7]=VS(cur,"KNbrEngineers");
  v[10]+=v[7];
    v[8]=VS(cur,"KProductionFlow");
    v[5]+=v[8];
  v[21]+=VS(cur,"KProfit");
  v[22]+=VS(cur,"KCumProfit");
  v[23]+=VS(cur,"CurrentProductivity");
   CYCLES(cur, cur1, "KLabor")
    {
     v[6]=VS(cur1,"KNbrWorkers");
   v[4]+=v[6];
    }

 }

WRITE("AvCurrentProductivity",v[23]/v[20]);
WRITE("AvKProfit",v[21]/v[20]);
//WRITE("AvKCumProfit",v[22]/v[0]);
v[9]=(v[0]+v[5])/(v[1]+v[4]+v[10]);
if(v[5]<0)
 INTERACT("Neg.Kprod", v[5]);
WRITE("TotalKProduction",v[5]);
RESULT(v[9] )


Variable:  Andre

Contained in:  Country
Used in:  Av_Computations
Using:  TotWage, TotPremiaNumClass, ShareWageIncome, SharePremiaIncome, Lorenz, ShareIncome, Individuals, LorenzInd

Equation code:

EQUATION("Andre")
/*
Lorenz curve
*/

v[10]=(double)t;
if(v[10]>1)
 {
  v[5]=v[6]=v[9]=0;
  v[4]=V("TotPremia");
  v[11]=V("TotWage");
  CYCLE(cur, "Demand")
   {
    SORTS(cur,"Class","ShareIncome", "UP");
    CYCLES(cur, cur1, "Class")
     {
      v[1]=VS(cur1,"ShareWageIncome");
      v[2]=VS(cur1,"SharePremiaIncome");
      v[12]=(v[1]*v[11])/(v[4]+v[11]);
      v[13]=(v[2]*v[4])/(v[4]+v[11]);
      v[3]=(v[12]+v[13]);
      WRITES(cur1,"Lorenz",v[3]+v[6]);
      v[6]=v[3]+v[6];
      v[5]+=v[3];
      v[8]=VS(cur1,"Individuals");
      v[9]+=v[8];
      WRITES(cur1,"LorenzInd",v[9]);
     }
    SORTS(cur,"Class","NumClass", "UP");

   }
 }

RESULT(v[5] )


Parameter:  AvAge

Contained in:  Country
Used in:  Production


Parameter:  AvCurrentProductivity

Contained in:  Country
Used in:  Entry, AggProductivity, MovAvAggProd


Parameter:  AvKProfit

Contained in:  Country
Used in:  AggProductivity


Variable:  AvMarkup

Contained in:  Country
Used in:  InitMarkup
Using:  markup

Equation code:

EQUATION("AvMarkup")
/*
*/
v[0]=AVE("markup");

RESULT(v[0] )


Variable:  AvMaxLProd

Contained in:  Country
Used in:  MovAvMaxLProd
Using:  MaxLaborProductivity, Ms

Equation code:

EQUATION("AvMaxLProd")
/*
Average Max theoretical labour productivity across firms, to be used to index min wages, as this productuvity is what can be shared between capital and labour
*/

v[3]=0;
CYCLE(cur1, "Supply")
 {
  CYCLES(cur1, cur, "Firm")
   {
    v[1]=VS(cur,"MaxLaborProductivity");
    v[2]=VS(cur,"Ms");
    v[3]+=v[1]*v[2];
   }
 }

RESULT(v[3] )


Parameter:  AvMkup

Contained in:  Country
Used in:  AggProductivity


Variable:  AvPrice

Contained in:  Country
Used in:  MovAvPrice, Inflation, Init
Using:  Ms, price

Equation code:

EQUATION("AvPrice")
/*
Weighted average price
*/

v[3]=0;
CYCLE(cur1, "Supply")
 {
  CYCLES(cur1, cur, "Firm")
   {
    v[1]=VS(cur,"price");
    v[2]=VS(cur,"Ms");
    v[3]+=v[1]*v[2];
   }
 }

RESULT(v[3] )


Parameter:  AvProfit

Contained in:  Country
Used in:  AggProductivity, Av_Computations


Parameter:  AvRatioVacancies

Contained in:  Country
Used in:  TotVacancies, UnemploymentRateXXX


Variable:  AvWagecoeff

Contained in:  Country
Used in:  MinimumPriceSet, MinimumInit
Using:  wagecoeff, IdLaborKWagecoeff, IdKLabor

Equation code:

EQUATION("AvWagecoeff")
/*
Average of the wage multiplier, in case they are different between firms (or capital and final good firms), to be used as a multiplier of the `minimum' parameter for consumers classes of executives
*/

v[3]=v[4]=0;
CYCLE(cur, "Supply")
 {
  CYCLES(cur, cur1, "Firm")
   {
    CYCLES(cur1, cur2, "Labor")
     {
      v[1]=VS(cur2,"IdLabor");
      if(v[1]>1)
       {
        v[2]=VS(cur2,"wagecoeff");
        v[3]+=v[2];
        v[4]++;
       }
     }

   }

 }
CYCLE(cur, "Machinery")
 {
  CYCLES(cur, cur1, "KFirm")
   {
    CYCLES(cur1, cur2, "KLabor")
     {
      v[5]=VS(cur2,"IdKLabor");
      if(v[5]>1)
       {
        v[6]=VS(cur2,"KWagecoeff");
        v[3]+=v[6];
        v[4]++;
       }
     }
   }
 }
v[7]=v[3]/v[4];

RESULT(v[7] )


Parameter:  Aversion

Contained in:  Country
Used in:  Atkinson


Variable:  Avx

Contained in:  Country
Used in:  InitMarkup
Using:  TotAvWage, WageGrowthAge, AvWage, Health, LaborForce, MaxLaborProductivity, MonetarySales, MsSector, Profit, Q, Revenues, Stocks, UnitLaborCost, UnitSales, backlog, numBLI, priceIdCh, xNetWorthSInvHerf, AvxS, AvpS, maxXS, Demography, SUnitSales, SQ, SRevenues, SProfits, SNumFirms, SMonetarySales, SAvHealth, SAvBacklog, SAvStock, SKProductivity, SULC, Sapp, SnumBLI, SNetWorth, SAvAge, SBacklogShare

Equation code:

EQUATION("Avx")
/*
Average value of the quality characteristic (non price characteristic that is not price)

Compute also all the statistics for sectors.
*/

v[3]=v[4]=0;

CYCLE(cur, "Sectors")
 {
  VS(cur,"Demography");
  WRITES(cur,"AvxS",0);
  WRITES(cur,"SUnitSales",0);
  WRITES(cur,"SQ",0);
  WRITES(cur,"SRevenues",0);
  WRITES(cur,"SProfits",0);
  WRITES(cur,"SNumFirms",0);
  WRITES(cur,"SMonetarySales",0);
  WRITES(cur,"Sapp",VS(cur,"maxXS"));
  WRITES(cur,"maxXS",0);
  WRITES(cur,"AvpS",0);
  WRITES(cur,"SInvHerf",0);
  WRITES(cur,"SAvHealth",0);
  WRITES(cur,"SAvStock",0);
  WRITES(cur,"SAvBacklog",0);
  WRITES(cur,"SKProductivity",0);
  WRITES(cur,"SULC",0);
  WRITES(cur,"SnumBLI",0);
  WRITES(cur,"SNetWorth",0);
  WRITES(cur,"SAvAge",0);
  WRITES(cur,"SBacklogShare",0);

 }

CYCLE(cur, "Supply")
 {
  CYCLES(cur, cur1, "Firm")
   {
    INCRS(cur1->hook->up, "SBacklogShare", VS(cur1,"backlog"));
    INCRS(cur1->hook->up, "SAvAge", VS(cur1,"Age"));
    INCRS(cur1->hook->up, "SUnitSales", VS(cur1,"UnitSales"));
    INCRS(cur1->hook->up, "SnumBLI", VS(cur1,"numBLI"));
    INCRS(cur1->hook->up, "SNetWorth", VS(cur1,"NetWorth"));
    INCRS(cur1->hook->up, "SQ", v[30]=VS(cur1,"Q"));
    INCRS(cur1->hook->up, "SRevenues", VS(cur1,"Revenues"));
    INCRS(cur1->hook->up, "AvpS", v[30]*VS(cur1,"price"));
    INCRS(cur1->hook->up, "SProfits", VS(cur1,"Profit"));
    INCRS(cur1->hook->up, "SMonetarySales", VS(cur1,"MonetarySales"));
    INCRS(cur1->hook->up, "SNumFirms", 1);
    WRITES(cur1,"MsSector",VS(cur1, "MonetarySales"));
    INCRS(cur1->hook->up, "SKProductivity", VS(cur1,"MaxLaborProductivity")*v[30]);
    INCRS(cur1->hook->up, "SULC", VS(cur1,"UnitLaborCost")*v[30]);

    CYCLES(cur1, cur2, "PNeed")
     {
      CYCLES(cur2, cur3, "Ch")
       {
        v[1]=VS(cur3,"IdCh");
        if(v[1]>1)
         { // to make it simple i assume that the first charateristic is price, this should be generalised
          v[2]=VS(cur3,"x");
          INCRS(cur1->hook->up, "AvxS", v[2]*v[30]);
          v[5]=VS(cur1->hook->up,"maxXS");
          if(v[2]>v[5])
           WRITES(cur1->hook->up,"maxXS",v[2]);
          v[3]+=v[2];
          v[4]++;
         }
       }

     }

   }

 }

v[40]=v[41]=0;
CYCLE(cur1, "Firm")
 {
  v[20]=VS(cur1->hook->up,"SMonetarySales");
  v[21]=VS(cur1,"MsSector");

  if(v[20]>0)
   v[23]=v[21]/v[20];
  else
   v[23]=0;
  WRITES(cur1,"MsSector",v[23]);
  INCRS(cur1->hook->up,"SAvHealth",v[23]*VS(cur1,"Health"));
  INCRS(cur1->hook->up,"SInvHerf",v[23]*v[23]);
  INCRS(cur1->hook->up,"SAvStock",v[23]*VS(cur1,"Stocks"));
  INCRS(cur1->hook->up,"SAvBacklog",v[23]*VS(cur1,"backlog"));
  v[42]=VS(cur1,"AvWage");
  v[43]=VS(cur1,"LaborForce");
  v[40]+=v[42]*v[43];
  v[41]+=v[43];
 }
if(t>1)
 v[44]=V("TotAvWage");
else
 v[44]=v[40]/v[41];
WRITE("TotAvWage",v[40]/v[41]);
v[45]=(v[40]/v[41]-v[44])/v[44];
WRITE("WageGrowth",v[45]);

CYCLE(cur1, "Sectors")
 {
  v[27]=VS(cur1,"SInvHerf");
  if(v[27]>0)
   WRITES(cur1,"SInvHerf",1/v[27]);
  v[30]=VS(cur1,"SQ");
  if(v[30]>0)
   {
    MULTS(cur1,"AvxS",1/v[30]);
    MULTS(cur1,"SKProductivity",1/v[30]);
    MULTS(cur1,"SULC",1/v[30]);
    MULTS(cur1,"AvpS",1/v[30]);
    MULTS(cur1,"SBacklogShare",1/v[30]);

   }
  else
   {
    WRITES(cur1,"maxXS",VS(cur1,"Sapp"));
   }
  v[17]=VS(cur1,"SNumFirms");
  if(v[17]>0)
   {
    MULTS(cur1,"SnumBLI",1/v[17]);
    MULTS(cur1,"SNetWorth",1/v[17]);
    MULTS(cur1,"SAvAge",1/v[17]);
   }
 }

v[5]=v[3]/v[4];

RESULT(v[5] )


Parameter:  BaseMinWage

Contained in:  Country
Used in:  MinWageIndex


Parameter:  BaseP

Contained in:  Country
Used in:  CPI


Parameter:  BaseProd

Contained in:  Country
Used in:  ProdIndex


Variable:  CPI

Contained in:  Country
Used in:  TotIncomeCapitaReal, TotDConsConst, TotConsConst
Using:  BaseP, MovAvPrice

Equation code:

EQUATION("CPI")
/*
Consumer Price Index
*/

v[1]=(double)t;
v[2]=V("MovAvPrice");
if(v[1]==1)
 WRITE("BaseP",v[2]);
v[3]=V("BaseP");
v[4]=v[2]/v[3]*100;

RESULT(v[4] )


Variable:  ClearExitRecord

Contained in:  Country
Used in:  Exit
Using:  numExit, AvAgeDeath

Equation code:

EQUATION("ClearExitRecord")
/*
Prepare the computation of the exit record
*/


CYCLE(cur, "Sectors")
 {
  WRITES(cur,"numExit",0);
  WRITES(cur,"AvAgeDeath",0);
 }

cur=SEARCH("Bank");
RESULT(1 )


Variable:  ConsumptionConcentration

Contained in:  Country
Used in:  (never used)
Using:  SectSales, SectSalesShare

Equation code:

EQUATION("ConsumptionConcentration")
/*
Comment
*/
v[0]=v[10]=0;
CYCLE(cur, "Sectors")
 {
 v[1]=VS(cur,"SectSales");
 v[0]+=v[1];
 }
v[2]=v[0];
CYCLE(cur, "Sectors")
 {
 v[1]=VS(cur,"SectSales");
 if(v[2]==0)
  v[3]=0;
 else
v[3]=v[1]/v[2];
 WRITES(cur,"SectSalesShare",v[3]);
 v[10]+=(v[3]*v[3]);
 }
if(v[10]==0)
v[11]=0;
else
v[11]=1/v[10];
RESULT(v[11] )


Parameter:  ConsumptionGdpRatio

Contained in:  Country
Used in:  GDPnom


Variable:  EmploymentConcentration

Contained in:  Country
Used in:  (never used)
Using:  GDPConcentration, GDP, GDPnom, NbrWorkers, OutputConcentrationKEmployment, KEmploymentShare, KNomGDPShare, KOutputShareKProductionFlow, KPrice, KConstPriceKNbrWorkers, KNbrEngineers, SectEmploymentShare, SectNomGDPShare, SectOutputShare

Equation code:

EQUATION("EmploymentConcentration")
/*
Comment
*/
v[0]=v[3]=0;
v[4]=V("NbrWorkers");
v[10]=v[11]=v[12]=0;
v[13]=V("GDPnom");
v[20]=v[21]=v[22]=0;
v[23]=V("GDP");
CYCLE(cur, "Sectors")
 {
  v[5]=VS(cur,"SectEmploymentShare");
  v[0]+=(v[5]*v[5]);
  v[14]=VS(cur,"SectNomGDPShare");
  if(v[14]==0)
v[19]=0;
else
v[19]=v[14]*v[14];
v[10]+=v[19];
  v[24]=VS(cur,"SectOutputShare");
  if(v[24]==0)
v[29]=0;
else
v[29]=v[24]*v[24];
v[20]+=v[29];
}

CYCLE(cur, "Machinery")
 {
  v[1]=v[2]=0;
  CYCLES(cur, cur1, "KFirm")
   {
    CYCLES(cur1, cur2, "KLabor")
     {
      v[6]=VS(cur2,"KNbrWorkers");
      v[2]+=v[6];
     }
CYCLES(cur1, cur2, "KEngineers")
  {
   v[7]=VS(cur2,"KNbrEngineers");
      v[1]+=v[7];
  }
v[15]=VS(cur1,"KProductionFlow");
    v[16]=VS(cur1,"KPrice");
    v[11]+=(v[15]*v[16]);
    v[26]=VS(cur1,"KConstPrice");
    v[21]+=v[15];
   }
v[8]=v[1]+v[2];
v[9]=v[8]/v[4];
v[3]+=(v[9]*v[9]);
WRITES(cur,"KEmployment",v[8]);
WRITES(cur,"KEmploymentShare",v[9]);
v[17]=v[11]/v[13];
if(v[11]==0)
v[18]=0;
else
v[18]=v[17]*v[17];
v[12]+=v[18];
WRITES(cur,"KNomGDPShare",v[17]);
//v[27]=v[21]/v[23];
v[23]==0 ? v[27]=0 : v[27]=v[21]/v[23];
if(v[21]==0)
v[28]=0;
else
v[28]=v[27]*v[27];
v[22]+=v[28];
WRITES(cur,"KOutputShare",v[27]);
 }
v[99]=1/(v[3]+v[0]);
v[98]=v[12]+v[10];
if(v[98]==0)
v[97]=0;
else
v[97]=1/v[98];
WRITE("GDPConcentration",v[97]);
v[96]=v[22]+v[20];
if(v[96]==0)
v[95]=0;
else
v[95]=1/v[96];
WRITE("OutputConcentration",v[95]);
RESULT(v[99])


Variable:  FinancialTrading

Contained in:  Country
Used in:  SumCashCCh, SumCashFCh, SumCashKFCh, BankCapital, SumCashEFCh, SumRevenuesEF, FirmControlCurrent, FirmControlCapital, KFirmControlCurrent, EFirmControlCurrent, EFirmControlCapital, BankControlCurrent, BankControlCapital, SumOutstandingDebtEFCh, OutstandingDebtEFCh, SumOutstandingDebtFCh, BankProfitIncome, SumCashC, SumCashF, SumCashEF, SumCashKF, TotalOutstandingDebtV, TotalDepositsV, TotalInterestCollectedV, TotalInterestDepositsV, OwnFundsBank, TotalProfitsBank, TotalInterestDeposits, RetainedProfitsBank, DistributedProfitsBank, OwnFundsTargetLRBank, OwnFundsTargetSRBank, RetainedProfitsTargetBank, TotalProfitsTargetBank, InterestRateSpread, CapitalAdequacyRatio, ExpectedLoanDefaultsPC, TotalAssets, Demography, GlobalFlows
Using:  Production, GovernmentFundCapitalPaymentF, OutstandingDebtF, InterestPaymentFCashF, OverdraftPaymentFCashCOverdraftPaymentCCashKF, OverdraftPaymentKFTotalDeposits, TotalOverdraft, TotalOutstandingDebt, TotalInterestCollected, TotalCapitalPayment, TotalDepositsLag, TotPCLiabilitiesEF, TotPCLiabilitiesF, TotPCLiabilitiesHH, TotPCLiabilitiesKF, TotLiabilitiesEF, TotLiabilitiesF, TotLiabilitiesHH, TotLiabilitiesKFCapitalPaymentEF, CashEF, InterestPaymentEF, OutstandingDebtEF, OverdraftPaymentEF

Equation code:

EQUATION("FinancialTrading")
/*
Collect from household classes and firms (C and K) the relevant financial aggregate
*/
//v[10]=t; //sprintf(msg, "\n FinancialTrading(%g)", v[10]); plog(msg);


V("Production");
v[0]=v[1]=v[2]=v[3]=v[4]=v[5]=v[6]=v[7]=v[8]=v[9]=v[10]=v[11]=v[12]=v[13]=v[14]=v[15]=v[16]=v[17]=v[18]=v[19]=v[20]=v[21]=v[22]=v[23]=v[24]=v[25]=v[26]=v[27]=v[28]=v[29]=v[30]=v[31]=v[32]=v[33]=v[34]=v[35]=v[36]=v[37]=v[38]=v[39]=v[40]=v[41]=v[42]=v[43]=v[44]=v[45]=v[46]=v[47]=v[48]=v[49]=v[50]=v[60]=v[61]=0;


CYCLE(cur, "Class")
 {
  v[6]=VS(cur,"CashC");
  if(v[6]>0)
   v[0]+=v[6];
  else
   v[1]+=-v[6];
  v[8] += VS(cur, "OverdraftPaymentC");
  v[6]=VLS(cur,"CashC",1);
  if(v[6]>0)
   v[60]+=v[6];
  else
   v[61]+=-v[6];
   
 }

CYCLE(cur, "Firm")
 {
   v[16]=VS(cur,"CashF");
  if(v[16]>0)
   v[10]+=v[16];
  else
   v[11]+=-v[16];
  v[14] += VS(cur, "OutstandingDebtF");
  v[15] += VS(cur, "CapitalPaymentF");
  v[19] += VS(cur, "InterestPaymentF");
  v[18] += VS(cur, "OverdraftPaymentF");
  v[6]=VLS(cur,"CashF",1);
  if(v[6]>0)
   v[60]+=v[6];
  else
   v[61]+=-v[6];
  
 }

CYCLE(cur, "KFirm")
 {
  v[26]=VS(cur,"CashKF");
  if(v[26]>0)
   v[20]+=v[26];
  else
   v[21]+=-v[26];
  v[28] += VS(cur, "OverdraftPaymentKF");
  v[6]=VLS(cur,"CashKF",1);
  if(v[6]>0)
   v[60]+=v[6];
  else
   v[61]+=-v[6];
  
 }

cur = SEARCH("Energy");

CYCLES(cur, cur1, "EnergyFirm")
{
  v[36]=VS(cur1,"CashEF");
  if(v[36]>0)
   v[30]+=v[36];
  else
   v[31]+=-v[36];
  v[34] += VS(cur1, "OutstandingDebtEF");
  v[35] += VS(cur1, "CapitalPaymentEF");
  v[39] += VS(cur1, "InterestPaymentEF");
  v[38] += VS(cur1, "OverdraftPaymentEF");
  v[6]=VLS(cur,"CashEF",1);
  if(v[6]>0)
   v[60]+=v[6];
  else
   v[61]+=-v[6];

}

v[74]=V("GovernmentFund");

v[40]=v[0]+v[10]+v[20]+v[30]; //deposits
v[41]=v[1]+v[11]+v[21]+v[31]; //overdraft
v[44]=v[14]+v[34] - v[74]; // EF and F OutstandingDebt
v[45]=v[15]+v[35]; // CapitalPayment EF and F (sum of principle repayments)
v[48]=v[8]+v[18]+v[28]+v[38]; //overdraft payments (interest payments on overdrafts)
v[49]=v[19]+v[39]; // interest payment on loans
v[50]=v[48]+v[49]; // total interest payments on loans and overdrafts




cur2=SEARCH("Bank");
WRITES(cur2,"TotalDeposits",v[40]);
WRITES(cur2,"TotalDepositsLag",v[60]);
WRITES(cur2,"TotalOverdraft",v[41]);
WRITES(cur2,"TotalOutstandingDebt",v[44]);
WRITES(cur2,"TotalInterestCollected",v[50]);
WRITES(cur2,"TotalCapitalPayment",v[45]);

WRITES(cur2,"TotLiabilitiesHH",v[1]);
WRITES(cur2,"TotLiabilitiesF",v[11]+v[14]);
WRITES(cur2,"TotLiabilitiesKF",v[21]);
WRITES(cur2,"TotLiabilitiesEF",v[31]+v[34]);

WRITES(cur2,"TotPCLiabilitiesHH",(v[1]/(v[41]+v[44])));
WRITES(cur2,"TotPCLiabilitiesF",((v[11]+v[14])/(v[41]+v[44])));
WRITES(cur2,"TotPCLiabilitiesKF",((v[21])/(v[41]+v[44])));
WRITES(cur2,"TotPCLiabilitiesEF",((v[31]+v[34])/(v[41]+v[44])));



RESULT(1)


Parameter:  GDPConcentration

Contained in:  Country
Used in:  EmploymentConcentration


Variable:  GDPCapita

Contained in:  Country
Used in:  (never used)
Using:  GDPTotIndividuals

Equation code:

EQUATION("GDPCapita")
/*
Comment
*/
v[0]=V("GDP");
v[1]=V("TotIndividuals");
if(v[1]>0.001)
 v[2]=v[0]/v[1];
else
 v[2]=0;
RESULT(v[2] )


Variable:  GDPg

Contained in:  Country
Used in:  MoAvGDPc
Using:  GDP, GDPl

Equation code:

EQUATION("GDPg")
/*
Growth rate of the GDP at constant prices
*/

//v[4]=(double)t;
v[4]=t;

if(v[4]>2)
 {
   v[1]=V("GDPl");
  //v[1]=VL("GDP",1);
  //INTERACT("GdPC_1",v[1]);
  v[2]=V("GDP");
  //INTERACT("GdPC",v[2]);
  v[1]==0 ? v[3]=0 : v[3]=v[2]/v[1]-1;
  //INTERACT("GrowthC",v[3]);

 }
else
 v[3]=0;

RESULT(v[3] )


Parameter:  GDP

Contained in:  Country
Used in:  dGDP, StatKFirms, dGDP, GovernmentExpenses, ENGDP, GovDemTot, LTGDP, GDPCapita, GDPnom, GDPg, SectEmployment, EmploymentConcentration


Parameter:  GDPF

Contained in:  Country
Used in:  GDPnom


Parameter:  GDPK

Contained in:  Country
Used in:  GDPnom


Parameter:  GDPl

Contained in:  Country
Used in:  GovDemTot, GDPnom, GDPg


Variable:  GDPnomg

Contained in:  Country
Used in:  (never used)
Using:  GDPnom

Equation code:

EQUATION("GDPnomg")
/*
Growth rate of the nominal GDP
*/

v[4]=(double)t;
if(v[4]>2)
 {
  v[1]=VL("GDPnom",1);
  v[2]=V("GDPnom");
  v[3]=(v[2]/v[1])-1;
 }
else
 v[3]=0;

RESULT(v[3] )


Variable:  GDPnom

Contained in:  Country
Used in:  StatKFirms, dGDPnom, sGDPnom, BankCapital, DistributedProfitsBank, GovDemTot, GDPnomg, SectEmployment, EmploymentConcentration
Using:  ConsumptionGdpRatio, GDP, GDPF, GDPK, GDPl, InvestmentGdpRatio, TotEnergyConsumption, EnergyGdpRatioConstPrice, Revenues, UnitSalesKProductionFlow, KPrice, KConstPricePriceEN

Equation code:

EQUATION("GDPnom")
/*
Nominal GDP, at varying prices
*/

v[4]=0;
v[8]=v[9]=v[10]=0;
CYCLE(cur, "Supply")
 {
  CYCLES(cur, cur1, "Firm")
   {
    v[1]=VS(cur1,"Revenues");
    v[4]+=v[1];
    v[5]=VS(cur1,"UnitSales");
    v[6]=VS(cur1,"ConstPrice");
    v[7]=v[5]*v[6];
    v[9]+=v[7];
   }

 }
CYCLE(cur, "Machinery")
 {
  CYCLES(cur, cur1, "KFirm")
   {
    v[5]=VS(cur1,"KProductionFlow");
    v[6]=VS(cur1,"KPrice");
    v[11]=VS(cur1,"KConstPrice");
    v[8]+=v[6]*v[5];
    v[10]+=v[11]*v[5];
   }

 }

v[20]=V("PriceEN");
v[21]=V("TotEnergyConsumption");
v[22]=v[20]*v[21];

WRITE("GDPl",V("GDP"));


v[11]=v[9]+v[10];
v[12]=v[4]+v[8];
if(v[12]==0)
v[13]=0;
else
v[13]=1/v[12];
v[14]=v[4]*v[13];
v[15]=v[8]*v[13];

v[30]=v[22]*v[13];
WRITE("GDP",v[11]);
WRITE("GDPF",v[9]);
WRITE("GDPK",v[10]); // Proxy for investment at constant prices
WRITE("ConsumptionGdpRatio",v[14]);
WRITE("InvestmentGdpRatio",v[15]);
WRITE("EnergyGdpRatio",v[30]);

RESULT(v[12] )


Variable:  Gini

Contained in:  Country
Used in:  (never used)
Using:  TotWage, TotPremia, TotIndividuals, AvIncomeNumClass, ShareWageIncome, SharePremiaIncome, ShareIncome, Individuals

Equation code:

EQUATION("Gini")
/*
Gini coefficient in t-1
*/

v[20]=(double)t;
if(v[20]>1)
{
CYCLE(cur, "Demand")
 {
  v[14]=v[21]=0;
  v[2]=VS(cur,"TotWage");
  v[3]=VS(cur,"TotPremia");

  CYCLES(cur, cur1, "Class")
   {
    v[1]=VS(cur1,"ShareIncome");
    if(v[1]>0)
     {
      v[22]=VLS(cur1,"ShareWageIncome",1);
      v[23]=VLS(cur1,"SharePremiaIncome",1);
      v[24]=v[22]*v[2];
      v[25]=v[23]*v[3];
      v[5]=VS(cur1,"Individuals");
      v[6]=(v[24]+v[25]); // total class income of the comparing class
      v[7]=VS(cur1,"NumClass");
      v[21]++;
      CYCLES(cur, cur2, "Class")
       {
        v[8]=VS(cur2,"NumClass");
        if(v[8]!=v[7])
         { // if it is a different class
          v[9]=VS(cur2,"ShareIncome");
          if(v[9]>0)
           {
            v[26]=VLS(cur2,"ShareWageIncome",1);
            v[27]=VLS(cur2,"SharePremiaIncome",1);
            v[28]=v[26]*v[2];
            v[29]=v[27]*v[3];
            v[11]=VS(cur2,"Individuals");
            v[12]=(v[28]+v[29]); // total class income of the compared class
            v[13]=abs(v[6]-v[12]);
            v[14]+=v[13];
           }
         }
       }

     }
   }

 }
v[15]=V("AvIncome");
v[30]=(v[2]+v[3])/v[21]; // average income per class
v[16]=V("TotIndividuals");
v[17]=pow(v[21],2);
v[18]=2*v[17]*v[30];
v[19]=v[14]/v[18];
}
else
 v[19]=0;

RESULT(v[19] )


Parameter:  Hired

Contained in:  Country
Used in:  (never used)


Parameter:  InProgress

Contained in:  Country
Used in:  Init, Init_Init


Parameter:  IncrAggProd

Contained in:  Country
Used in:  MinWage, MinWageXXX


Parameter:  IncrAvPrice

Contained in:  Country
Used in:  MinWage, MinWageXXX


Parameter:  IndexYear

Contained in:  Country
Used in:  (never used)


Variable:  Inflation

Contained in:  Country
Used in:  MaxLaborProductivity
Using:  AvPrice

Equation code:

EQUATION("Inflation")
/*
One period change in price in the conumables market
*/

v[1]=VL("AvPrice",1);
v[2]=V("AvPrice");
v[3]=v[2]/v[1]-1;

RESULT(v[3] )


Function:  Init

Contained in:  Country
Used in:  Init_Init
Using:  AggProductivity, AvPrice, InProgress, InitAggProd, InitAvPrice, InitInProgress, Init_x, MinWage, MinimumInit, MovAvAggProd, MovAvNbrWork, MovAvPrice, ShareInit, TauInitminMarkupAvWage, CapitalCapacity, CapitalStock, ConstPrice, DesiredUnusedCapacity, ExpectedSales, IdFirm, LaborCapacity, LaborForce, LaborForceL, MaxLaborProductivity, MovAvExpSales, price, product, OutstandingDebtFIncProductivity, K, KExpenditures, MaxKQ, IncEfficiency, PrincipalF, NumWorkers, wage, wagecoeff, IdLabor, nu, SRMultiplier, TopSavingRateNumClass, Income, WageIncome, SavingRate, CashCKPrice, KConstPriceKNbrWorkers, IdKLabor, KNbrEngineers, IdGood, NFirmsSIdsFirm, MultiplierCapacityENBrown, MultiplierCapacityENGreenEFType, IdFirmEN, OutstandingDebtEFKENProductivity, MAUtilizationPP, KExpendituresEN, CapitalEN, PrincipalEF, IdLaborEF, nuEF, NumWorkersEF, wageEF, wagecoeffEF, PricePP, IdEF, PricePPDoped

Equation code:

EQUATION("Init")
/*
Initialisation of initial values
*/

v[0]=V("InProgress");
if(v[0]==1)
 {
  V("InitInProgress");
  INTERACT("InitInProgress",1);
  END_EQUATION(-1);
 }
WRITE("InProgress",1);
V("Init_x");

v[22]=VL("MinWage",1);
CYCLE(cur4, "Supply")
 {cur7=SEARCH("Bank");
  cur6=SEARCH("Demand");
  CYCLES(cur6, cur1, "Class")
   {
    cur5=SEARCHS(cur1,"BankC");
    cur5->hook=cur7;
   }

  CYCLES(cur4, cur1, "Firm")
   {// run a first cycle trough firms to set the number of labor in t-1
    cur = SEARCHS(cur1, "Engineers");
    cur3 = SEARCH_CND( "NumClass", 0);
    cur->hook=cur3;
    cur=SEARCHS(cur1,"BankF");
    cur->hook=cur7;
    v[15]=0;
    v[16]=VS(cur1,"product");
    cur5=SEARCH_CND("IdGood",v[16]);
    cur6=SEARCHS(cur5,"sFirm");
    if(VS(cur6, "IdsFirm")!=-1)
     cur6=ADDOBJS(cur5,"sFirm");

    WRITES(cur6,"IdsFirm",VS(cur1, "IdFirm"));
    cur1->hook=cur6;
    cur6->hook=cur1;
    v[60] = VS(cur1, "CapitalStock"); //defines also the capital capacity
    v[61] = VS(cur1, "CapitalCapacity");
    v[62] = VS(cur1, "MaxLaborProductivity"); //Labor productivity
    WRITELS(cur1, "MovAvExpSales", v[61]/v[62], t-1);
    WRITELS(cur1, "ExpectedSales", v[61]/v[62], t-1);

    CYCLES(cur1, cur, "Labor")
     {
      v[14]=VS(cur,"IdLabor");
      cur3=SEARCH_CND("NumClass",v[14]);
      cur->hook=cur3;
      
      if(v[14]==1)
       { // compute the first tier workers given their productivity and production needs
        v[2]=VS(cur1,"MaxLaborProductivity");
        v[8]=VS(cur1,"CapitalCapacity");
        v[9]=v[8];
        v[4]=VS(cur1,"DesiredUnusedCapacity");
        v[3]=v[4]*(v[9]/v[2]); // number of workers in the first layer in the first period
        WRITELLS(cur,"NumWorkers",v[3],t,1);
        WRITELS(cur,"NumWorkers",v[3],t);
        v[21]=VS(cur,"wagecoeff");
        v[23]=v[22]*v[21];
        WRITELS(cur,"wage",v[23], t-1);
        INCRS(cur->hook, "WageIncome", v[23]);
       }
      else
       {// when above the first tier workers...
        v[18]=VS(cur,"IdLabor");
        v[76]=v[18]; //Maximum class
        cur3=SEARCH_CND("NumClass",v[18]);
        cur->hook=cur3;
        cur2=SEARCH_CNDS(cur->up,"IdLabor",v[18]-1);
        v[17]=VS(cur2,"nu"); //given the worker ratio between tiers of the tier below
        v[19]=VS(cur2,"NumWorkers"); //and the number of workers in the previous tier
        v[6]=v[19]/v[17]; // compute the required executives
        v[24]=VS(cur,"nu"); // given the worker ration between tiers of the present tier (use different worker ratios in case we want to change it along the hierarchical structure)
        WRITELLS(cur,"NumWorkers",v[6], t,1);
        WRITELS(cur,"NumWorkers",v[6],t);
        v[25]=VLS(cur2,"wage",1);
        v[26]=VS(cur,"wagecoeff");
        v[27]=v[25]*v[26];
        WRITELS(cur,"wage",v[27], t-1);
        INCRS(cur->hook, "WageIncome", v[23]);
        if(v[6]>=v[24] && v[18]>=2) //IMPORTANT: this init expects to be TWO (2) layers of workers, then it creates the additional ones as requested by the initial capital
         {
          cur3=ADDOBJ_EXS(cur->up,"Labor",cur);
          WRITES(cur3,"IdLabor",v[18]+1);
          v[20]=v[6]/v[24];
          WRITELLS(cur3,"NumWorkers",v[20], t,1);
          WRITELS(cur3,"NumWorkers",v[20],t);
          v[28]=v[27]*v[26];
          WRITELS(cur3,"wage",v[28], t-1);
          INCRS(cur->hook, "WageIncome", v[28]);
         }
       }

     }
   }
 }

CYCLE(cur2, "Supply")
 {v[75]=0;//TotalDebt
  CYCLES(cur2, cur, "Firm")
   {// a second cycle to set the price in t-1
    v[10]=1+V("minMarkup");
    //WRITELS(cur,"markup",v[10], t);
    v[21]=v[22]=0;
    CYCLES(cur,cur1, "Labor")
     {
      v[16]=VLS(cur1,"wage",1);
      v[17]=VLS(cur1,"NumWorkers",1);
      v[21]+=v[16]*v[17];
      v[22]+=v[17];
     }
    //if(v[21]==0)
     //v[11]=V("AvWage");
    //else
     v[11]=v[21]/v[22]; //av. wage in the firm
    WRITES(cur,"AvWage",v[11]);
    v[0]=v[31]=v[32]=0;
    v[71] = VL("KPrice", 1);
    CYCLES(cur,cur1, "Capital")
     {
      v[72] = VS(cur1, "K");
      WRITELS(cur1, "PrincipalF", v[72]*v[71], t-1);
      WRITES(cur1, "KExpenditures", v[72]*v[71]);
      v[75]+=v[72]*v[71];
      v[3]=VS(cur1,"MaxKQ");
      v[5]=VS(cur1,"IncProductivity");
      v[0]+=v[3];
      v[32]+=v[5]*v[3];
      v[31]+=v[72]*v[71];
     }
    v[9]=v[32]/v[0]; //weighted av. incProductivity
    WRITELS(cur, "OutstandingDebtF", v[31], t-1);
    WRITELS(cur,"MaxLaborProductivity",v[9],t-1);
    v[14]=v[11]*v[10]/v[9];
    if(v[14]<0)
     v[14]=INTERACT("nEG. price", v[14]);
    WRITELS(cur,"price",v[14], t-1);
    WRITES(cur,"ConstPrice",v[14]);
    v[65]=VS(cur,"LaborForce");
    WRITES(cur,"LaborForceL",v[65]);
    v[64]=VS(cur,"product");
    cur3=SEARCH_CND("IdGood",v[64]);
    INCRS(cur3,"NFirmsS",1);

   }
 }


v[3]=v[8]=v[68]=v[72]=v[73]=0;
 CYCLE( cur, "Firm")
   {v[68] += VS(cur, "K")/VS(cur, "IncEfficiency"); //assumes a single capital unit, estimates energy
    VS(cur, "CapitalStock");
    v[72]+=min(VS(cur, "CapitalCapacity"),VS(cur, "LaborCapacity"))*VLS(cur, "price", 1);
 
    CYCLES(cur, cur1, "Labor")
   {
      v[1]=VS(cur1,"NumWorkers");
      v[2]=VLS(cur1,"NumWorkers",1);
      v[3]+=v[1];
      v[8]+=v[2];
     }
   }
   
  
  v[69]=0;
  v[70] = VL("KPrice",1); //Price of capital, from the first KFirm assuming it is representative
  cur4 = SEARCH("Energy");
  CYCLES(cur4, cur, "EnergyFirm")
   v[69]++;
  CYCLES(cur4, cur1, "EnergyFirm")
   {
    cur3 = SEARCHS(cur1, "CapitalEF");
    
    if(VS(cur1, "EFType")==0)
      v[83] = V("MultiplierCapacityENBrown");
    else
      v[83] = V("MultiplierCapacityENGreen");

    WRITES(cur3, "CapitalEN", v[68]/v[69]);
    WRITELS(cur3, "PrincipalEF", v[70]*v[68]/(v[69]*v[83]), t-1);
    WRITELS(cur1, "OutstandingDebtEF", v[70]*v[68]/(v[69]*v[83]), t-1);

    WRITES(cur3, "KExpendituresEN", v[70]*v[68]/(v[69]*v[83]));
       
    v[75]+=v[70]*v[68]/(v[69]*v[83]);
    WRITELS(cur3, "MAUtilizationPP", 1, t-1);
    cur5 = SEARCHS(cur4, "PP");
    if(cur5->hook!=NULL)
     cur5 = ADDOBJS(cur4, "PP");
    cur3->hook=cur5;
    cur5->hook=cur3;
    WRITELS(cur5, "PricePP", 0, T-1);
    WRITELS(cur5, "PricePPDoped", 0, T-1);
    v[71] = VS(cur1, "IdFirmEN");
    WRITES(cur5, "IdEF", v[71]);
    
    CYCLES(cur1, cur, "LaborEF")
     {
      v[14]=VS(cur,"IdLaborEF");
      cur3=SEARCH_CND("NumClass",v[14]);
      cur->hook=cur3;
      
      if(v[14]==1)
       { // compute the first tier workers given their productivity and production needs
        v[8]=VS(cur, "KENProductivity");
        v[3]=(v[68]/v[69])/v[8]; // number of workers in the first layer in the first period
        WRITELLS(cur,"NumWorkersEF",v[3],t,1);
        WRITELS(cur,"NumWorkersEF",v[3],t);
        v[21]=VS(cur,"wagecoeffEF");
        v[23]=v[22]*v[21];
        WRITELS(cur,"wageEF",v[23], t-1);
        INCRS(cur->hook, "WageIncome", v[23]);
       }
      else
       {// when above the first tier workers...
        v[18]=VS(cur,"IdLaborEF");
        v[76]=max(v[76],v[18]); //Maximum class
        cur3=SEARCH_CND("NumClass",v[18]);
        cur->hook=cur3;
        cur2=SEARCH_CNDS(cur->up,"IdLaborEF",v[18]-1);
        v[17]=VS(cur2,"nuEF"); //given the worker ratio between tiers of the tier below
        v[19]=VS(cur2,"NumWorkersEF"); //and the number of workers in the previous tier
        v[6]=v[19]/v[17]; // compute the required executives
        v[24]=VS(cur,"nuEF"); // given the worker ration between tiers of the present tier (use different worker ratios in case we want to change it along the hierarchical structure)
        WRITELLS(cur,"NumWorkersEF",v[6], t,1);
        WRITELS(cur,"NumWorkersEF",v[6],t);
        v[25]=VLS(cur2,"wageEF",1);
        v[26]=VS(cur,"wagecoeffEF");
        v[27]=v[25]*v[26];
        WRITELS(cur,"wageEF",v[27], t-1);
        INCRS(cur->hook, "WageIncome", v[27]);
        if(v[6]>=v[24] && v[18]>=2) //IMPORTANT: this init expects to be TWO (2) layers of workers, then it creates the additional ones as requested by the initial capital
         {
          cur3=ADDOBJ_EXS(cur->up,"LaborEF",cur);
          WRITES(cur3,"IdLaborEF",v[18]+1);
          v[20]=v[6]/v[24];
          WRITELLS(cur3,"NumWorkersEF",v[20], t,1);
          WRITELS(cur3,"NumWorkersEF",v[20],t);
          v[28]=v[27]*v[26];
          WRITELS(cur3,"wageEF",v[28], t-1);
          INCRS(cur->hook, "WageIncome", v[28]);
         }
       }

     }
    
   }//END cycle through EnFirms
 


v[77]=v[75]/(v[76]+1); //INitial debt, divided among populated classes.
v[79] = V("SRMultiplier");
v[82] = V("TopSavingRate");
CYCLE_SAFE(cur, "Class")
{
 v[78]=VS(cur, "NumClass");

if(v[78]>v[76])
DELETE(cur);
else
{
if(v[78]>1)
     {
      cur2 = SEARCH_CND("NumClass", v[78]-1);
      if(cur2==NULL)
        INTERACTS(cur, "mmm",v[78]);
      v[80] = VS(cur2,"SavingRate");
      v[81] = v[80]*v[79]+(1-v[79])*v[82];
      WRITES(cur, "SavingRate", v[81]);
      }
WRITELS(cur, "CashC", v[77], t-1);
WRITELS(cur, "Income", v[72]/(1+v[76]), t-1);
}
}


CYCLE(cur, "KFirm")
 {
  v[40]=VLS(cur,"KPrice",1);
  WRITES(cur,"KConstPrice",v[40]);
  cur1=SEARCHS(cur,"BankK");
  cur1->hook=cur7;
  CYCLES(cur, cur1, "KLabor")
   {
    v[30]=VS(cur1,"IdKLabor");
    cur3=SEARCH_CND("NumClass",v[30]);
    cur1->hook=cur3;
    v[4]=VS(cur1,"KNbrWorkers");
    v[5]=VLS(cur1,"KNbrWorkers",1);
    v[3]+=v[4];
    v[8]+=v[5];
   }
  cur2=SEARCHS(cur,"KEngineers");
  cur3=SEARCH_CND("NumClass",0);
  cur2->hook=cur3;
  v[6]=VS(cur2,"KNbrEngineers");
  v[7]=VLS(cur2,"KNbrEngineers",1);
  v[3]+=v[6];
  v[8]+=v[7];
 }
cur=SEARCH("Country");
WRITELS(cur,"MovAvNbrWork",v[3],t);
//v[10]=V("AvPrice");
v[10]=1;
WRITELS(cur,"AvPrice",v[10], t-1);
WRITELS(cur,"MovAvPrice",v[10], t-1);
WRITES(cur,"InitAvPrice",v[10]);
//WRITELS(cur,"MinWage",v[10],1);
//v[11]=V("AggProductivity");
v[11]=1;
WRITELS(cur,"MovAvAggProd",v[11], t-1);
WRITELS(cur,"AggProductivity",v[11], t-1);
WRITES(cur,"InitAggProd",v[11]);

V("MinimumInit"); // assign the value for the Minimum parameter to all classes
V("TauInit");
V("ShareInit"); // assign the expenniture shares to the classes above the first one



PARAMETER;
RESULT(1 )


Parameter:  InitAggProd

Contained in:  Country
Used in:  MinWage, MinWageXXX, Init


Parameter:  InitAvPrice

Contained in:  Country
Used in:  MinWage, MinWageXXX, Init


Function:  InitInProgress

Contained in:  Country
Used in:  Init, Init_Init
Using:  ShareInit, TauInitCapitalStock, IdFirm, LaborForce, LaborForceL, productK, KAge, IdLaborNumClassIdNeedNumOrdersIdKLabor, IdClient, EnergyKOrderIdGoodIdsFirm, InitPPIdFirmENIdLaborEF

Equation code:

EQUATION("InitInProgress")
/*
Initialization function establishing only the hooks and leaving numbers of objects and values as they are, supposedly generated by a concluded simulation run with standard init (i.e. param InProgress=0).
*/

cur8=SEARCH("Bank");
cur7=SEARCH_CND("NumClass",0);
CYCLE(cur, "Firm")
 {
  v[0]=VS(cur,"product");
  cur1=SEARCH_CND("IdGood",v[0]);
  cur->hook=cur1;
  v[2]=VS(cur,"IdFirm");
  cur3=SEARCH_CNDS(cur1,"IdsFirm",v[2]);
  cur->hook=cur3;
  cur3->hook=cur;
  //v[6]=VLS(cur,"price",1);
  //WRITES(cur,"ConstPrice",v[6]);
  v[7]=VS(cur,"LaborForce");
  WRITES(cur,"LaborForceL",v[7]);
  CYCLES(cur, cur1, "Labor")
   {
    v[1]=VS(cur1,"IdLabor");
    cur2=SEARCH_CND("NumClass",v[1]);
    cur1->hook=cur2;
   }
  v[31]=0;
  CYCLES(cur,cur1, "Capital")
  {
      v[31]+=VS(cur1, "K");
      WRITELLS(cur1, "KAge", 1, t-1,t-1);
  }

  WRITELLS(cur, "CapitalStock",v[31],t-1,t-1);
  cur3=SEARCHS(cur,"BankF");
  cur3->hook=cur8;
  
  cur7=SEARCH_CND("NumClass",0);
  cur3=SEARCHS(cur,"Engineers");
  cur3->hook=cur7;

  
 }

CYCLE(cur, "Class")
 {
  CYCLES(cur, cur1, "Need")
   {
    v[3]=VS(cur1,"IdNeed");
    cur2=SEARCH_CND("IdGood",v[3]);
    cur1->hook=cur2;
   }
  cur1=SEARCHS(cur,"BankC");
  cur1->hook=cur8;
 }

CYCLE(cur, "KFirm")
 {
  //v[7]=VLS(cur,"KPrice",1);
  //WRITES(cur,"KConstPrice",v[7]);
  CYCLES(cur, cur1, "KLabor")
   {
    v[4]=VS(cur1,"IdKLabor");
    cur2=SEARCH_CND("NumClass",v[4]);
    cur1->hook=cur2;
   }
  cur3=SEARCHS(cur,"KEngineers");
  cur3->hook=cur7;
  if(VS(cur, "NumOrders")>0)
  {
  CYCLES(cur, cur1, "Order")
   {
      v[5]=VS(cur1,"IdClient");
      if(VS(cur1,"EnergyKOrder")==0)
       cur3=SEARCH_CND("IdFirm",v[5]);
      else
       cur3=SEARCH_CND("IdFirmEN",-v[5]);
      cur1->hook=cur3;
   }
  }
  else
  {v[40]=0;
  CYCLES(cur, cur1, "Order")
   {v[40]++;
    cur1->hook=NULL;
    WRITES(cur1, "IdClient", -1);
   }
  }

  cur1=SEARCHS(cur,"BankK");
  cur1->hook=cur8;

 }


V("TauInit");
V("ShareInit");

v[40]=0;


CYCLE(cur1,"EnergyFirm")
{
CYCLES(cur1,cur, "LaborEF")
   {
   v[41] = VS(cur, "IdLaborEF");
    cur2 = SEARCH_CND("NumClass", v[41]);
    cur->hook=cur2;
   }
}
V("InitPP");

RESULT( 1)


Parameter:  InitMinWage

Contained in:  Country
Used in:  MinWage, MinWageXXX


Variable:  Init_x

Contained in:  Country
Used in:  Init
Using:  Max_x, Min_xIdPNeedIdCh, x

Equation code:

EQUATION("Init_x")
/*
Initialisation of the charactheristics (quality)
*/

CYCLE(cur, "Supply")
 {
  CYCLES(cur, cur1, "Firm")
   {
    CYCLES(cur1, cur2, "PNeed")
     {
      v[5]=VS(cur2,"IdPNeed");
      if(v[5]==0)
       { // set the initial value of the quality characteristic only for the product that is currently produced. The others are set to 0
        CYCLES(cur2, cur3, "Ch")
         {
          v[1]=VS(cur3,"IdCh");
          if(v[1]>1)
           { // if it is not a price characteristic set the initial value
            v[2]=V("Min_x");
            v[3]=V("Max_x");
            v[4]=uniform(v[2],v[3]);
            WRITELS(cur3,"x",v[4], t-1);
           }
         }
       }

     }

   }

 }

PARAMETER;
RESULT(1 )


Variable:  InvSalesRatio

Contained in:  Country
Used in:  (never used)
Using:  TotInventories, TotUSales

Equation code:

EQUATION("InvSalesRatio")
/*
ratio between inventories and sales in the final good sector
*/

v[1]=V("TotInventories");
v[2]=V("TotUSales");

v[2]==0 ? v[0]=0 : v[0]=v[1]/v[2];

RESULT(v[0])


Parameter:  InventGrowth

Contained in:  Country
Used in:  (never used)


Parameter:  InvestmentGdpRatio

Contained in:  Country
Used in:  GDPnom


Parameter:  JobLoss

Contained in:  Country
Used in:  (never used)


Parameter:  KaNW

Contained in:  Country
Used in:  KNbrWorkers


Variable:  LTUnemployment

Contained in:  Country
Used in:  MinWage, MinWageXXX, LTUnemployment
Using:  LTUnemployment, UnemploymentRate, aLTUR

Equation code:

EQUATION("LTUnemployment")
/*
Long term unemployment rate
*/

v[0]=VL("LTUnemployment",1);
v[1]=V("UnemploymentRate");
if(t==1)
 END_EQUATION(v[1]);

v[2]=V("aLTUR");

v[3]=v[0]*v[2]+(1-v[2])*v[1];
RESULT( v[3])


Parameter:  LowerMinWage

Contained in:  Country
Used in:  (never used)


Variable:  MaxNumWorkers

Contained in:  Country
Used in:  MaxNumWorkers, UnemploymentRate, UnemploymentRateXXX
Using:  MaxNumWorkers, STUnemployment, PopGrowth, UnempTarget

Equation code:

EQUATION("MaxNumWorkers")
/*
*/
v[0]=VL("MaxNumWorkers",1);

if(t < 2)
END_EQUATION(v[0]);

v[1]=V("PopGrowth");
//v[2]=VL("UnemploymentRate",1);
v[2]=VL("STUnemployment",1);

//v[10]=v[0]*(1+v[1]);
v[3]=V("UnempTarget");
v[4]=(-v[2]+v[3]);
if(v[4]<0)
v[10]=v[0];
else
v[10]=v[0]*(1-v[2]+v[3]);

RESULT(v[10] )


Parameter:  Max_x

Contained in:  Country
Used in:  Init_x


Variable:  Mechanisation

Contained in:  Country
Used in:  (never used)
Using:  SectEmploymentShare, SectMechanisation

Equation code:

EQUATION("Mechanisation")
/*
Comment
*/
v[0]=0;
CYCLE(cur, "Sectors")
 {
 v[1]=VS(cur,"SectMechanisation");
 v[2]=VS(cur,"SectEmploymentShare");
 v[0]+=(v[1]*v[2]);
 }
v[3]=v[0];
RESULT(v[3] )


Variable:  MinWage

Contained in:  Country
Used in:  ExpCostENK, EntryEF, MinWageMA, PlaceOrderEF, KRdExpenditure, WageEngineers, MinWageGr, wageEF, betaEff, MoAvMinWageGr, Entry, wage, KWageEngineers, KWage, MinWage, MinWageXXX, MinWageIndex, Init
Using:  IncrAggProd, IncrAvPrice, InitAggProd, InitAvPrice, InitMinWage, LTUnemployment, MinWage, MovAvMaxLProd, MovAvPrice, NbrWorkers, STUnemployment, elasMWPrice, elasMWProd, elasMinWage, maxMinWage, minMinWage, maxMinWageGr

Equation code:

EQUATION("MinWage")
/*
Sets the minimum wage for all categories, as an aggregate relation. Variables influecing overall wage are: aggregate productivity, inflation, and unemployment.
Aggregate productivity?
Unemployment: to account for Beveridge curves we could use the suggishness in the hiring process, which gnerates rates of vacancies...
NOTE: probably it makes sense to use levels for all variables. That is, when the variable reaches a certain level, a wage resetting is unedergone: if inflation runs too high, wages are renegotiated, if aggregate productivity increase evidently, wage are renegotiated.

*/
V("NbrWorkers");
v[0]=VL("MinWage",1);
//END_EQUATION(v[0]);
v[10]=V("InitAggProd"); //the reference level of productivity
v[2]=V("MovAvMaxLProd");
v[43]=VL("MovAvMaxLProd",1);
v[11]=V("IncrAggProd");
v[12]=v[10]+v[10]*v[11]; //required increase in productity to change the min wage
v[13]=V("MovAvPrice");
v[44]=VL("MovAvPrice",1);
v[14]=V("InitAvPrice"); //the reference level of prices
v[15]=V("IncrAvPrice");
v[16]=v[14]+v[14]*v[15]; //required increase in prices to change the min wage
v[17]=VL("LTUnemployment",1);
v[18]=VL("STUnemployment",1);
v[19]=V("STUnemployment");

v[30]=V("minMinWage");
v[31]=V("maxMinWage");
v[32]=V("elasMinWage");
v[33]=V("elasMWProd");
v[34]=V("elasMWPrice");

v[36]=v[2]/v[10]-1;//Change in productivity
v[37]=v[13]/v[14]-1; // Change in prices

v[39]=0;
v[40]=0;

if(v[2]>v[12])
 {//Negotiation on productivity
  v[30]=(v[12]/v[10])*v[30];
  v[31]=(v[12]/v[10])*v[31];
  v[39]=(v[33])*v[36];
  WRITE("InitAggProd",v[2]);
 // WRITE("IncrAggProd",v[11]*v[2]/v[10]);
 }


if(v[13]>v[16])
 {//Negotiation on price
  v[30]=(v[16]/v[14])*v[30];
  v[31]=(v[16]/v[14])*v[31];
  v[40]=(v[34])*v[37];
  WRITE("InitAvPrice",v[13]);
 // WRITE("IncrAvPrice",v[15]*v[13]/v[14]);
 }

if(v[2]>v[12] & v[13]>v[16])
 { //both negotiation
  v[39]=(v[33])*v[36]*0.5;
  v[40]=(v[34])*v[37]*0.5;
 }


v[48]=V("InitMinWage");

//wage curve, expressing a percentage change of wage as a function of unemployment.
if(v[19]<0.10)
 v[41]=0.001/(v[19]+0.01);
else
 v[41]=0;
 
//v[41]=-0.2+0.1/(v[19]+0.2);
//v[6]=v[0]+(v[32]*v[41]+v[39]+v[40])*v[48]; //***
v[6]=v[0]*(1+v[32]*v[41]+v[39]+v[40]);

v[6]=v[0]*(1+v[32]*v[41])+v[48]*(v[39]+v[40]);




if(is_nan( v[6] )!=0 || is_inf(v[6])!=0)
 {
  v[6]=v[0];
// INTERACT("UNO", v[0]);
 }
 
// INTERACT("Due", v[6]);
if(v[2]>v[12] | v[13]>v[16])
 WRITE("InitMinWage",v[6]);


WRITE("minMinWage",v[30]);
WRITE("maxMinWage",v[31]);

v[33] = V("maxMinWageGr");
if(abs(v[0]/v[6]-1)>v[33])
  v[6]>v[0]?v[6]=v[0]*(1+v[33]):v[6]=v[0]*(1-v[33]);

RESULT(v[6] )


Variable:  MinWageIndex

Contained in:  Country
Used in:  (never used)
Using:  BaseMinWage, MinWage

Equation code:

EQUATION("MinWageIndex")
/*
Minimum Wage index
*/

v[1]=(double)t;
v[2]=V("MinWage");
if(v[1]==1)
 WRITE("BaseMinWage",v[2]);
v[3]=V("BaseMinWage");
v[4]=v[2]/v[3]*100;


RESULT(v[4] )


Parameter:  Min_x

Contained in:  Country
Used in:  Init_x


Parameter:  MinimumCMaxE

Contained in:  Country
Used in:  MinimumInit


Parameter:  MinimumCMaxW

Contained in:  Country
Used in:  MinimumInit


Parameter:  MinimumCMinE

Contained in:  Country
Used in:  MinimumInit


Parameter:  MinimumCMinW

Contained in:  Country
Used in:  MinimumInit


Function:  MinimumInit

Contained in:  Country
Used in:  Init
Using:  AvWagecoeff, MinimumCMaxE, MinimumCMaxW, MinimumCMinE, MinimumCMinW, MinimumPMaxE, MinimumPMaxW, MinimumPMinE, MinimumPMinWpriceNumClassIdDCh, Delta, Minimum

Equation code:

EQUATION("MinimumInit")
/*
Initialisation of the minimum parameter across classes, needs and chars
*/

v[2]=V("MinimumPMinE"); // minimum value of the minimum parameter on price for engineers
v[3]=V("MinimumPMaxE"); // maximum value of the minimum parameter on price for engineers
v[4]=V("MinimumPMinW"); // minimum value of the minimum parameter on price for workers
v[5]=V("MinimumPMaxW"); // maximum value of the minimum parameter on price for workers
v[13]=V("MinimumCMinE"); // minimum value of the minimum parameter on any quality characteristic for engineers
v[14]=V("MinimumCMaxE"); // maximum value of the minimum parameter on any quality characteristic for engineers
v[15]=V("MinimumCMinW"); // minimum value of the minimum parameter on any quality characteristic for workers
v[16]=V("MinimumCMaxW"); // maximum value of the minimum parameter on any quality characteristic for workers
v[6]=1000000;
CYCLE(cur, "Supply")
 {
  CYCLES(cur, cur1, "Firm")
   {
    v[7]=VLS(cur1,"price",1);
    if(v[7]<v[6])
     v[6]=v[7];
   }

 }
v[10]=V("AvWagecoeff");
CYCLE(cur, "Demand")
 {
  CYCLES(cur, cur1, "Class")
   {
    v[1]=VS(cur1,"NumClass");
    if(v[1]<1)
     { // engineers
      CYCLES(cur1, cur2, "Need")
       {
        CYCLES(cur2, cur3, "DCh")
         {
          v[2]=VS(cur3,"IdDCh");
          if(v[2]==1)
           { // maintain the minimum above the minimum of the characteritic (price) only for the fist (price) characteritic
            v[8]=uniform(v[2],v[3]);
            v[9]=VS(cur3,"Delta"); // variance of the distribution of the perceived characteritic around the actaul value
            v[11]=v[9]*v[6];
            v[12]=max(v[8],v[11]); // use either the initially set minimum or the price of the cheapest firm
            WRITES(cur3,"Minimum",v[12]);
           }
          else
           {
            v[17]=uniform(v[13],v[14]);
            WRITES(cur3,"Minimum",v[17]);
           }
         }

       }

     }
    if(v[1]==1)
     {// first tier workers
      CYCLES(cur1, cur2, "Need")
       {
        CYCLES(cur2, cur3, "DCh")
         {
          v[17]=VS(cur3,"IdDCh");
          if(v[17]==1)
           {
            v[18]=uniform(v[4],v[5]);
            v[19]=VS(cur3,"Delta");
            v[20]=v[19]*v[6];
            v[21]=max(v[18],v[20]);
            WRITES(cur3,"Minimum",v[21]);
           }
          else
           {
            v[22]=uniform(v[15],v[16]);
            WRITES(cur3,"Minimum",v[22]);
           }
         }

       }

     }
    if(v[1]>1)
     { // exectuives, above the first tier workers
      CYCLES(cur1, cur2, "Need")
       {
        CYCLES(cur2, cur3, "DCh")
         {
          v[23]=VS(cur3,"IdDCh");
          if(v[23]==1)
           {
            cur4=SEARCH_CNDS(cur,"NumClass",v[1]-1);
            CYCLES(cur4, cur5, "DCh")
             {
              v[24]=VS(cur5,"IdDCh");
              if(v[24]==1)
               v[25]=VS(cur5,"Minimum");
             }
            v[26]=v[25]*v[10];
            WRITES(cur3,"Minimum",v[26]);
           }
          else
           {
            v[27]=uniform(v[15],v[16]);
            WRITES(cur3,"Minimum",v[27]);
           }
         }

       }

     }
   }
 }

PARAMETER
RESULT(1 )


Parameter:  MinimumPMaxE

Contained in:  Country
Used in:  MinimumInit


Parameter:  MinimumPMaxW

Contained in:  Country
Used in:  MinimumInit


Parameter:  MinimumPMinE

Contained in:  Country
Used in:  MinimumInit


Parameter:  MinimumPMinW

Contained in:  Country
Used in:  MinimumInit


Variable:  MinimumPriceSet

Contained in:  Country
Used in:  (never used)
Using:  AvWagecoeffpriceNumClassIdDCh, Delta, Minimum

Equation code:

EQUATION("MinimumPriceSet")
/*
System equation that mantains the `minimum' parameter for the price characteristic, of the first tyer working class and engineers, above the minimum price among firms (times the variance of the consumer percetion error).
It also sets the Minimum parameter across needs for the price
*/


v[4]=1000000;
CYCLE(cur, "Supply")
 {
  CYCLES(cur, cur1, "Firm")
   {
    v[3]=VLS(cur1,"price",1);
    if(v[3]<v[4])
     v[4]=v[3];
   }

 }
v[10]=V("AvWagecoeff");
CYCLE(cur, "Demand")
 {
  CYCLES(cur, cur1, "Class")
   {
    v[1]=VS(cur1,"NumClass");
    if(v[1]<=1)
     { // start with the engineers and the first tier working class (they both set their minimum independently)
      CYCLES(cur1, cur2, "Need")
       {
        CYCLES(cur2, cur3, "DCh")
         {
          v[2]=VS(cur3,"IdDCh");
          if(v[2]==1)
           { // maintain the minimum above the minimum of the characteritic (price) only for the fist (price) characteritic
            v[5]=VS(cur3,"Minimum"); // check the initialised value of the minimum
            v[6]=VS(cur3,"Delta"); // variance of the distribution of the perceived characteritic around the actaul value
            v[7]=v[6]*v[4];
            v[8]=max(v[5],v[7]); // use either the initially set minimum or the price of the cheapest firm
            WRITES(cur3,"Minimum",v[8]);
           }
         }

       }

     }
    if(v[1]>1)
     { // layers above the first one (different types of executives)
      CYCLES(cur1, cur2, "Need")
       {
        CYCLES(cur2, cur3, "DCh")
         {
          v[9]=VS(cur3,"IdDCh");
          if(v[9]==1)
           {
            cur4=SEARCH_CNDS(cur,"NumClass",v[1]-1);
            CYCLES(cur4, cur5, "DCh")
             { // cycle the DCh for any need (we assume that the minimum for price is equal across needs)
              v[11]=VS(cur5,"IdDCh");
              if(v[11]==1)
               v[12]=VS(cur5,"Minimum"); // read the minimum par of the previsous class for char price
             }
            v[8]=v[12]*v[10];
            WRITES(cur3,"Minimum",v[8]); // write the value of the parameter, as the previous Minimum times the multiplier
           }
         }
       }
     }
   }
 }


RESULT(v[8] )


Variable:  MoAvGDPc

Contained in:  Country
Used in:  MoAvGDPc
Using:  GDPg, MoAvGDPc

Equation code:

EQUATION("MoAvGDPc")
/*
Growth rate of the GDP at constant prices
*/

//v[4]=(double)t;

  v[1]=V("GDPg");
  //INTERACT("MoAvGDPc",v[1]);
  v[0]=VL("MoAvGDPc",1);
  //INTERACT("GDPg1",v[0]);
  v[2]=0.9*v[0]+0.1*v[1];
  //INTERACT("MoAv",v[2]);

RESULT(v[2] )


Variable:  MoAvInvestment

Contained in:  Country
Used in:  MoAvInvestment, MoAvInvestmentGr
Using:  MoAvInvestmentKProductionFlow

Equation code:

EQUATION("MoAvInvestment")
/*
Comment
*/

v[0]=SUM("KProductionFlow");
v[1]=VL("MoAvInvestment",1);

v[2]= 0.9*v[1]+0.1*v[0]; // MoAvInvestment

RESULT(v[2] )


Variable:  MoAvInvestmentGr

Contained in:  Country
Used in:  (never used)
Using:  MoAvInvestment

Equation code:

EQUATION("MoAvInvestmentGr")
/*
Comment
*/

v[0]=V("MoAvInvestment");
v[1]=VL("MoAvInvestment",1);
if(v[1]==0)
v[1]=0.0001;

v[3]=v[0]/v[1]-1;

RESULT(v[3] )


Variable:  MoAvMinWageGr

Contained in:  Country
Used in:  MoAvMinWageGr
Using:  MinWage, MoAvMinWageGr

Equation code:

EQUATION("MoAvMinWageGr")
/*
Comment
*/

v[0]=VL("MinWage",1);
v[1]=V("MinWage");
v[2]=v[1]/v[0]-1; // MinWage growth rate

v[3]=VL("MoAvMinWageGr",1);

// Compute moving average
v[4]= 0.99*v[3]+0.11*v[2]; // MoAvMinWageGr

RESULT(v[4] )


Variable:  MovAvAggProd

Contained in:  Country
Used in:  MovAvAggProd, Init
Using:  AvCurrentProductivity, MovAvAggProd, aAgProd

Equation code:

EQUATION("MovAvAggProd")
/*
Exponential Moving Average of the aggregate productivity
*/

v[1]=VL("MovAvAggProd",1);
//v[2]=VL("AggProductivity",1);
v[2]=VL("AvCurrentProductivity",0);
v[3]=V("aAgProd");
v[4]=v[3]*v[2]+(1-v[3])*v[1];

RESULT(v[4] )


Variable:  MovAvMaxLProd

Contained in:  Country
Used in:  MovAvMaxLProd, MinWage, MinWageXXX, ProdIndex
Using:  AvMaxLProd, MovAvMaxLProd, aAgProd

Equation code:

EQUATION("MovAvMaxLProd")
/*
Exponential Moving Average of the aggregate productivity
*/

v[1]=VL("MovAvMaxLProd",1);
//v[2]=VL("AggProductivity",1);
v[2]=VL("AvMaxLProd",0);
v[3]=V("aAgProd");
v[4]=v[3]*v[2]+(1-v[3])*v[1];

RESULT(v[4] )


Variable:  MovAvNbrWork

Contained in:  Country
Used in:  MovAvNbrWork, Init
Using:  MovAvNbrWork, NbrWorkers, aNbrWork

Equation code:

EQUATION("MovAvNbrWork")
/*
Exponential Moving Average of the number of worwers
*/

v[1]=VL("MovAvNbrWork",1);
v[2]=VL("NbrWorkers",1);
v[3]=V("aNbrWork");
v[4]=v[3]*v[2]+(1-v[3])*v[1];

RESULT(v[4] )


Variable:  MovAvPrice

Contained in:  Country
Used in:  Consumption, MinWage, MinWageXXX, CPI, MovAvPrice, Init
Using:  AvPrice, MovAvPrice, aAvPrice

Equation code:

EQUATION("MovAvPrice")
/*
Exponential Moving Average of the inflation
*/

v[1]=VL("MovAvPrice",1);
v[2]=VL("AvPrice",1);
v[3]=V("aAvPrice");
v[4]=v[3]*v[2]+(1-v[3])*v[1];


RESULT(v[4] )


Parameter:  MovAvTotHired

Contained in:  Country
Used in:  (never used)


Variable:  MovAvTotVac

Contained in:  Country
Used in:  MovAvTotVac
Using:  MovAvTotVac, TotVacancies, aTotVac

Equation code:

EQUATION("MovAvTotVac")
/*
Exponential Moving Average of Total vacancies
*/

v[1]=VL("MovAvTotVac",1);
v[2]=VL("TotVacancies",1);
v[3]=V("aTotVac");
v[4]=v[3]*v[2]+(1-v[3])*v[1];

RESULT(v[4] )


Parameter:  NaturalUR

Contained in:  Country
Used in:  (never used)


Variable:  NbrWorkers

Contained in:  Country
Used in:  VacancyRate, ControlWorkers, WorkersEFRatio, WorkersKRatio, WorkersRatio, UnemploymentRate, MinWage, MinWageXXX, TotVacancies, UnemploymentRateXXX, MovAvNbrWork, SectEmployment, EmploymentConcentration
Using:  NumWorkersKNbrWorkers, KNbrEngineersNumWorkersEF

Equation code:

EQUATION("NbrWorkers")
/*

*/

v[3]=v[8]=0;
CYCLE(cur2, "Supply")
 {
  CYCLES(cur2, cur, "Firm")
   {
    CYCLES(cur, cur1, "Labor")
     {
      v[1]=VS(cur1,"NumWorkers");
      v[2]=VLS(cur1,"NumWorkers",1);
      v[3]+=v[1];
      v[8]+=v[2];
     }

   }
 }
CYCLE(cur, "KFirm")
 {
  CYCLES(cur, cur1, "KLabor")
   {
    v[4]=VS(cur1,"KNbrWorkers");
    v[5]=VLS(cur1,"KNbrWorkers",1);
    v[3]+=v[4];
    v[8]+=v[5];
   }
  cur2=SEARCHS(cur,"KEngineers");
  v[6]=VS(cur2,"KNbrEngineers");
  v[7]=VLS(cur2,"KNbrEngineers",1);
  v[3]+=v[6];
  v[8]+=v[7];
 }
CYCLE(cur, "EnergyFirm")
 {
  CYCLES(cur, cur1, "LaborEF")
   {
    v[4]=VS(cur1,"NumWorkersEF");
    v[5]=VLS(cur1,"NumWorkersEF",1);
    v[3]+=v[4];
    v[8]+=v[5];
   }
 }

RESULT(v[3] )


Parameter:  OutputConcentration

Contained in:  Country
Used in:  EmploymentConcentration


Parameter:  PTrend

Contained in:  Country
Used in:  (never used)


Variable:  ProdIndex

Contained in:  Country
Used in:  (never used)
Using:  BaseProd, MovAvMaxLProd

Equation code:

EQUATION("ProdIndex")
/*
Aggregate productivity Index (average theoretical productivity given firms capital goods)
*/

v[1]=(double)t;
v[2]=V("MovAvMaxLProd");
if(v[1]==1)
 WRITE("BaseProd",v[2]);
v[3]=V("BaseProd");
v[4]=v[2]/v[3]*100;

RESULT(v[4] )


Variable:  Production

Contained in:  Country
Used in:  SumCashCCh, SumCashFCh, SumCashKFCh, FinancialTrading, Income, SumCashEFCh, ControlDemand, FirmControlCurrent, FirmControlCapital, EFirmControlCurrent, EFirmControlCapital, BankControlCurrent, BankControlCapital, OutstandingDebtEFCh, NumActiveOrders, TotPremia, Av_Computations, GlobalFlows
Using:  AvAgeAge, InvestmentDecision, Profit, WagePremNumWorkers, IdLabor, NetWorth, WageEngineersKWagePremKNbrWorkers, KWage, IdKLabor, KWageEngineers, DebtKWagePremEF

Equation code:

EQUATION("Production")
/*
After trading fix any remaining variable to compute
*/

v[0]=v[1]=v[5]=v[6]=v[7]=v[8]=v[9]=v[70]=0;

cur = SEARCH("Supply");
  CYCLES(cur, cur1, "Firm")
   {
    VS(cur1,"Profit");
    VS(cur1,"InvestmentDecision");
    v[5]+=VS(cur1,"Age");
    v[6]++;
    VS(cur1,"WagePrem");

    v[8]=0;
    CYCLE_SAFES(cur1, cur2, "Labor")
     {
      v[4]=VS(cur2,"NumWorkers");
      v[8]+=v[4];
      //INCRS(cur2->hook,"tempWage",v[2]*v[4]);
      if(v[4]==0 && VS(cur2,"IdLabor")!=1)
       DELETE(cur2);

     }
   v[9]+=v[8];
   //cur5=SEARCHS(cur1,"BankF");
   VS(cur1,"NetWorth");
   cur6 = SEARCHS(cur1, "Engineers");
   VS(cur6, "WageEngineers");
   }
cur1 = SEARCH("Machinery");
CYCLES(cur1, cur, "KFirm")
 {
   cur6 = SEARCHS(cur, "KEngineers");
   VS(cur6, "KWageEngineers");

  CYCLE_SAFES(cur, cur1, "KLabor")
   {
    v[4]=VS(cur1,"KWage");
    v[3]=VS(cur1,"KNbrWorkers");
    VS(cur1,"KWagePrem");
    if(v[4]==0 && VS(cur2,"IdKLabor")!=1)
      DELETE(cur2);
   }
  v[70]+=VS(cur,"DebtK");//xxx
 }

cur = SEARCH("Energy");
CYCLES(cur, cur1, "EnergyFirm")
{
VS(cur1, "WagePremEF");
}

/*
 v[5]=V("TotPremia");
 v[6]=V("TotWage");
 if(v[5]!=v[0] || v[6]!=v[1])
  {
   INTERACT("Failed income",v[1]);
  }
*/
WRITE("AvAge",v[5]/v[6]);

RESULT(1 )


Parameter:  Redistribute

Contained in:  Country
Used in:  RedistributeSales


Variable:  STUnemployment

Contained in:  Country
Used in:  MaxNumWorkers, MinWage, MinWageXXX, STUnemployment
Using:  STUnemployment, UnemploymentRate, aSTUR

Equation code:

EQUATION("STUnemployment")
/*
Short term unemployment rate
*/

v[0]=VL("STUnemployment",1);
v[1]=V("UnemploymentRate");
if(t==1)
 END_EQUATION(v[1]);

v[2]=V("aSTUR");

v[3]=v[0]*v[2]+(1-v[2])*v[1];
RESULT( v[3])


Parameter:  ShareInit

Contained in:  Country
Used in:  Init, InitInProgress


Parameter:  TTB_multiplWinner

Contained in:  Country
Used in:  TradeXXX


Parameter:  TauInit

Contained in:  Country
Used in:  Init, InitInProgress


Parameter:  TotAvWage

Contained in:  Country
Used in:  Avx


Variable:  TotConsConst

Contained in:  Country
Used in:  (never used)
Using:  CPIExpenditure

Equation code:

EQUATION("TotConsConst")
/*
Total Consumption at constant prices
*/

v[1]=SUM("Expenditure");
v[2]=V("CPI");

RESULT(v[1]/v[2])


Variable:  TotDConsConst

Contained in:  Country
Used in:  (never used)
Using:  CPITotConsumption

Equation code:

EQUATION("TotDConsConst")
/*
Total desired consumption at constant prices
*/

v[1]=V("TotConsumption");
v[2]=V("CPI");

RESULT(v[1]/v[2] )


Variable:  TotEnergyConsumption

Contained in:  Country
Used in:  ExcessEnergyRatio, FirstOrderEF, ControlTotEN, ENGDP, GreenENShare, DirtyENShare, FairEnergy, PriceEN, GreenInvestment, InvestmentDecisionEFXXX, InvestmentDecisionEF, GDPnom
Using:  TotEN, TotKEN

Equation code:

EQUATION("TotEnergyConsumption")
/*
Total Energy Consumption (Firms+Kfirms)
*/
//v[10]=t;sprintf(msg, "\n TotEnergyConsumption(%g)", v[10]); plog(msg);
v[0]=V("TotEN");
v[1]=V("TotKEN");

RESULT(v[0]+v[1] )


Parameter:  TotHired

Contained in:  Country
Used in:  (never used)


Parameter:  TotHiredLag

Contained in:  Country
Used in:  (never used)


Variable:  TotIncomeCapitaReal

Contained in:  Country
Used in:  (never used)
Using:  CPITotIncomeCapita

Equation code:

EQUATION("TotIncomeCapitaReal")
/*
Comment
*/
v[0]=V("TotIncomeCapita");
v[1]=V("CPI");
RESULT(v[0]/v[1] )


Variable:  TotInventories

Contained in:  Country
Used in:  InvSalesRatio
Using:  Stocks

Equation code:

EQUATION("TotInventories")
/*
Total inventories in the economy, and their growth
*/

//v[4]=(double)t;
//v[4]=(double)t;
v[4]=t;

v[1]=v[2]=0;
CYCLE(cur, "Supply")
 {
  CYCLES(cur, cur1, "Firm")
   {
    v[1]+=VS(cur1,"Stocks");
    v[2]+=VLS(cur1,"Stocks",1);
   }

 }
if(v[4]>2)
 v[3]=v[1]/v[2]-1;
else
 v[3]=0;
//WRITE("InventGrowth",v[3]);

RESULT(v[1] )


Variable:  TotUSales

Contained in:  Country
Used in:  Ms, InvSalesRatio
Using:  UnitSales

Equation code:

EQUATION("TotUSales")
/*
Total unit sold by the consumabe sector
*/

v[2]=0;
CYCLE(cur1, "Supply")
 {
  CYCLES(cur1, cur, "Firm")
   {
    v[1]=VS(cur,"UnitSales");
    v[2]+=v[1];
   }
 }

RESULT(v[2] )


Variable:  TotVacancies

Contained in:  Country
Used in:  VacancyRate, MovAvTotVac
Using:  AvRatioVacancies, NbrWorkersVacanciesKVacancies

Equation code:

EQUATION("TotVacancies")
/*
Number of vacancies
*/

v[1]=V("NbrWorkers");
v[0]=0;

CYCLE(cur,"Firm")
 {
  v[0]+=VS(cur,"Vacancies");
  v[1]++;
 }

CYCLE(cur,"KFirm")
 {
  v[0]+=VS(cur,"KVacancies");
 }

//WRITE("AvRatioVacancies",v[0]/(v[1]+v[0])*100);
WRITE("AvRatioVacancies",v[0]/v[1]);
RESULT(v[0] )


Parameter:  TotalKProduction

Contained in:  Country
Used in:  AggProductivity


Variable:  Trade

Contained in:  Country
Used in:  SumCashCCh, SumCashFCh, SumCashKFCh, SumCashEFCh, UnitDemand, Revenues, FirmControlCurrent, FirmControlCapital, KFirmControlCurrent, EFirmControlCurrent, EFirmControlCapital, BankControlCurrent, BankControlCapital, ControlRevenues, OutstandingDebtEFCh, smoothMonSales, Entry, Exit, Trade, DesiredQ, PayTime, ProdInno, Av_Computations
Using:  TradeMonetarySales, MonetarySalesL, VisibilityIdCh, xExpenditure, Competitiveness, GovDemHHIdNeed, SharetauIdGood, NFirmsSapp2, app3

Equation code:

EQUATION("Trade")
/*
Set a trading cycle:
- initialize "sales" to zero in firms;
- compute the sales for each firm as the total of classes and needs
*/
v[10]=t;
//sprintf(msg, "\n Trade(%g)", v[10]); plog(msg);

CYCLE(cur1, "Supply")
 {
  CYCLES(cur1, cur, "Firm")
  {
   v[1]=VS(cur,"MonetarySales");
   WRITES(cur,"MonetarySalesL",v[1]); // before setting the sales to 0 for the current period computation, register the lagged value of monetary sales
   WRITES(cur,"MonetarySales",0);
  }
 }
v[70]=v[71]=0;
CYCLE(cur, "Class")
 {
  v[4]=VS(cur,"Expenditure")+VLS(cur, "GovDemHH",1);
v[70]+=v[4];
  //WRITES(cur,"NoConsumption",0); // after having computed the expenditure set the non expenditure to 0, to be computed again inthis period for the following period expenditures
  v[14]=v[21]=0;
  v[18] = VS(cur, "Competitiveness");
  
  CYCLES(cur, cur1, "Need")
   { // Cycle through the needs of the class
    if(cur1->hook==NULL)
      {//this hook should point to the sector of the need, find it if not already set
       v[10]=VS(cur1,"IdNeed");
       cur1->hook = SEARCH_CND("IdGood", v[10]);
      }
    if(VS(cur1->hook, "NFirmsS")<1)
     INTERACTS(cur1, "Number of SFirm=0",v[14]);
    v[12]=VS(cur1, "Share");
    v[13]=v[12]*v[4];//share of expenditure on this need
    v[30]=-1;
    CYCLES(cur1->hook, cur2, "sFirm")
     {//Find the maximum price
     if(cur2->hook==NULL)
      INTERACT("missing hook", v[12]);
     
      cur3 = SEARCH_CNDS(cur2->hook, "IdCh", 1);
      v[31] = VS(cur3, "x");
      if(v[31]>v[30])
        v[30]=v[31];

     }
    v[30]*=1.1;//increase the maximum price of 10% to avoid the indicator to be 0
    v[17]=0;
    CYCLES(cur1->hook, cur2, "sFirm")
     {//Cycle through all firms producing the good for this need
      cur4 = SEARCHS(cur2->hook, "Ch");
      v[15]=1;
      CYCLES(cur1, cur3, "DCh")
        {//Double cycle, through the characteristics of the firm and those of the consumer class
         v[14] = VS(cur4, "x"); //value of the characteristic
         v[16] = VS(cur3, "tau");//preference of the class for this characteristic
         if(v[14]==0)
         INTERACTS(cur4,"Zerox", v[14]);
        
         if(VS(cur4, "IdCh")==1)
           v[15]*=pow(v[30]-v[14],v[16]);//Factor for price
         else
           v[15]*=pow(v[14],v[16]);//Factor for quality
         cur4=cur4->next;
        }
        v[22] = VLS(cur2->hook, "Visibility",1);
        if(v[22]==0)
         INTERACTS(cur,"ZeroVisibility", v[22]);
        
        v[19]=pow(v[15],v[18])*v[22];
      WRITES(cur2, "app2", v[19]);//write the indicator for this sFirm
      v[17]+=v[19];
     }
    v[40]=v[42]=v[43]=0;
    if(v[17]==0)
       INTERACTS(cur,"ZeroSales", v[17]);

    CYCLES(cur1->hook, cur2, "sFirm")
     {//Cycle again through the firms supplying this good
      v[20] = VS(cur2, "app2");
      v[43]+=v[20]/v[17];
      v[21]= v[13]*v[20]/v[17];//Share of the expenditures allocated to the firm
      if(v[21]<0)
       INTERACTS(cur,"NEGSALES", v[21]);
      INCRS(cur2->hook, "MonetarySales", v[21]);
      WRITES(cur2, "app3", v[20]/v[17]);
      v[71]+=v[21];
     }
   }
  }
/**
v[90]=v[70]-v[71];
if(abs(v[90])>0.001)
 {
//sprintf(msg, "\n Trade(%g)", v[90]); plog(msg);
//sprintf(msg, "\n v70(%g)", v[70]); plog(msg);
//sprintf(msg, "\n v71(%g)", v[71]); plog(msg);
// LOG("\nExpenditures %lf\nMonetary sal %lf (%lf)\n",v[70],v[71], abs(v[70]-v[71]));
 INTERACT("Trade",v[90]);
 }
**/
RESULT( 1)


Variable:  UnemploymentRate

Contained in:  Country
Used in:  GovernmentExpenses, NumWorkers, KNbrWorkers, LTUnemployment, STUnemployment
Using:  MaxNumWorkers, NbrWorkers, NegUnemp, Unemployment

Equation code:

EQUATION("UnemploymentRate")
/*
*/
v[0]=V("MaxNumWorkers");
v[1]=V("NbrWorkers");
v[2]=(v[0]-v[1])/v[0];
if(v[2]<0)
{
WRITE("NegUnemp",v[2]);
//INTERACT("neg. UnemploymentRate", v[2]);
v[2]=0;
}
else
{
WRITE("NegUnemp",0);
}
WRITE("Unemployment",v[0]-v[1]);
RESULT(v[2] )


Parameter:  UpperMinWage

Contained in:  Country
Used in:  (never used)


Parameter:  WageGrowth

Contained in:  Country
Used in:  Avx


Parameter:  aAgProd

Contained in:  Country
Used in:  MovAvMaxLProd, MovAvAggProd


Parameter:  aAvPrice

Contained in:  Country
Used in:  MovAvPrice


Parameter:  aLTUR

Contained in:  Country
Used in:  LTUnemployment


Parameter:  aMWA

Contained in:  Country
Used in:  (never used)


Parameter:  aMWL

Contained in:  Country
Used in:  (never used)


Parameter:  aMWP

Contained in:  Country
Used in:  (never used)


Parameter:  aNbrWork

Contained in:  Country
Used in:  MovAvNbrWork


Parameter:  aSTUR

Contained in:  Country
Used in:  STUnemployment


Parameter:  aTotHir

Contained in:  Country
Used in:  (never used)


Parameter:  aTotVac

Contained in:  Country
Used in:  MovAvTotVac


Parameter:  beta

Contained in:  Country
Used in:  UnemploymentRateXXX


Parameter:  c

Contained in:  Country
Used in:  UnemploymentRateXXX


Parameter:  elasMWPrice

Contained in:  Country
Used in:  MinWage, MinWageXXX


Parameter:  elasMWProd

Contained in:  Country
Used in:  MinWage, MinWageXXX


Parameter:  elasMinWage

Contained in:  Country
Used in:  MinWage, MinWageXXX


Parameter:  maxMinWage

Contained in:  Country
Used in:  MinWage, MinWageXXX


Parameter:  minAgeExit

Contained in:  Country
Used in:  Exit


Parameter:  minMinWage

Contained in:  Country
Used in:  MinWage, MinWageXXX


Parameter:  minRRoKExit

Contained in:  Country
Used in:  CashInjectionKF, Exit


Parameter:  tauMax

Contained in:  Country
Used in:  NumWorkersEF, NumWorkers, KNbrWorkers, TauInit, Dtau


Parameter:  tauMaxE

Contained in:  Country
Used in:  TauInit


Parameter:  tauMaxW

Contained in:  Country
Used in:  TauInit


Parameter:  tauMin

Contained in:  Country
Used in:  NumWorkersEF, NumWorkers, KNbrWorkers, TauInit, Dtau


Parameter:  tauMinE

Contained in:  Country
Used in:  TauInit


Parameter:  tauMinW

Contained in:  Country
Used in:  TauInit


Parameter:  tauMultiplier

Contained in:  Country
Used in:  NumWorkersEF, NumWorkers, KNbrWorkers, TauInit


Parameter:  totNeeds

Contained in:  Country
Used in:  (never used)


Parameter:  zero

Contained in:  Country
Used in:  (never used)


Parameter:  EnergyGdpRatio

Contained in:  Country
Used in:  GDPnom


Variable:  MinWageGr

Contained in:  Country
Used in:  (never used)
Using:  MinWage

Equation code:

EQUATION("MinWageGr")
/*
*/
v[4]=VL("MinWage",1);
v[5]=V("MinWage");
v[7]=v[5]/v[4]-1; //compute the growth rate of MinWage
RESULT(v[7] )


Parameter:  ExtraCapacity

Contained in:  Country
Used in:  Q, NumWorkers, KapitalNeed


Parameter:  minVisibility

Contained in:  Country
Used in:  Entry, Visibility


Parameter:  MaxQGrowth

Contained in:  Country
Used in:  (never used)


Variable:  ControlPremiaIncome

Contained in:  Country
Used in:  Entry, Exit, Demography
Using:  SumWagePrem, SumPremiaIncome, SumKWagePrem, SumWagePremEF

Equation code:

EQUATION("ControlPremiaIncome") //ok
/*
 */
v[0]=V("SumPremiaIncome");
v[1]=V("SumWagePrem");
v[2]=V("SumKWagePrem");
v[3]=V("SumWagePremEF");
v[4]=v[0]-v[1]-v[2]-v[3];
//if(v[4]>0.001 | v[4]<-0.001) // avoid approximation issue
//INTERACT("ControlPremiaIncome",v[4]);
RESULT(v[4] )


Variable:  ControlLaborCost

Contained in:  Country
Used in:  Exit
Using:  SumLaborCost, SumRdExpenditure, TotWage, SumKLaborCost, SumLaborCostEF

Equation code:

EQUATION("ControlLaborCost") //ok
/*
 */
v[0]=V("TotWage");
v[1]=V("SumLaborCost");
v[2]=V("SumKLaborCost");
v[3]=V("SumLaborCostEF");
v[4]=V("SumRdExpenditure");
v[5]=v[0]-v[1]-v[2]-v[3]-v[4];
//if(v[4]>0.01 | v[4]<-0.01) // avoid approximation issue
//INTERACT("ControlLaborCost",v[4]);
RESULT(v[5] )


Variable:  ControlTotEN

Contained in:  Country
Used in:  (never used)
Using:  TotEnergyConsumptionPriceEN, SumEnergyProductionEF, SumEnergyProductionPP

Equation code:

EQUATION("ControlTotEN")
/*
*/
//v[10]=t;sprintf(msg, "\n ControlTotEN(%g)", v[10]); plog(msg);

V("SumEnergyProductionPP");
V("SumEnergyProductionEF");
V("PriceEN");

v[0]=V("TotEnergyConsumption");
v[1]=V("SumEnergyProductionEF");
//v[2]=V("ExcessEnergy");
v[3]=v[0]-v[1];//-v[2];
//if(v[3]>0.001 | v[3]<-0.001) // avoid approximation issue
//INTERACT("ControlTotEN",v[3]);
RESULT(v[3] )


Variable:  ControlRdExpenditure

Contained in:  Country
Used in:  (never used)
Using:  SumRdExpenditureWageEngineersNumClass, WageIncome, ControlDemand, SumKRdExpenditureKWageEngineers

Equation code:

EQUATION("ControlRdExpenditure")
/*
*/

// v[10]=t;sprintf(msg, "\n ControlRd(%g)", v[10]); plog(msg);

CYCLE(cur,"Class")
 {
V("ControlDemand");
 }
V("KWageEngineers");

CYCLE(cur,"Firm")
{
VS(cur,"WageEngineers"); v[10]=t; //sprintf(msg, "\n ControlRd(%g)", v[10]); plog(msg);
}
//V("WageEngineers"); // Does not work. ControlRd is executed before WageEngineers

v[0]=V("SumKRdExpenditure");
v[1]=V("SumRdExpenditure");

cur=SEARCH_CND("NumClass",0);
v[2]=VS(cur,"WageIncome");

v[3]=v[2]-v[0]-v[1];
//if(abs(v[3])>0.001)
 //INTERACT("RdExpenditure",v[3]);
//v[10]=t; //sprintf(msg, "\n ControlRd(%g)", v[10]); plog(msg);
RESULT(v[3] )


Variable:  MinWageMA

Contained in:  Country
Used in:  KExpCostLabor, MinWageMAGr, MinWageMA
Using:  MinWage, MinWageMA, SpeedMinWageMA

Equation code:

EQUATION("MinWageMA")
/*
Moving average of minwage
*/
v[1]=V("MinWage");
v[2]=VL("MinWageMA",1);
v[3]=V("SpeedMinWageMA");

v[0]=v[3]*v[2]+(1-v[3])*v[1];
RESULT(v[0] )


Parameter:  SpeedMinWageMA

Contained in:  Country
Used in:  MinWageMA


Variable:  MinWageMAGr

Contained in:  Country
Used in:  KShareEngiProd
Using:  MinWageMA

Equation code:

EQUATION("MinWageMAGr")
/*
Growth rate of MinWageMA
*/
v[1]=V("MinWageMA");
v[2]=VL("MinWageMA",1);

RESULT(v[1]/v[2]-1 )


Variable:  PriceENMAGr

Contained in:  Country
Used in:  KShareEngiProd
Using:  PriceENMA

Equation code:

EQUATION("PriceENMAGr")
/*
Growth rate of PriceENMA
*/
v[1]=V("PriceENMA");
v[2]=VL("PriceENMA",1);

RESULT(v[1]/v[2]-1 )


Variable:  ControlShareENPP

Contained in:  Country
Used in:  (never used)
Using:  ShareENPP

Equation code:

EQUATION("ControlShareENPP")
/*
*/
//v[10]=t;sprintf(msg, "\n ShareENPP(%g)", v[10]); plog(msg);
v[0]=0;
CYCLE_SAFE(cur, "EnergyFirm")
 {
  CYCLES(cur, cur1, "CapitalEF")
   {
   v[1]=VS(cur1,"ShareENPP");
   v[0]+=v[1];
   }
 }
RESULT(v[0] )


Parameter:  roPremia

Contained in:  Country
Used in:  WagePremEF, WagePrem, KWagePrem


Parameter:  roCash

Contained in:  Country
Used in:  WagePremEF, WagePrem, KWagePrem


Variable:  test

Contained in:  Country
Used in:  (never used)
Using:  SumMonetarySales, SumExpenditures

Equation code:

EQUATION("test")
/*
*/
v[0]=V("SumMonetarySales");
v[1]=V("SumExpenditures");
//v[2]=V("SumBacklogSales");
v[10]=v[0]-v[1];
RESULT(v[10] )


Parameter:  maxMinWageGr

Contained in:  Country
Used in:  MinWage, MinWageXXX


Parameter:  FreezeEmployment

Contained in:  Country
Used in:  NumWorkers


Parameter:  PopGrowth

Contained in:  Country
Used in:  MaxNumWorkers


Variable:  ControlWorkers

Contained in:  Country
Used in:  (never used)
Using:  NbrWorkersTotLaborForce, TotKLaborForce, SumTotNumWorkersEF

Equation code:

EQUATION("ControlWorkers")
/*
*/
v[0]=V("NbrWorkers");
v[1]=V("TotLaborForce");
v[2]=V("TotKLaborForce");
v[3]=V("SumTotNumWorkersEF");
RESULT(v[0]-v[1]-v[2]-v[3] )


Variable:  WorkersEFRatio

Contained in:  Country
Used in:  (never used)
Using:  NbrWorkersSumTotNumWorkersEF

Equation code:

EQUATION("WorkersEFRatio")
/*
*/
v[0]=V("NbrWorkers");
v[1]=V("SumTotNumWorkersEF");
RESULT(v[1]/v[0] )


Variable:  WorkersKRatio

Contained in:  Country
Used in:  (never used)
Using:  NbrWorkersTotKLaborForce

Equation code:

EQUATION("WorkersKRatio")
/*
*/
v[0]=V("NbrWorkers");
v[1]=V("TotKLaborForce");
RESULT(v[1]/v[0] )


Variable:  WorkersRatio

Contained in:  Country
Used in:  (never used)
Using:  NbrWorkersTotLaborForce

Equation code:

EQUATION("WorkersRatio")
/*
*/
v[0]=V("NbrWorkers");
v[1]=V("TotLaborForce");
RESULT(v[1]/v[0] )


Parameter:  NegUnemp

Contained in:  Country
Used in:  UnemploymentRate


Variable:  TotBacklogRatio

Contained in:  Country
Used in:  (never used)
Using:  TotQ, SumBacklog

Equation code:

EQUATION("TotBacklogRatio")
/*
*/
v[0]=V("SumBacklog");
v[1]=V("TotQ");
v[2]=v[0]/v[1];
if(v[1]==0)
v[2]=0;
RESULT(v[2] )


Parameter:  UnempTarget

Contained in:  Country
Used in:  MaxNumWorkers


Variable:  sGDPnom

Contained in:  Country
Used in:  sGDPnom, BankCapital
Using:  GDPnom, sGDPnom

Equation code:

EQUATION("sGDPnom")
/*
Smoothed nominal GDP
*/
v[1]=V("GDPnom");
v[2]=VL("sGDPnom",1);

v[3]=v[2]*0.95+0.05*v[1];

RESULT(v[3] )


Variable:  StatKFirms

Contained in:  Country
Used in:  (never used)
Using:  GDP, GDPnom, BrownI, BrownInom, GreenI, GreenInom, FirmsI, FirmsInom, BrownIGdpRatio, BrownInomGdpRatio, GreenIGdpRatio, GreenInomGdpRatio, FirmsIGdpRatio, FirmsInomGdpRatio, TimeWaitedBrown, TimeWaitedFirms, TimeWaitedGreen, WaitTimeBrown, WaitTimeFirms, WaitTimeGreen, BrownGOSKShare, GreenGOSKShare, FirmsGOSKShare, BrownKprice, GreenKprice, FirmsKprice, BrownKProductivity, GreenKProductivity, FirmsKProductivity, BrownWaitTime, GreenWaitTime, FirmsWaitTimeKProductionFlow, KPrice, WaitTime, KConstPrice, KType, GOSKKLaborProductivity, TimeWaited, KRevenues

Equation code:

EQUATION("StatKFirms")
/*
*/
v[3]=v[4]=v[13]=v[14]=v[23]=v[24]=v[50]=v[51]=v[52]=v[5]=v[15]=v[25]=v[6]=v[16]=v[26]=v[7]=v[17]=v[27]=v[8]=v[18]=v[28]=v[9]=v[19]=v[29]=v[97]=v[98]=v[99]=0;
CYCLE(cur,"KFirm")
{
v[0]=VS(cur,"KType");

   if(v[0]==0) // Brown
   {
   v[1]=VS(cur,"KRevenues");
   v[2]=VS(cur,"KProductionFlow");
   v[3]+=v[1]; // Nominal Brown Investment
   v[4]+=v[2]; // Real Brown Investment
   v[5]+=VS(cur,"WaitTime");
   v[6]+=VS(cur,"GOSK");
   v[7]+=VS(cur,"WaitTime");
   v[8]+=VS(cur,"KPrice");
   v[9]+=VS(cur,"KLaborProductivity");
   v[99]+=1;
   }
   if(v[0]==1) // Green
   {
   v[11]=VS(cur,"KRevenues");
   v[12]=VS(cur,"KProductionFlow");
   v[13]+=v[11]; // Nominal Green Investment
   v[14]+=v[12]; // Real Green Investment
   v[15]+=VS(cur,"WaitTime");
   v[16]+=VS(cur,"GOSK");
   v[17]+=VS(cur,"WaitTime");
   v[18]+=VS(cur,"KPrice");
   v[19]+=VS(cur,"KLaborProductivity");
   v[98]+=1;
   }
   if(v[0]==2) // Final good
   {
   v[21]=VS(cur,"KRevenues");
   v[22]=VS(cur,"KProductionFlow");
   v[23]+=v[21]; // Nominal Firms Investment
   v[24]+=v[22]; // Real Firms Investment
   v[25]+=VS(cur,"WaitTime");
   v[26]+=VS(cur,"GOSK");
   v[27]+=VS(cur,"WaitTime");
   v[28]+=VS(cur,"KPrice");
   v[29]+=VS(cur,"KLaborProductivity");
   v[97]+=1;
   }
  CYCLES(cur, cur1, "Order")
     {
   if(v[0]==0) // Brown
   {v[50]+=VS(cur1,"TimeWaited");
   //sprintf(msg, "\n TimeWaited(%g)", v[50]); plog(msg);
   }
   if(v[0]==1) // Green
  {v[51]+=VS(cur1,"TimeWaited");}
  if(v[0]==2) // Final good
  {v[52]+=VS(cur1,"TimeWaited");}
     }
}

v[90]=V("KConstPrice"); // normalize by artificial constant price of K

WRITE("BrownI",v[4]*v[90]);
WRITE("BrownInom",v[3]);
WRITE("GreenI",v[14]*v[90]);
WRITE("GreenInom",v[13]);
WRITE("FirmsI",v[24]*v[90]);
WRITE("FirmsInom",v[23]);

v[30]=V("GDPnom");
v[40]=V("GDP");

WRITE("BrownIGdpRatio",v[40]==0 ? 0 : v[4]/v[40]);
WRITE("BrownInomGdpRatio",v[30]==0 ? 0 : v[3]/v[30]);
WRITE("GreenIGdpRatio",v[40]==0 ? 0 : v[14]/v[40]);
WRITE("GreenInomGdpRatio",v[30]==0 ? 0 : v[13]/v[30]);
WRITE("FirmsIGdpRatio",v[40]==0 ? 0 : v[24]/v[40]);
WRITE("FirmsInomGdpRatio",v[30]==0 ? 0 : v[23]/v[30]);

WRITE("TimeWaitedBrown",v[50]);
WRITE("TimeWaitedGreen",v[51]);
WRITE("TimeWaitedFirms",v[52]);

WRITE("WaitTimeBrown",v[5]);
WRITE("WaitTimeGreen",v[15]);
WRITE("WaitTimeFirms",v[25]);

v[1]==0 ? v[60]=0 : v[60]=v[6]/v[1];
v[11]==0 ? v[61]=0 : v[61]=v[16]/v[11];
v[21]==0 ? v[62]=0 : v[62]=v[26]/v[21];
WRITE("BrownGOSKShare",v[60]);
WRITE("GreenGOSKShare",v[61]);
WRITE("FirmsGOSKShare",v[62]);

WRITE("BrownWaitTime",v[7]/v[99]);
WRITE("GreenWaitTime",v[17]/v[98]);
WRITE("FirmsWaitTime",v[27]/v[97]);

WRITE("BrownKprice",v[8]/v[99]);
WRITE("GreenKprice",v[18]/v[98]);
WRITE("FirmsKprice",v[28]/v[97]);

WRITE("BrownKProductivity",v[9]/v[99]);
WRITE("GreenKProductivity",v[19]/v[98]);
WRITE("FirmsKProductivity",v[29]/v[97]);


RESULT(1 )


Parameter:  BrownI

Contained in:  Country
Used in:  StatKFirms


Parameter:  BrownInom

Contained in:  Country
Used in:  StatKFirms


Parameter:  GreenI

Contained in:  Country
Used in:  StatKFirms


Parameter:  GreenInom

Contained in:  Country
Used in:  StatKFirms


Parameter:  FirmsI

Contained in:  Country
Used in:  StatKFirms


Parameter:  FirmsInom

Contained in:  Country
Used in:  StatKFirms


Parameter:  BrownIGdpRatio

Contained in:  Country
Used in:  StatKFirms


Parameter:  BrownInomGdpRatio

Contained in:  Country
Used in:  StatKFirms


Parameter:  GreenIGdpRatio

Contained in:  Country
Used in:  StatKFirms


Parameter:  GreenInomGdpRatio

Contained in:  Country
Used in:  StatKFirms


Parameter:  FirmsIGdpRatio

Contained in:  Country
Used in:  StatKFirms


Parameter:  FirmsInomGdpRatio

Contained in:  Country
Used in:  StatKFirms


Variable:  TotSavings

Contained in:  Country
Used in:  (never used)
Using:  TotIncome, TotConsumption

Equation code:

EQUATION("TotSavings")
/*
Total savings as the difference between TotIncome and TotConsumption
*/
v[1]=V("TotIncome");
v[2]=V("TotConsumption");
RESULT(v[2]-v[1] )


Variable:  SavingsIncomeRatio

Contained in:  Country
Used in:  (never used)
Using:  TotIncome, TotConsumption

Equation code:

EQUATION("SavingsIncomeRatio")
/*
Savings / Income
*/
v[1]=V("TotIncome");
v[2]=V("TotConsumption");
RESULT((v[2]-v[1])/v[1] )


Variable:  ExcessEnergyRatio

Contained in:  Country
Used in:  (never used)
Using:  TotEnergyConsumptionExcessEnergy

Equation code:

EQUATION("ExcessEnergyRatio")
/*
*/
v[1]=V("ExcessEnergy");
v[2]=V("TotEnergyConsumption");
RESULT(v[1]/v[2] )


Variable:  AvUtilisationRate

Contained in:  Country
Used in:  (never used)
Using:  CapitalCapacity, Q

Equation code:

EQUATION("AvUtilisationRate")
/*
Average utilisation rate of capital weighted by CapitalCapacity
*/
v[3]=v[4]=0;
CYCLE(cur,"Firm")
{
v[1]=VS(cur,"Q");
v[2]=VS(cur,"CapitalCapacity");
v[3]+=v[1];
v[4]+=v[2];
}

RESULT(v[3]/v[4] )


Variable:  AvUtilisationBrown

Contained in:  Country
Used in:  (never used)
Using:  AvUtilization, EFType, MaxEnergyCapacity

Equation code:

EQUATION("AvUtilisationBrown")
/*
Average utilisation rate of capital in the energy sector weighted by capacity
*/
v[4]=v[5]=0;
CYCLE(cur,"EnergyFirm")
{
v[1]=VS(cur,"EFType");
if(v[1]==0)
{// it's a brown firm
v[2]=VS(cur,"AvUtilization"); // average utilisation of PP, not weighted by their size
v[3]=VS(cur,"MaxEnergyCapacity");
v[4]+=v[2]*v[3];
v[5]+=v[3];
}
}
if(v[5]==0)
END_EQUATION(0);
RESULT(v[4]/v[5] )


Variable:  AvUtilisationGreen

Contained in:  Country
Used in:  (never used)
Using:  AvUtilization, EFType, MaxEnergyCapacity

Equation code:

EQUATION("AvUtilisationGreen")
/*
Average utilisation rate of capital in the energy sector weighted by capacity
*/
v[4]=v[5]=0;
CYCLE(cur,"EnergyFirm")
{
v[1]=VS(cur,"EFType");
if(v[1]==1)
{// it's a green firm
v[2]=VS(cur,"AvUtilization"); // average utilisation of PP, not weighted by their size
v[3]=VS(cur,"MaxEnergyCapacity");
v[4]+=v[2]*v[3];
v[5]+=v[3];
}
}
if(v[5]==0)
END_EQUATION(0);
RESULT(v[4]/v[5] )


Parameter:  TimeWaitedBrown

Contained in:  Country
Used in:  StatKFirms


Parameter:  TimeWaitedFirms

Contained in:  Country
Used in:  StatKFirms


Parameter:  TimeWaitedGreen

Contained in:  Country
Used in:  StatKFirms


Parameter:  WaitTimeBrown

Contained in:  Country
Used in:  StatKFirms


Parameter:  WaitTimeFirms

Contained in:  Country
Used in:  StatKFirms


Parameter:  WaitTimeGreen

Contained in:  Country
Used in:  StatKFirms


Parameter:  BrownGOSKShare

Contained in:  Country
Used in:  StatKFirms


Parameter:  GreenGOSKShare

Contained in:  Country
Used in:  StatKFirms


Parameter:  FirmsGOSKShare

Contained in:  Country
Used in:  StatKFirms


Variable:  StatEF

Contained in:  Country
Used in:  (never used)
Using:  BrownGOSShare, GreenGOSShareEFType, RevenuesEF, GOSEF

Equation code:

EQUATION("StatEF")
/*
*/
v[20]=v[30]=v[21]=v[31]=0;
CYCLE(cur,"EnergyFirm")
{
v[0]=VS(cur,"EFType");
if(v[0]==0)
{ // it's a brown firm
v[1]=VS(cur,"RevenuesEF");
v[2]=VS(cur,"GOSEF");
v[20]+=v[1]; // sum of brown revenues
v[30]+=v[2]; // sum of brown GOS
}
if(v[0]==1)
{ // it's a green firm
v[11]=VS(cur,"RevenuesEF");
v[12]=VS(cur,"GOSEF");
v[21]=+v[11]; // sum of green revenues
v[31]+=v[12]; // sum of green GOS
}
}
v[20]==0 ? v[40]=0 : v[40]=v[30]/v[20];
v[21]==0 ? v[41]=0 : v[41]=v[31]/v[21];

WRITE("BrownGOSShare",v[40]);
WRITE("GreenGOSShare",v[41]);

RESULT(1 )


Parameter:  BrownGOSShare

Contained in:  Country
Used in:  StatEF


Parameter:  GreenGOSShare

Contained in:  Country
Used in:  StatEF


Variable:  StatFirms

Contained in:  Country
Used in:  (never used)
Using:  FirmsGOSShareMonetarySales, GOS

Equation code:

EQUATION("StatFirms")
/*
*/
v[11]=v[12]=0;
CYCLE(cur,"Firm")
{
v[1]=VS(cur,"MonetarySales");
v[2]=VS(cur,"GOS");
v[11]+=v[1]; // sum of MonetarySales
v[12]+=v[2]; // sum of GOS
}
WRITE("FirmsGOSShare", v[12]/v[11]); //UNRECOGNISE GRAMMAR ERROR
RESULT(1 )


Parameter:  FirmsGOSShare

Contained in:  Country
Used in:  StatFirms


Variable:  dGDP

Contained in:  Country
Used in:  (never used)
Using:  GDP

Equation code:

EQUATION( "dGDP" )
/*
Gross domestic product (log) growth rate
*/
RESULT(t>1 ? log(V("GDP")+1) - log(VL("GDP",1)+1) : 0)


Parameter:  Unemployment

Contained in:  Country
Used in:  UnemploymentRate


Variable:  VacancyRate

Contained in:  Country
Used in:  (never used)
Using:  NbrWorkers, TotVacancies

Equation code:

EQUATION( "VacancyRate" )
/*
number of vacancies over employment
*/
v[0]=V("TotVacancies");
v[1]=V("NbrWorkers");
RESULT(v[0]/v[1] )


Parameter:  BrownKprice

Contained in:  Country
Used in:  StatKFirms


Parameter:  GreenKprice

Contained in:  Country
Used in:  StatKFirms


Parameter:  FirmsKprice

Contained in:  Country
Used in:  StatKFirms


Parameter:  BrownKProductivity

Contained in:  Country
Used in:  StatKFirms


Parameter:  GreenKProductivity

Contained in:  Country
Used in:  StatKFirms


Parameter:  FirmsKProductivity

Contained in:  Country
Used in:  StatKFirms


Parameter:  BrownWaitTime

Contained in:  Country
Used in:  StatKFirms


Parameter:  GreenWaitTime

Contained in:  Country
Used in:  StatKFirms


Parameter:  FirmsWaitTime

Contained in:  Country
Used in:  StatKFirms


Parameter:  TotProfit

Contained in:  Country
Used in:  LTTotProfit, AggProductivity


Variable:  TaxRevenues

Contained in:  Country
Used in:  (never used)
Using:  SumTaxF, SumTaxK, SumTaxEF

Equation code:

EQUATION("TaxRevenues")
/*
Global tax revenues
*/

v[0] = V("SumTaxF");
v[1] = V("SumTaxEF");
v[2] = V("SumTaxK");

RESULT(v[0]+v[1]+v[2] )


Parameter:  taxrate

Contained in:  Country
Used in:  TaxF, TaxK, TaxEF


Parameter:  GovernmentExpenses

Contained in:  Country
Used in:  GovernmentFund, Subsidies


Variable:  GovernmentFund

Contained in:  Country
Used in:  FinancialTrading, InterestGovFund, GovernmentFund, CheckFinBalance
Using:  GovernmentExpenses, GovernmentFund, InterestGovFund, GovDemTotSumTaxF, IncomeTaxTot, SumTaxK, SumTaxEF

Equation code:

EQUATION("GovernmentFund")
/*
Money available to the government
*/
v[0] = VL("GovernmentFund",1);
v[1] = V("SumTaxF");
v[2] = V("SumTaxK");
v[3] = V("SumTaxEF");
v[4] = V("GovernmentExpenses");
v[6] = VL("InterestGovFund",1);
v[7] = VL("IncomeTaxTot",1);
v[8] = VL("GovDemTot",1);

v[5]=v[0]+v[1]+v[2]+v[3]-v[4]-v[6]-v[8]+v[7];
RESULT(v[5] )


Parameter:  minShareGovGDP

Contained in:  Country
Used in:  GovernmentExpenses


Parameter:  maxShareGovGDP

Contained in:  Country
Used in:  GovernmentExpenses


Parameter:  shareGovGDP

Contained in:  Country
Used in:  GovernmentExpenses


Variable:  InterestGovFund

Contained in:  Country
Used in:  BankCapital, GovernmentFund
Using:  GovernmentFundInterestRate

Equation code:

EQUATION("InterestGovFund")
/*
Interest paid on gov. debt
*/
v[0] = V("GovernmentFund");
v[1] = V("InterestRate");
v[2]=-v[1]*v[0];
RESULT(v[2] )


Variable:  ENGDP

Contained in:  Country
Used in:  (never used)
Using:  GDP, TotEnergyConsumption

Equation code:

EQUATION("ENGDP")
/*
*/
v[1]=V("TotEnergyConsumption");
v[2]=V("GDP");
RESULT(v[1]/v[2] )


Variable:  GovDemTot

Contained in:  Country
Used in:  GovernmentFund, GovDemHH, GovDemTot
Using:  GDP, GDPl, GDPnom, GovDemTot, shareGDdown, shareGDup

Equation code:

EQUATION("GovDemTot")
/*
Total government demand
*/
v[1] = V("shareGDup");
V("GDPnom");
v[3] = V("GDPl");
if(t==2)
 END_EQUATION(v[3]*v[1]);
v[0] = VL("GovDemTot", 1);
v[5] = V("shareGDdown");

v[2] = V("GDP");
if(v[2]>v[3])
 v[4]=v[1]*(v[2]-v[3]);
else
 v[4]=v[5]*(v[2]-v[3]);

v[6]=v[0]+v[4];
RESULT(v[6] )


Parameter:  shareGDdown

Contained in:  Country
Used in:  GovDemTot


Parameter:  shareGDup

Contained in:  Country
Used in:  GovDemTot


Parameter:  IncomeTaxShare

Contained in:  Country
Used in:  IncomeTax


Object:  Supply

Contained in:  Root—>Stats—>Country
Containing:  Firm

Variables:  
Parameters:  

Parameter:  aES

Contained in:  Supply
Used in:  ExpectedSales


Variable:  InvHerfIndex

Contained in:  Supply
Used in:  (never used)
Using:  TotalSalesUnitSales

Equation code:

EQUATION("InvHerfIndex")
/*
Inverse Herfindahl Index for firm sales in each sector
*/
v[0]=0;
v[1]=0;
CYCLE(cur, "Firm")
 {
  v[2]=VS(cur,"UnitSales");
  v[0]+=v[2];
 }
WRITE("TotalSales",v[0]);
CYCLE(cur, "Firm")
 {
 v[3]=VS(cur,"UnitSales");
 //v[4]=v[3]/v[0];
 v[0]==0 ? v[4]=0 : v[4]=v[3]/v[0];
 v[1]+=(v[4]*v[4]);
 }
//v[5]=1/v[1];
v[1]==0 ? v[5]=0 : v[5]=1/v[1];
RESULT(v[5] )


Parameter:  TotalSales

Contained in:  Supply
Used in:  InvHerfIndex


Parameter:  innoInterval

Contained in:  Supply
Used in:  ProdInno


Parameter:  aLearningK

Contained in:  Supply
Used in:  IncLearningK


Function:  Entry

Contained in:  Supply
Used in:  Demography
Using:  AvCurrentProductivity, MinWage, Trade, minVisibility, ControlPremiaIncomeCounterIdFirm, AvMaxEfficiencyAge, CapitalCapacity, CapitalStock, DesiredQ, DesiredUnusedCapacity, EN, ExpectedSales, Health, IdFirm, KapitalNeed, LaborForce, LaborForceL, LaborGrowth, MaxLaborProductivity, MonetarySales, MonetarySalesL, MovAvExpSales, MovAvProfit, Ms, MsSector, NumK, Profit, Q, RatioVacancies, SmoothProfit, Stocks, UnitDemand, UnitSales, Vacancies, Visibility, Waiting, backlog, backlogSales, numBLI, price, product, smoothMonSales, backlogSalesL, flagNewEntrantIdCh, xIncProductivity, IncSkillBiais, K, KAge, KExpenditures, IncLearningK, IncEfficiency, PrincipalF, NumWorkers, wage, wagecoeff, IdLabor, nu, blQ, CashFNumClass, PlaceOrder, IdGood, FrontierX, SUnitSales, newFirmKNeed, msEntrantsIdsFirm

Equation code:

EQUATION("Entry")
/*
Entry of new firms, function triggered by SectorEntry
*/
//V("ControlInvestment");

 v[0]=t;
 if(t==1)
  END_EQUATION(0);
//sprintf(msg, "\n Entry(%g)", v[0]); plog(msg);
V("ControlPremiaIncome");
V("Trade");


v[1]=VS(c,"IdGood");
cur1=ADDOBJ("Firm");
WRITES(cur1, "flagNewEntrant", 1);
//INTERACT("New Firm added",v[1]);
cur1->hook=c;
WRITELS(cur1,"Age",0, t);
WRITELS(cur1,"Visibility",V("minVisibility"), t);
WRITES(cur1,"IdFirm",v[20]=V("CounterIdFirm"));
//INTERACT("Entry IdFirm",v[20]);
cur5=ADDOBJS(c,"sFirm");

WRITES(cur5,"IdsFirm",v[20]);
cur5->hook=cur1;
cur1->hook=cur5;

WRITES(cur1,"product",v[1]);
cur=SEARCHS(cur1,"PNeed");
cur2=ADDOBJS(cur,"Ch");
WRITES(cur2,"IdCh",2);
v[2]=VS(c,"FrontierX");
WRITELS(cur2,"x",v[2],t);

cur3=SEARCHS(cur1,"Engineers");
cur4=SEARCH_CND("NumClass",0);
cur3->hook=cur4;
cur3=SEARCH_CNDS(cur1,"IdLabor",1);
cur4=SEARCH_CND("NumClass",1);
cur3->hook=cur4;
cur = ADDOBJS(cur1, "Labor");
WRITES(cur, "IdLabor", 2);
cur4=SEARCH_CND("NumClass",2);
cur->hook=cur4;

v[4]=V("MinWage");
//INTERACTS(cur1,"Boh",v[1]); /*********************/

cur2=SEARCHS(cur1,"BankF");
cur3=SEARCHS(p->up,"Bank");
WRITELS(cur2, "CashF", 0,t);

cur4=SEARCHS(cur1,"Capital");
if(cur4==NULL)
INTERACT("NULLcur4 Entry",v[0]);

cur2->hook=cur3;

WRITES(cur4,"IncProductivity",0);
WRITES(cur4, "PrincipalF", 0);


WRITELS(cur1,"MonetarySales",0, t);
WRITELS(cur1,"Q",0, t);
WRITELS(cur1,"backlog",0, t);
v[2] = VS(cur1->hook,"SUnitSales");
v[3] = VS(cur1->hook, "msEntrants");
WRITELS(cur1,"ExpectedSales",v[2]*v[3], t);
WRITELS(cur1,"DesiredQ",v[2]*v[3], t);
WRITELS(cur1,"CapitalStock",0, t);
WRITELS(cur1,"Ms",0, t);
WRITELS(cur1,"CapitalCapacity",0, t);
WRITELS(cur1,"MovAvProfit",0, t);
WRITELS(cur1,"Stocks",0, t);
WRITELS(cur1,"price",1, t);
WRITELS(cur1,"backlogSales",0, t);
WRITELS(cur1,"backlogSalesL",0, t);
WRITELS(cur1,"Profit",0, t);
WRITELS(cur1,"MsSector",0, t);
WRITELS(cur1,"NumK",0, t);
WRITELS(cur1,"MovAvExpSales",0, t);
WRITELS(cur1,"LaborForce",0, t);
WRITELS(cur1,"LaborForceL",0, t);
WRITELS(cur1,"UnitDemand",0, t);
WRITELS(cur1,"EN",0, t);
WRITELS(cur1,"LaborGrowth",0, t);
WRITELS(cur1,"UnitSales",0, t);

v[2] = VS(cur1->hook, "newFirmKNeed");
WRITELS(cur1,"KapitalNeed",v[2], t);
WRITELS(cur1,"MaxLaborProductivity",1, t);



WRITELS(cur1,"Vacancies",0, t);
WRITELS(cur1,"MonetarySalesL",1, t);
WRITELS(cur1,"Health",1, t);
WRITELS(cur1,"smoothMonSales",1, t);
WRITELS(cur1,"Visibility",V("minVisibility"), t);
WRITELS(cur1,"SmoothProfit",0, t);
WRITELS(cur1,"RatioVacancies",0, t);

WRITELS(cur4,"IncLearningK",1,t);
WRITELS(cur4,"IncSkillBiais",0.2,t);
WRITES(cur4, "IncProductivity", V("AvCurrentProductivity"));
WRITELS(cur4,"KAge",0,t);

v[50]=V("AvMaxEfficiency");
WRITELS(cur4,"IncEfficiency",0,t);

WRITELS(cur4,"K",0,t);
WRITELS(cur4,"KExpenditures",0,t);



WRITES(cur1, "numBLI", 0);

v[44]=0;
CYCLE_SAFES(cur1, cur, "blItem")
{
if(v[44]==1)
DELETE(cur);
else
WRITES(cur, "blQ", 0);
v[44]=1;
}

cur7=SEARCH_CND("NumClass",0);
cur3=SEARCH("Engineers");
cur3->hook=cur7;

//INTERACTS(cur1,"Boh1.5",v[1]); /*********************/

WRITELS(cur1, "CapitalStock", 0, t);//place a fake value with a lag, so that the following line forces the variable to be computed
WRITELS(cur1, "MovAvExpSales", 0, t);
WRITELS(cur1, "ExpectedSales", 0, t);
WRITELS(cur1, "MonetarySales", 0, t);


//INTERACTS(cur1,"Boh2",v[1]); /*********************/

v[22]=VL("MinWage",1);
CYCLES(cur1, cur, "Labor")
     {
      v[14]=VS(cur,"IdLabor");
      cur3=SEARCH_CND("NumClass",v[14]);
      cur->hook=cur3;
      
      if(v[14]==1)
       { // compute the first tier workers given their productivity and production needs
        v[2]=VS(cur1,"MaxLaborProductivity");
        v[8]=VS(cur1,"CapitalCapacity");
        v[9]=v[8];
        v[4]=VS(cur1,"DesiredUnusedCapacity");
        v[3]=v[4]*(v[9]/v[2]); // number of workers in the first layer in the first period
        v[8] = VS(cur, "nu");
        v[3]=1/v[8]+1;
        WRITELLS(cur,"NumWorkers",v[3],t,1);
        WRITELS(cur,"NumWorkers",v[3],t);
        v[21]=VS(cur,"wagecoeff");
        v[23]=v[22]*v[21];
        WRITELS(cur,"wage",v[23], t);
       }
      else
       {// when above the first tier workers...
        v[18]=VS(cur,"IdLabor");
        v[76]=v[18]; //Maximum class
        cur3=SEARCH_CND("NumClass",v[18]);
        cur->hook=cur3;
        cur2=SEARCH_CNDS(cur->up,"IdLabor",v[18]-1);
        v[17]=VS(cur2,"nu"); //given the worker ratio between tiers of the tier below
        v[19]=VS(cur2,"NumWorkers"); //and the number of workers in the previous tier
        v[6]=v[19]/v[17]; // compute the required executives
        v[24]=VS(cur,"nu"); // given the worker ration between tiers of the present tier (use different worker ratios in case we want to change it along the hierarchical structure)
        WRITELLS(cur,"NumWorkers",v[6], t,1);
        WRITELS(cur,"NumWorkers",v[6],t);
        v[25]=VLS(cur2,"wage",1);
        v[26]=VS(cur,"wagecoeff");
        v[27]=v[25]*v[26];
        WRITELS(cur,"wage",v[27], t);
        if(v[6]>=v[24] && v[18]>=2) //IMPORTANT: this init expects to be TWO (2) layers of workers, then it creates the additional ones as requested by the initial capital
         {
          cur3=ADDOBJ_EXS(cur->up,"Labor",cur);
          WRITES(cur3,"IdLabor",v[18]+1);
          v[20]=v[6]/v[24];
          WRITELLS(cur3,"NumWorkers",v[20], t,1);
          WRITELS(cur3,"NumWorkers",v[20],t);
          v[28]=v[27]*v[26];
          WRITELS(cur3,"wage",v[28], t);
         }
       }

     }

//INTERACTS(cur1,"Boh3",v[1]); /*********************/


//INTERACT("Entry",v[0]);
V_CHEAT("PlaceOrder", cur1);
WRITES(cur1, "Waiting", 1);
RESULT( 1)


Variable:  Exit

Contained in:  Supply
Used in:  BankCapital, ExitEF, Demography
Using:  ClearExitRecord, Trade, minAgeExit, minRRoKExit, ControlPremiaIncome, ControlLaborCostExitFlag, CapitalDestroyedAge, Health, IdFirm, WaitingPrincipalF, DebtF, NetWorth, RRoK, CashFNumOrdersKAmount, KCompletion, TimeWaited, Kproductivity, IdClient, KEfficiency, NFirmsS, minHealth, numExit, AvAgeDeath, NonPerformingLoansTotal, NPLF

Equation code:

EQUATION("Exit")
/*
Remove firms with too poor Health
*/
V("Trade");
//V("ControlInvestment");
 v[0]=t;
//sprintf(msg, "\n Exit(%g)", v[0]); plog(msg);
V("ControlPremiaIncome");
V("ControlLaborCost");
V("ClearExitRecord");
v[4]=v[70]=0;

cur5 = SEARCHS(p->up,"Bank");
WRITES(cur5,"NonPerformingLoansTotal",0);
WRITES(cur5,"NPLF",0);

v[18]=V("minAgeExit");
v[19]=V("minRRoKExit");
WRITE("CapitalDestroyed", 0);
CYCLE_SAFE(cur, "Firm")
 {
  v[6]=VS(cur,"Waiting");
  v[16]=VS(cur,"Age");
  if(v[16]>v[18]) //don't kill firms waiting for a capital good to be delivered.
   {
    v[2]=VS(cur->hook,"minHealth");
    v[3]=VS(cur,"Health");
    cur2=SEARCHS(cur,"BankF");
    v[20]=VS(cur2,"DebtF");//xxx
    v[70]+=v[20];
    v[7]=VS(cur,"NetWorth");
    v[17]=VS(cur,"RRoK");
// if(v[3]<v[2])
// if(v[7]<0)
    v[27] = VS(cur, "CashF");
    if(v[17]<v[19] && v[27]<0 && VS(cur->hook->up,"NFirmsS")>1)
     {
       if(v[6]==1)
        {//firm is waiting an order, to be removed
         v[30] = VS(cur, "IdFirm");
         cur2 = SEARCH_CND("IdClient", v[30]);
         if(cur2==NULL)
          INTERACTS(cur, "Err. exiting waiting firm", v[30]);
         else
          {
           if(INCRS(cur2->up, "NumOrders",-1)==0)
            {
             WRITES(cur2,"KAmount",0);
             WRITES(cur2,"KCompletion",0);
             WRITES(cur2,"TimeWaited",0);
             WRITES(cur2,"Kproductivity",0);
             WRITES(cur2,"KEfficiency",0);
             WRITES(cur2, "IdClient", -1);
             cur2->hook=NULL;
            }
           else
            {
             DELETE(cur2);
            }
          }
        }
       v[4]-=v[27];
      INCRS(cur->hook->up,"NFirmsS",-1);
      v[5]=VS(cur,"Age");
      if(V("ExitFlag")==1 )
        INTERACTS(cur,"Dying", v[7]);
      INCRS(cur->hook->up,"AvAgeDeath",v[5]);
      INCRS(cur->hook->up,"numExit",1);
      v[20]=0;
      CYCLES(cur, cur1, "Capital")
      {
       v[20]+=VS(cur1, "PrincipalF");
      }
v[4]+=v[20];
      DELETE(cur->hook);
      DELETE(cur);
     }
   }
 }
//cur5 = SEARCHS(p->up,"Bank");
INCRS(cur5,"NonPerformingLoansTotal",v[4]);
WRITES(cur5,"NPLF",v[4]);
RESULT(v[4] )


Function:  CounterIdFirm

Contained in:  Supply
Used in:  Entry
Using:  (none)

Equation code:

EQUATION("CounterIdFirm")
/*
Issue idFirm progressive numbers
*/

RESULT(CURRENT+1 )


Parameter:  coefMarkupVar

Contained in:  Supply
Used in:  markupXXX


Parameter:  CapitalIntens

Contained in:  Supply
Used in:  CapitalStock, MaxKQ, MaxLaborProductivity, KapitalNeed


Parameter:  ExitFlag

Contained in:  Supply
Used in:  Exit


Parameter:  DivisorLiquidityFinance

Contained in:  Supply
Used in:  (never used)


Parameter:  capMinWage

Contained in:  Supply
Used in:  (never used)


Variable:  TotEN

Contained in:  Supply
Used in:  TotEnergyConsumption
Using:  EN

Equation code:

EQUATION("TotEN")
/*
Total Energy Consumption of FIRMS
*/
RESULT(SUM("EN") )


Parameter:  ControlWaiting

Contained in:  Supply
Used in:  (never used)


Variable:  AvDiffCapacity

Contained in:  Supply
Used in:  (never used)
Using:  DiffCapacity

Equation code:

EQUATION("AvDiffCapacity")
/*
*/
v[0]=AVE("DiffCapacity");

RESULT(v[0] )


Variable:  DiffCapacity

Contained in:  Supply
Used in:  AvDiffCapacity
Using:  CapitalCapacity, LaborCapacity

Equation code:

EQUATION("DiffCapacity")
/*
*/
v[0]=V("CapitalCapacity");
v[1]=V("LaborCapacity");

RESULT(v[0]-v[1] )


Variable:  NbrFirms

Contained in:  Supply
Used in:  WaitingRatio, msEntrants
Using:  (none)

Equation code:

EQUATION("NbrFirms")
/*
Count the number of firm waiting for their new capital
*/
v[0]=COUNT("Firm");

RESULT(v[0] )


Variable:  NbrNotWaiting

Contained in:  Supply
Used in:  (never used)
Using:  Waiting

Equation code:

EQUATION("NbrNotWaiting")
/*
Count the number of firm waiting for their new capital
*/
v[0]=SUM("Waiting");
v[1]=COUNT("Firm");
v[2]=v[1]-v[0];

RESULT(v[2] )


Variable:  NbrWaiting

Contained in:  Supply
Used in:  (never used)
Using:  Waiting

Equation code:

EQUATION("NbrWaiting")
/*
Count the number of firm waiting for their new capital
*/
v[0]=SUM("Waiting");

RESULT(v[0] )


Variable:  TotBacklog

Contained in:  Supply
Used in:  (never used)
Using:  backlog

Equation code:

EQUATION("TotBacklog")
/*
*/
v[0]=SUM("backlog");
RESULT(v[0] )


Variable:  AvMaxLaborProductivity

Contained in:  Supply
Used in:  (never used)
Using:  MaxLaborProductivity

Equation code:

EQUATION("AvMaxLaborProductivity")
/*
*/
v[0]=AVE("MaxLaborProductivity");

RESULT(v[0] )


Variable:  TotLaborForce

Contained in:  Supply
Used in:  ControlWorkers, WorkersRatio, LaborForceRatio
Using:  LaborForce

Equation code:

EQUATION("TotLaborForce")
/*
*/
v[0]=SUM("LaborForce");

RESULT(v[0] )


Parameter:  NumWorkersMaxGr

Contained in:  Supply
Used in:  (never used)


Parameter:  NumWorkersMinInc

Contained in:  Supply
Used in:  (never used)


Variable:  TotNumWorkers

Contained in:  Supply
Used in:  (never used)
Using:  NumWorkers

Equation code:

EQUATION("TotNumWorkers")
/*
*/
v[1]=SUM("NumWorkers");

RESULT(v[1] )


Variable:  TotUnitDemand

Contained in:  Supply
Used in:  (never used)
Using:  UnitDemand

Equation code:

EQUATION("TotUnitDemand")
/*
*/
v[0]=SUM("UnitDemand");

RESULT(v[0] )


Variable:  TotQ

Contained in:  Supply
Used in:  TotBacklogRatio, TotBacklogRatio
Using:  Q

Equation code:

EQUATION("TotQ")
/*
*/
v[0]=SUM("Q");

RESULT(v[0] )


Parameter:  sPrice

Contained in:  Supply
Used in:  (never used)


Parameter:  aClearingPrice

Contained in:  Supply
Used in:  ClearingPrice


Parameter:  aaNW

Contained in:  Supply
Used in:  aNW


Variable:  AvMaxEfficiency

Contained in:  Supply
Used in:  Entry
Using:  MaxEfficiency

Equation code:

EQUATION("AvMaxEfficiency")
/*
*/
v[1]=AVE("MaxEfficiency");

RESULT(v[1] )


Parameter:  aNWmin

Contained in:  Supply
Used in:  aNW


Parameter:  aNWmax

Contained in:  Supply
Used in:  aNW


Parameter:  aNWsmooth

Contained in:  Supply
Used in:  aNW


Variable:  SumWagePrem

Contained in:  Supply
Used in:  ControlPremiaIncome
Using:  WagePrem

Equation code:

EQUATION("SumWagePrem")
/*
Sum of Premia distributed by Firms
 */
v[0]=v[1]=0;
CYCLE(cur, "Firm")
{
  v[0]=VS(cur,"WagePrem");
  v[1]+=v[0];
}
RESULT(v[1] )


Variable:  SumLaborCost

Contained in:  Supply
Used in:  ControlLaborCost
Using:  LaborCost

Equation code:

EQUATION("SumLaborCost")
/*
Sum of wages distributed by Firms
 */
v[0]=v[1]=0;
CYCLE(cur, "Firm")
{
  v[0]=VS(cur,"LaborCost");
  v[1]+=v[0];
}
RESULT(v[1] )


Variable:  SumInvestment

Contained in:  Supply
Used in:  ControlInvestment
Using:  InvestmentSpending

Equation code:

EQUATION("SumInvestment")
/*
Sum of investment spending of Firms
 */
 v[0]=t;
//sprintf(msg, "\n SumInvestment(%g)", v[0]); plog(msg);
v[0]=v[1]=0;
CYCLE(cur, "Firm")
{
  v[0]=VS(cur,"InvestmentSpending");
  v[1]+=v[0];
}
RESULT(v[1] )


Variable:  TotEN2

Contained in:  Supply
Used in:  (never used)
Using:  EN

Equation code:

EQUATION("TotEN2")
/*
Total Energy Consumption of FIRMS
*/
v[1]=v[2]=0;
CYCLE(cur,"Firm")
{
v[1]=VS(cur,"EN");
v[2]+=v[1];
}

RESULT(v[2] )


Variable:  TotStocks

Contained in:  Supply
Used in:  (never used)
Using:  Stocks

Equation code:

EQUATION("TotStocks")
/*
*/
v[0]=SUM("Stocks");
RESULT(v[0] )


Variable:  SumRevenues

Contained in:  Supply
Used in:  (never used)
Using:  Revenues

Equation code:

EQUATION("SumRevenues")
/*
*/
RESULT(SUM("Revenues") )


Variable:  SumBacklogSales

Contained in:  Supply
Used in:  (never used)
Using:  backlogSales

Equation code:

EQUATION("SumBacklogSales")
/*
*/
v[0]=v[1]=0;
CYCLE(cur, "Firm")
{
  v[0]=VS(cur,"backlogSales");
v[1]+=v[0];
}
RESULT(v[1] )


Variable:  SumBacklogCh

Contained in:  Supply
Used in:  (never used)
Using:  backlogCh

Equation code:

EQUATION("SumBacklogCh")
/*
*/
v[0]=v[1]=0;
CYCLE(cur, "Firm")
{
  v[0]=VS(cur,"backlogCh");
v[1]+=v[0];
}
RESULT(v[1] )


Variable:  SumBacklogValueCh

Contained in:  Supply
Used in:  (never used)
Using:  backlogValueCh

Equation code:

EQUATION("SumBacklogValueCh")
/*
*/
v[0]=v[1]=0;
CYCLE(cur, "Firm")
{
  v[0]=VS(cur,"backlogValueCh");
v[1]+=v[0];
}
RESULT(v[1] )


Variable:  SumRdExpenditure

Contained in:  Supply
Used in:  ControlRdExpenditure, ControlLaborCost
Using:  RdExpenditure

Equation code:

EQUATION("SumRdExpenditure")
/*
*/
V("RdExpenditure");
RESULT(SUM("RdExpenditure") )


Parameter:  TimeRepayment

Contained in:  Supply
Used in:  InstallmentF, CapitalStock, MaxKExpenditureF


Parameter:  CapitalDestroyed

Contained in:  Supply
Used in:  Exit


Variable:  SumCashF

Contained in:  Supply
Used in:  SumCashFCh, BankControlCapital
Using:  FinancialTradingCashF

Equation code:

EQUATION("SumCashF")
/*
*/
V("FinancialTrading");
v[0]=v[1]=0;
CYCLE(cur, "Firm")
{
  v[0]=VS(cur,"CashF");
v[1]+=v[0];
}
RESULT(v[1] )


Variable:  SumOutstandingDebtFCh

Contained in:  Supply
Used in:  BankControlCapital
Using:  FinancialTradingOutstandingDebtFCh

Equation code:

EQUATION("SumOutstandingDebtFCh")
/*
*/
V("FinancialTrading");
v[0]=v[1]=0;
CYCLE(cur, "Firm")
{
  v[0]=VS(cur,"OutstandingDebtFCh");
v[1]+=v[0];
}
RESULT(v[1] )


Variable:  SumMonetarySales

Contained in:  Supply
Used in:  test
Using:  MonetarySales

Equation code:

EQUATION("SumMonetarySales")
/*
*/
v[0]=SUM("MonetarySales");
RESULT(v[0] )


Variable:  SumInterestDepositsF

Contained in:  Supply
Used in:  BankCapital
Using:  InterestDepositsF

Equation code:

EQUATION("SumInterestDepositsF")
/*
*/
v[0]=0;
CYCLE(cur, "Firm")
{
v[0] += VS(cur, "InterestDepositsF");
}

RESULT(v[0] )


Variable:  SumOverdraftPaymentF

Contained in:  Supply
Used in:  (never used)
Using:  OverdraftPaymentF

Equation code:

EQUATION("SumOverdraftPaymentF")
/*
*/
RESULT(SUM("OverdraftPaymentF") )


Variable:  SumInterestPaymentF

Contained in:  Supply
Used in:  (never used)
Using:  InterestPaymentF

Equation code:

EQUATION("SumInterestPaymentF")
/*
*/
v[0]=0;
CYCLE(cur, "Firm")
{
v[0] += VS(cur, "InterestPaymentF");
}

RESULT(v[0] )


Variable:  UpdateExpenses

Contained in:  Supply
Used in:  ControlDemand
Using:  RdExpenditureWageEngineers

Equation code:

EQUATION("UpdateExpenses")
/*
Variable ensuring that RdExpenditure and WageEngineers are updated, used in ControlDemand
*/

CYCLE(cur,"Firm")
{
VS(cur,"RdExpenditure");
VS(cur,"WageEngineers");
}

RESULT(1 )


Variable:  SumCashFCh

Contained in:  Supply
Used in:  (never used)
Using:  FinancialTrading, Production, TradeSumCashFInvestmentDecision

Equation code:

EQUATION("SumCashFCh")
/*
*/
V("Trade");
V("FinancialTrading");
V("InvestmentDecision");
V("Production");
v[1]=V("SumCashF");
v[2]=VL("SumCashF",1);
RESULT(v[1]-v[2] )


Variable:  SumWaiting

Contained in:  Supply
Used in:  WaitingRatio
Using:  Waiting

Equation code:

EQUATION("SumWaiting")
/*
*/
RESULT(SUM("Waiting") )


Variable:  WaitingRatio

Contained in:  Supply
Used in:  (never used)
Using:  NbrFirms, SumWaiting

Equation code:

EQUATION("WaitingRatio")
/*
*/
v[0]=V("SumWaiting");
v[1]=V("NbrFirms");
RESULT(v[0]/v[1] )


Variable:  SumBacklog

Contained in:  Supply
Used in:  TotBacklogRatio, TotBacklogRatio
Using:  backlog

Equation code:

EQUATION("SumBacklog")
/*
*/
v[0]=v[1]=0;
CYCLE(cur, "Firm")
{
  v[0]=VS(cur,"backlog");
v[1]+=v[0];
}
RESULT(v[1] )


Variable:  SumFirmControlCurrent

Contained in:  Supply
Used in:  (never used)
Using:  FirmControlCurrent

Equation code:

EQUATION("SumFirmControlCurrent")
/*
*/
RESULT(SUM("FirmControlCurrent") )


Parameter:  aVisibility

Contained in:  Supply
Used in:  Visibility


Parameter:  LTGDP

Contained in:  Supply
Used in:  LTGDP, RatioProfitGDP


Parameter:  aLTGDP

Contained in:  Supply
Used in:  LTGDP


Parameter:  aLTProfit

Contained in:  Supply
Used in:  LTTotProfit


Parameter:  RatioProfitGDP

Contained in:  Supply
Used in:  markup


Parameter:  minMarkup

Contained in:  Supply
Used in:  markup, markupXXX, Init


Parameter:  maxMarkup

Contained in:  Supply
Used in:  markup


Parameter:  LTTotProfit

Contained in:  Supply
Used in:  LTTotProfit, RatioProfitGDP


Parameter:  markup

Contained in:  Supply
Used in:  AvMarkup, price, markup, AggProductivity, InitMarkup


Variable:  SumTaxF

Contained in:  Supply
Used in:  GovernmentFund, TaxRevenues
Using:  TaxF

Equation code:

EQUATION("SumTaxF")
/*
Total tax Firm
*/

RESULT(SUM("TaxF") )


Object:  Firm

Contained in:  Root—>Stats—>Country—>Supply
Containing:  PNeed, Capital, Labor, blItem, BankF, Engineers

Variables:  
Parameters:  

Variable:  Age

Contained in:  Firm
Used in:  Entry, Exit, Production, Avx
Using:  (none)

Equation code:

EQUATION("Age")
/*
Age of the firm
*/

RESULT(CURRENT+1 )


Variable:  AvWage

Contained in:  Firm
Used in:  UnitLaborCost, Init, Avx
Using:  TotWage, TotIndividuals

Equation code:

EQUATION("AvWage")
/*
Average wage
*/

v[1]=V("TotWage");
v[2]=V("TotIndividuals");

if(v[1]==0 | v[2]==0)
END_EQUATION(0);

RESULT(v[1]/v[2] )


Parameter:  CapitalCapacity

Contained in:  Firm
Used in:  AvUtilisationRate, UtilisationRate, DiffCapacity, CapitalStock, Entry, Q, NumWorkers, KapitalNeed, Init


Parameter:  CapitalDepress

Contained in:  Firm
Used in:  EN, CapitalStock, MaxKQ, MaxLaborProductivity, KPresentValue


Variable:  CapitalStock

Contained in:  Firm
Used in:  KProductionFlow, CapitalStock, Entry, MaxLaborProductivity, newFirmKNeed, Init, SectEmployment, InitInProgress
Using:  CapitalIntens, TimeRepaymentCapitalCapacity, CapitalDepress, CapitalStock, flagNewEntrantK, KAge, PrincipalF, InstallmentF

Equation code:

EQUATION("CapitalStock")
/*
Compute the depreciation of capital
*/
v[0]=VL("CapitalStock",1);

v[20] = V("flagNewEntrant");
if(v[20]==1)
 END_EQUATION(v[0]);
v[1]=V("CapitalDepress");// depression rate of capital
v[2]=V("CapitalIntens");
v[10]=0;
//if(V("IdFirm")==895)
 //INTERACT("Merde 3", v[0]);

v[20] = V("TimeRepayment");
CYCLE_SAFE(cur, "Capital")
 {
  v[3]=VS(cur,"K");
  v[4]=VS(cur,"KAge");
  v[5]=pow((1-v[1]),v[4]);//computes the depressiation of capital
  v[6]=v[3]*v[5];//computes the actual stock of this capital vintage that can be used
  v[7] = VS(cur, "PrincipalF");
  v[8] = VS(cur, "InstallmentF");
// if(v[6]>1) // Scrap if absolute value is below 1

if( (v[6]/v[0]>0.01 || v[7]>0 || v[8]>0) && v[4]<v[20]*2) // Scrap if relative value is low
   {
    v[10]+=v[6];
   }
  else
   {
    //INTERACTS(cur,"Scrap CapitalStock", v[3]);
    DELETE(cur);
   }
 }

//if(v[10]==0)
 //INTERACT("Merde 2", v[6]);
WRITE("CapitalCapacity",v[10]/v[2]);
RESULT(v[10] )


Parameter:  ConstPrice

Contained in:  Firm
Used in:  Init, GDPnom, SectEmployment


Variable:  DesiredQ

Contained in:  Firm
Used in:  Entry, Q, NumWorkers, ExpectedProfit2
Using:  TradeDesiredStocks, ExpectedSales, Stocks, backlog

Equation code:

EQUATION("DesiredQ")
/*
Production, as a function of the difference between past stocks and desired ones
*/
V("Trade");
v[0]=VL("Stocks",1);
v[1]=V("DesiredStocks"); // percentage of expected sales firms want to stock to face unexpected demand
v[2]=VL("backlog",1);
v[4]=V("ExpectedSales");
v[3]=v[1]*v[4];
v[6]=max(0,v[3]+v[2]+v[4]-v[0] );

RESULT(v[6])


Parameter:  DesiredStocks

Contained in:  Firm
Used in:  markupXXX, DesiredQ, KapitalNeed


Parameter:  DesiredUnusedCapacity

Contained in:  Firm
Used in:  Entry, NumWorkers, KapitalNeed, Init


Variable:  EN

Contained in:  Firm
Used in:  ENCost, ENCost, UnitEnergyCost, TotEN, TotEN2, Entry
Using:  CapitalDepress, QIncProductivity, K, KAge, IncEfficiency

Equation code:

EQUATION("EN")
/*
Compute the energy used in production
*/

v[10]=V("Q");
v[0]=0;
v[1]=0;
v[2]=V("CapitalDepress");//defines the depression rate of capital

CYCLE(cur, "Capital")
 {
  v[3]=VS(cur,"K");
  v[4]=VS(cur,"KAge");
  v[5]=VS(cur,"IncEfficiency");
  v[8] = VS(cur, "IncProductivity");
  v[6]=pow((1-v[2]),v[4]);//computes the depreciation of capital
  v[7]=v[3]*v[6];//computes the actual stock of this capital vintage that can be used

  //v[9]=v[6]*v[8]; //max production with this capital vintage
  v[9]=v[7]*v[8]; //max production with this capital vintage

  v[11]=min(v[10], v[9]);//actual production with this vintage
  v[10]-=v[11]; //remaining production
  if(v[5]>0)
   v[0]+=v[11]/v[5];//energy consumed by this vintage
   
}

RESULT(v[0] )


Variable:  ExpectedProfit

Contained in:  Firm
Used in:  (never used)
Using:  ExpectedSales, LaborCost, RdExpenditure, price, ENCost, CapitalCostF

Equation code:

EQUATION("ExpectedProfit")
/*
Level of profits perceived by the firm, which reflects the expected gains from the sales.
To be used as an indicator of profit that is not oscillating as unit sales, and that would allow to use profits to trigger exit from markets
*/
v[0]=V("ExpectedSales");
//v[1]=V("price");
v[1]=VL("price",1);
v[2]=V("LaborCost");
v[4]=V("RdExpenditure");
v[5]=V("ENCost");
v[6] = V("CapitalCostF");

v[3]=v[0]*v[1]-v[2]-v[4] - v[5]-v[6];

RESULT(v[3] )


Variable:  ExpectedProfit2

Contained in:  Firm
Used in:  (never used)
Using:  DesiredQ, LaborCost, price, ENCost, CapitalCostF

Equation code:

EQUATION("ExpectedProfit2")
/*
Level of profits perceived by the firm, which reflects the gains from the desired production
*/
v[0]=V("DesiredQ");
//v[1]=V("price");
v[1]=VL("price",1);
v[2]=V("LaborCost");
v[5]=V("ENCost");
v[6] = V("CapitalCostF");

v[3]=v[0]*v[1]-v[2]-v[5] -v[6];
RESULT(v[3] )


Variable:  ExpectedProfit3

Contained in:  Firm
Used in:  (never used)
Using:  LaborCost, Q, price, ENCost, CapitalCostF

Equation code:

EQUATION("ExpectedProfit3")
/*
Level of profits perceived by the firm, which reflects the gains from the actual production
*/
v[0]=V("Q");
//v[1]=V("price");
v[1]=VL("price",1);
v[2]=V("LaborCost");
v[5]=V("ENCost");
v[6] = V("CapitalCostF");

v[3]=v[0]*v[1]-v[2] -v[5] - v[6];
RESULT(v[3] )


Variable:  ExpectedSales

Contained in:  Firm
Used in:  Entry, MaxKExpenditureF, Visibility, markupXXX, DesiredQ, ExpectedSales, ExpectedProfit, MovAvExpSales, KapitalNeed, Init
Using:  aESExpectedSales, UnitDemand

Equation code:

EQUATION("ExpectedSales")
/*
Smoothed level demand
*/
v[0]=VL("ExpectedSales",1);
v[1]=V("UnitDemand");
//v[1]=VL("UnitSales",1);
v[2]=V("aES");
v[3]=v[0]*v[2]+(1-v[2])*v[1];

RESULT(v[3] )


Variable:  Health

Contained in:  Firm
Used in:  Entry, Exit, Avx
Using:  aHealth, smoothMonSalesNetWorth

Equation code:

EQUATION("Health")
/*
Measure the sustainability of the firm comparing the ratio of (smoothed) monetary sales to cumulated profits.
Values close to 0 approach exit, 1 is perfect health.
*/
v[2]=V("aHealth");

v[1]=V("NetWorth");
if(v[1]>0)
 {
 END_EQUATION(v[2]*CURRENT+ (1-v[2]));
 }
else
 END_EQUATION(v[2]*CURRENT);
v[0]=V("smoothMonSales");

v[4]=min(1,v[0]/v[1]);//minimum between 1 and the ration of sales to (neg.) profits

v[5]=v[2]*CURRENT+(1-v[2])*v[4];

//if(v[5]<0)
// INTERACT("neg.health", v[3]);
RESULT(v[5] )


Parameter:  IdFirm

Contained in:  Firm
Used in:  Entry, Exit, NumWorkers, PlaceOrder, Init, InitInProgress, ControlWaiting


Parameter:  IdTech

Contained in:  Firm
Used in:  PlaceOrder


Variable:  InvestmentDecision

Contained in:  Firm
Used in:  SumCashCCh, SumCashFCh, SumCashKFCh, OutstandingDebtF, SumCashEFCh, FirmControlCurrent, FirmControlCapital, EFirmControlCurrent, BankControlCurrent, OutstandingDebtEFCh, InvestmentDecision, Production, RdExpenditure
Using:  InvestmentDecision, KapitalNeed, Waiting, InvestmentSpending, MaxKExpenditureFAvKPrice, IsEnergyK, PlaceOrder

Equation code:

EQUATION("InvestmentDecision")
/*
Place an order of K if you need it and did not place an order as yet
*/

//sprintf(msg, "\n InvestmentDecision(%g)", v[0]); plog(msg);
WRITE("InvestmentSpending",0);

v[0]=V("Waiting");
if(v[0]==1)
 END_EQUATION(1); //skip the equation if you already placed an order. To be edited to give the possibility to remove a too late order
//we are here only if there is no pending order

v[1]=V("KapitalNeed");
v[2]=V("AvKPrice");

v[10]=0;
v[4] = V("MaxKExpenditureF");
if(v[1]>0 && v[4]>=0 )
 {
  cur = SEARCHS(p->up->up, "Machinery");
  WRITES(cur, "IsEnergyK", 0);
  V("PlaceOrder");
  WRITE("Waiting",1);
  v[10]=1;
 }

v[6]=VL("InvestmentDecision",1);
if(v[6]==1 & v[10]==0)
v[10]=2;

RESULT( v[10])


Variable:  KapitalNeed

Contained in:  Firm
Used in:  InvestmentDecision, Entry, PlaceOrder
Using:  ExtraCapacityCapitalIntensCapitalCapacity, DesiredStocks, DesiredUnusedCapacity, ExpectedSales, LaborCapacity, MaxLaborProductivity, RationingRatioFirm, SmoothProfit, Stocks, Waiting, backlogDebtF, NetWorth, BacklogValue, AvKPrice, InterestRate

Equation code:

EQUATION("KapitalNeed")
/*
Decide whether to order new capital.
*/


v[0]=V("Waiting");
if(v[0]==1)
 END_EQUATION(CURRENT);

V("MaxLaborProductivity");
v[3]=V("CapitalCapacity");
v[4]=V("ExpectedSales");
//v[5]=V("backlog")/10;//a tenth of backlog should be got rid of.
v[5]=V("backlog");//a tenth of backlog should be got rid of.

v[7]=V("DesiredUnusedCapacity");
v[8]=V("CapitalIntens");
v[50]=VL("Stocks",1);
v[51]=V("DesiredStocks"); // percentage of expected sales firms want to stock to face unexpected demand +1


//v[9]=(v[4]+v[5])*v[7];
v[9]=(v[4]*(1+v[51])-v[50]*0.1+v[5])*v[7]; // add stocks' gap to the equation


v[6] = V("ExtraCapacity");
v[23]=V("LaborCapacity")*v[6];
v[24]=min(v[9],v[23]);//increase K if it is the bottleneck, considering also LaborCapacity
v[10]=v[24]-v[3];
v[11]=max(v[10],0);
if(v[11]==0)
 END_EQUATION(0);

v[12]=v[11]*v[8];//desired capital

END_EQUATION(v[12]);

/////// CANCELED ///////////////
v[14]=VL("SmoothProfit",1);
v[16]=V("AvKPrice");
v[17]=V("InterestRate");
v[24]=V("BacklogValue");

v[18]=max(0,v[14]) ;//financial constraints


v[20]=VL("NetWorth",1)-V("DebtF");//Financial feasibility xxx
if(v[20]>=v[12]*v[16])
 {
  WRITE("RationingRatioFirm",1);
  END_EQUATION(v[12]);
 }

v[21]=v[20]/(v[16]*v[12]);
v[12]*=v[21];

WRITE("RationingRatioFirm",v[21]);


RESULT(v[12] )


Variable:  LaborCapacity

Contained in:  Firm
Used in:  DiffCapacity, Q, KapitalNeed, Init
Using:  MaxLaborProductivityNumWorkers

Equation code:

EQUATION("LaborCapacity")
/*
Maximum capacity allowed by currently employed workers on current capital stock
*/
v[0]=0;
v[1]=V("MaxLaborProductivity");
v[2]=VL("NumWorkers",0); // refers only to first layer workers, not to executives
v[4]=v[2]*v[1];

RESULT(v[4] )


Variable:  LaborCost

Contained in:  Firm
Used in:  IncomeBeforeDebtPaymentsF, GOS, Profit, FirmControlCurrent, SumLaborCost, ExpectedProfit, ExpectedProfit2, ExpectedProfit3
Using:  NumWorkers, wage

Equation code:

EQUATION("LaborCost")
/*
Comment
*/
v[0]=0;
CYCLE(cur, "Labor")
 {
  v[1]=VS(cur,"NumWorkers");
  v[2]=VS(cur,"wage");
  v[0]+=v[1]*v[2];
 }

RESULT(v[0] )


Parameter:  LaborForce

Contained in:  Firm
Used in:  LaborForceRatio, TotLaborForce, Entry, UnitLaborCost, Init, Avx, InitInProgress


Parameter:  LaborForceL

Contained in:  Firm
Used in:  Entry, UnitLaborCost, Init, InitInProgress


Parameter:  LaborGrowth

Contained in:  Firm
Used in:  Entry, UnitLaborCost


Variable:  MaxLaborProductivity

Contained in:  Firm
Used in:  AvMaxLaborProductivity, Entry, LaborCapacity, NumWorkers, UnitLaborCost, AvMaxLProd, KapitalNeed, Init, Avx
Using:  InflationCapitalIntensCapitalDepress, CapitalStock, MaxEfficiencyIncProductivity, K, KAge, IncEfficiency

Equation code:

EQUATION("MaxLaborProductivity")
/*
Defines the Theoretical Labor Productivity of the Firm as incorporated in the various capital vintages of the firm.
*/

v[10]=V("CapitalStock");
if(v[10]==0)
END_EQUATION(0);

v[0]=0;
v[1]=v[41]=v[42]=0;
v[2]=V("CapitalDepress");//defines the depression rate of capital
v[40]=V("CapitalIntens");

v[20]=0;
v[30]=VL("Inflation",1);
CYCLE_SAFE(cur, "Capital")
 {
// MULTS(cur,"ResellPrice",(1+v[30]));

  v[3]=VS(cur,"K");
  v[4]=VS(cur,"KAge");
  v[5]=VS(cur, "IncProductivity");
  v[6]=pow((1-v[2]),v[4]);//computes the depreciation of capital
  v[7]=v[3]*v[6];//computes the actual stock of this capital vintage that can be used

// if(v[7]/v[10]>0.01)
// {
    v[0]+=(v[7]*v[5]);
    v[1]+=v[7];
// }
// else
// DELETE(cur);

  v[25]=VS(cur, "IncEfficiency");
v[20]+=(v[7]*v[25]);



}
v[8]=v[0]/v[1];//Max Labor productivity computed as the weighted average of the incorporated productivity in every capital vintages

v[28]=v[20]/v[1];
WRITE("MaxEfficiency", v[28]);

//v[50]=v[1]/v[40];
//WRITE("CapitalStock",v[1]);
//WRITE("CapitalCapacity",v[50]);
RESULT(v[8] )


Parameter:  MonetarySales

Contained in:  Firm
Used in:  IncomeBeforeDebtPaymentsF, StatFirms, GOSShare, GOS, Profit, UnitDemand, Revenues, SumMonetarySales, FirmControlCurrent, ControlRevenues, smoothMonSales, Entry, TTB_multiplWinner, Trade, TradeXXX, RedistributeSales, CheckFinBalance, Avx


Parameter:  MonetarySalesL

Contained in:  Firm
Used in:  Entry, Trade, TradeXXX


Variable:  MovAvExpSales

Contained in:  Firm
Used in:  Entry, RdExpenditure, MovAvExpSales, Init
Using:  ExpectedSales, MovAvExpSales, aExpSales

Equation code:

EQUATION("MovAvExpSales")
/*
Moving average of expected sales.
Used by the firm to decide wether to adopt a prototipe
*/

v[1]=VL("MovAvExpSales",1);
v[2]=VL("ExpectedSales",1);
v[3]=V("aExpSales");
v[4]=v[3]*v[2]+(1-v[3])*v[1];
RESULT(v[4])


Variable:  MovAvProfit

Contained in:  Firm
Used in:  Entry, MovAvProfit
Using:  MovAvProfit, Profit, aProfit

Equation code:

EQUATION("MovAvProfit")
/*
Moving average of the profits.
Test to be uases as an indicator of profits that is not oscillating as unit sales, and allows to use profits to trigger exit from market
*/

v[1]=VL("MovAvProfit",1);
v[2]=VL("Profit",1);
v[3]=V("aProfit");
v[4]=v[3]*v[2]+(1-v[3])*v[1];

RESULT(v[4] )


Variable:  Ms

Contained in:  Firm
Used in:  Entry, AvMaxLProd, Ms, AvPrice
Using:  TotUSalesMs, UnitSales

Equation code:

EQUATION("Ms")
/*
Market share of each firm, computed differently only for firms in the consumable market
*/

v[1]=V("UnitSales");
v[2]=VS(p->up->up,"TotUSales");
v[3]=VL("Ms",1);
if(v[2]>0)
 v[4]=v[1]/v[2];
else
 v[4]=v[3];

RESULT(v[4] )


Parameter:  MsSector

Contained in:  Firm
Used in:  Entry, Avx, HerfIndexS


Parameter:  NumK

Contained in:  Firm
Used in:  Entry


Variable:  ProdInno

Contained in:  Firm
Used in:  (never used)
Using:  TradeinnoIntervalProdShockP, RdExpenditure, product, tInno, zInnoIdPNeedIdCh, x

Equation code:

EQUATION("ProdInno")
/*
The actual product innovation: extraction of a quality given the quality of the good the firm is currently producing
*/


if(INCR("tInno",1)<0)
 END_EQUATION(0);

v[17]=V("RdExpenditure");

V("Trade");
cur1=SEARCH_CND("IdPNeed",0);
cur=SEARCH_CNDS(cur1,"IdCh",2);
v[2]=VS(cur,"x"); // check the current quality level of the produced good
v[4]=V("product"); // the sector in which the firm is currently producing
v[6]=V("ProdShockP")*v[2]; // productivity shock that determines the variance of the product innovation


v[0]=V("zInno"); //probability of hitting an innovation
for(v[14]=v[9]=0; v[9]<v[17]; v[9]++)
{
 if(RND<v[0])
 {
   v[8]=norm(v[2],v[6]); // outcome of the product innovation
   if(v[8]>v[2])
    {
     v[14]++;
     WRITELS(cur,"x",v[8],t);
     v[2]=v[8];
     v[10]=V("innoInterval");
     WRITE("tInno",-1*v[10]);
    }
 }
}

RESULT(v[14] )


Parameter:  ProdShockP

Contained in:  Firm
Used in:  ProdInno


Variable:  Profit

Contained in:  Firm
Used in:  WagePrem, sProfit, TaxF, BalanceF, Entry, Production, MovAvProfit, SmoothProfit, AggProductivity, AvProfit, Avx
Using:  LaborCost, MonetarySales, RdExpenditure, ENCost, CapitalPaymentF, InterestPaymentFInterestDepositsF, OverdraftPaymentF

Equation code:

EQUATION("Profit")
/*
Profit, difference between revenues, total costs and RD
*/
//v[0]=V("Revenues");
v[0]=V("MonetarySales"); //flo

v[2]=V("LaborCost");
v[3]=V("RdExpenditure");
v[4]=V("ENCost");
//v[6]=V("CapitalCostF");
v[7]=V("OverdraftPaymentF");/**/
v[8]=V("InterestDepositsF");/**/

v[9]=V("CapitalPaymentF");
v[10]=V("InterestPaymentF");/**/

/*
if(v[10]==0 || v[9]==0)
 {
  v[11]=0;
  CYCLE(cur, "Capital")
  {
   v[11] += VS(cur, "PrincipalF");
  }
  //if(abs(v[11])>0.000001)
   //INTERACT("Merde-profit", v[11]);
 }
*/

v[5]=v[0]-v[2]-v[3]-v[4]-v[7]+v[8]-v[9]-v[10];
RESULT(v[5] )


Variable:  Q

Contained in:  Firm
Used in:  AvUtilisationRate, UtilisationRate, Control, UnitSales, Stocks, backlog, TotQ, EN, UnitEnergyCost, ClearingPrice, Entry, RedistributeSales, markupXXX, ExpectedProfit3, AggProductivity, Avx
Using:  ExtraCapacityCapitalCapacity, DesiredQ, LaborCapacity

Equation code:

EQUATION("Q")
/*
Actual production, which is the minimum between desired production and constraints
*/

v[6] = V("ExtraCapacity");
v[0]=V("DesiredQ");
v[1]=V("LaborCapacity")*v[6];
v[2]=min(v[0],v[1]);
v[3]=V("CapitalCapacity")*v[6];
v[5]=min(v[3],v[2]);
if(v[5]<0)
INTERACT("neg. Q",v[5]);
RESULT(v[5] )


Parameter:  RatioVacancies

Contained in:  Firm
Used in:  Entry, NumWorkers


Parameter:  RationingRatioFirm

Contained in:  Firm
Used in:  KapitalNeed


Variable:  RdExpenditure

Contained in:  Firm
Used in:  IncomeBeforeDebtPaymentsF, GOS, Profit, UpdateExpenses, FirmControlCurrent, SumRdExpenditure, WageEngineers, NbrEngineers, ExpectedProfit, ProdInno
Using:  InvestmentDecision, MovAvExpSales, roRD

Equation code:

EQUATION("RdExpenditure")
/*
Cumulated profits (not used to invest in kapital) devoted to product R&D
*/

V("InvestmentDecision");
v[0]=V("MovAvExpSales");

v[2]=V("roRD");
v[3]=v[2]*v[0];
v[1]=log(1+v[3]);

RESULT(v[1] )


Variable:  Revenues

Contained in:  Firm
Used in:  ControlRevenues, SumRevenues, GDPnom, Avx, SectEmployment
Using:  TradeMonetarySales, Stocks, UnitDemand, backlog, price, backlogValueCh

Equation code:

EQUATION("Revenues")
/*
Money flowing in
*/
v[10]=t;
//sprintf(msg, "\n Revenues(%g)", v[10]); plog(msg);
V("Trade");
v[5]=V("MonetarySales");
V("UnitDemand");
V("backlog");
V("Stocks");

v[0]=V("UnitDemand");
v[1]=VL("price",1);
//v[2]=V("backlogSales");
v[2]=V("backlogValueCh"); //we assume that backlog are orders paid by households, but not fulfilled xxx
v[3]=(v[0]*v[1]);//+v[2];
RESULT(v[3] )


Variable:  SmoothProfit

Contained in:  Firm
Used in:  Entry, KapitalNeed
Using:  Profit

Equation code:

EQUATION("SmoothProfit")
/*
Comment
*/
v[1]=CURRENT;
if(v[1]==-1)
  v[0]=V("Profit");
else
  v[0]=v[1]*0.9+0.1*V("Profit");
RESULT(v[0] )


Variable:  Stocks

Contained in:  Firm
Used in:  Control, UnitSales, Stocks, backlog, Revenues, NetWorth, ControlRevenues, TotStocks, ClearingPrice, Entry, markupXXX, DesiredQ, KapitalNeed, TotInventories, Avx
Using:  Q, Stocks, UnitSales

Equation code:

EQUATION("Stocks")
/*
Stocks
*/
v[1]=VL("Stocks",1);
v[2]=V("Q");
v[3]=V("UnitSales");

v[0]=v[1]+v[2]-v[3];

if(v[0]<0)
v[0]=0;
// INTERACT("NEG. Stocks",v[3]);
RESULT(v[0] )


Variable:  UnitDemand

Contained in:  Firm
Used in:  Control, UnitSales, backlog, Revenues, ControlRevenues, TotUnitDemand, ClearingPrice, Entry, ExpectedSales
Using:  TradeMonetarySales, price

Equation code:

EQUATION("UnitDemand")
/*
Number of product units demanded
*/
V("Trade"); //ensure that Monetary sales is updated
v[0]=VL("price",1);
v[1]=V("MonetarySales");

if(v[0]==0)
END_EQUATION(0);

RESULT(v[1]/v[0] )


Variable:  UnitEnergyCost

Contained in:  Firm
Used in:  UnitELdiff, price
Using:  EN, QPriceEN

Equation code:

EQUATION("UnitEnergyCost")
/*
Cost of energy for unit of output
*/

v[3]=VL("EN",1);
v[4]=VL("PriceEN",1);
v[5]=VL("Q",1);

if(v[5]>0.01)
 {
v[6]=(v[3]*v[4])/v[5]; // compute the energy cost to produce one final good using lagged values
 }
else
v[6]=0;

RESULT(v[6] )


Variable:  UnitLaborCost

Contained in:  Firm
Used in:  UnitELdiff, price, Avx
Using:  AvWage, LaborForce, LaborForceL, LaborGrowth, MaxLaborProductivityNumWorkers, wage

Equation code:

EQUATION("UnitLaborCost")
/*
Unit labor cost
*/

v[21]=v[22]=v[4]=v[26]=0;
CYCLE(cur, "Labor")
 {
  v[16]=VS(cur,"wage");
  v[17]=VS(cur,"NumWorkers");
  
  if(v[17]==0)
   END_EQUATION(0);
  
  v[25]=VLS(cur,"NumWorkers",1);
  if(v[4]==0)
   {
    v[5]=v[17];
    v[4]=1;
   }
  v[21]+=v[16]*v[17];
  v[22]+=v[17]; // total labour force
  v[26]+=v[25]; //total lagged labour force
 }

if(v[22]>0)
 v[23]=v[21]/v[22];
else
 v[23]=0;
WRITE("AvWage",v[21]/v[22]);
WRITE("LaborForce",v[22]);
WRITE("LaborForceL",v[26]);

if(v[26]>0)
v[30]=v[22]/v[26]-1;
else
v[30]=0;

WRITE("LaborGrowth",v[30]);
/*
v[0]=V("CapitalCapacity");
v[1]=V("LaborCapacity");
v[2]=min(v[0],v[1]);
v[24]=v[21]/v[2];
*/

v[2]=V("MaxLaborProductivity");
if(v[5]>0 && v[2])
 v[24]=v[21]/(v[2]*v[5]);
else
 v[24]=v[21];
RESULT(v[24] )


Variable:  UnitSales

Contained in:  Firm
Used in:  Stocks, ControlRevenues, ClearingPrice, Entry, Ms, TotUSales, InvHerfIndex, GDPnom, Avx, HerfIndexS, SectEmployment
Using:  Q, Stocks, UnitDemand, backlog

Equation code:

EQUATION("UnitSales")
/*
Actual supply
*/

v[1]=V("Q");
v[2]=VL("Stocks",1);

v[3]=V("UnitDemand");
v[4]=VL("backlog",1);

v[5]=v[1]+v[2];//capacity
v[6]=v[3]+v[4];//demand

v[0]=min(v[5],v[6]); //UNRECOGNISE GRAMMAR ERROR

if(v[0]<0)
v[0]=0; //UNRECOGNISE GRAMMAR ERROR

//INTERACT("NegSales", v[7]);
RESULT(v[0] )


Parameter:  Vacancies

Contained in:  Firm
Used in:  VacanciesRatio, aNW, Entry, NumWorkers, TotVacancies


Variable:  Visibility

Contained in:  Firm
Used in:  Entry, TTB_multiplWinner, Trade
Using:  minVisibilityaVisibilityExpectedSales, backlog

Equation code:

EQUATION("Visibility")
/*
Comment
*/
//END_EQUATION(1);
v[0]=V("backlog");
v[1]=CURRENT;
//v[2]=V("MonetarySales");
v[2]=V("ExpectedSales");
if(v[2]<1)
 v[2]=1;

v[3]=(v[2]-v[0])/v[2];

v[4]=max(v[3],V("minVisibility"));

//v[5]=v[1]*0.9+0.1*v[4];
v[6]=V("aVisibility");
v[5]=v[1]*(1-v[6])+v[6]*v[4];

RESULT(v[5] )


Variable:  WagePrem

Contained in:  Firm
Used in:  BalanceF, FirmControlCurrent, ControlPremia, SumWagePrem, Production, CheckFinBalance
Using:  roPremia, roCashProfitwage, IdLabor, Premia, CashFPremiaIncome

Equation code:

EQUATION("WagePrem")
/*
Wage premia distributed, when available to all classes of executives.
*/


v[0]=V("Profit");
v[1]=VL("CashF",1);
v[50]=V("roPremia");
v[4]=V("roCash");

if(v[0]>0)
 v[5]=max(0,(v[0])*v[50]+v[1]*v[4]);
else
 v[5]=0;

v[3]=0;

if(v[5]>0)
 {
  CYCLE(cur, "Labor")
   {
    v[10]=VS(cur,"IdLabor");
    if(v[10]>1)
     {
      v[2]=VS(cur,"wage");
      v[3]+=v[2];
     }
   }

  CYCLE(cur, "Labor")
   {
    v[10]=VS(cur,"IdLabor");
    if(v[10]>1)
     {v[2]=VS(cur,"wage");
      WRITES(cur,"Premia",v[5]*v[2]/v[3]);
      INCRS(cur->hook,"PremiaIncome",v[5]*v[2]/v[3]);
     }
   }
   
   v[20]=0;
   CYCLE(cur,"Labor")
    {
    v[21]=VS(cur,"Premia");
    v[20]+=v[21];
    }
   v[22]=v[20]-v[5];
   if(v[22]>0.000001 | v[22]<-0.000001) // avoid approximation issue
    {
    //v[10]=t;
    //sprintf(msg, "\n WagePrem(%g)", v[22]); plog(msg);
    }
 }
 else
 {
   CYCLE(cur, "Labor")
   {
    WRITES(cur,"Premia",0);
   }
 }

RESULT(v[5] )


Parameter:  Waiting

Contained in:  Firm
Used in:  SumWaiting, KProductionFlow, NbrNotWaiting, NbrWaiting, InvestmentDecision, Entry, Exit, KapitalNeed, ControlWaiting


Parameter:  aExpSales

Contained in:  Firm
Used in:  MovAvExpSales


Parameter:  aHealth

Contained in:  Firm
Used in:  Health


Parameter:  aMonSales

Contained in:  Firm
Used in:  smoothMonSales


Parameter:  aProfit

Contained in:  Firm
Used in:  MovAvProfit


Parameter:  app

Contained in:  Firm
Used in:  TTB_multiplWinner


Variable:  backlog

Contained in:  Firm
Used in:  Control, UnitSales, backlog, Revenues, NetWorth, ControlRevenues, SumBacklog, backlogCh, TotBacklog, Entry, Visibility, markupXXX, DesiredQ, KapitalNeed, Avx
Using:  Q, Stocks, UnitDemand, backlog

Equation code:

EQUATION("backlog")
/*
*/
v[1]=V("Q");
v[2]=VL("Stocks",1);

v[3]=V("UnitDemand");
v[4]=VL("backlog",1);

v[5]=v[1]+v[2];//capacity

v[6]=v[3]-v[5];//change in backlogs

v[0]=v[4]+v[6];

if(v[0]<0)
v[0]=0;

RESULT(v[0] )


Parameter:  backlogSales

Contained in:  Firm
Used in:  SumBacklogSales, Entry


Variable:  betaEff

Contained in:  Firm
Used in:  betaEff, betaProd, PlaceOrder
Using:  MinWagebetaEff, psiPriceEN

Equation code:

EQUATION("betaEff")
/*
compute the value of betaEff depending on the relative changes of energy price and minimum wage.
*/

v[0]=VL("betaEff",1);
v[1]=V("psi");
v[2]=VL("PriceEN",1);
v[3]=V("PriceEN");
v[4]=VL("MinWage",1);
v[5]=V("MinWage");
v[6]=v[3]/v[2]-1; //compute the growth rate of PriceEN
v[7]=v[5]/v[4]-1; //compute the growth rate of MinWage
v[10]=v[0]*(1+(v[6]-v[7])*v[1]);

if(t>2)
{v[11]=v[10];}
else
{v[11]=v[0];}

RESULT(v[11] )


Parameter:  betaPrice

Contained in:  Firm
Used in:  betaProd, PlaceOrder


Variable:  betaProd

Contained in:  Firm
Used in:  PlaceOrder
Using:  betaEff, betaPrice, betaTime

Equation code:

EQUATION("betaProd")
/*
compute the value of betaEff depending on the relative changes of energy price and minimum wage.
*/

v[0]=V("betaEff");
v[1]=V("betaPrice");
v[2]=V("betaTime");

v[10]=1-v[0]-v[1]-v[2];
RESULT(v[10] )


Parameter:  betaTime

Contained in:  Firm
Used in:  betaProd, PlaceOrder


Parameter:  numBLI

Contained in:  Firm
Used in:  Entry, Avx


Variable:  price

Contained in:  Firm
Used in:  UnitDemand, Revenues, NetWorth, ControlRevenues, ClearingPrice, Entry, MaxKExpenditureF, x, RedistributeSales, MinimumPriceSet, ExpectedProfit, ExpectedProfit2, ExpectedProfit3, AvPrice, Init, MinimumInit, Avx
Using:  markupUnitEnergyCost, UnitLaborCost

Equation code:

EQUATION("price")
/*
Markup on the unit production cost
*/
v[10]=V("markup");
v[22]=V("UnitLaborCost"); // labour in the first tier (the ones which define the production capacity)

v[6]=V("UnitEnergyCost");

v[14]=v[10]*(v[22]+v[6]); // add the energy cost to the pricing equation

RESULT(v[14] )


Parameter:  product

Contained in:  Firm
Used in:  Entry, TTB_multiplWinner, TradeXXX, ProdInno, Init, HerfIndexS, InitInProgress


Parameter:  psi

Contained in:  Firm
Used in:  betaEff


Parameter:  roRD

Contained in:  Firm
Used in:  RdExpenditure


Variable:  smoothMonSales

Contained in:  Firm
Used in:  Health, Entry
Using:  TradeMonetarySales, aMonSales

Equation code:

EQUATION("smoothMonSales")
/*
Smoothed value of MonetarySales
*/
V("Trade");
v[0]=V("aMonSales");
v[1]=V("MonetarySales");
RESULT(CURRENT*v[0]+(1-v[0])*v[1] )


Parameter:  tInno

Contained in:  Firm
Used in:  ProdInno


Parameter:  zInno

Contained in:  Firm
Used in:  ProdInno


Variable:  ClearingPrice

Contained in:  Firm
Used in:  (never used)
Using:  aClearingPriceQ, Stocks, UnitDemand, UnitSales, price

Equation code:

EQUATION("ClearingPrice")
/*
Comment
*/

v[0] = VL("price", 1);
v[1] = V("Q");
v[2] = V("Stocks");
v[3] = V("UnitDemand");
v[4] = V("UnitSales");
v[6] = V("aClearingPrice");
if(v[3]+v[4]==0)
 v[5]=-1;
else
 v[5]=v[0]*(1+v[6]*(v[3]-v[4])*2/(v[3]+v[4]));
RESULT(v[5] )


Variable:  aNW

Contained in:  Firm
Used in:  aNW, NumWorkers
Using:  aaNW, aNWmin, aNWmax, aNWsmoothVacancies, aNW

Equation code:

EQUATION("aNW")
/*
*/
//v[0]=VL("MaxLaborProductivity",1);
//v[1]=VL("Q",1);
//v[2]=v[1]-v[0];

//if(v[2]<0)
// v[2]=0;

v[3]=V("aaNW");

v[4]=V("Vacancies");



if(v[4]<1)
v[4]=1;

v[5]=v[3]*log(v[4]);
if(v[5]>1)
v[5]=1;

if(v[5]<V("aNWmin") )
 v[5]=V("aNWmin");
if(v[5]>V("aNWmax"))
 v[5]=V("aNWmax");

v[6]=VL("aNW",1);
//INTERACT("aNW 1", v[6]);
v[7]=V("aNWsmooth")*v[5]+(1-V("aNWsmooth"))*v[6];

//RESULT(v[3]*log(v[2]+1) )
RESULT(v[7] )


Parameter:  MaxEfficiency

Contained in:  Firm
Used in:  AvMaxEfficiency, MaxLaborProductivity


Parameter:  backlogSalesL

Contained in:  Firm
Used in:  Entry


Variable:  ControlPremia

Contained in:  Firm
Used in:  (never used)
Using:  WagePremNumWorkers, PremiaKNbrWorkers

Equation code:

EQUATION("ControlPremia") // does not work because of add-on and removal of tiers
/*
*/

V("NumWorkers");
V("KNbrWorkers");

v[0]=v[1]=0;
CYCLE(cur, "Labor")
{
  v[0]=VS(cur,"Premia");
  v[1]+=v[0];
}
v[2]=V("WagePrem");
v[3]=v[1]-v[2];
//if(v[3]>0.001 | v[3]<-0.001) // avoid approximation issue
//INTERACT("ControlPremia",v[3]);
RESULT(v[3] )


Parameter:  InvestmentSpending

Contained in:  Firm
Used in:  OutstandingDebtF, FirmControlCapital, SumInvestment, KProductionFlow, InvestmentDecision


Variable:  Control

Contained in:  Firm
Used in:  (never used)
Using:  Q, Stocks, UnitDemand, backlog

Equation code:

EQUATION("Control")
/*
Control the allocation of production
*/

v[0]=V("Q");
v[1]=V("UnitDemand");
v[2]=V("Stocks");
v[3]=VL("Stocks",1);
v[4]=V("backlog");
v[5]=VL("backlog",1);

v[6]=v[0]-v[1]-(v[2]-v[3])+(v[4]-v[5]);
//if(abs(v[6]-v[0])>0.001)
 //INTERACT("Control",v[6]);
RESULT( v[6])


Variable:  backlogCh

Contained in:  Firm
Used in:  SumBacklogCh
Using:  backlog

Equation code:

EQUATION("backlogCh")
/*
*/
v[0]=V("backlog");
v[1]=VL("backlog",1);
RESULT(v[0]-v[1] )


Parameter:  backlogValue

Contained in:  Firm
Used in:  backlogValueCh


Parameter:  backlogValueCh

Contained in:  Firm
Used in:  Revenues, SumBacklogValueCh


Parameter:  backlogValueL

Contained in:  Firm
Used in:  backlogValueCh


Variable:  ENCost

Contained in:  Firm
Used in:  IncomeBeforeDebtPaymentsF, GOS, Profit, FirmControlCurrent, ExpectedProfit, ExpectedProfit2, ExpectedProfit3
Using:  ENPriceEN

Equation code:

EQUATION("ENCost")
/*
*/
v[0]=V("EN");
v[1]=V("PriceEN");

RESULT(v[0]*v[1] )


Variable:  MaxKExpenditureF

Contained in:  Firm
Used in:  InvestmentDecision, PlaceOrder
Using:  TimeRepaymentExpectedSales, pricesCashF, sProfit, sInterestRate

Equation code:

EQUATION("MaxKExpenditureF")
/*
Maximum costs of purchasing capital.
It is computed assuming a flow of free cash available represented by sBalanceF for the foreseeable future to finance additional capital interests and repayment.
We approximate the single time repayment cost of borrowing K to be repayed in L periods at interest i as:
R=K [ i / z]

where

z=(1-(1/(1+i)^L))

Consequently, the maximum K the firm can expect to pay is:
K=sBalanceF/[i/z]
*/

v[5] = VL("sCashF", 1);
v[0] = VL("sProfit", 1);
v[1] = V("TimeRepayment");
if(v[0]==0) //presumably time t=1
 {
  v[0] = V("ExpectedSales")*V("price")*v[1];//essentially ignore the constraint
 }
v[2] = max(VL("sInterestRate",1),0.0001);//xxx

if(v[5]<0)
 v[5]=0;
if(v[0]<0)
 v[0]=0;

v[3]=1-pow(1/(1+v[2]),v[1]);
v[4]=(v[0]+v[5]/v[1])/(v[2]/v[3]);

RESULT(v[4] )


Variable:  CapitalCostF

Contained in:  Firm
Used in:  FirmControlCurrent, ExpectedProfit, ExpectedProfit2, ExpectedProfit3
Using:  CapitalPaymentF, InterestPaymentF

Equation code:

EQUATION("CapitalCostF")
/*
Cost of repayment loans
*/
v[0]=V("CapitalPaymentF");
v[1]=V("InterestPaymentF");/**/

RESULT(v[0]+v[1] )


Variable:  CapitalPaymentF

Contained in:  Firm
Used in:  FinancialTrading, Profit, OutstandingDebtF, CapitalCostF, FirmControlCapital
Using:  InstallmentF

Equation code:

EQUATION("CapitalPaymentF")
/*
Cost of repayment principal
*/
v[0]=0;
CYCLE(cur, "Capital")
{
v[0]+=VS(cur, "InstallmentF");
}
RESULT(v[0] )


Variable:  OutstandingDebtF

Contained in:  Firm
Used in:  LiabilitiesF, FinancialTrading, OutstandingDebtF, NetWorth, FirmControlCapital, OutstandingDebtFCh, NetWorthXXX, Init
Using:  InvestmentDecision, InvestmentSpending, CapitalPaymentF, OutstandingDebtFPrincipalF

Equation code:

EQUATION("OutstandingDebtF")
/*
Stock of existing debt
*/
v[0] = VL("OutstandingDebtF",1);
V("InvestmentDecision");
v[1] = V("InvestmentSpending");
v[2] = V("CapitalPaymentF");
v[3] = v[0]+v[1]-v[2];

v[10]=0;
CYCLE(cur, "Capital")
{
v[10]+=VS(cur, "PrincipalF");
}
v[11]=max(abs(v[3]),abs(v[10]));
if(v[11]>10 && abs(v[10]-v[3])/v[11]>0.000001)
 INTERACT("Outstanding debt mismatch", v[3]-v[10]);
RESULT(v[3] )


Variable:  InterestPaymentF

Contained in:  Firm
Used in:  SumInterestPaymentF, FinancialTrading, BankCapital, Profit, CapitalCostF, CheckFinBalance
Using:  InterestF

Equation code:

EQUATION("InterestPaymentF")
/*
Interest payments on outstanding debt
*/
v[0]=0;
CYCLE(cur, "Capital")
{
v[0]+=VS(cur, "InterestF");
}

RESULT(v[0] )


Variable:  FirmControlCapital

Contained in:  Firm
Used in:  (never used)
Using:  FinancialTrading, Production, TradeInvestmentDecision, InvestmentSpending, CapitalPaymentF, OutstandingDebtF

Equation code:

EQUATION("FirmControlCapital")
/*
*/
V("Trade");
V("FinancialTrading");
V("InvestmentDecision");
V("Production");

v[6]=V("CapitalPaymentF");
v[5]=V("InvestmentSpending");
v[10]=V("OutstandingDebtF");
v[11]=VL("OutstandingDebtF",1);

v[20]=(v[10]-v[11])-v[5]+v[6];
RESULT(v[20] )


Variable:  FirmControlCurrent

Contained in:  Firm
Used in:  SumFirmControlCurrent
Using:  FinancialTrading, Production, TradeInvestmentDecision, LaborCost, MonetarySales, RdExpenditure, WagePrem, ENCost, CapitalCostFCashF, InterestDepositsF, OverdraftPaymentF, CashFAdjustment

Equation code:

EQUATION("FirmControlCurrent")
/*
*/
V("Trade");
V("FinancialTrading");
V("InvestmentDecision");
V("Production");



//v[0]=V("Revenues");
v[0]=V("MonetarySales"); //flo

v[1]=V("WagePrem");
v[2]=V("LaborCost");
v[3]=V("RdExpenditure");
v[4]=V("ENCost");
v[6]=V("CapitalCostF");
v[7]=VL("OverdraftPaymentF",0);
v[8]=VL("InterestDepositsF",0);
v[12]=V("CashF");
v[13]=VL("CashF",1);
v[14] = V("CashFAdjustment");

v[20]=v[0]-v[1]-v[2]-v[3]-v[4]-v[6]-v[7]+v[8]-(v[12]-v[13])-v[14];
RESULT(v[20] )


Variable:  OutstandingDebtFCh

Contained in:  Firm
Used in:  SumOutstandingDebtFCh
Using:  OutstandingDebtF

Equation code:

EQUATION("OutstandingDebtFCh")
/*
*/
v[10]=V("OutstandingDebtF");
v[11]=VL("OutstandingDebtF",1);
v[12]=v[10]-v[11];
RESULT(v[12] )


Variable:  ControlRevenues

Contained in:  Firm
Used in:  (never used)
Using:  TradeMonetarySales, Revenues, Stocks, UnitDemand, UnitSales, backlog, priceBacklogValue, BacklogValueCh

Equation code:

EQUATION("ControlRevenues")//
/*
 */
V("Trade");
V("backlog");
V("BacklogValue");
V("Stocks");
V("UnitDemand");

v[10]=t;
//sprintf(msg, "\n ControlRevenues(%g)", v[10]); plog(msg);
v[0]=V("Revenues");
v[1]=V("MonetarySales");
v[10]=V("UnitSales");
v[11]=VL("price",1);
v[12]=v[10]*v[11];
v[2]=V("BacklogValueCh");
//v[3]=v[0]-v[1]-v[2];
//v[3]=v[0]-v[12];//-v[2];
v[3]=v[0]-v[1];

//if(v[3]>0.01 | v[3]<-0.01) // avoid approximation issue
//INTERACT("ControlRevenues",v[3]);
RESULT(v[3] )


Parameter:  flagNewEntrant

Contained in:  Firm
Used in:  KProductionFlow, CapitalStock, Entry, PlaceOrder


Variable:  VacanciesRatio

Contained in:  Firm
Used in:  (never used)
Using:  VacanciesNumWorkers

Equation code:

EQUATION("VacanciesRatio")
/*
*/
v[0]=V("Vacancies");
v[1]=V("NumWorkers");

RESULT(v[0]/v[1] )


Variable:  UtilisationRate

Contained in:  Firm
Used in:  (never used)
Using:  CapitalCapacity, Q

Equation code:

EQUATION("UtilisationRate")
/*
Utilisation rate of capital
*/
v[1]=V("Q");
v[2]=V("CapitalCapacity");
if(v[2]==0)
END_EQUATION(0);
RESULT(v[1]/v[2] )


Variable:  GOS

Contained in:  Firm
Used in:  StatFirms, GOSShare
Using:  LaborCost, MonetarySales, RdExpenditure, ENCost

Equation code:

EQUATION("GOS")
/*
Gross Operating Surplus, difference between revenues, labor costs, energy costs and R&D
*/
//v[0]=V("Revenues");
v[0]=V("MonetarySales"); //flo
v[2]=V("LaborCost");
v[3]=V("RdExpenditure");
v[4]=V("ENCost");

v[10]=v[0]-v[2]-v[3]-v[4];
RESULT(v[10] )


Variable:  GOSShare

Contained in:  Firm
Used in:  (never used)
Using:  MonetarySales, GOS

Equation code:

EQUATION("GOSShare")
/*
GOS / MonetarySales
*/
v[0]=V("MonetarySales");
v[1]=V("GOS");
RESULT(v[1]/v[0] )


Variable:  UnitELdiff

Contained in:  Firm
Used in:  (never used)
Using:  UnitEnergyCost, UnitLaborCost

Equation code:

EQUATION( "UnitELdiff" )
/*
Difference between UnitEnergyCost and UnitLaborCost, must always be negative
*/
v[0]=V("UnitEnergyCost");
v[1]=V("UnitLaborCost");
RESULT(v[0]-v[1] )


Variable:  IncomeBeforeDebtPaymentsF

Contained in:  Firm
Used in:  sIncomeBeforeDebtPaymentsF
Using:  LaborCost, MonetarySales, RdExpenditure, ENCostInterestDepositsF

Equation code:

EQUATION("IncomeBeforeDebtPaymentsF")
/*
*/
v[0]=V("MonetarySales");
v[2]=V("LaborCost");
v[3]=V("RdExpenditure");
v[4]=V("ENCost");
v[8]=V("InterestDepositsF");

v[5]=v[0]-v[2]-v[3]-v[4]+v[8];
RESULT(v[5] )


Variable:  sIncomeBeforeDebtPaymentsF

Contained in:  Firm
Used in:  sIncomeBeforeDebtPaymentsF, RRoK
Using:  IncomeBeforeDebtPaymentsF, sIncomeBeforeDebtPaymentsF

Equation code:

EQUATION("sIncomeBeforeDebtPaymentsF")
/*
*/
v[1]=VL("sIncomeBeforeDebtPaymentsF",1);
v[2]=V("IncomeBeforeDebtPaymentsF");

v[3]=v[1]*0.95+0.05*v[2];
RESULT(v[3] )


Variable:  LiabilitiesF

Contained in:  Firm
Used in:  sLiabilitiesF
Using:  OutstandingDebtFCashF

Equation code:

EQUATION("LiabilitiesF")
/*
*/
v[36]= -1* V("CashF");
v[34]=V("OutstandingDebtF");

v[37]=v[36] + v[34];

if(v[37]<0.0001)
 v[38]=0.0001;
else
 v[38]=v[36]+v[34];

RESULT(v[38] )


Variable:  sLiabilitiesF

Contained in:  Firm
Used in:  sLiabilitiesF
Using:  LiabilitiesF, sLiabilitiesF

Equation code:

EQUATION("sLiabilitiesF")
/*
*/
v[1]=VL("sLiabilitiesF",1);
v[2]=V("LiabilitiesF");

v[3]=v[1]*0.95+0.05*v[2];
RESULT(v[3] )


Variable:  TaxF

Contained in:  Firm
Used in:  SumTaxF, BalanceF
Using:  taxrateProfit

Equation code:

EQUATION("TaxF")
/*
Tax paid on profit of F firm
*/

v[0] = V("taxrate");
v[1] = V("Profit");
if(v[1]>0)
 v[2]=v[0]*v[1];
else
 v[2]=0;
RESULT(v[2] )


Object:  Ch

Contained in:  Root—>Stats—>Country—>Supply—>Firm—>PNeed

Variables:  
Parameters:  

Parameter:  IdCh

Contained in:  Ch
Used in:  Entry, x, TTB_multiplWinner, Trade, ProdInno, Init_x, AvxFirm, Avx


Variable:  x

Contained in:  Ch
Used in:  Entry, TTB_multiplWinner, Trade, ProdInno, Init_x, AvxFirm, Avx
Using:  priceIdCh

Equation code:

EQUATION("x")
/*
Characteristics' values, constant unless they are a of a specified Id.
*/

v[0]=V("IdCh");
if(v[0]==1)
 v[1]=VLS(p->up->up,"price",1);
else
 {
  v[1]=CURRENT;
 }
RESULT(v[1] )


Parameter:  obs_x

Contained in:  Ch
Used in:  TTB_multiplWinner


Object:  Capital

Contained in:  Root—>Stats—>Country—>Supply—>Firm

Variables:  
Parameters:  

Parameter:  IncProductivity

Contained in:  Capital
Used in:  KProductionFlow, EN, Entry, MaxLaborProductivity, KPresentValue, Init


Parameter:  IncSkillBiais

Contained in:  Capital
Used in:  Entry


Parameter:  K

Contained in:  Capital
Used in:  KProductionFlow, EN, CapitalStock, Entry, MaxKQ, MaxLaborProductivity, KPresentValue, Init, InitInProgress


Variable:  KAge

Contained in:  Capital
Used in:  KProductionFlow, EN, CapitalStock, Entry, MaxKQ, MaxLaborProductivity, KAge, KPresentValue, InitInProgress
Using:  KAge

Equation code:

EQUATION("KAge")
v[0]=VL("KAge",1);
RESULT((v[0]+1) )


Parameter:  KExpenditures

Contained in:  Capital
Used in:  InstallmentF, KProductionFlow, Entry, Init


Variable:  MaxKQ

Contained in:  Capital
Used in:  Init
Using:  CapitalIntensCapitalDepressK, KAge, IncLearningK

Equation code:

EQUATION("MaxKQ")
/*
Defines the Theoretical Labor Productivity of the Firm as incorporated in the various capital vintages of the firm.
*/
v[0]=0;
v[1]=0;
v[2]=V("CapitalDepress");//defines the depression rate of capital
v[3]=V("K");
v[4]=V("KAge");
v[9]=V("CapitalIntens");
v[6]=pow((1-v[2]),v[4]);//computes the depressiation of capital
v[19]=V("IncLearningK");
v[7]=v[3]*v[6]*v[19];//computes the actual stock of this capital vintage that can be used

v[8]=v[7]/v[9];
RESULT(v[8] )


Variable:  IncLearningK

Contained in:  Capital
Used in:  KProductionFlow, Entry, MaxKQ
Using:  aLearningK

Equation code:

EQUATION("IncLearningK")
/*
Express the skills of the firm in exploiting the capital, where 0 is the inability to use the capital and
1 is the maximum exploitation
*/

v[0]=V("aLearningK");
v[1]=CURRENT*v[0]+(1-v[0]);
RESULT(v[1] )


Parameter:  IncEfficiency

Contained in:  Capital
Used in:  KProductionFlow, EN, Entry, MaxLaborProductivity, Init


Variable:  PrincipalF

Contained in:  Capital
Used in:  InstallmentF, PrincipalF, InterestF, OutstandingDebtFXXX, OutstandingDebtF, KProductionFlow, CapitalStock, Entry, Exit, Init, CheckFinBalance, CheckFinBalanceLag
Using:  PrincipalF, InstallmentF

Equation code:

EQUATION("PrincipalF")
/*
Remaining loan to be returned
*/
v[0] = VL("PrincipalF", 1);
v[1] = V("InstallmentF");

RESULT(v[0]-v[1] )


Variable:  InterestF

Contained in:  Capital
Used in:  InterestPaymentF
Using:  PrincipalFInterestRate

Equation code:

EQUATION("InterestF")
/*
Total interest to pay on the loan
*/
v[0] = VL("PrincipalF",1);
v[1] = VL("InterestRate",1);

RESULT(v[0]*v[1] )


Variable:  InstallmentF

Contained in:  Capital
Used in:  CapitalPaymentF, PrincipalF, CapitalStock
Using:  TimeRepaymentKExpenditures, PrincipalF

Equation code:

EQUATION("InstallmentF")
/*
Share of loans returned
*/
v[0] = VL("PrincipalF", 1);
if(v[0]<=0)
 END_EQUATION(0);
v[2] = V("KExpenditures");
v[1] = V("TimeRepayment");

v[4]=min(v[0],v[2]/v[1]);
RESULT(v[4] )


Object:  Labor

Contained in:  Root—>Stats—>Country—>Supply—>Firm

Variables:  
Parameters:  

Variable:  NumWorkers

Contained in:  Labor
Used in:  ControlPremia, ControlKPremia, VacanciesRatio, Entry, Production, LaborCapacity, TotNumWorkers, NumWorkersGr, NumWorkers, UnitLaborCost, LaborCost, wage, AggProductivity, NbrWorkers, Init, CheckFinBalance, SectEmployment, Dump, GlobalFlows
Using:  UnemploymentRate, tauMax, tauMin, tauMultiplier, ExtraCapacity, FreezeEmploymentCapitalCapacity, DesiredQ, DesiredUnusedCapacity, IdFirm, MaxLaborProductivity, RatioVacancies, Vacancies, aNWNumWorkers, IdLabor, nuSRMultiplier, TopSavingRateNumClass, Expenditure, ShareWageIncome, SharePremiaIncome, ShareIncome, Individuals, LorenzInd, ComputeShare, Income, WageIncome, Consumption, SavingRate, CashCIdNeedIdDCh, tau, NegativeQuality, BalanceC, OverdraftPaymentC

Equation code:

EQUATION("NumWorkers")
/*
Number of workers, computed as the 120% of the workers required to fill expected sales
*/

v[15]=0;
CYCLES(p->up, cur, "Labor")
 { //check how many tiers already exist
  v[15]++;
 }
v[14]=V("IdLabor");
if(v[14]==1)
 { // compute the first tier workers given their productivity and production needs
  //V("aNWDynamic");
  v[0]=VL("NumWorkers",1);
  //v[1]=V("ExpectedSales");
  v[1]=V("DesiredQ");
  //v[10]=V("backlog");
  //v[11]=v[1]+v[10];
  v[2]=V("MaxLaborProductivity");
  if(v[2]==0)
   END_EQUATION(v[0]);
  
  
  v[30] = V("ExtraCapacity");
  v[8]=V("CapitalCapacity")*v[30];
  v[9]=min(v[1],v[8]);
  v[4]=V("DesiredUnusedCapacity");
  v[3]=v[4]*(v[9]/v[2]);
  v[5]=V("aNW");
  v[6]=v[0]*v[5]+(1-v[5])*v[3]; // number of workers in the first layer
  v[26] = VL("UnemploymentRate",1);
  v[28]=v[6]-v[0];
  if(v[28]>0)
   {//if increasing
     v[28]*=v[26];
     v[6]=v[0]+v[28];
   }

/*
    if(v[6]/v[0]-1 > 1+V("NumWorkersMaxGr") )
   {
   if(v[6]-v[0] > V("NumWorkersMinInc") )
   {
   v[6]=1+V("NumWorkersMaxGr");
   }
   }
*/

  v[33]=(v[3]>v[6])?(v[3]-v[6]):0; //number of vacancies for the first layer, if there are more desired workers than actual new hires
  WRITES(p->up,"Vacancies",v[33]);
  if(v[6]>0)
   {
   v[54]=v[33]/v[6];//ratio of vacancies to actual workers
   }
  else
   {
    v[54]=0;
   }
  WRITES(p->up,"RatioVacancies",v[54]);
 }

else
 {// when above the first tier workers...
  v[18]=V("IdLabor");
  cur=SEARCH_CNDS(p->up,"IdLabor",v[18]-1);
  v[23]=VS(p->up,"IdFirm");
  v[24]=VS(cur->up,"IdFirm");
  if(v[23]!=v[24])
   v[25]=INTERACT("the firm ID is different from the current firm", v[24]);
  v[21]=VS(cur,"nu"); //given the worker ratio between tiers (defined by the tier below)
  v[19]=VS(cur,"NumWorkers"); //and the number of workers in the previous tier
  v[6]=v[19]/v[21]; // compute the required executives for the current tier
  v[54] = V("RatioVacancies");
  INCRS(p->up,"Vacancies",v[54]*v[6]);

  v[17]=V("nu");
  if(v[6]>=v[17] && v[18]==v[15] && V("FreezeEmployment")==0)
   { // if they are above the workers ratio of this tier and this is the last tier, create a new working class
    cur1=ADDOBJ_EXS(p->up,"Labor",p);
    WRITES(cur1,"IdLabor",v[18]+1);
    v[20]=v[6]/v[17];
    WRITELS(cur1,"NumWorkers",v[20], t);
    WRITELLS(cur1,"NumWorkers",0, t,1); // write also that the number of workers in the previous period is equal to 0, as it is used in the inequality statistics
    v[22]=0;
    CYCLES(p->up->up->up,cur2, "Class")
     {
      if(v[22]==0)
       {
        cur7=SEARCHS(cur2,"BankC");
        cur7=cur7->hook;
       }
      v[22]++;
     }
     
    if(v[22]-1<v[18]+1 )
     { //starting from the second class (the first are engineers), if it does not exist a class that represnt the new layer of executives, create it
      cur2=SEARCH_CNDS(p->up->up->up,"NumClass",v[18]);
      cur3=ADDOBJ_EXS(cur2->up,"Class",cur2);
      //cur3=ADDOBJS(cur2->up,"Class");
      //INTERACTS(cur3,"New class",v[22]);
      cur8=SEARCHS(cur3,"BankC");
      WRITELS(cur8,"BalanceC",0, t-1);
      WRITELS(cur8,"OverdraftPaymentC",0, t-1);

      cur8->hook=cur7;
      cur1->hook=cur3;
      v[44]=VS(cur2,"SavingRate");
      v[45]=VS(cur2->up,"SRMultiplier");
      v[47] = VS(cur2->up, "TopSavingRate");
      v[46]=v[44]*v[45]+(1-v[45])*v[47];
      WRITES(cur3,"SavingRate",v[46]);
// INTERACTS(cur3,"Inspect SavingRate", v[46]);

      WRITES(cur3,"NumClass",v[18]+1);
      WRITELLS(cur3,"Expenditure",0, t-1,1);
      WRITELS(cur3,"Expenditure",0, t);
      WRITELS(cur3,"Income",0, t-1);
      WRITES(cur3,"WageIncome",0);
      WRITELS(cur3,"Consumption",0, t-1);
      WRITELS(cur3,"ShareWageIncome",0, t-1);
      WRITELS(cur3,"SharePremiaIncome",0, t-1);
      WRITELS(cur3, "CashC", 0, t-1);
      WRITELS(cur3,"ShareIncome",0, t-1); // reset the share income to be recomputed
      WRITES(cur3,"Individuals",v[20]); // set the number of individuals to nu;ber of workers of the new class
      v[35]=VS(cur2,"LorenzInd");
      WRITES(cur3,"LorenzInd",v[35]+v[20]); // set total number of workers as previous total plus new workers
      //WRITELS(cur3,"NoConsumption",0, t-1); // set the savongs due to unavailability of the good to 0
      //INTERACTS(cur3,"Created class",v[44]);
      CYCLES(cur3, cur, "Need")
       { // enter in neds and characterisitcs to change the tau parameter (the minimum is set every period)
        v[27]=VS(cur,"IdNeed");
        CYCLES(cur, cur1, "DCh")
         {
          v[26]=VS(cur1,"IdDCh");
          CYCLES(cur2, cur4, "Need")
           { // cycle among the needs of the preceding class
            v[28]=VS(cur4,"IdNeed");
            if(v[28]==v[27])
             { // when in the same need as the one the new class is cycling cycle through the char of the preceding class
              CYCLES(cur4, cur5, "DCh")
               {
                v[29]=VS(cur5,"IdDCh");
                if(v[29]==v[26])// when in the same characteristic the new class is cycling
                 v[30]=VS(cur5,"tau"); // read the value of the tau parameter
               }

             }
           }
          v[31]=VS(cur1,"tauMultiplier"); // the speed of adjustment of the tolerance level from one class to the following one
          v[34]=VS(cur1,"NegativeQuality");
          if(v[34]>0)
           v[33]=VS(p->up->up->up,"tauMax"); // the asympthotic level of the tolerance level (1 for qualities and 0 for price)
          if(v[34]<0)
           v[33]=VS(p->up->up->up,"tauMin"); // the asympthotic level of the tolerance level (1 for qualities and 0 for price)
          v[32]=v[30]*(1-v[31])+v[31]*v[33]; // adjustment in the treshold level of tolerance
          WRITES(cur1,"tau",v[32]); // finally write the tau for the new consumer class in each of its characteristic for each need
         }

       }
     v[35]=VS(cur3,"ComputeShare"); // set the distribution of expenditure shares across needs for the new class
     //INTERACTS(cur3,"NewClass END", v[20]);
     }
    else
     {
      cur3=SEARCH_CND("NumClass",v[18]+1);
      cur1->hook=cur3;

     }

   }
  if(v[18]>2 && v[19]<v[21])
   v[6]=0;
 }


RESULT(v[6] )


Variable:  wage

Contained in:  Labor
Used in:  WagePrem, Entry, UnitLaborCost, LaborCost, wage, Init, CheckFinBalance, Dump, GlobalFlows
Using:  MinWageNumWorkers, wage, wagecoeff, IdLabor, flagShowWagePayTimeIndividuals, WageIncome

Equation code:

EQUATION("wage")
/*
Wage of the workers in this layer of the firm
*/
v[5]=V("NumWorkers");
v[2]=V("IdLabor");
if(v[2]==1)
 { // first tier workers
  v[0]=V("MinWage");
  v[1]=V("wagecoeff"); // wage coefficient as the minimum wage multiplier
 }
else
 { // executives
  cur=SEARCH_CNDS(p->up,"IdLabor",v[2]-1);
  v[0]=VS(cur,"wage");
  v[1]=V("wagecoeff"); // wage coefficient as the wage tier multiplier
 }

VS(p->hook,"PayTime");
if(V("flagShowWage")==1)
 INTERACT("Income push", v[5]*v[0]*v[1]);
INCRS(p->hook,"Individuals",v[5]);
INCRS(p->hook,"WageIncome",v[5]*v[0]*v[1]);

RESULT((v[0]*v[1]) )


Parameter:  wagecoeff

Contained in:  Labor
Used in:  Entry, AvWagecoeff, wage, Init


Parameter:  IdLabor

Contained in:  Labor
Used in:  WagePrem, Entry, Production, NumWorkers, AvWagecoeff, wage, Init, InitInProgress


Parameter:  nu

Contained in:  Labor
Used in:  Entry, NumWorkers, Init


Parameter:  Premia

Contained in:  Labor
Used in:  WagePrem, ControlPremia, Dump, GlobalFlows


Variable:  NumWorkersGr

Contained in:  Labor
Used in:  (never used)
Using:  NumWorkers

Equation code:

EQUATION("NumWorkersGr")
/*
*/
v[0]=VL("NumWorkers",1);
if(v[0]==0)
END_EQUATION(0);

v[1]=V("NumWorkers");

RESULT(v[1]/v[0]-1 )


Parameter:  flagShowWage

Contained in:  Labor
Used in:  wage


Object:  BankF

Contained in:  Root—>Stats—>Country—>Supply—>Firm

Variables:  
Parameters:  

Variable:  BalanceF

Contained in:  BankF
Used in:  CashF, sBalanceF, TestFinance
Using:  Profit, WagePrem, TaxF

Equation code:

EQUATION("BalanceF")
/*
Balance of the current account for firms
*/
v[0]=V("Profit");
v[1]=V("WagePrem");
v[2] = V("TaxF");

v[3]=v[0]-v[1]-v[2];
RESULT(v[3])


Parameter:  DebtF

Contained in:  BankF
Used in:  DebtFCh, DebtFL, Exit, KapitalNeed, TestFinance


Variable:  KPresentValue

Contained in:  BankF
Used in:  NetWorth, NetWorthXXX
Using:  CapitalDepressIncProductivity, K, KAgeAvCurrProd, AvKPrice

Equation code:

EQUATION("KPresentValue")
/*
Present value of capital
*/

v[0]=v[1]=0;
v[5]=V("AvCurrProd");
v[6]=V("CapitalDepress");
v[2]=V("AvKPrice");
CYCLES(p->up, cur, "Capital")
 {
  //v[2]=VS(cur,"ResellPrice");
  v[3]=VS(cur,"IncProductivity");
  v[4]=VS(cur,"K");
  v[7]=VS(cur,"KAge");
  v[8]=pow(1-v[6],v[7]);

  v[0]+=v[2]*v[4]*v[8]*v[3]/v[5];
 }

RESULT(v[0] )


Variable:  NetWorth

Contained in:  BankF
Used in:  Health, Exit, Production, KapitalNeed, Avx
Using:  Stocks, backlog, price, OutstandingDebtFKPresentValue, CashFPrudenceLending

Equation code:

EQUATION("NetWorth")
/*
Measure of the value of the firm in case of sales
*/

v[0]=V("KPresentValue")*V("PrudenceLending");
v[1]=V("CashF");
v[2]=VL("OutstandingDebtF",1);//xxx
v[4]=V("backlog");//xxx
//v[4]=V("BacklogValue");//xxx
v[5]=VL("price",1);
v[6]=VL("Stocks",1);


//v[3]=v[0]-v[4]-v[2]+v[1];
v[3]=v[0]-(v[4]*v[5])+(v[6]*v[5])-v[2]+v[1];
RESULT(v[3] )


Variable:  BacklogValue

Contained in:  BankF
Used in:  BacklogValueCh, ControlRevenues, KapitalNeed, NetWorthXXX
Using:  blQ, blPrice

Equation code:

EQUATION("BacklogValue")
/*
Value of the backlog, future revenues
*/

v[0]=0;
CYCLES(p->up, cur, "blItem")
 {
  v[0]+=VS(cur,"blQ")*VS(cur,"blPrice");
 }

RESULT(v[0] )


Variable:  sBalanceF

Contained in:  BankF
Used in:  (never used)
Using:  BalanceF

Equation code:

EQUATION("sBalanceF")
/*
Smoothed BalanceF
*/
v[0]=V("BalanceF");

v[1]=CURRENT*0.95+0.05*v[0];

RESULT(v[1] )


Variable:  RRoK

Contained in:  BankF
Used in:  Exit
Using:  sIncomeBeforeDebtPaymentsFsProfit

Equation code:

EQUATION("RRoK")
/*
*/
v[1]=V("sIncomeBeforeDebtPaymentsF");
v[2]=V("sProfit");

if(v[1]<0.001)
 v[1]=0.001;

v[3]=v[2]/v[1];
RESULT(v[3] )


Variable:  DebtFL

Contained in:  BankF
Used in:  DebtFCh
Using:  DebtF

Equation code:

EQUATION("DebtFL") //xxx
/*
Lagged value of DebtF
 */
//v[10]=t; //sprintf(msg, "\n DebtFL(%g)", v[10]); plog(msg);

v[0]=V("DebtF");
RESULT(v[0] )


Variable:  DebtFCh

Contained in:  BankF
Used in:  (never used)
Using:  DebtF, DebtFL

Equation code:

EQUATION("DebtFCh") //xxx
/*
Change of DebtF
*/
v[0]=V("DebtF");
v[1]=V("DebtFL");
RESULT(v[0]-v[1] )


Parameter:  DistributedProfits

Contained in:  BankF
Used in:  (never used)


Variable:  CashF

Contained in:  BankF
Used in:  WagePrem, LiabilitiesF, FinancialTrading, BankCapital, CashF, CashFAdjustment, OverdraftPaymentF, InterestDepositsF, NetWorth, FirmControlCurrent, SumCashF, CashFCh, Entry, sCashF, Exit, NetWorthXXX, CheckFinBalance, CheckFinBalanceLag
Using:  BalanceF, CashF, OrganicCashF

Equation code:

EQUATION("CashF")
/*
Cash in deposits for F
*/
v[0] = VL("CashF", 1);
v[1] = V("BalanceF");

v[3]=v[0]+v[1];
WRITE("OrganicCashF", v[3]);
RESULT(v[3])


Variable:  InterestDepositsF

Contained in:  BankF
Used in:  IncomeBeforeDebtPaymentsF, SumInterestDepositsF, BankCapital, Profit, FirmControlCurrent, CheckFinBalance
Using:  CashFInterestRateDeposits

Equation code:

EQUATION("InterestDepositsF")
/*
Cash obtained as interest on deposits
*/
v[0] = V("InterestRateDeposits");
v[1] = VL("CashF",1);/**/
if(v[1]>0)
 v[3]=v[0]*v[1];
else
 v[3]=0;
RESULT(v[3] )


Variable:  sCashF

Contained in:  BankF
Used in:  MaxKExpenditureF
Using:  CashF

Equation code:

EQUATION("sCashF")
/*
Smoothed cash
*/
v[0]=V("CashF");

v[1]=CURRENT*0.95+0.05*v[0];
RESULT(v[1] )


Variable:  OverdraftPaymentF

Contained in:  BankF
Used in:  SumOverdraftPaymentF, FinancialTrading, BankCapital, Profit, FirmControlCurrent, CheckFinBalance
Using:  CashFInterestRate

Equation code:

EQUATION("OverdraftPaymentF")
/*
Interest paid on overdraft FDF
*/
v[0] = VL("CashF",1);/**/
if(v[0]>0)
 END_EQUATION(0);
v[1] = VL("InterestRate",1);

v[2]=-v[0]*v[1];
RESULT(v[2] )


Variable:  CashFCh

Contained in:  BankF
Used in:  (never used)
Using:  CashF

Equation code:

EQUATION("CashFCh")
/*
*/
v[10]=V("CashF");
v[11]=VL("CashF",1);
v[12]=v[10]-v[11];
RESULT(v[12] )


Variable:  BacklogValueCh

Contained in:  BankF
Used in:  ControlRevenues
Using:  BacklogValue

Equation code:

EQUATION("BacklogValueCh")
/*
*/
v[0]=V("BacklogValue");
v[1]=VL("BacklogValue",1);
RESULT(v[0]-v[1] )


Variable:  sProfit

Contained in:  BankF
Used in:  RRoK, sProfit, MaxKExpenditureF
Using:  ProfitsProfit

Equation code:

EQUATION("sProfit")
/*
Smoothed ProfitF
*/
v[0]=VL("sProfit",1);
v[1]=V("Profit");
v[2]=v[0]*0.95+0.05*v[1];

RESULT(v[2] )


Parameter:  OrganicCashF

Contained in:  BankF
Used in:  CashF, CashFAdjustment


Variable:  CashFAdjustment

Contained in:  BankF
Used in:  FirmControlCurrent
Using:  CashF, OrganicCashFBankCapital

Equation code:

EQUATION("CashFAdjustment")
/*
Variation of CashC due to Bank's actions
*/

V("BankCapital");
v[0] = V("CashF");
v[1] = V("OrganicCashF");
v[2]=v[1]-v[0];
RESULT(v[2] )


Object:  Engineers

Contained in:  Root—>Stats—>Country—>Supply—>Firm

Variables:  
Parameters:  

Parameter:  EWagecoeff

Contained in:  Engineers
Used in:  WageEngineers


Variable:  NbrEngineers

Contained in:  Engineers
Used in:  CheckFinBalance, GlobalFlows
Using:  RdExpenditureWageEngineersIndividuals

Equation code:

EQUATION("NbrEngineers")
/*
Number of engineers
*/
v[0]=V("RdExpenditure");
v[1]=V("WageEngineers");
INCRS(p->hook,"Individuals",v[0]/v[1]);
RESULT((v[0]/v[1]) )


Variable:  WageEngineers

Contained in:  Engineers
Used in:  UpdateExpenses, ControlRdExpenditure, NbrEngineers, Production, CheckFinBalance, GlobalFlows
Using:  MinWageRdExpenditureEWagecoeffWageIncomeKWageEngineers

Equation code:

EQUATION("WageEngineers")
/*
Wage of engineers
*/

//v[10]=t;sprintf(msg, "\n WageEngineers(%g)", v[10]); plog(msg);

V("KWageEngineers"); // Reset WageIncome with PayTime

v[0]=V("MinWage");
v[1]=V("EWagecoeff");

v[3]=V("RdExpenditure");

//VS(p->hook->up,"PayTime"); // already exucuted by KWageEngineers
//INCRS(p->hook,"WageIncome",v[1]*v[0]*v[3]);
INCRS(p->hook,"WageIncome",v[3]);
//v[20]=t; //sprintf(msg, "\n WageEngineers(%g)", v[20]); plog(msg);
RESULT((v[0]*v[1]) )


Object:  Demand

Contained in:  Root—>Stats—>Country
Containing:  Class

Variables:  
Parameters:  

Variable:  IncomeDistribution

Contained in:  Demand
Used in:  Av_Computations
Using:  HerfTotalIncome, HerfWageIncome, HerfNonWageIncome, TotWage, TotPremia, TotIncome, WageIncomeRatio, PremiaIncomeRatioShareWageIncome, SharePremiaIncome

Equation code:

EQUATION("IncomeDistribution")
/*
Herfindahl Index for the Income
*/
v[2]=0;
v[3]=0;
v[4]=0;
CYCLE(cur, "Class")
 {
  v[5]=VS(cur,"ShareWageIncome");
  v[6]=VS(cur,"SharePremiaIncome");
  v[8]=v[5]+v[6];
  v[2]+=(v[8]*v[8]);
  v[3]+=(v[5]*v[5]);
  v[4]+=(v[6]*v[6]);
 }
WRITE("HerfTotalIncome",v[2]);
WRITE("HerfWageIncome",v[3]);
WRITE("HerfNonWageIncome",v[4]);
v[10]=V("TotWage");
v[11]=V("TotPremia");
v[12]=V("TotIncome");
v[13]=v[10]/v[12];
v[14]=v[11]/v[12];
WRITE("WageIncomeRatio",v[13]);
WRITE("PremiaIncomeRatio",v[14]);
RESULT(1 )


Parameter:  HerfTotalIncome

Contained in:  Demand
Used in:  IncomeDistribution


Parameter:  HerfWageIncome

Contained in:  Demand
Used in:  IncomeDistribution


Parameter:  HerfNonWageIncome

Contained in:  Demand
Used in:  IncomeDistribution


Parameter:  eta

Contained in:  Demand
Used in:  ExpShare


Variable:  PayTime

Contained in:  Demand
Used in:  wageEF, wage, KWageEngineers, KWage
Using:  TradeIndividuals, PremiaIncome, WageIncome, tempWage

Equation code:

EQUATION("PayTime")
/*
Semaphore resetting the parameters collecting the incomes from employees before being computed
*/
V("Trade");
CYCLE(cur, "Class")
 {
  WRITES(cur,"Individuals",0);
  WRITES(cur,"WageIncome",0);
  WRITES(cur,"PremiaIncome",0);
  WRITES(cur,"tempWage",0);
 }

RESULT(1)


Variable:  TotWage

Contained in:  Demand
Used in:  ControlLaborCost, TotIncome, AvWage, ShareWageIncome, IncomeDistribution, Andre, Gini
Using:  WageIncome

Equation code:

EQUATION("TotWage")
/*
Total wage
*/

v[0]=0;

CYCLE(cur, "Class")
 {
  v[0]+=VS(cur,"WageIncome");
 }

RESULT(v[0] )


Variable:  TotPremia

Contained in:  Demand
Used in:  TotIncome, SharePremiaIncome, IncomeDistribution, Andre, Gini
Using:  ProductionPremiaIncome

Equation code:

EQUATION("TotPremia")
/*
Total premia
*/

V("Production");
v[0]=0;

CYCLE(cur, "Class")
 {
  v[0]+=VS(cur,"PremiaIncome");
 }

RESULT(v[0] )


Variable:  TotIncome

Contained in:  Demand
Used in:  TotSavings, SavingsIncomeRatio, TotIncomeCapita, ShareIncome, IncomeDistribution, AvIncome, Atkinson
Using:  TotWage, TotPremiaIncome

Equation code:

EQUATION("TotIncome")
/*
Total income from the wage
*/

v[1]=V("TotWage");
v[2]=V("TotPremia");

v[3]=0;
CYCLE(cur, "Class")
{
v[3] += VS(cur, "Income");
}

RESULT(v[3] )


Variable:  TotIndividuals

Contained in:  Demand
Used in:  Subsidies, TotIncomeCapita, GDPCapita, AvWage, ShareIndividuals, AvIncome, Atkinson, Gini
Using:  ShareIncome, Individuals

Equation code:

EQUATION("TotIndividuals")
/*
Total number of consumers (workers) in t-1
*/

V("ShareIncome");
v[2]=0;
CYCLE(cur, "Demand")
 {
  CYCLES(cur, cur1, "Class")
   {
    v[1]=VS(cur1,"Individuals");
    v[2]+=v[1];
   }

 }

RESULT(v[2] )


Variable:  Atkinson

Contained in:  Demand
Used in:  (never used)
Using:  AversionTotIncome, TotIndividuals, AtkinsonClassIndividuals, Income

Equation code:

EQUATION("Atkinson")
/*
Atkinson index of inequality for income in period t-1
A=1-{SUM_i[y_i**(1-e)]**(1/(1-e))}/Av.y
*/

v[16]=(double)t;
if(v[16]>1)
 {
  v[10]=v[20]=v[30]=v[40]=0;
  //v[6]=V("AvIncome");
  v[8]=V("Aversion"); // parmeter for the aversion to inequality (changes which end of the income distribution has a higher weight in the index computation)
  v[11]=V("TotIndividuals");
  v[22]=V("TotIncome");
  CYCLE(cur, "Demand")
   {
    CYCLES(cur, cur1, "Class")
     {
      v[4]=VS(cur1,"Individuals");
      v[5]=VS(cur1,"Income");
      if(v[5]>0 && v[4]>0.01)
       {
        v[7]=v[5]/v[4]; // av. income of the class
        v[9]=pow(v[7],(1-v[8]));
        v[17]=v[9]*v[4];
        v[41]=pow(v[5],(1-v[8]));
       }
      else
       {
       v[17]=0;
       v[41]=0;
        }
      v[10]+=v[17];
      v[20]+=v[5];
      v[30]+=1;
      v[40]+=v[41];
     }

   }

  v[12]=v[10]/v[11];
  v[13]=1/(1-v[8]);
  v[14]=pow(v[12],v[13]);
  v[15]=1-v[14]/(v[20]/v[11]);//Atkinson Index for Individual inequality
  v[42]=v[41]/v[30];
  v[43]=pow(v[42],v[13]);
  v[44]=1-v[43]/(v[20]/v[30]);//Atkinson Index for Individual inequality
  WRITE("AtkinsonClass",v[44]);
 }
else
 v[15]=0;

RESULT(v[15] )


Variable:  AvIncome

Contained in:  Demand
Used in:  Gini
Using:  TotIncome, TotIndividualsShareIncome

Equation code:

EQUATION("AvIncome")
/*
Average income across classes in time t-1
*/

v[5]=(double)t;
if(v[5]>1)
 {
  V("ShareIncome");
  v[1]=V("TotIncome");
  v[3]=V("TotIndividuals");
  v[4]=(v[1])/v[3];
 }
else
 v[4]=1;

RESULT(v[4] )


Variable:  TotIncomeCapita

Contained in:  Demand
Used in:  TotIncomeCapitaReal
Using:  TotIncome, TotIndividuals

Equation code:

EQUATION("TotIncomeCapita")
/*
Comment
*/
v[0]=V("TotIncome");
v[1]=V("TotIndividuals");
RESULT(v[0]/v[1] )


Parameter:  ShareSavingsConsumed

Contained in:  Demand
Used in:  (never used)


Parameter:  SRMultiplier

Contained in:  Demand
Used in:  NumWorkersEF, NumWorkers, KNbrWorkers, Init


Parameter:  TopSavingRate

Contained in:  Demand
Used in:  NumWorkersEF, NumWorkers, KNbrWorkers, Init


Parameter:  AtkinsonClass

Contained in:  Demand
Used in:  Atkinson


Variable:  TotConsumption

Contained in:  Demand
Used in:  TotSavings, SavingsIncomeRatio, TotDConsConst, shareConsumption
Using:  Consumption

Equation code:

EQUATION("TotConsumption")
/*
Total desired Consumption
*/

RESULT(SUM("Consumption") )


Variable:  MargPropConsume

Contained in:  Demand
Used in:  (never used)
Using:  Expenditure, Income

Equation code:

EQUATION("MargPropConsume")
/*
Comment
*/
v[1]=v[2]=v[3]=v[4]=0;
CYCLE(cur, "Class")
 {
  v[5]=VS(cur,"Expenditure");
  v[6]=VLS(cur,"Expenditure",1);
  v[7]=VS(cur,"Income");
  v[8]=VLS(cur,"Income",1);
  v[1]+=v[5];
  v[2]+=v[6];
  v[3]+=v[7];
  v[4]+=v[8];
 }
v[9]=(v[1]-v[2])/(v[3]-v[4]);
RESULT(v[9] )


Parameter:  WageIncomeRatio

Contained in:  Demand
Used in:  IncomeDistribution


Parameter:  PremiaIncomeRatio

Contained in:  Demand
Used in:  IncomeDistribution


Variable:  TopBotInc

Contained in:  Demand
Used in:  (never used)
Using:  NumClass, Income

Equation code:

EQUATION("TopBotInc")
/*
Ratio between top class and bottom class income
*/
v[2]=0;
CYCLE(cur, "Class")
 {
  v[1]=VS(cur,"NumClass");
  if(v[1]>v[2])
   {
    v[2]=v[1];
    v[3]=VS(cur,"Income"); // Top class income
   }
  if(v[1]==2)
   v[4]=VS(cur,"Income"); //Bottom class income
 }
v[5]=v[3]/v[4];

RESULT(v[5])


Variable:  TopBotEarn

Contained in:  Demand
Used in:  (never used)
Using:  NumClass, WageIncome

Equation code:

EQUATION("TopBotEarn")
/*
Ratio between top and bottom class wages
*/

v[2]=0;
CYCLE(cur, "Class")
 {
  v[1]=VS(cur,"NumClass");
  if(v[1]>v[2])
   {
    v[2]=v[1];
    v[3]=VS(cur,"WageIncome"); //Top class earings
   }
  if(v[2]==2)
   v[4]=VS(cur,"WageIncome"); // Bottom class wage
 }
v[5] = v[3]/v[4];

RESULT(v[5] )


Variable:  GlobalIncome

Contained in:  Demand
Used in:  (never used)
Using:  Income

Equation code:

EQUATION("GlobalIncome")
/*
Differentiate from TotIncome because considers also the financial rents
*/

v[0]=0;
CYCLE(cur, "Class")
 {
  v[0]+=VS(cur,"Income");
 }

RESULT(v[0] )


Variable:  DecilesRatios

Contained in:  Demand
Used in:  (never used)
Using:  IncomeTop1, IncomeTop10, IncomeBottom90, Ratio190, Ratio1090NumClass, IncomeCapita, ShareIndividuals

Equation code:

EQUATION("DecilesRatios")
/*
Compute a few statistics:
- Income of top 1%
- Income of top 10%
- Ratio of 1%/90%
- Ratio of 10%/90%
*/

v[0]=v[1]=v[2]=v[3]=v[21]=v[22]=v[23]=0;
SORT("Class","IncomeCapita", "DOWN");
CYCLE(cur, "Class")
 {
  v[4]=VS(cur,"ShareIndividuals");
  v[7]=VS(cur,"IncomeCapita");

  v[8]=0.01;
  if(v[0]<v[8])
   {//for the 1%
    v[5]=min(v[8], v[0]+v[4]);
    v[6]=v[5]-v[0];//it is v[4], if you did not reach the threshold, or the part of it necessary to reach the top
    v[1]+=v[7]*v[6];
    v[21]+=v[6];
   }
  v[8]=0.1;
  if(v[0]<v[8])
   {//for the 10%
    v[5]=min(v[8], v[0]+v[4]);
    v[6]=v[5]-v[0];//it is v[4], if you did not reach the threshold, or the part of it necessary to reach the top
    v[2]+=v[7]*v[6];
    v[22]+=v[6];
   }
  v[0]+=v[4];
 }
WRITE("IncomeTop1",v[41]=v[1]*100);
WRITE("IncomeTop10",v[42]=v[2]*10);

v[0]=0;
SORT("Class","IncomeCapita", "UP");
CYCLE(cur, "Class")
 {
  v[4]=VS(cur,"ShareIndividuals");
  v[7]=VS(cur,"IncomeCapita");

  v[8]=0.90;
  if(v[0]<v[8])
   {//for the 90%
    v[5]=min(v[8], v[0]+v[4]);
    v[6]=v[5]-v[0];//it is v[4], if you did not reach the threshold, or the part of it necessary to reach the top
    v[3]+=v[7]*v[6];
    v[23]+=v[6];
   }
  v[0]+=v[4];
 }
WRITE("IncomeBottom90",v[43]=v[3]/(0.9));

WRITE("Ratio190",v[41]/v[43]);
WRITE("Ratio1090",v[42]/v[43]);
SORT("Class","NumClass", "UP");
RESULT(1 )


Parameter:  IncomeTop1

Contained in:  Demand
Used in:  DecilesRatios


Parameter:  IncomeTop10

Contained in:  Demand
Used in:  DecilesRatios


Parameter:  IncomeBottom90

Contained in:  Demand
Used in:  DecilesRatios


Parameter:  Ratio190

Contained in:  Demand
Used in:  DecilesRatios


Parameter:  Ratio1090

Contained in:  Demand
Used in:  DecilesRatios


Parameter:  ShareIncomeTop01

Contained in:  Demand
Used in:  (never used)


Parameter:  ShareIncomeTop10

Contained in:  Demand
Used in:  (never used)


Parameter:  ShareIncomeBottom90

Contained in:  Demand
Used in:  (never used)


Variable:  SumPremiaIncome

Contained in:  Demand
Used in:  ControlPremiaIncome
Using:  PremiaIncome

Equation code:

EQUATION("SumPremiaIncome")
/*
Sum of Premia distributed to classes
 */
v[0]=v[1]=0;
CYCLE(cur, "Class")
{
  v[0]=VS(cur,"PremiaIncome");
  v[1]+=v[0];
}
RESULT(v[1] )


Variable:  SumExpenditures

Contained in:  Demand
Used in:  test
Using:  Expenditure

Equation code:

EQUATION("SumExpenditures")
/*
*/
v[0]=v[1]=0;
CYCLE(cur, "Class")
{
  v[0]=VS(cur,"Expenditure");
v[1]+=v[0];
}
RESULT(v[1] )


Variable:  SumBalanceC

Contained in:  Demand
Used in:  (never used)
Using:  BalanceC

Equation code:

EQUATION("SumBalanceC")
/*
*/
v[0]=v[1]=0;
CYCLE(cur, "Class")
{
  v[0]=VS(cur,"BalanceC");
v[1]+=v[0];
}
RESULT(v[1] )


Variable:  MaxNumClass

Contained in:  Demand
Used in:  (never used)
Using:  NumClass

Equation code:

EQUATION("MaxNumClass")
/*
*/
RESULT(MAX("NumClass") )


Variable:  SumCashC

Contained in:  Demand
Used in:  CashCShare, SumCashCCh, BankControlCapital
Using:  FinancialTradingCashC

Equation code:

EQUATION("SumCashC")
/*
*/
V("FinancialTrading");
v[0]=v[1]=0;
CYCLE(cur, "Class")
{
  v[0]=VS(cur,"CashC");
v[1]+=v[0];
}
RESULT(v[1] )


Parameter:  aCashC

Contained in:  Demand
Used in:  Consumption


Variable:  SumExpenditure

Contained in:  Demand
Used in:  (never used)
Using:  Expenditure

Equation code:

EQUATION("SumExpenditure")
/*
*/
v[0]=SUM("Expenditure");
RESULT(v[0] )


Variable:  SumInterestDepositsC

Contained in:  Demand
Used in:  BankCapital
Using:  InterestDepositsC

Equation code:

EQUATION("SumInterestDepositsC")
/*
*/
RESULT(SUM("InterestDepositsC") )


Variable:  SumOverdraftPaymentC

Contained in:  Demand
Used in:  (never used)
Using:  OverdraftPaymentC

Equation code:

EQUATION("SumOverdraftPaymentC")
/*
*/
RESULT(SUM("OverdraftPaymentC") )


Variable:  SumCashCCh

Contained in:  Demand
Used in:  (never used)
Using:  FinancialTrading, Production, TradeInvestmentDecisionSumCashC

Equation code:

EQUATION("SumCashCCh")
/*
*/
V("Trade");
V("FinancialTrading");
V("InvestmentDecision");
V("Production");
v[1]=V("SumCashC");
v[2]=VL("SumCashC",1);
RESULT(v[1]-v[2] )


Parameter:  brakeExpenditure

Contained in:  Demand
Used in:  Expenditure


Variable:  IncomeTaxTot

Contained in:  Demand
Used in:  GovernmentFund
Using:  IncomeTax

Equation code:

EQUATION("IncomeTaxTot")
/*
Sum of total income tax
*/

RESULT(SUM("IncomeTax") )


Object:  Class

Contained in:  Root—>Stats—>Country—>Demand
Containing:  Need, BankC

Variables:  
Parameters:  

Parameter:  NumClass

Contained in:  Class
Used in:  EntryEF, ControlRdExpenditure, MaxNumClass, NumWorkersEF, Entry, NumWorkers, MinimumPriceSet, DecilesRatios, KNbrWorkers, ExpShare, Init, MinimumInit, TauInit, ShareInit, TopBotInc, TopBotEarn, Andre, Gini, InitInProgress


Variable:  Expenditure

Contained in:  Class
Used in:  Expenditure, BalanceC, SumExpenditure, ControlDemand, SumExpenditures, NumWorkersEF, TTB_multiplWinner, Trade, TradeXXX, NumWorkers, TotConsConst, KNbrWorkers, CheckFinBalance, MargPropConsume
Using:  brakeExpenditureExpenditure, aEx, Consumption, CashC

Equation code:

EQUATION("Expenditure")
/*
Total money spent by consumers, computed as a combination of past consumption and available resources (from wages and stock options)
*/
v[0]=VL("Expenditure",1);
v[1]=V("Consumption");
v[2]=V("aEx");
v[10]=v[0]*v[2]+(1-v[2])*(v[1]);
if(t==1)
 v[10]=v[1];

v[11]=max(v[10],0);
v[15] = V("brakeExpenditure");
if(v[0]>v[11])
 v[11]=v[0]*v[15]+(1-v[15])*v[11];

v[12] = VL("CashC", 1);
if(v[11]>v[12])
 {
 //INTERACT("STOP EXP", v[10]);
 v[11]=v[12];
 }
RESULT(v[11] )


Variable:  ShareWageIncome

Contained in:  Class
Used in:  NumWorkersEF, NumWorkers, KNbrWorkers, IncomeDistribution, Andre, Gini
Using:  TotWageWageIncome

Equation code:

EQUATION("ShareWageIncome")
/*
Share of total wage for this class
*/

v[0]=V("WageIncome");
v[1]=VS(p->up,"TotWage");
RESULT(v[0]/v[1] )


Parameter:  aEx

Contained in:  Class
Used in:  Expenditure


Variable:  SharePremiaIncome

Contained in:  Class
Used in:  NumWorkersEF, NumWorkers, KNbrWorkers, IncomeDistribution, Andre, Gini
Using:  TotPremiaPremiaIncome

Equation code:

EQUATION("SharePremiaIncome")
/*
Share of total premia for this class
*/

v[0]=V("PremiaIncome");
v[1]=VS(p->up,"TotPremia");
if(v[1]==0)
 v[2]=0;
else
 v[2]=v[0]/v[1];
RESULT(v[2] )


Parameter:  Lorenz

Contained in:  Class
Used in:  Andre


Variable:  ShareIncome

Contained in:  Class
Used in:  ExcessCostIncome, BankProfitIncome, NumWorkersEF, NumWorkers, KNbrWorkers, Andre, TotIndividuals, AvIncome, Gini
Using:  TotIncomeIncome

Equation code:

EQUATION("ShareIncome")
/*
Share of total income for this class
*/

v[0]=V("Income");
v[1]=VS(p->up,"TotIncome");
RESULT(v[0]/v[1] )


Parameter:  Individuals

Contained in:  Class
Used in:  Consumption, Subsidies, NbrEngineers, NumWorkersEF, wageEF, NumWorkers, IncomeCapita, PayTime, ShareIndividuals, wage, KWageEngineers, KWage, KNbrWorkers, Andre, TotIndividuals, Atkinson, Gini, Dump


Parameter:  LorenzInd

Contained in:  Class
Used in:  NumWorkersEF, NumWorkers, KNbrWorkers, Andre


Function:  ComputeShare

Contained in:  Class
Used in:  NumWorkersEF, NumWorkers, KNbrWorkers, ShareInit
Using:  Share, NumIterations, ExpShare

Equation code:

EQUATION("ComputeShare")
/*
The Share is a function that is called when a classed is formed to determine the shares of expenditure across needs, as a change with respect to the previous class.
he dynamic mimics engels laws (shiting the share of expenditures toward different needs, thus reducing the expenditure on 'basic' needs, as income increases)
This Share function simply normalise the shares computed in ExpShares
*/

v[1]=SUM("ExpShare"); //compute the sum of the newly computed expenditure shares
v[4]=v[7]=0;
CYCLE(cur, "Need")
 { // cycle through the needs
  v[2]=VS(cur,"ExpShare");
  v[3]=v[2]/v[1]; // normalise the share
  WRITES(cur,"Share",v[3]); // and fix it
  v[4]+=v[3]; // check that the sum is equal to 1
  v[5]=v[3]*151; // compute the number of iterations given the consumption shares
  v[6]=round(v[5]); // round to the closest integer
  WRITES(cur,"NumIterations",v[6]);
  v[7]+=v[6]; // check that the sum of interations is 100
 }

if(abs(v[4]-1)>0.0001)
INTERACT("Share issue", v[4]);

RESULT(v[4]+v[7] )


Variable:  TotIterations

Contained in:  Class
Used in:  TTB_multiplWinner
Using:  NumIterations, ProdExists, TempIterations

Equation code:

EQUATION("TotIterations")
/*
Total number of iterations for a class
Thios is computed separately, in order to take into account the redistribution of expenditure due to missing goods, and avoid that expenditure level is modified by rounding the number of iterations to an integer
*/

v[5]=0;
CYCLE(cur, "Need")
 {
  v[1]=VS(cur,"ProdExists");
  if(v[1]==1)
   {
    v[2]=VS(cur,"NumIterations");
    v[3]=VS(cur,"TempIterations");
    v[4]=v[2]+v[3];
    v[5]+=v[4];
   }
 }

RESULT(v[5] )


Variable:  Income

Contained in:  Class
Used in:  Consumption, BalanceC, ControlDemand, NumWorkersEF, NumWorkers, IncomeCapita, TotIncome, ShareIncome, GlobalIncome, KNbrWorkers, Init, MargPropConsume, TopBotInc, Atkinson
Using:  ProductionPremiaIncome, WageIncome, InterestDepositsC, ExcessCostIncome, Subsidies, IncomeTaxOverdraftPaymentC

Equation code:

EQUATION("Income")
/*
Comment
*/
V("Production");
v[0]=V("PremiaIncome");
v[1]=V("WageIncome");
v[14]=V("InterestDepositsC");/**/

v[16]=V("OverdraftPaymentC");/**/
v[20]=V("ExcessCostIncome");


v[3] = VL("Subsidies",1);
v[6] = V("IncomeTax");

v[5]=v[0]+v[1]+v[14]+v[3]-v[16]+v[20]-v[6];

RESULT(v[5])


Parameter:  PremiaIncome

Contained in:  Class
Used in:  WagePremEF, WagePrem, KWagePrem, Consumption, Income, IncomeTax, ControlDemand, SumPremiaIncome, TotPremia, PayTime, SharePremiaIncome, CheckFinBalance, GlobalFlows


Parameter:  WageIncome

Contained in:  Class
Used in:  Income, IncomeTax, ControlDemand, ControlRdExpenditure, WageEngineers, NumWorkersEF, wageEF, NumWorkers, TotWage, PayTime, ShareWageIncome, wage, KWageEngineers, KWage, Init, CheckFinBalance, TopBotEarn, GlobalFlows


Parameter:  tempWage

Contained in:  Class
Used in:  PayTime


Variable:  IncomeCapita

Contained in:  Class
Used in:  DecilesRatios
Using:  Individuals, Income

Equation code:

EQUATION("IncomeCapita")
/*
Comment
*/
v[0]=V("Income");
v[1]=V("Individuals");
if(v[1]>0.001)
 v[2]=v[0]/v[1];
else
 v[2]=0;
RESULT(v[2] )


Variable:  Consumption

Contained in:  Class
Used in:  Expenditure, NumWorkersEF, NumWorkers, TotConsumption, shareConsumption, KNbrWorkers, Dump
Using:  MovAvPriceaCashCIndividuals, Income, PremiaIncome, SavingRate, CashC, AutonomousC, AutComp

Equation code:

EQUATION("Consumption")
/*
Desired level of consumption
*/

v[0]=VL("Income",1);
v[2] = V("PremiaIncome");

v[8]=v[0]-v[2]+min(v[0]-v[2],v[2]); //as far as consumption is concerned, consider premia up to the level of non premia income
v[1]=V("SavingRate");
//v[3]=VL("HHWealth",1);
v[3]=VL("CashC",1);

v[4]=V("AutonomousC");
v[5]=V("aCashC");
v[6] = V("Individuals");
v[7] = V("MovAvPrice");

v[2]= (v[4]) + (v[0]*(1-v[1])) + (v[5]*v[3]);
WRITE("AutComp", v[6]*v[4]*v[7]);
if(v[3]<0)
{
//LOG("Zero C. %d", (int)v[6]);
//INTERACT("ZERO", v[6]);
v[2]=0;

}
RESULT(v[2] )


Parameter:  SavingRate

Contained in:  Class
Used in:  Consumption, IncomeTax, NumWorkersEF, NumWorkers, KNbrWorkers, Init


Variable:  ShareIndividuals

Contained in:  Class
Used in:  GovDemHH, DecilesRatios
Using:  TotIndividualsIndividuals

Equation code:

EQUATION("ShareIndividuals")
/*
Share of total income for this class
*/

v[0]=V("Individuals");
v[1]=VS(p->up,"TotIndividuals");
RESULT(v[0]/v[1] )


Variable:  shareConsumption

Contained in:  Class
Used in:  (never used)
Using:  TotConsumptionConsumption

Equation code:

EQUATION("shareConsumption")
/*
Comment
*/
v[0]=V("Consumption");
v[1]=V("TotConsumption");
v[2]=v[0]/v[1];
if(v[1]==0)
v[2]=0;
RESULT(v[2] )


Parameter:  Competitiveness

Contained in:  Class
Used in:  Trade


Variable:  CashC

Contained in:  Class
Used in:  Expenditure, Consumption, HHWealth, CashCShare, FinancialTrading, BankCapital, CashC, OverdraftPaymentC, InterestDepositsC, ControlDemand, CashCAdjustment, SumCashC, NumWorkersEF, NumWorkers, KNbrWorkers, Init, CheckFinBalance, CheckFinBalanceLag
Using:  CashC, OrganicCashCBalanceC

Equation code:

EQUATION("CashC")
/*
Cash in the account of consumers
*/
v[0] = VL("CashC", 1);
v[1] = V("BalanceC");
v[2]=v[0]+v[1];
WRITE("OrganicCashC", v[2]);
if(v[2]<0)
 INTERACT("mEG c.",v[1]);
RESULT(v[2] )


Variable:  InterestDepositsC

Contained in:  Class
Used in:  SumInterestDepositsC, BankCapital, Income, IncomeTax, ControlDemand, CheckFinBalance
Using:  CashCInterestRateDeposits

Equation code:

EQUATION("InterestDepositsC")
/*
Cash obtained as interest on deposits
*/
v[0] = V("InterestRateDeposits");
v[1] = VL("CashC",1);/**/
if(v[1]>0)
 v[3]=v[0]*v[1];
else
 v[3]=0;
RESULT(v[3] )


Variable:  BankProfitIncome

Contained in:  Class
Used in:  CumBPI, ControlDemand
Using:  FinancialTradingShareIncomeDistributedProfitsBank

Equation code:

EQUATION("BankProfitIncome")
/*
 */
V("FinancialTrading");
v[1]=V("DistributedProfitsBank");
//v[2]=VL("CashC",1);
//v[3]=VL("SumCashC",1);
v[4]=VL("ShareIncome",1);

//v[0]=v[1]*(v[2]/v[3])
v[0]=v[1]*v[4];//xxx
RESULT(v[0] )


Parameter:  AutonomousC

Contained in:  Class
Used in:  Consumption


Variable:  ControlDemand

Contained in:  Class
Used in:  CumBPI, ControlRdExpenditure
Using:  ProductionUpdateExpensesExpenditure, Income, PremiaIncome, WageIncome, CashC, InterestDepositsC, BankProfitIncome, ExcessCostIncome, CashCAdjustmentBalanceC, OverdraftPaymentC

Equation code:

EQUATION("ControlDemand")
/*
Control the vertical SFC of households
*/
/*****************
WRONG, firms are not located below Class
CYCLE(cur,"Firm")
{
VS(cur,"RdExpenditure");
VS(cur,"WageEngineers");
}
*****************/
V("UpdateExpenses");

V("Production");
 
v[0]=V("PremiaIncome");
v[1]=V("WageIncome");
v[2]=VL("InterestDepositsC",0);
v[3]=VL("BankProfitIncome",1);
v[4]=VL("OverdraftPaymentC",0);
v[5]=V("Expenditure");
v[6]=V("CashC");
v[7]=VL("CashC",1);
v[9] = V("CashCAdjustment");
v[8]=v[6]-v[7]+v[9];
v[18] = V("BalanceC");
if(abs(v[8]-v[18])/max(abs(v[8]),abs(v[18]))>0.5)
  INTERACT("eRR BalanceC",v[18]);
v[20]=V("ExcessCostIncome");

v[21] = V("Income");
if(abs((v[18]-(v[21]-v[5]))/abs(v[21]) )>0.5)
 INTERACT("Err Bal.2", v[18]);
v[22]=v[21]-v[0]-v[1]-v[2]+v[4]-v[20];
//if(abs(v[22])/abs(v[21])>0.5)
  //INTERACT("eRR Income", v[22]);

//v[10]=v[0]+v[1]+v[2]+v[3]-v[4]-v[5]-(v[6]-v[7])+v[20];
v[10]=v[0]+v[1]+v[2]+v[3]-v[4]-v[5]-v[8]+v[20];
//v[20]=t; //sprintf(msg, "\n ControlDemand(%g)", v[20]); plog(msg);
RESULT(v[10])


Variable:  ExcessCostIncome

Contained in:  Class
Used in:  Income, IncomeTax, ControlDemand
Using:  ShareIncomeTotExcessCost

Equation code:

EQUATION("ExcessCostIncome")
/*
Excess energy cost due to overutilization distrubuted to classes
*/
v[0]=V("TotExcessCost");
v[1]=VL("ShareIncome",1);
v[10]=v[0]*v[1];
RESULT(v[10] )


Variable:  SumShare

Contained in:  Class
Used in:  (never used)
Using:  Share

Equation code:

EQUATION("SumShare")
/*
*/
RESULT(SUM("Share") )


Parameter:  appCtrlWage

Contained in:  Class
Used in:  GlobalFlows


Parameter:  appCtrlPremia

Contained in:  Class
Used in:  GlobalFlows


Variable:  CumBPI

Contained in:  Class
Used in:  (never used)
Using:  BankProfitIncome, ControlDemand

Equation code:

EQUATION("CumBPI")
/*
Comment
*/
V("ControlDemand");
v[0] = VL("BankProfitIncome", 1);

RESULT(CURRENT+v[0] )


Parameter:  OrganicCashC

Contained in:  Class
Used in:  CashC, CashCAdjustment


Variable:  CashCAdjustment

Contained in:  Class
Used in:  ControlDemand
Using:  CashC, OrganicCashCBankCapital

Equation code:

EQUATION("CashCAdjustment")
/*
Variation of CashC due to Bank's actions
*/

V("BankCapital");
v[0] = V("CashC");
v[1] = V("OrganicCashC");
v[2]=v[1]-v[0];
RESULT(v[2] )


Variable:  HHWealth

Contained in:  Class
Used in:  (never used)
Using:  CashC, CashCShareBankCapital

Equation code:

EQUATION("HHWealth")
/*
HH own the bank in proportion to their wealth
*/
v[1] = V("CashC");
v[2] = V("BankCapital");
v[3] = V("CashCShare");

v[4] = v[1] + (v[2]*v[3]);
RESULT(v[4] )


Variable:  CashCShare

Contained in:  Class
Used in:  HHWealth
Using:  SumCashCCashC

Equation code:

EQUATION("CashCShare")
/*
Share of CashC held by each class
*/
v[1] = V("SumCashC");
v[2] = V("CashC");

v[3] = v[2]/v[1];
RESULT(v[3] )


Parameter:  AutComp

Contained in:  Class
Used in:  Consumption


Parameter:  Subsidies

Contained in:  Class
Used in:  Income


Variable:  IncomeTax

Contained in:  Class
Used in:  Income, IncomeTaxTot
Using:  IncomeTaxSharePremiaIncome, WageIncome, SavingRate, InterestDepositsC, ExcessCostIncomeOverdraftPaymentC

Equation code:

EQUATION("IncomeTax")
/*
Income tax
*/

v[0]=V("PremiaIncome");
v[1]=V("WageIncome");
v[14]=V("InterestDepositsC");/**/

v[16]=V("OverdraftPaymentC");/**/
v[20]=V("ExcessCostIncome");


v[2]=v[0]+v[1]+v[14]-v[16]+v[20];

v[1] = V("SavingRate");
v[4] = V("IncomeTaxShare");
v[3]=v[2]*v[1]*v[4];
RESULT(v[3] )


Variable:  GovDemHH

Contained in:  Class
Used in:  Trade
Using:  GovDemTotShareIndividuals

Equation code:

EQUATION("GovDemHH")
/*
Government demand expressed by the class
*/
v[0] = V("GovDemTot");
v[1] = V("ShareIndividuals");
v[2]=v[0]*v[1];
RESULT(v[2] )


Object:  Need

Contained in:  Root—>Stats—>Country—>Demand—>Class
Containing:  DCh

Variables:  
Parameters:  

Parameter:  IdNeed

Contained in:  Need
Used in:  NumWorkersEF, TTB_multiplWinner, Trade, TradeXXX, NumWorkers, KNbrWorkers, ExpShare, TauInit, InitInProgress


Parameter:  Share

Contained in:  Need
Used in:  Trade, TradeXXX, ComputeShare, SumShare, ExpShare


Parameter:  NumIterations

Contained in:  Need
Used in:  TotIterations, TradeXXX, ComputeShare


Function:  ExpShare

Contained in:  Need
Used in:  ComputeShare
Using:  etaNumClassIdNeed, Share, endExpShare

Equation code:

EQUATION("ExpShare")
/*
Change in the expenditure shares across classes
*/

v[1]=VS(p->up->up,"eta"); // iterrelations between the changes in the shares
v[2]=VS(p->up, "NumClass"); // check the current class for which the share is computed
v[5]=V("IdNeed");
v[3]=V("endExpShare"); // asymptotic value of the expenditure share for the current need (defined in the beginning symmetric to the first class distribution of shares)
CYCLES(p->up->up, cur, "Class")
 {
  v[4]=VS(cur,"NumClass");
  if(v[4]==v[2]-1)
   { // select the class below the one for which the shares are computed
    CYCLES(cur, cur1, "Need")
     { // cycle through the different needs
      v[6]=VS(cur1,"IdNeed");
      if(v[6]==v[5])
       v[7]=VS(cur1,"Share"); // read the value of the Share
     }

   }
 }
v[8]=v[1]*(v[7]-v[3]);
v[9]=v[7]*(1-v[8]);

RESULT(v[9] )


Parameter:  endExpShare

Contained in:  Need
Used in:  ExpShare


Parameter:  ProdExists

Contained in:  Need
Used in:  TotIterations, TradeXXX


Parameter:  TempIterations

Contained in:  Need
Used in:  TotIterations, TradeXXX


Object:  BankC

Contained in:  Root—>Stats—>Country—>Demand—>Class

Variables:  
Parameters:  (none)

Variable:  BalanceC

Contained in:  BankC
Used in:  CashC, ControlDemand, SumBalanceC, NumWorkersEF, NumWorkers, KNbrWorkers, Dump
Using:  Expenditure, Income

Equation code:

EQUATION("BalanceC")
/*
Comment
*/
v[1]=V("Income");
v[2]=V("Expenditure");
v[3]=v[1]-v[2];
//if(v[3]<0)
 //INTERACT("mEG BalC.",v[3]);
RESULT(v[3] )


Variable:  OverdraftPaymentC

Contained in:  BankC
Used in:  SumOverdraftPaymentC, FinancialTrading, BankCapital, Income, IncomeTax, ControlDemand, NumWorkersEF, NumWorkers, KNbrWorkers, CheckFinBalance
Using:  CashCInterestRate

Equation code:

EQUATION("OverdraftPaymentC")
/*
Interest paid on overdraft HH
*/
v[0] = VL("CashC",1);/**/
if(v[0]>0)
 END_EQUATION(0);
v[1] = VL("InterestRate",1);

v[2]=-v[0]*v[1];
RESULT(v[2] )


Object:  Machinery

Contained in:  Root—>Stats—>Country
Containing:  KFirm

Variables:  
Parameters:  

Parameter:  AvCurrEff

Contained in:  Machinery
Used in:  PlaceOrderEF, PlaceOrder


Parameter:  AvCurrProd

Contained in:  Machinery
Used in:  PlaceOrderEF, AvLocalPriceProd, KPresentValue, PlaceOrder


Parameter:  AvGreenKPrice

Contained in:  Machinery
Used in:  (never used)


Parameter:  AvKPrice

Contained in:  Machinery
Used in:  PlaceOrderEF, AvLocalPriceProd, InvestmentDecision, KapitalNeed, KPresentValue, PlaceOrder


Variable:  AvLocalPriceProd

Contained in:  Machinery
Used in:  (never used)
Using:  AvCurrProd, AvKPrice

Equation code:

EQUATION("AvLocalPriceProd")
/*
*/
v[0]=V("AvKPrice");
v[1]=V("AvCurrProd");

RESULT(v[0]/v[1] )


Parameter:  AvWaitTime

Contained in:  Machinery
Used in:  PlaceOrderEF, PlaceOrder


Parameter:  DiscountUsedK

Contained in:  Machinery
Used in:  (never used)


Parameter:  IsEnergyK

Contained in:  Machinery
Used in:  PlaceOrderEF, InvestmentDecision, InvestmentDecisionEFXXX, InvestmentDecisionEF


Parameter:  KEmployment

Contained in:  Machinery
Used in:  EmploymentConcentration


Parameter:  KEmploymentShare

Contained in:  Machinery
Used in:  EmploymentConcentration


Parameter:  KFirmSeeRoW

Contained in:  Machinery
Used in:  (never used)


Parameter:  KNomGDPShare

Contained in:  Machinery
Used in:  EmploymentConcentration


Parameter:  KOutputShare

Contained in:  Machinery
Used in:  EmploymentConcentration


Function:  PlaceOrder

Contained in:  Machinery
Used in:  InvestmentDecision, Entry
Using:  stopPlaceOrderIdFirm, IdTech, KapitalNeed, betaEff, betaPrice, betaProd, betaTime, MaxKExpenditureF, flagNewEntrantAvCurrEff, AvCurrProd, AvKPrice, AvWaitTimeIdKTech, KQ, NumOrders, kapp, KPrice, kselect, WaitTime, KTypeCurrentProductivity, CurrentEfficiency, KAmount, KCompletion, TimeWaited, Kproductivity, KP, IdClient, KEfficiency, EnergyKOrder

Equation code:

EQUATION("PlaceOrder")
/*
Place the order from the calling firm to a Kapital producer adopting the technology of the firm
 */
 v[0]=t;
 v[1] = V("stopPlaceOrder");
//sprintf(msg, "\n PlaceOrder %lf", v[0] ); plog(msg);
if(v[0]>v[1])
 END_EQUATION(0);

  v[0]=VS(c,"IdTech"); //this is the technology of the final product firm
  v[30]=VS(c,"betaPrice");
  v[31]=VS(c,"betaProd");
  v[32]=VS(c,"betaTime");
  v[11]=VS(c,"betaEff"); //add betaEff as a parameter
  v[3]=VS(c,"KapitalNeed");
  v[74] = VS(c, "MaxKExpenditureF");

v[99] = VS(c, "flagNewEntrant");
//if(v[99]==1)
 //INTERACT("ne", v[99]);

//assuming there are many firms producing K with the same technologies, firm select the one they prefer in terms of price and productivity of the capital, and waiting time (insert also durability of the capital if we include depreciation as a function of production quantity and not time)
v[51]=v[53]=v[59]=v[60]=v[58]=v[70]=v[11]=v[12]=v[13]=v[14]=v[15]=v[16]=v[17]=v[18]=0;
//given the preference of the buyer firm wth respect to the features of the capital production, namely price and current productivity of the capital, and approximate time to wait for receiving the order & the energy efficiency


CYCLE(cur, "KFirm")
{
  v[14]=VS(cur,"KType");
if(v[14]==2) // compute average only for KFirms producing final goods
{

  v[50]=VLS(cur,"KPrice",1);
  v[51]+=v[50];
  cur2=SEARCHS(cur,"KCapital");
  v[52]=VLS(cur2,"CurrentProductivity",1);
  v[12]=VLS(cur2,"CurrentEfficiency",1); // Efficiency of the vintage
  v[53]+=v[52];
  v[13]+=v[12];
  v[60]++;
  v[64]=VS(cur,"NumOrders");

  v[54]=VS(cur,"KQ");//number of productive workers
  // WRITES(cur,"WaitTime",ceil(v[3]/v[54]));
  WRITES(cur,"WaitTime",1);
  if(v[64]>0)
  {
    CYCLES(cur, cur1, "Order")
    {

      v[55]=VS(cur1,"KCompletion");
      v[56]=VS(cur1,"KAmount");
      v[57]=(v[56]-v[55])/v[54];
      INCRS(cur,"WaitTime",v[57]);
    }
  }

  v[65]=VS(cur,"WaitTime");
  if(v[65]<0)
    INTERACTS(c, "Neg. waittime", v[65]);
  v[58]+=v[65];
  // an index that gives the amount of time needed or a firm to complete the production of the capital already ordered
  }
}
// write the average values for price and producitivty of capital, and for the index of awaiting time. The averates are updated each time a firm place an order, as this would affectthe choice of a following firm in the same time period.
// NOTE THAT THIS PROVIDES A FIRST MOVER 'ADVANTAGE' TO THE FIRST FIRMS.
v[61]=v[51]/v[60];
WRITE("AvKPrice",v[61]);
v[62]=v[53]/v[60];
WRITE("AvCurrProd",v[62]);
v[14]=v[13]/v[60];
WRITE("AvCurrEff",v[14]); // Average Current Efficiency
v[63]=v[58]/v[60];
WRITE("AvWaitTime",v[63]);


//v[17]=V("MinWage");
//v[18]=V("PriceEN");
v[81]=-9999;

cur1=SEARCH("KFirm");
CYCLE(cur, "KFirm")
{
  v[14]=VS(cur,"KType");
if(v[14]==2) // compute average only for KFirms producing final goods
{
  v[1]=VS(cur,"IdKTech");
  if(v[0]!=v[1])
    WRITES(cur,"kapp",0);
  else
    WRITES(cur,"kapp",1);
  v[20]=VLS(cur,"KPrice",1);
  v[21]=VLS(cur,"CurrentProductivity",1);
  v[15]=VLS(cur,"CurrentEfficiency",1); // retrieve current efficiency
  v[26]=VS(cur,"WaitTime");
  // normalise relative values (shares) in order to compare firms on the different indicators using the same evaluation for different units of measurement
  v[27]=v[20]/v[61]+1; // Normalize Price
  v[28]=v[21]/v[62]+1; // Normalize Productivity
  v[16]=v[15]/v[14]+1; // Normalize Efficiency
  v[29]=v[26]/v[63]+1; // Normalize Wait Time
  if(v[27]*v[28]*v[29]*v[16]==0)
    v[33]=0;
  else// Do not include energy price and minimum wage here
{
//v[33]=RND;
v[33]=v[28]*v[31] - v[29]*v[32] - v[27]*v[30] + v[16]*v[11]; //sprintf(msg, "\n v33 %lf", v[33] ); plog(msg);
//v[33]=pow(v[28],v[31]) - pow(v[29],v[32]) - pow(v[27],v[30]) + pow(v[16],v[11]);
    //v[33]=pow(v[28],v[31])*pow(v[29],-v[32])*pow(v[27],-v[30])*pow(v[16],v[11]);
}


  //v[33]=pow(v[28]*v[17],v[31])*pow(v[29],-v[32])*pow(v[27],-v[30])*pow(v[16]*v[18],v[11]); // Includes PriceEN and MinWage
  WRITES(cur,"kselect",v[33]*VS(cur,"kapp"));
  v[70]+=v[33];
  if(v[33]>=v[81])
  {
    v[81]=v[33];
    cur1=cur;
  }

}
}

      //Legend:
      //c: it is the final producer firm ordering the K
      //cur: is the K producer

      cur=cur1;
      v[6]=VLS(cur,"KPrice",1);
      if(VS(cur,"NumOrders")==0)
        cur1=SEARCHS(cur,"Order");
      else
        cur1=ADDOBJS(cur,"Order");
      
// if(V("Age")<=2) // Allow new firms to place order
// v[63]=min(v[3],v[74]/v[6]); // v[3]=V("KapitalNeed")
// else
      v[63]=v[3];
      WRITES(cur1,"KAmount",v[63]);
      if(v[63]<=0)
        INTERACTS(c,"Neg.KAmount",v[63]);
      WRITES(cur1,"KCompletion",0);
      WRITES(cur1,"TimeWaited",1);
      WRITES(cur1, "EnergyKOrder", 0);
      cur1->hook=c; //useful to retrieve quickly the ordering firm
      

      INCRS(cur,"NumOrders",1);
      v[4]=VLS(cur,"CurrentProductivity",1); //current state of the K art
      WRITES(cur1,"Kproductivity",v[4]); //tech characteristics of the capital stock order

      v[90]=VLS(cur,"CurrentEfficiency",1); //lagged CurrentEfficiency, correct to non lagged if necessary
      WRITES(cur1,"KEfficiency",v[90]); // efficiency of the capital stock order

      //v[5]=VLS(cur,"CurrentSkillBiais",1);
      //WRITES(cur1,"KSkillBiais",v[5]);
      WRITES(cur1,"KP",v[6]);// write the price of the capital in the period in which it is ordered, and use it to compute the actual expenditure using the `agreed' price.

        v[72]=VS(c,"IdFirm");

      WRITES(cur1,"IdClient",v[72]);

RESULT(1 )


Function:  PlaceOrderEF

Contained in:  Machinery
Used in:  InvestmentDecisionEFXXX, InvestmentDecisionEF
Using:  stopPlaceOrderEFMinWageAvCurrEff, AvCurrProd, AvKPrice, AvWaitTime, IsEnergyKIdKTech, KQ, NumOrders, kapp, KPrice, kselect, WaitTime, KTypeCurrentProductivity, CurrentEfficiency, KAmount, KCompletion, TimeWaited, Kproductivity, KP, IdClient, EnergyKOrder, sInterestRate, TimeRepaymentEF, betaPriceEN, betaProdEN, betaTimeENEFType, ExpectedIncomePP, IdFirmEN, IdTechEN, KapitalNeedEF, MaxKExpenditureEF, SafetyCoefEF, WaitingEF

Equation code:

EQUATION("PlaceOrderEF")
/*
Place the order from the calling firm to a Kapital producer adopting the technology of the firm
*/
 //v[0]=t;
 //sprintf(msg, "\n PlaceOrderEF %lf", v[0] ); plog(msg);

//INTERACT("PlaceOrderEF",v[0]);

//v[44]=VLS(c,"NetWorth",1);

 v[0]=t;
 v[1] = V("stopPlaceOrderEF");
//sprintf(msg, "\n PlaceOrder %lf", v[0] ); plog(msg);
if(v[0]>v[1])
 END_EQUATION(0);

  /* v[72]=VS(c,"IdFirmEN");
   //sprintf(msg, "\n IdFirmEN %lf", v[72] ); plog(msg);
*/

v[82]=v[71]=V("IsEnergyK");

v[0]=VS(c,"IdTechEN"); //this is the technology of the energy firm
v[30]=VS(c,"betaPriceEN");
//sprintf(msg, "\n betaPriceEN %lf", v[30] ); plog(msg);

v[31]=VS(c,"betaProdEN");
v[32]=VS(c,"betaTimeEN");
//v[11]=VS(c,"betaEffEN"); //add betaEff as a parameter
v[11]=1;//assuming energy firms are not interested in the consumption of energy
v[3]=VS(c,"KapitalNeedEF");
//sprintf(msg, "\n KapitalNeedEF %lf", v[3] ); plog(msg);
//INTERACT("KapitalNeedEF",v[3]);

//v[33] = VS(c, "MaxEnergyCapacity");

v[74] = VS(c, "MaxKExpenditureEF");

v[99]=VS(c, "EFType");


//assuming there are many firms producing K with the same technologies, firm select the one they prefer in terms of price and productivity of the capital, and waiting time (insert also durability of the capital if we include depreciation as a function of production quantity and not time)
v[51]=v[53]=v[59]=v[60]=v[58]=v[70]=v[11]=v[12]=v[13]=v[14]=v[15]=v[16]=v[17]=v[18]=0;
//given the preference of the buyer firm wth respect to the features of the capital production, namely price and current productivity of the capital, and approximate time to wait for receiving the order & the energy efficiency


CYCLE(cur, "KFirm")
{

v[98]=VS(cur,"KType");
  if(v[98]==v[99])
  {
  v[50]=VLS(cur,"KPrice",1);
  cur2=SEARCHS(cur,"KCapital");
  v[52]=VLS(cur2,"CurrentProductivity",1);
  //v[12]=VLS(cur2,"CurrentEfficiency",1); // Efficiency of the vintage
  
v[51]+=v[50];
  v[53]+=v[52];
  //v[13]+=v[12];
  v[60]++;

  v[64]=VS(cur,"NumOrders");

  v[54]=VS(cur,"KQ");//number of productive workers
  // WRITES(cur,"WaitTime",ceil(v[3]/v[54]));
  WRITES(cur,"WaitTime",1);
  //if(v[64]>0)
   //{
     CYCLES(cur, cur1, "Order")
     {
       v[55]=VS(cur1,"KCompletion");
       v[56]=VS(cur1,"KAmount");
       v[57]=(v[56]-v[55])/v[54];
       INCRS(cur,"WaitTime",v[57]);
     }
   //}

  v[65]=VS(cur,"WaitTime");
  if(v[65]<0)
    INTERACTS(c, "Neg. waittime", v[65]);
  v[58]+=v[65];
  // an index that gives the amount of time needed or a firm to complete the production of the capital already ordered
}
}
// write the average values for price and producitivty of capital, and for the index of awaiting time. The averates are updated each time a firm place an order, as this would affectthe choice of a following firm in the same time period.
// NOTE THAT THIS PROVIDES A FIRST MOVER 'ADVANTAGE' TO THE FIRST FIRMS.
v[61]=v[51]/v[60];
WRITE("AvKPrice",v[61]);
v[62]=v[53]/v[60];
WRITE("AvCurrProd",v[62]);
v[14]=v[13]/v[60];
WRITE("AvCurrEff",v[14]); // Average Current Efficiency
v[63]=v[58]/v[60];
WRITE("AvWaitTime",v[63]);


//v[17]=V("MinWage");
//v[18]=V("PriceEN");
v[81]=-99999;
CYCLE(cur, "KFirm")
{
  v[98]=VS(cur,"KType");
  if(v[98]==v[99])
  {
  v[1]=VS(cur,"IdKTech");
  if(v[0]!=v[1])
    WRITES(cur,"kapp",0);
  else
    WRITES(cur,"kapp",1);
  v[20]=VLS(cur,"KPrice",1);
  v[21]=VLS(cur,"CurrentProductivity",1);
  v[15]=VLS(cur,"CurrentEfficiency",1); // retrieve current efficiency
  v[26]=VS(cur,"WaitTime");
  // normalise relative values (shares) in order to compare firms on the different indicators using the same evaluation for different units of measurement
  v[27]=v[20]/v[61]+1; // Normalize Price
  v[28]=v[21]/v[62]+1; // Normalize Productivity
  v[16]=v[15]/v[14]+1; // Normalize Efficiency
  v[29]=v[26]/v[63]+1; // Normalize Wait Time
  if(v[27]*v[28]*v[29]*v[16]==0)
    v[33]=0;
  else// Do not include energy price and minimum wage here
    {
    v[33]=pow(v[28],v[31]) - pow(v[29],v[32]) - pow(v[27],v[30]); //sprintf(msg, "\n Grade %lf", v[33] ); plog(msg);
    //v[33]=RND;
}
    //v[33]=pow(v[28],v[31])*pow(v[29],-v[32])*pow(v[27],-v[30])*pow(v[16],v[11]);
  //v[33]=pow(v[28]*v[17],v[31])*pow(v[29],-v[32])*pow(v[27],-v[30])*pow(v[16]*v[18],v[11]); // Includes PriceEN and MinWage
  WRITES(cur,"kselect",v[33]*VS(cur,"kapp"));
  v[70]+=v[33];
  if(v[33]>=v[81])
    {
    v[81]=v[33];
    cur1=cur;
    }
  }
}
      //Legend:
      //c: it is the final producer firm ordering the K
      //cur: is the K producer

v[6]=VLS(cur1,"KPrice",1);
if(VS(c, "WaitingEF")==-1)
  v[63]=v[3];//new entrants have no financial limits to invest
else
  v[63]=min(v[3],v[74]/v[6]); // v[3]=V("KapitalNeed")
 //sprintf(msg, "\n v63 %lf", v[63] ); plog(msg);

cur=cur1;

// Cost expectation

v[12]=V("MinWage");
v[4]=VLS(cur,"CurrentProductivity",1); //current state of the K art


v[16]= v[63]/v[4]*v[12]; // labor cost


v[17]=v[6]*v[63]; // Principal
v[18]=V("TimeRepaymentEF");
v[97]=v[17]/v[18];
v[11]=VL("sInterestRate",1);
v[19]=v[11]*v[17]; // Interests
v[2]=V("SafetyCoefEF");
v[7]= (1+v[2]) * (v[16]+v[97]+v[19]); // expected cost
v[8]=VS(c,"ExpectedIncomePP");

//sprintf(msg, "\n ExpectedIncomePP %lf", v[8] ); plog(msg);
//sprintf(msg, "\n Expected cost %lf", v[7] ); plog(msg);



if(v[8] > v[7] || v[8]>0)
{
   if(VS(cur,"NumOrders")==0)
     cur1=SEARCHS(cur,"Order");
   else
     cur1=ADDOBJS(cur,"Order");

   WRITES(cur1,"KAmount",v[63]);
   
  //sprintf(msg, "\n E. Order Placed %lf", v[63] ); plog(msg);
   
   if(v[63]<=0)
     INTERACTS(c,"Neg.KAmountEF",v[63]);
   
   WRITES(cur1,"KCompletion",0);
   WRITES(cur1,"TimeWaited",1);
   WRITES(cur1, "EnergyKOrder", 1);
   cur1->hook=c; //useful to retrieve quickly the ordering firm
   cur2 = SEARCHS(c, "CapitalEF");
   INCRS(cur,"NumOrders",1);
   v[4]=VLS(cur,"CurrentProductivity",1); //current state of the K art
   WRITES(cur1,"Kproductivity",v[4]); //tech characteristics of the capital stock order
   WRITES(cur1,"KP",v[6]);// write the price of the capital in the period in which it is ordered, and use it to compute the actual expenditure using the `agreed' price.
WRITES(c,"WaitingEF",1);
   c->hook=cur1;

   v[72]=VS(c,"IdFirmEN");
   //sprintf(msg, "\n IdFirmEN %lf", v[72] ); plog(msg);
   WRITES(cur1,"IdClient",-v[72]);
}
else
{ //sprintf(msg, "\n neg. profitability %lf", v[63] ); plog(msg);
END_EQUATION(1 );
}

RESULT(1 )


Parameter:  PrudenceLending

Contained in:  Machinery
Used in:  NetWorth, NetWorthXXX


Variable:  RemoveEFOrders

Contained in:  Machinery
Used in:  (never used)
Using:  EnergyKOrder

Equation code:

EQUATION("RemoveEFOrders")
/*
*/
CYCLE(cur, "KFirm")
{
CYCLE_SAFES(cur, cur1, "Order")
{
//cur2 = SEARCH_CNDS( cur1, "EnergyKOrder", 1 );
v[1]=VS(cur1, "EnergyKOrder");
if(v[1]==1 & COUNTS(cur,"Order")>1)
{
DELETE(cur1);
sprintf(msg, "\n Removed Order %lf", v[1] ); plog(msg);
}
}
}

PARAMETER;
RESULT(1 )


Variable:  SumCashKF

Contained in:  Machinery
Used in:  SumCashKFCh, BankControlCapital
Using:  FinancialTradingCashKF

Equation code:

EQUATION("SumCashKF")
/*
*/
V("FinancialTrading");
v[0]=v[1]=0;
CYCLE(cur, "KFirm")
{
  v[0]=VS(cur,"CashKF");
v[1]+=v[0];
}
RESULT(v[1] )


Variable:  SumKLaborCost

Contained in:  Machinery
Used in:  ControlLaborCost
Using:  KLaborCost

Equation code:

EQUATION("SumKLaborCost")
/*
Sum of wages distributed by KFirms
 */
v[0]=v[1]=0;
CYCLE(cur, "KFirm")
{
  v[0]=VS(cur,"KLaborCost");
  v[1]+=v[0];
}
RESULT(v[1] )


Variable:  SumKRdExpenditure

Contained in:  Machinery
Used in:  ControlRdExpenditure
Using:  KRdExpenditure

Equation code:

EQUATION("SumKRdExpenditure")
/*
*/
V("KRdExpenditure");
RESULT(SUM("KRdExpenditure") )


Variable:  SumKRevenues

Contained in:  Machinery
Used in:  ControlInvestment
Using:  KRevenues

Equation code:

EQUATION("SumKRevenues")
/*
Sum of revenues of KFirms (Investment of Firms and EnergyFirms)
 */
 v[0]=t;
//sprintf(msg, "\n SumKRevenues(%g)", v[0]); plog(msg);
v[0]=v[1]=0;
CYCLE(cur, "KFirm")
{
  v[0]=VS(cur,"KRevenues");
  v[1]+=v[0];
}
RESULT(v[1] )


Variable:  SumKWagePrem

Contained in:  Machinery
Used in:  ControlPremiaIncome
Using:  KWagePrem

Equation code:

EQUATION("SumKWagePrem")
/*
Sum of Premia distributed by KFirms
 */
v[0]=v[1]=0;
CYCLE(cur, "KFirm")
{
  v[0]=VS(cur,"KWagePrem");
  v[1]+=v[0];
}
RESULT(v[1] )


Variable:  TotInvestment

Contained in:  Machinery
Used in:  (never used)
Using:  KProductionFlow

Equation code:

EQUATION("TotInvestment")
/*
*/
v[0]=SUM("KProductionFlow");

RESULT(v[0] )


Variable:  TotKEN

Contained in:  Machinery
Used in:  TotEnergyConsumption
Using:  KEN

Equation code:

EQUATION("TotKEN")
/*
Total Energy Consumption of KFIRMS
*/
RESULT(SUM("KEN") )


Variable:  TotKEN2

Contained in:  Machinery
Used in:  (never used)
Using:  KEN

Equation code:

EQUATION("TotKEN2")
/*
Total Energy Consumption of KFIRMS
*/
v[1]=v[2]=0;
CYCLE(cur,"KFirm")
{
v[1]=VS(cur,"KEN");
v[2]+=v[1];
}

RESULT(v[2] )


Variable:  TotKLaborForce

Contained in:  Machinery
Used in:  ControlWorkers, WorkersKRatio
Using:  KLaborForce

Equation code:

EQUATION("TotKLaborForce")
/*
*/
v[0]=SUM("KLaborForce");

RESULT(v[0] )


Variable:  TotLocalGreenInvestment

Contained in:  Machinery
Used in:  (never used)
Using:  LocalGreenInvestment

Equation code:

EQUATION("TotLocalGreenInvestment")
/*
Total amount of local green investment
*/

v[0]=SUM("LocalGreenInvestment");

RESULT(v[0] )


Parameter:  psi_spe

Contained in:  Machinery
Used in:  (never used)


Variable:  SumInterestDepositsKF

Contained in:  Machinery
Used in:  BankCapital
Using:  InterestDepositsKF

Equation code:

EQUATION("SumInterestDepositsKF")
/*
*/
v[0]=0;
CYCLE(cur, "KFirm")
{
v[0] += VS(cur, "InterestDepositsKF");
}

RESULT(v[0] )


Variable:  SumOverdraftPaymentKF

Contained in:  Machinery
Used in:  (never used)
Using:  OverdraftPaymentKF

Equation code:

EQUATION("SumOverdraftPaymentKF")
/*
*/
RESULT(SUM("OverdraftPaymentKF") )


Variable:  SumKFirmControlCurrent

Contained in:  Machinery
Used in:  (never used)
Using:  KFirmControlCurrent

Equation code:

EQUATION("SumKFirmControlCurrent")
/*
*/
RESULT(SUM("KFirmControlCurrent") )


Variable:  SumCashKFCh

Contained in:  Machinery
Used in:  (never used)
Using:  FinancialTrading, Production, TradeInvestmentDecisionSumCashKF

Equation code:

EQUATION("SumCashKFCh")
/*
*/
V("Trade");
V("FinancialTrading");
V("InvestmentDecision");
V("Production");
v[1]=V("SumCashKF");
v[2]=VL("SumCashKF",1);
RESULT(v[1]-v[2] )


Variable:  NumActiveOrders

Contained in:  Machinery
Used in:  (never used)
Using:  ProductionNumOrdersPriceEN

Equation code:

EQUATION("NumActiveOrders")
/*
Comment
*/
V("Production");
V("PriceEN");

v[0]=0;
CYCLE(cur, "KFirm")
{
v[0] += VS(cur, "NumOrders");
}

RESULT(v[0] )


Variable:  SumNbrOrders

Contained in:  Machinery
Used in:  (never used)
Using:  NumOrders

Equation code:

EQUATION("SumNbrOrders")
/*
*/
RESULT(SUM("NumOrders") )


Parameter:  speedSO

Contained in:  Machinery
Used in:  CurrentProductivity


Variable:  SumCashInjectionKF

Contained in:  Machinery
Used in:  BankCapital
Using:  CashInjectionKF

Equation code:

EQUATION("SumCashInjectionKF")
/*
Remove debt for KF with too poor Health
*/
v[0]=0;
CYCLE(cur,"KFirm")
{
v[0]+=VS(cur,"CashInjectionKF");
}
RESULT(v[0] )


Variable:  EnergyFrontierProd

Contained in:  Machinery
Used in:  CurrentProductivity
Using:  KTypeCurrentProductivity

Equation code:

EQUATION("EnergyFrontierProd")
/*
Energy productivity frontier
*/

v[0]=0;
CYCLE(cur, "KFirm")
{
v[1] = VS(cur, "KType");
if(v[1]!=2)
{
v[2] = VS(cur,"CurrentProductivity");
if(v[0]<v[2])
v[0]=v[2];
}
}

RESULT(v[0] )


Parameter:  KExtraCapacity

Contained in:  Machinery
Used in:  KProductionFlow


Variable:  SumTaxK

Contained in:  Machinery
Used in:  GovernmentFund, TaxRevenues
Using:  TaxK

Equation code:

EQUATION("SumTaxK")
/*
Total tax KFirm
*/

RESULT(SUM("TaxK") )


Parameter:  KPriceOverCharge

Contained in:  Machinery
Used in:  KPrice


Object:  KFirm

Contained in:  Root—>Stats—>Country—>Machinery
Containing:  KLabor, KEngineers, KCapital, Order, BankK

Variables:  
Parameters:  

Parameter:  IdKTech

Contained in:  KFirm
Used in:  PlaceOrderEF, PlaceOrder


Variable:  KQ

Contained in:  KFirm
Used in:  PlaceOrderEF, KProductionFlow, KEN, KUnitEnergyCost, KPrice, PlaceOrder
Using:  KNbrWorkers, KLaborProductivity

Equation code:

EQUATION("KQ")
/*
Comment
*/

v[0]=V("KNbrWorkers");
v[1]=V("KLaborProductivity");

RESULT((v[0]*v[1]) )


Parameter:  NumOrders

Contained in:  KFirm
Used in:  SumNbrOrders, ExitEF, PlaceOrderEF, KProductionFlow, Exit, NumActiveOrders, PlaceOrder, InitInProgress


Parameter:  kapp

Contained in:  KFirm
Used in:  PlaceOrderEF, PlaceOrder


Variable:  KProductionFlow

Contained in:  KFirm
Used in:  IncomeBeforeDebtPaymentsKF, GOSK, StatKFirms, SumInvestmentSpendingEF, KProfit, TotInvestment, MoAvInvestment, AggProductivity, GDPnom, EmploymentConcentration
Using:  CapitalStock, Waiting, InvestmentSpending, flagNewEntrantIncProductivity, K, KAge, KExpenditures, IncLearningK, IncEfficiency, PrincipalFKExtraCapacityKQ, NumOrders, KRatioVacancies, KDeliveredKAmount, KCompletion, TimeWaited, Kproductivity, KP, IdClient, KEfficiency, EnergyKOrder, KRevenues, CallalphaBrown, CallalphaGreen, HistoricalCapitalEN, MultiplierCapacityENBrown, MultiplierCapacityENGreen, alphaBrown, alphaGreenEFType, IdFirmEN, InvestmentDecisionEF, InvestmentSpendingEF, NumPP, WaitingEF, alphaSize, TimeDeliveryPPPPKAge, KENProductivity, EnergyProductionPP, KExpendituresEN, CapitalEN, PrincipalEF, alphaSizePP, alphaPP, FairEnergyPP, IdEF

Equation code:

EQUATION("KProductionFlow")
/*
Activity of the K producing firm
 */
//v[10]=t; //sprintf(msg, "\n KProductionFlow(%g)", v[10]); plog(msg);


cur = SEARCH("BankK");
WRITES(cur, "KRevenues", 0);

CYCLES(p->up->up,cur,"EnergyFirm")
{
VS(cur,"InvestmentDecisionEF");
//sprintf(msg, "\n cycle KProd(%g)", v[10]); plog(msg);
}

v[30]=0;

v[0]=V("KQ"); //production capacity of the firm
v[98] = V("KRatioVacancies");
if(v[98]>0)
 {
  v[99] = V("KExtraCapacity");
  v[97]=min(v[98]+1,v[99]);
  v[0]*=v[97];
 }

v[1]=V("NumOrders");
if(v[1]==0)
  END_EQUATION(0);

v[2]=v[0]/v[1]; //one way to determine the amount of K production capacity per order. Otherwise...

v[3]=0;
CYCLE(cur, "Order")
{
  v[4]=VS(cur,"KAmount"); //sprintf(msg, " KAmount(%g)\n", v[4]); plog(msg);
  v[5]=VS(cur,"KCompletion");
  v[3]+=v[4]-v[5];
}
cur5=SEARCH("BankK");
//cur5=SEARCHS(c,"BankK");
WRITES(cur5,"KRevenues",0);

CYCLE_SAFE(cur, "Order")
{//increase the level of advancement of the orders and, if completed, remove the order. Given the production capacity, devote it respecting oreders' order (first comes first go, which allows to respect the priority given by customers, on side, and to reduce the dofferences between the price agreed upon ordering and the price at which the kapital is sold)
  v[4]=VS(cur,"KAmount");
  v[5]=VS(cur,"KCompletion");
  v[6]=(v[4]-v[5]); // given the missing quantity of the current order
  //v[7]=v[6]*v[0]; //share of production capacity devoted to this order
  v[8]=min(v[0], v[4]-v[5]); //use the production capacity needed actually neded to produce the order, or exhaust here the production capacity (for the current period)
  INCRS(cur,"KCompletion",v[8]);
  v[0]=v[0]-v[8];
  v[5]=VS(cur,"KCompletion"); //update the completion level in order to cancel the order if done
  if(v[5]>=v[4])
  {//order fulfilled. Either search for the ordering firm, or simply use the hook
   
    if(v[5]>0)
    {//stupid control needed to not be confused by the very initial object
      v[30]+=v[5]; // keep tracks of all fullfilled Orders: KproductionFlow
        if(VS(cur,"EnergyKOrder")==0)
        {
          if(cur->hook==NULL)
            INTERACT("hook NULL",v[0]);
          // INCRS(cur->hook,"NumK",1); // hook should be the ordering firm
          //cur1=ADDOBJS(cur->hook,"Capital");
          // cur1=cur->hook->add_an_object("Capital");
          // if(t>7)
          // INTERACTS(cur->hook, "PincoPallo", v[5]);
          if(VS(cur->hook, "flagNewEntrant")==1)
           {
            WRITELS(cur->hook,"CapitalStock",v[5],t);
            cur1 = SEARCHS(cur->hook, "Capital");
            
           }
          else
           cur1=ADDOBJS(cur->hook,"Capital");
          WRITELS(cur1,"K",v[5],t);
          v[9]=VS(cur,"Kproductivity");
          WRITELS(cur1,"IncProductivity",v[9],t);
  
          // Incorporate KEfficiency in the vintage produced IncEfficiency
          v[90]=VS(cur,"KEfficiency");
          WRITELS(cur1,"IncEfficiency",v[90],t);
  
          WRITELS(cur1,"IncLearningK",0.1,t);
          WRITELS(cur1,"KAge",0,t);
          v[11]=VS(cur,"KP");
          WRITES(cur1,"KExpenditures",v[11]*v[4]);
          WRITELS(cur1,"PrincipalF",v[11]*v[4],t);
          WRITELS(cur->hook,"InvestmentSpending",v[4]*v[11],t);
          if(VS(cur->hook, "flagNewEntrant")==1)
           {
            cur4 = SEARCHS(cur->hook, "BankF");
            //WRITELS(cur4, "CashF", 0,t);
            //INTERACTS(cur, "K NewE", v[11]*v[4]);
            WRITES(cur->hook, "flagNewEntrant", 0);
           }
          WRITES(cur->hook,"Waiting",0); //tell the firms it has the new capital
          //sprintf(msg, "waiting zero(%g)\n", v[0]); plog(msg);
          SORTS(cur->hook,"Capital","IncProductivity", "DOWN");
          //INTERACTS(cur, "Firm K delivered", v[12]-v[4]*v[11]);
         } //end delivered to final good firm
        else
         {//delivery of a K for Energy firm
          
          if(cur->hook==NULL)
            INTERACT("hook NULL KEN",v[0]);
           
          v[50]=VS(cur,"IdClient");
          
          cur5=SEARCH_CND("IdFirmEN",-v[50]);
           
          if(cur5!=cur->hook)
            INTERACT("cur diff",v[50]);
            
           if(cur5==NULL)
            INTERACT("cur5 NULL",v[0]);
           
                   //cur7=SEARCH_CNDS(cur->hook, "CapitalEN", 0 ); // Remove the original K if any WRONG!!!!! It returns the first CapitalEN==0, from another FirmEN is cur->hook has none
          cur7=NULL;
          CYCLES(cur->hook, cur8, "CapitalEF")
          {//checks if there is a null capital in the firm, and only that firm
           v[77] = VS(cur8, "CapitalEN");
           if(v[77]==0)
           {
           cur7=cur8;
           break;
           }
          }

                    
          if(cur7!=NULL)
           cur1=cur7;
          else
            {
            if(cur->hook==NULL)
             INTERACTS(cur,"ERR212",v[0]);
            else
             {v[50]=VS(cur->hook, "IdFirmEN");
              //LOG("%d", (int)v[50]);
              }
            cur1=ADDOBJS(cur->hook,"CapitalEF"); // hook doesn"t work
            
            }
 //CHECK IT OUT. Before there was a comment after 'else', may be it disrupted the conditional statement INTERACTS(cur1, "Created", v[50]);

          
          INCRS(cur->hook, "NumPP", 1);
          WRITES(cur->hook, "TimeDeliveryPP", (double)t);
          //INCRS(cur5, "NumPP", 1);
          cur2 = ADDOBJS(cur->hook->up, "PP");
          WRITES(cur2, "IdEF", v[50]);
          
          //cur2 = ADDOBJS(cur5->up, "PP");
          cur1->hook=cur2;
          cur2->hook=cur1;
          if(VS(cur->hook, "EFType") == 0)
            v[20] = VS(cur->hook, "MultiplierCapacityENBrown");
          else
            v[20] = VS(cur->hook, "MultiplierCapacityENGreen");
            
          WRITES(cur1,"CapitalEN",v[5]*v[20]);
          WRITES(cur1,"EnergyProductionPP",0);
          WRITES(cur1, "FairEnergyPP", 0);

          
          v[9]=VS(cur,"Kproductivity");
// v[21] = VS(cur->hook, "MultiplierProductivityEN");
          WRITES(cur1,"KENProductivity",v[9]);
          
          
          v[99]=VS(cur->hook,"EFType");
          if(v[99]==0)
           { // its a brown firm
            //INCRS(cur1->up,"HistoricalCapitalEN",v[5]);
            INCRS(cur1->up->up,"HistoricalCapitalEN",v[5]);
           V("CallalphaBrown");
           v[41]=V("alphaBrown");
           WRITES(cur1,"alphaPP",v[41]);
           }
          else
           { // its a green firm
           V("CallalphaGreen");
           v[41]=V("alphaGreen");
           WRITES(cur1,"alphaPP",v[41]);
           }
          
          v[42]=VS(cur->hook,"alphaSize");
WRITES(cur1,"alphaSizePP",v[42]);


          
          WRITELS(cur1,"PPKAge",0,t);
          v[11]=VS(cur,"KP");
          v[12]=v[11]*v[4];
          WRITES(cur1,"KExpendituresEN",v[12]);
          
          //WRITELS(cur1,"PrincipalEF",0,t-1);
          WRITELS(cur1,"PrincipalEF",v[12],t);
          
          //INTERACT("aa",v[12]);
          //VS(cur->hook,"DebtEFL");
          //INCRS(cur->hook,"DebtEF",v[12]);
          
          WRITELS(cur->hook,"InvestmentSpendingEF",v[12],t);
          //INTERACTS(cur->hook, "Used", v[12]);
          //INTERACT("KP",v[12]);
          //WRITELS(cur->hook,"InvestmentSpendingEF",v[12],t); //sprintf(msg, "\n KProd InvestmentSpendingEF(%g)", v[12]); plog(msg); // hook doesn"t work
          //WRITELS(cur5,"InvestmentSpendingEF",v[12],t); //sprintf(msg, "\n KProd InvestmentSpendingEF(%g)", v[12]); plog(msg);

          
          WRITES(cur->hook,"WaitingEF",0); //tell the firms it has the new capital
          //sprintf(msg, "\n EN K delivered(%g)", v[12]); plog(msg);
          //WRITELS(cur5,"WaitingEF",0,t); //tell the firms it has the new capital
         
          //INTERACTS(cur, "Energy K delivered", v[12]-v[4]*v[11]);
         } //end delivered to energy firm
        
        cur5=SEARCH("BankK");
//cur5=SEARCHS(c,"BankK");
        INCRS(cur5,"KRevenues",v[4]*v[11]);
        v[20]=INCR("NumOrders",-1);
        if(v[20]>0)
          DELETE(cur);
        else
        {
          WRITES(cur,"KAmount",0);
          WRITES(cur,"KCompletion",0);
          WRITES(cur,"TimeWaited",0);
          WRITES(cur,"Kproductivity",0);
          WRITES(cur,"KEfficiency",0);
          WRITES(cur, "IdClient", -1);
          cur->hook=NULL;
        }
      }//end control first toke object
   }//end order completed
  else
   {
    if(v[4]>0)
      INCRS(cur,"TimeWaited",1); // if orders remain non completed increase the time needed to go through future orders
   }

}

v[13]=min(V("KQ"),v[3]);

WRITE("KDelivered",v[30]);

//v[15]=V("KQ")-v[3];
//v[16]=v[15]-v[0];
//if(v[15]>0 && v[15]!=v[0])
//INTERACT("check the correspondence between production and KQ",v[16]);
//if(v[15]<0 && v[0]!=0)
//INTERACT("check the correspondence between production and KQ",v[0]);

RESULT(v[13] )


Variable:  KPrice

Contained in:  KFirm
Used in:  StatKFirms, ExpCostENK, PlaceOrderEF, KRevenues2, GreenEnergyPriceProd, GreenEnergyCost, PlaceOrder, Init, GDPnom, EmploymentConcentration
Using:  KPriceOverChargeKQ, Kmarkup, KLaborCost, KRatioVacancies, KUnitEnergyCost

Equation code:

EQUATION("KPrice")
/*
Comment
*/
v[0]=V("Kmarkup");
v[8]=V("KQ"); // productive capacity of the firm
v[4]=V("KLaborCost");
v[1]=V("KUnitEnergyCost");
//v[7]=(v[0])*(v[4]/v[8]+v[1]);
v[7]=(v[0])*(v[4]/v[8]);

v[9] = V("KRatioVacancies");
v[10] = V("KPriceOverCharge");
v[19]=max(v[9],10);
v[8]=v[19]*v[10];
v[17]=v[7]*(1+v[8]);
if(v[7]<=0)
INTERACT("Neg.KPrice",v[7]);

RESULT(v[17] )


Parameter:  z

Contained in:  KFirm
Used in:  CurrentProductivity, CurrentEfficiency, KMaxEnergyEfficiency, KLaborProductivity, GreenProductivity


Parameter:  ProductivityShock

Contained in:  KFirm
Used in:  CurrentProductivity


Parameter:  SkillBiaisShock

Contained in:  KFirm
Used in:  (never used)


Variable:  KProfit

Contained in:  KFirm
Used in:  KWagePrem, sProfitKF, TaxK, BalanceK, AggProductivity, AvKProfit
Using:  KProductionFlow, KCumProfit, KLaborCost, KENCostKNbrEngineers, KRevenues, InterestDepositsKF, OverdraftPaymentKF

Equation code:

EQUATION("KProfit")
/*
Comment
*/
V("KNbrEngineers"); // compute first the number of engineers which use the past value of cumulated profits
V("KProductionFlow");
//v[0]=V("KPrice");
v[0]=V("KRevenues");
v[2]=V("KENCost");
v[3]=V("KLaborCost");
v[4]=V("OverdraftPaymentKF");/**/
v[8]=V("InterestDepositsKF");/**/

v[5]=v[0]-v[2]-v[3]-v[4]+v[8];
v[6]=INCR("KCumProfit",v[5]);
RESULT(v[5] )


Parameter:  EngineersHiring

Contained in:  KFirm
Used in:  (never used)


Parameter:  Kmarkup

Contained in:  KFirm
Used in:  KPrice


Parameter:  KCumProfit

Contained in:  KFirm
Used in:  KProfit, AggProductivity


Parameter:  EngineersShare

Contained in:  KFirm
Used in:  KNbrEngineers


Parameter:  kselect

Contained in:  KFirm
Used in:  PlaceOrderEF, PlaceOrder


Parameter:  WaitTime

Contained in:  KFirm
Used in:  StatKFirms, PlaceOrderEF, PlaceOrder


Parameter:  AvKWage

Contained in:  KFirm
Used in:  (never used)


Parameter:  KConstPrice

Contained in:  KFirm
Used in:  StatKFirms, Init, GDPnom, EmploymentConcentration


Variable:  KWagePrem

Contained in:  KFirm
Used in:  BalanceK, KFirmControlCurrent, ControlKPremia, SumKWagePrem, Production, CheckFinBalance
Using:  roPremia, roCashPremiaIncomeKProfitKWage, IdKLabor, KPremia, CashKF

Equation code:

EQUATION("KWagePrem")
/*
Wage premia distributed, when available to all classes of executives.
*/

v[0]=V("KProfit");
v[1]=VL("CashKF",1);
v[50]=V("roPremia");
v[4]=V("roCash");

if(v[0]>0)
 v[5]=max(0,(v[0])*v[50]+v[1]*v[4]);
else
 v[5]=0;

v[3]=0;
if(v[5]>0)
 {
  CYCLE(cur, "KLabor")
   {
    v[10]=VS(cur,"IdKLabor");
    if(v[10]>1)
     {
      v[2]=VS(cur,"KWage");
      v[3]+=v[2];
     }
   }

  CYCLE(cur, "KLabor")
   {
    v[10]=VS(cur,"IdKLabor");
    if(v[10]>1)
     {v[2]=VS(cur,"KWage");
      WRITES(cur,"KPremia",v[5]*v[2]/v[3]);
      INCRS(cur->hook,"PremiaIncome",v[5]*v[2]/v[3]);
     }
   }
 }
else
 {
   CYCLE(cur, "KLabor")
   {
    WRITES(cur,"KPremia",0);
   }
 }

RESULT(v[5] )


Variable:  KLaborCost

Contained in:  KFirm
Used in:  IncomeBeforeDebtPaymentsKF, GOSK, KProfit, KFirmControlCurrent, SumKLaborCost, KPrice
Using:  KLaborForce, KLaborForceL, KLaborGrowthKNbrWorkers, KWage, KNbrEngineers, KWageEngineers

Equation code:

EQUATION("KLaborCost")
/*
Comment
*/
v[0]=v[1]=v[2]=0;
CYCLE(cur, "KLabor")
 {
  v[0]+=VS(cur,"KNbrWorkers")*VS(cur,"KWage");
  v[1]+=VS(cur,"KNbrWorkers");
  v[2]+=VLS(cur,"KNbrWorkers",1);
 }
v[3]=V("KNbrEngineers");
v[4]=VL("KNbrEngineers",1);
WRITE("KLaborForce",v[1]+v[3]);
WRITE("KLaborForceL",v[2]+v[4]);
WRITE("KLaborGrowth",(v[1]+v[3])/(v[2]+v[4])-1);
v[0]+=V("KNbrEngineers")*V("KWageEngineers");
RESULT(v[0] )


Parameter:  KVacancies

Contained in:  KFirm
Used in:  KNbrEngineers, KNbrWorkers, TotVacancies


Parameter:  KRatioVacancies

Contained in:  KFirm
Used in:  KProductionFlow, KPrice, KNbrEngineers, KNbrWorkers


Parameter:  KLaborForce

Contained in:  KFirm
Used in:  TotKLaborForce, KLaborCost


Parameter:  KLaborForceL

Contained in:  KFirm
Used in:  KLaborCost


Parameter:  KLaborGrowth

Contained in:  KFirm
Used in:  KLaborCost


Variable:  KEN

Contained in:  KFirm
Used in:  KENCost, KENCost, KUnitEnergyCost, TotKEN, TotKEN2
Using:  KQ, KMaxEnergyEfficiency

Equation code:

EQUATION("KEN")
/*
Compute the energy used by final good firms
*/
v[0]=V("KQ");
v[1]=V("KMaxEnergyEfficiency");
RESULT(v[0]/v[1] )


Variable:  KUnitEnergyCost

Contained in:  KFirm
Used in:  KPrice
Using:  KQ, KENPriceEN

Equation code:

EQUATION("KUnitEnergyCost")
/*
comment
*/

v[3]=V("KEN");
v[4]=V("PriceEN");
v[5]=V("KQ");

if(v[5]>0.01)
 {
v[6]=(v[3]*v[4])/v[5]; // compute the energy cost to produce one final good
 }
else
v[6]=0;

RESULT(v[6] )


Variable:  KMaxEnergyEfficiency

Contained in:  KFirm
Used in:  KMaxEnergyEfficiency, KEN
Using:  z, KMaxEnergyEfficiency, EnergyEfficiencyShockKNbrEngiProcessEff

Equation code:

EQUATION("KMaxEnergyEfficiency")
/*
R\&D to improve the energy efficiency of capital good production
*/

v[0]=VL("KMaxEnergyEfficiency",1);
v[1]=V("EnergyEfficiencyShock");
//v[2]=VL("KNbrEngiProcessEff",1);
v[2]=V("KNbrEngiProcessEff");
v[3]=V("z");
v[4]=-(v[2]*v[3]);
v[5]=1-exp(v[4]);//Proba to innovate increases with the nbr of engineers
//first random draw to define the outcome of R&D i.e. success or failure
if (RND<v[5])
{
v[8]=norm(0,v[1]);//second stochastic variable, defines the level of productivity out of the successful R&D process
}
else
{
v[8]=0;
}
v[10]=max(v[8],0);
v[11]=v[0] + v[10];
RESULT(v[11] )


Parameter:  EfficiencyShock

Contained in:  KFirm
Used in:  CurrentEfficiency


Parameter:  EnergyEfficiencyShock

Contained in:  KFirm
Used in:  KMaxEnergyEfficiency


Parameter:  GreenKProdShock

Contained in:  KFirm
Used in:  GreenProductivity


Parameter:  IdKFirm

Contained in:  KFirm
Used in:  (never used)


Parameter:  LocalGreenInvestment

Contained in:  KFirm
Used in:  TotLocalGreenInvestment


Variable:  ControlKPremia

Contained in:  KFirm
Used in:  (never used)
Using:  NumWorkersKWagePremKNbrWorkers, KPremia

Equation code:

EQUATION("ControlKPremia") //ok
/*
*/
V("NumWorkers");
V("KNbrWorkers");

v[0]=v[1]=0;
CYCLE(cur, "KLabor")
{
  v[0]=VS(cur,"KPremia");
  v[1]+=v[0];
}
v[2]=V("KWagePrem");
v[3]=v[1]-v[2];
//if(v[3]>0.001 | v[3]<-0.001) // avoid approximation issue
//INTERACT("ControlKPremia",v[3]);
RESULT(v[3] )


Variable:  KRdExpenditure

Contained in:  KFirm
Used in:  SumKRdExpenditure
Using:  MinWageKNbrEngineers, KWageEngineers, KEWagecoeff

Equation code:

EQUATION("KRdExpenditure")
/*
*/

V("KWageEngineers");

v[0]=V("MinWage");
v[1]=V("KEWagecoeff");
v[3]=V("KNbrEngineers");

RESULT((v[1]*v[0]*v[3]) )


Variable:  KENCost

Contained in:  KFirm
Used in:  IncomeBeforeDebtPaymentsKF, GOSK, KProfit, KFirmControlCurrent
Using:  KENPriceEN

Equation code:

EQUATION("KENCost")
/*
*/
v[3]=V("KEN");
v[4]=V("PriceEN");
v[6]=v[3]*v[4]; //UNRECOGNISE GRAMMAR ERROR
RESULT(v[6] )


Parameter:  KDelivered

Contained in:  KFirm
Used in:  KRevenues2, KProductionFlow


Parameter:  KType

Contained in:  KFirm
Used in:  StatKFirms, KShareEngiProcess, CurrentProductivity, EnergyFrontierProd, PlaceOrderEF, PlaceOrder


Variable:  ExpCostENK

Contained in:  KFirm
Used in:  (never used)
Using:  MinWageKPriceCurrentProductivitysInterestRate, TimeRepaymentEF

Equation code:

EQUATION("ExpCostENK")
/*
Expected cost to produce energy without margin and management
*/
v[12]=V("MinWage");
v[4]=V("CurrentProductivity"); //current state of the K art
v[16]= v[12]/v[4]; // labor cost
v[6]=V("KPrice");
v[17]=v[6]; // Principal
v[18]=V("TimeRepaymentEF");
v[97]=v[17]/v[18];
v[11]=V("sInterestRate");
v[19]=v[11]*v[17]; // Interests

v[7]=(v[16]+v[97]+v[19]); // expected cost

RESULT(v[7] )


Variable:  KFirmControlCurrent

Contained in:  KFirm
Used in:  SumKFirmControlCurrent
Using:  FinancialTrading, TradeKWagePrem, KLaborCost, KENCostKRevenues, CashKF, InterestDepositsKF, OverdraftPaymentKF, CashKFAdjustment

Equation code:

EQUATION("KFirmControlCurrent")
/*
*/
V("Trade");
V("FinancialTrading");

v[0]=V("KRevenues");
v[1]=V("KWagePrem");
v[2]=V("KLaborCost");
v[4]=V("KENCost");
//v[7]=VL("OverdraftPaymentKF",1);
//v[8]=VL("InterestDepositsKF",1);
v[7]=V("OverdraftPaymentKF");
v[8]=V("InterestDepositsKF");
v[12]=V("CashKF");
v[13]=VL("CashKF",1);
v[14] = V("CashKFAdjustment");

v[20]=v[0]-v[1]-v[2]-v[4]-v[7]+v[8]-(v[12]-v[13])-v[14];
RESULT(v[20] )


Parameter:  KProcessShock

Contained in:  KFirm
Used in:  KLaborProductivity


Variable:  KExpCostEN

Contained in:  KFirm
Used in:  KShareEngiProd
Using:  CurrentEfficiencyPriceENMA

Equation code:

EQUATION("KExpCostEN")
/*
*/
v[1]=V("PriceENMA");
v[2]=V("CurrentEfficiency");

v[0]=v[1]/v[2];

RESULT(v[0] )


Variable:  KExpCostLabor

Contained in:  KFirm
Used in:  KShareEngiProd
Using:  MinWageMACurrentProductivity

Equation code:

EQUATION("KExpCostLabor")
/*
*/
v[1]=V("MinWageMA");
v[2]=V("CurrentProductivity");

v[0]=v[1]/v[2];

RESULT(v[0] )


Variable:  SumKNbrWorkers

Contained in:  KFirm
Used in:  (never used)
Using:  KNbrWorkers

Equation code:

EQUATION("SumKNbrWorkers")
/*
*/
v[0]=SUM("KNbrWorkers");

RESULT(v[0] )


Variable:  GOSK

Contained in:  KFirm
Used in:  GOSKShare, StatKFirms
Using:  KProductionFlow, KLaborCost, KENCostKNbrEngineers, KRevenues

Equation code:

EQUATION("GOSK")
/*
Gross Operating Surplus of KFirm, difference between revenues, labor costs and energy costs
*/
V("KNbrEngineers"); // compute first the number of engineers which use the past value of cumulated profits
V("KProductionFlow");
v[0]=V("KRevenues");
v[2]=V("KENCost");
v[3]=V("KLaborCost"); // includes engineers

v[10]=v[0]-v[2]-v[3];
RESULT(v[10] )


Variable:  GOSKShare

Contained in:  KFirm
Used in:  (never used)
Using:  GOSKKRevenues

Equation code:

EQUATION("GOSKShare")
/*
GOS / MonetarySales
*/
v[0]=V("KRevenues");
v[1]=V("GOSK");
v[0]==0 ? v[10]=0 : v[10] = v[1]/v[0];
RESULT(v[10] )


Variable:  IncomeBeforeDebtPaymentsKF

Contained in:  KFirm
Used in:  sIncomeBeforeDebtPaymentsKF
Using:  KProductionFlow, KLaborCost, KENCostKNbrEngineers, KRevenues, InterestDepositsKF

Equation code:

EQUATION("IncomeBeforeDebtPaymentsKF")
/*
*/
V("KNbrEngineers"); // compute first the number of engineers which use the past value of cumulated profits
V("KProductionFlow");

v[0]=V("KRevenues");
v[2]=V("KENCost");
v[3]=V("KLaborCost");
v[8]=V("InterestDepositsKF");

v[5]=v[0]-v[2]-v[3]+v[8];
RESULT(v[5] )


Variable:  sIncomeBeforeDebtPaymentsKF

Contained in:  KFirm
Used in:  sIncomeBeforeDebtPaymentsKF, RRoKKF
Using:  IncomeBeforeDebtPaymentsKF, sIncomeBeforeDebtPaymentsKF

Equation code:

EQUATION("sIncomeBeforeDebtPaymentsKF")
/*
*/
v[1]=VL("sIncomeBeforeDebtPaymentsKF",1);
v[2]=V("IncomeBeforeDebtPaymentsKF");

v[3]=v[1]*0.95+0.05*v[2];
RESULT(v[3] )


Variable:  LiabilitiesKF

Contained in:  KFirm
Used in:  sLiabilitiesKF
Using:  CashKF

Equation code:

EQUATION("LiabilitiesKF")
/*
*/
v[36]=-1 * V("CashKF");


if(v[37]<0.0001)
 v[38]=0.0001;
else
 v[38]=v[36];

RESULT(v[38] )


Variable:  sLiabilitiesKF

Contained in:  KFirm
Used in:  sLiabilitiesKF
Using:  LiabilitiesKF, sLiabilitiesKF

Equation code:

EQUATION("sLiabilitiesKF")
/*
*/
v[1]=VL("sLiabilitiesKF",1);
v[2]=V("LiabilitiesKF");

v[3]=v[1]*0.95+0.05*v[2];
RESULT(v[3] )


Variable:  TaxK

Contained in:  KFirm
Used in:  SumTaxK, BalanceK
Using:  taxrateKProfit

Equation code:

EQUATION("TaxK")
/*
Tax paid on profit of F firm
*/

v[0] = V("taxrate");
v[1] = V("KProfit");
if(v[1]>0)
 v[2]=v[0]*v[1];
else
 v[2]=0;
RESULT(v[2] )


Object:  KLabor

Contained in:  Root—>Stats—>Country—>Machinery—>KFirm

Variables:  
Parameters:  

Variable:  KNbrWorkers

Contained in:  KLabor
Used in:  ControlPremia, ControlKPremia, SumKNbrWorkers, Production, KLaborCost, KNbrEngineers, KWage, KNbrWorkers, KQ, AggProductivity, NbrWorkers, Init, CheckFinBalance, EmploymentConcentration, GlobalFlows
Using:  KaNW, UnemploymentRate, tauMax, tauMin, tauMultiplierSRMultiplier, TopSavingRateNumClass, Expenditure, ShareWageIncome, SharePremiaIncome, ShareIncome, Individuals, LorenzInd, ComputeShare, Income, Consumption, SavingRate, CashCIdNeedIdDCh, tau, NegativeQuality, BalanceC, OverdraftPaymentCKVacancies, KRatioVacanciesKNbrWorkers, KDesiredUnusedCapacity, KLaborProductivity, IdKLabor, knu, KAmount, KCompletion

Equation code:

EQUATION("KNbrWorkers")
/*
Number of workers in the capital sector firms
*/
v[1]=0;
CYCLES(p->up, cur, "Order")
 {
  v[11]=VS(cur,"KAmount");
  v[12]=VS(cur,"KCompletion");
  v[1]+=v[11]-v[12];
 }
v[15]=0;
CYCLE_SAFES(p->up, cur, "KLabor")
 { //check how many tiers already exist
  if(VLS(cur,"KNbrWorkers",1)>0)
    v[15]++;
  else
    DELETE(cur);
 }
v[14]=V("IdKLabor");
if(v[14]==1)
 {
  v[0]=VL("KNbrWorkers",1);
  v[2]=VL("KLaborProductivity",1);
  v[4]=V("KDesiredUnusedCapacity");
  v[3]=v[4]*(v[1]/v[2]);
  v[5]=V("KaNW");
  v[6]=v[0]*v[5]+(1-v[5])*v[3];
v[26] = VL("UnemploymentRate", 1);
  v[28]=v[6]-v[0];
  if(v[28]>0)
   {
    v[28]*=v[26];
    v[6]=v[0]+v[28];
   }

  v[33]=v[3]>v[6]?v[3]-v[6]:0;
  v[54]=v[33]/v[6];
  WRITES(p->up,"KVacancies",v[33]);
  WRITES(p->up,"KRatioVacancies",v[54]);
  if(v[6]<1)
   v[6]=1; //limit the minimum number of workers to 1 to avoid crazy errors.
 }
else
 {// when above the first tier workers...
  v[18]=V("IdKLabor");
  cur=SEARCH_CNDS(p->up,"IdKLabor",v[18]-1);
  v[19]=VS(cur,"KNbrWorkers"); //and the number of workers in the previous tier
  v[21]=VS(cur,"knu"); //given the worker ratio between tiers n the tier below
  v[6]=v[19]/v[21]; // compute the required executives
  v[54]=VS(p->up,"KRatioVacancies");
  INCRS(p->up,"KVacancies",v[6]*v[54]);
  v[17]=V("knu"); //given the worker ratio between tiers in the present tier
  if(v[6]>=v[17] && v[18]==v[15])
   {
    cur1=ADDOBJ_EXS(p->up,"KLabor",p);
    WRITES(cur1,"IdKLabor",v[18]+1);
    v[20]=v[6]/v[17];
    WRITELS(cur1,"KNbrWorkers",v[20], t);
    WRITELLS(cur1,"KNbrWorkers",0, t,1); // write also that the number of workers in the previous period is 0, to be used in the statistics
    v[22]=0;
    CYCLES(p->up->up->up,cur2, "Class")
     {if(v[22]==0)
       {
        cur7=SEARCHS(cur2,"BankC");
        cur7=cur7->hook;
       }
      v[22]++;
     }
    if(v[22]-1<v[18]+1)
     { /// if there is still not a class for the new tyoe of wage earner create one
      cur2=SEARCH_CNDS(p->up->up->up,"NumClass",v[18]);
      cur3=ADDOBJ_EXS(cur2->up,"Class",cur2);
      cur6=SEARCHS(cur3,"BankC");
      WRITELS(cur6,"BalanceC",0, t-1);
      WRITELS(cur6,"OverdraftPaymentC",0, t-1);
      cur6->hook=cur7;

      cur1->hook=cur3;
      v[44]=VS(cur2,"SavingRate");
      v[45]=VS(cur2->up,"SRMultiplier");
      v[47] = VS(cur2->up, "TopSavingRate");
      v[46]=v[44]*v[45]+(1-v[45])*v[47];
      WRITES(cur3,"SavingRate",v[46]);

      WRITES(cur3,"NumClass",v[18]+1);
      WRITELLS(cur3,"Expenditure",0, t-1,1);
      WRITELS(cur3,"Expenditure",0, t);
      WRITELS(cur3,"Income",0, t-1);
      WRITELS(cur3,"Consumption",0, t-1);
      WRITELS(cur3,"ShareWageIncome",0, t-1);
      WRITELS(cur3,"SharePremiaIncome",0, t-1);
      WRITELS(cur3, "CashC", 0, t-1);
      WRITELS(cur3,"ShareIncome",0, t-1); // reset the share income to be recomputed
      WRITES(cur3,"Individuals",v[20]); // set the number of individuals to nu;ber of workers of the new class
      v[35]=VS(cur2,"LorenzInd");
      WRITES(cur3,"LorenzInd",v[35]+v[20]); // set total number of workers as previous total plus new workers
      //WRITELS(cur3,"NoConsumption",0, t-1); // set the available income due to unavailability of goods to 0
      CYCLES(cur3, cur, "Need")
       { // enter in neds and characterisitcs to change the tau parameter (the minimum is set every period)
        v[27]=VS(cur,"IdNeed");
        CYCLES(cur, cur1, "DCh")
         {
          v[26]=VS(cur1,"IdDCh");
          CYCLES(cur2, cur4, "Need")
           { // cycle among the needs of the preceding class
            v[28]=VS(cur4,"IdNeed");
            if(v[28]==v[27])
             { // when in the same need as the one the new class is cycling cycle through the char of the preceding class
              CYCLES(cur4, cur5, "DCh")
               {
                v[29]=VS(cur5,"IdDCh");
                if(v[29]==v[26])// when in the same characteristic the new class is cycling
                 v[30]=VS(cur5,"tau"); // read the value of the tau parameter
               }

             }
           }
          v[31]=VS(cur1,"tauMultiplier"); // the speed of adjustment of the tolerance level from one class to the following one
          v[34]=VS(cur1,"NegativeQuality");
          if(v[34]>0)
           v[33]=VS(p->up->up->up,"tauMax"); // the asympthotic level of the tolerance level (1 for qualities and 0 for price)
          if(v[34]<0)
           v[33]=VS(p->up->up->up,"tauMin"); // the asympthotic level of the tolerance level (1 for qualities and 0 for price)
          v[32]=v[30]*(1-v[31])+v[31]*v[33]; // adjustment in the treshold level of tolerance
          WRITES(cur1,"tau",v[32]); // finally write the tau for the new consumer class in each of its characteristic for each need
         }

       }
     v[35]=VS(cur3,"ComputeShare"); // set the expenditure shares for the needs in the new class
     }
    else
     {
      cur3=SEARCH_CND("NumClass",v[18]+1);
      cur1->hook=cur3;
     }
   }
  if(v[18]>2 && v[19]<v[21])
   v[6]=0;
 }

RESULT(v[6] )


Variable:  KWage

Contained in:  KLabor
Used in:  KWagePrem, Production, KLaborCost, KWage, CheckFinBalance, GlobalFlows
Using:  MinWagePayTimeIndividuals, WageIncomeKNbrWorkers, KWage, KWagecoeff, IdKLabor

Equation code:

EQUATION("KWage")
/*
Comment
*/
v[12]=V("KNbrWorkers");
v[2]=V("IdKLabor");
if(v[2]==1)
 {
  v[0]=V("MinWage");
  v[1]=V("KWagecoeff");
 }
else
 {
  cur=SEARCH_CNDS(p->up,"IdKLabor",v[2]-1);
  v[0]=VS(cur,"KWage");
  v[1]=V("KWagecoeff"); // wage coefficient as the wage tier multiplier
 }
VS(p->hook,"PayTime");
INCRS(p->hook,"Individuals",v[12]);
INCRS(p->hook,"WageIncome",v[12]*v[0]*v[1]);

RESULT((v[0]*v[1]) )


Parameter:  KWagecoeff

Contained in:  KLabor
Used in:  AvWagecoeff, KWage


Parameter:  KDesiredUnusedCapacity

Contained in:  KLabor
Used in:  KNbrWorkers


Variable:  KLaborProductivity

Contained in:  KLabor
Used in:  StatKFirms, KLaborProductivity, KNbrWorkers, KQ
Using:  z, KProcessShockKLaborProductivity, KNbrEngiProcess

Equation code:

EQUATION("KLaborProductivity")
/*
R\&D to improve labor productivity in K process
*/

v[0]=VL("KLaborProductivity",1);
v[1]=V("KProcessShock");
//v[2]=VL("KNbrEngiProcess",1);
v[2]=VL("KNbrEngiProcess",0);
v[3]=V("z");
v[4]=-(v[2]*v[3]);
v[5]=1-exp(v[4]);//Proba to innovate increases with the nbr of engineers
//first random draw to define the outcome of R&D i.e. success or failure
if (RND<v[5])
{
v[8]=norm(0,v[1]);//second stochastic variable, defines the level of productivity out of the successful R&D process
}
else
{
v[8]=0;
}
v[10]=max(v[8],0);
v[11]=v[0] + v[10];
RESULT(v[11] )


Parameter:  IdKLabor

Contained in:  KLabor
Used in:  KWagePrem, Production, AvWagecoeff, KWage, KNbrWorkers, Init, InitInProgress


Parameter:  knu

Contained in:  KLabor
Used in:  KNbrWorkers


Parameter:  KPremia

Contained in:  KLabor
Used in:  KWagePrem, ControlKPremia, GlobalFlows


Object:  KEngineers

Contained in:  Root—>Stats—>Country—>Machinery—>KFirm

Variables:  
Parameters:  

Variable:  KNbrEngineers

Contained in:  KEngineers
Used in:  IncomeBeforeDebtPaymentsKF, GOSK, KProfit, KNbrEngiProd, KNbrEngiEff, KNbrEngiProcessEff, KNbrEngiProcess, KRdExpenditure, KNbrGreenKProd, KLaborCost, KWageEngineers, AggProductivity, NbrWorkers, Init, CheckFinBalance, EmploymentConcentration, GlobalFlows
Using:  EngineersShare, KVacancies, KRatioVacanciesKNbrWorkers

Equation code:

EQUATION("KNbrEngineers")
/*
Number of enginers is a share of the number of blue collars.
*/

v[8]=V("EngineersShare");
v[9]=VS(p->up,"KNbrWorkers"); // number of first tier worker as a max to chose the number of engineers
v[11]=v[9]*v[8];
v[55]=VS(p->up,"KRatioVacancies");
INCRS(p->up,"KVacancies",v[55]*v[11]);

RESULT(v[11] )


Variable:  KWageEngineers

Contained in:  KEngineers
Used in:  ControlRdExpenditure, KRdExpenditure, WageEngineers, Production, KLaborCost, CheckFinBalance, GlobalFlows
Using:  MinWagePayTimeIndividuals, WageIncomeKNbrEngineers, KEWagecoeff

Equation code:

EQUATION("KWageEngineers")
/*
Wage of engineers
*/
v[0]=V("MinWage");
v[1]=V("KEWagecoeff");
VS(p->hook->up,"PayTime");
v[3]=V("KNbrEngineers");
VS(p->hook->up,"PayTime");
INCRS(p->hook,"WageIncome",v[1]*v[0]*v[3]);
INCRS(p->hook,"Individuals",v[3]);
RESULT((v[0]*v[1]) )


Parameter:  KEWagecoeff

Contained in:  KEngineers
Used in:  KRdExpenditure, KWageEngineers


Variable:  KNbrEngiEff

Contained in:  KEngineers
Used in:  CurrentEfficiency
Using:  KNbrEngineers, KShareEngiEff

Equation code:

EQUATION("KNbrEngiEff")
/*
Defines the number of engineers working on vintage efficiency
*/

v[0]=VL("KNbrEngineers",1);
v[1]=V("KShareEngiEff");
v[2]=v[0]*v[1];

RESULT(v[2] )


Variable:  KNbrEngiProd

Contained in:  KEngineers
Used in:  CurrentProductivity
Using:  KNbrEngineers, KShareEngiProd

Equation code:

EQUATION("KNbrEngiProd")
/*
Defines the number of engineers working on vintage productivity
*/

v[0]=VL("KNbrEngineers",1);
v[1]=V("KShareEngiProd");
v[2]=v[0]*v[1];

RESULT(v[2] )


Variable:  KShareEngiEff

Contained in:  KEngineers
Used in:  ControlKShareEngi, KNbrEngiEff
Using:  KShareEngiProd, KShareEngiProcessEff, KShareEngiProcess

Equation code:

EQUATION("KShareEngiEff")
/*
Comment
*/
v[1]=V("KShareEngiProd");
v[2]=V("KShareEngiProcess");
v[3]=V("KShareEngiProcessEff");

v[10]=1-v[1]-v[2]-v[3]; // available engineers

RESULT(v[10] )


Variable:  KShareEngiProd

Contained in:  KEngineers
Used in:  ControlKShareEngi, KShareEngiProd, KShareEngiEff, KNbrEngiProd
Using:  MinWageMAGr, PriceENMAGrKExpCostEN, KExpCostLaborKShareEngiProd, KShareEngiProcessEff, KShareEngiProcess

Equation code:

EQUATION("KShareEngiProd")
/*
Comment
*/
v[1]=V("PriceENMAGr");
v[2]=V("MinWageMAGr");

v[3]=V("KShareEngiProcess");
v[4]=V("KShareEngiProcessEff");

v[21]=VL("KExpCostEN",1);
v[22]=VL("KExpCostLabor",1);
v[23]=v[21]+v[22];

v[24]=v[21]/v[23]; // share of cost due to energy
v[25]=v[22]/v[23]; // share of cost due to labor

v[6]=VL("KShareEngiProd",1);

//v[7]=v[2]-v[1];
v[7]=v[2]*v[25]-v[1]*v[24];

v[10]=v[6]*(1+v[7]+ 0.01*(RND - 0.5) );

v[5]=1-v[3]-v[4]-v[10];
if(v[5]<0)
END_EQUATION(v[6] ); //

RESULT(v[10] )


Parameter:  KShareEngiProcessEff

Contained in:  KEngineers
Used in:  KShareEngiProcess, ControlKShareEngi, KShareEngiProd, KShareEngiEff, KNbrEngiProcessEff


Variable:  KNbrEngiProcessEff

Contained in:  KEngineers
Used in:  KMaxEnergyEfficiency
Using:  KNbrEngineers, KShareEngiProcessEff

Equation code:

EQUATION("KNbrEngiProcessEff")
/*
Defines the number of engineers working on process efficiency
*/

v[0]=VL("KNbrEngineers",1);
v[1]=V("KShareEngiProcessEff");
v[2]=v[0]*v[1];

RESULT(v[2] )


Variable:  KShareEngiProcess

Contained in:  KEngineers
Used in:  ControlKShareEngi, KShareEngiProd, KShareEngiEff, KNbrEngiProcess
Using:  KTypeKShareEngiProcessEff

Equation code:

EQUATION("KShareEngiProcess")
/*
*/
v[1]=V("KType");
v[2]=V("KShareEngiProcessEff");
if(v[1]==2)
 {
  v[0]=0.1;
 }
else
 {
v[0]=1-v[2];
 }
RESULT(v[0] )


Variable:  ControlKShareEngi

Contained in:  KEngineers
Used in:  (never used)
Using:  KShareEngiEff, KShareEngiProd, KShareEngiProcessEff, KShareEngiProcess

Equation code:

EQUATION("ControlKShareEngi")
/*
*/
v[1]=V("KShareEngiProcess");
v[2]=V("KShareEngiEff");
v[3]=V("KShareEngiProd");
v[4]=V("KShareEngiProcessEff");

v[0]=1-v[1]-v[2]-v[3]-v[4];

RESULT(v[0] )


Variable:  KNbrEngiProcess

Contained in:  KEngineers
Used in:  KLaborProductivity
Using:  KNbrEngineers, KShareEngiProcess

Equation code:

EQUATION("KNbrEngiProcess")
/*
Defines the number of engineers working on process
*/

v[0]=VL("KNbrEngineers",1);
v[1]=V("KShareEngiProcess");
v[2]=v[0]*v[1];

RESULT(v[2] )


Object:  KCapital

Contained in:  Root—>Stats—>Country—>Machinery—>KFirm

Variables:  
Parameters:  

Variable:  CurrentProductivity

Contained in:  KCapital
Used in:  KExpCostLabor, CurrentProductivity, EnergyFrontierProd, ExpCostENK, PlaceOrderEF, PlaceOrder, AggProductivity
Using:  speedSO, EnergyFrontierProdz, ProductivityShock, KTypeKNbrEngiProd, CurrentProductivity

Equation code:

EQUATION("CurrentProductivity")
/*
Changes in the productivity of kapital thanks to R&D
*/

v[0]=VL("CurrentProductivity",1);
v[1]=V("KNbrEngiProd");
v[2]=V("z");
v[3]=V("ProductivityShock");
v[4]=-(v[1]*v[2]);
v[5]=1-exp(v[4]);//Proba to innovate increases with the nbr of engineers
//first random draw to define the outcome of R&D i.e. success or failure
if (RND<v[5])
{
v[6]=norm(0,v[3]);//second stochastic variable, defines the level of productivity out of the successful R&D process
}
else
{
v[6]=0;
}
v[7]=max(v[6],0);
v[8]=v[0] + v[7];


v[12] = V("KType");
if(v[12]!=2)
 {
  v[9] = VL("EnergyFrontierProd",1);
  v[10] = V("speedSO");
  v[11]= v[8]*v[10]+(1-v[10])*v[9];
 }
else
 {
  v[11]=v[8];
 }
RESULT(v[11] )


Variable:  CurrentEfficiency

Contained in:  KCapital
Used in:  KExpCostEN, CurrentEfficiency, PlaceOrderEF, PlaceOrder
Using:  z, EfficiencyShockKNbrEngiEff, CurrentEfficiency

Equation code:

EQUATION("CurrentEfficiency")
/*
Changes in the efficiency of kapital thanks to R&D
*/

v[0]=VL("CurrentEfficiency",1);
v[1]=V("KNbrEngiEff");
v[2]=V("z");
v[3]=V("EfficiencyShock");
v[4]=-(v[1]*v[2]);
v[5]=1-exp(v[4]);//Proba to innovate increases with the nbr of engineers
//first random draw to define the outcome of R&D i.e. success or failure
if (RND<v[5])
{
v[6]=norm(0,v[3]);//second stochastic variable, defines the level of efficiency out of the successful R&D process
}
else
{
v[6]=0;
}
v[7]=max(v[6],0);
v[8]=v[0] + v[7];

RESULT(v[8] )


Variable:  GreenEnergyCost

Contained in:  KCapital
Used in:  (never used)
Using:  KPriceMaxENProduction

Equation code:

EQUATION("GreenEnergyCost") // Called by KCapital
/*
Compute the investment cost to produce one unit of green energy during the whole life of the vintage.
*/

cur1=SEARCHS(p->up,"KFirm");

v[0]=VS(cur1,"KPrice");

// INTERACT("KPrice",v[0]);

v[1]=V("MaxENProduction");

// INTERACT("MaxENProduction",v[1]);

v[2]=v[0]/v[1];

RESULT(v[2] )


Parameter:  MaxENProduction

Contained in:  KCapital
Used in:  GreenEnergyCost


Object:  BankK

Contained in:  Root—>Stats—>Country—>Machinery—>KFirm

Variables:  
Parameters:  

Variable:  BalanceK

Contained in:  BankK
Used in:  CashKF, sBalanceK, TestFinance
Using:  KProfit, KWagePrem, TaxK

Equation code:

EQUATION("BalanceK")
/*
Balance of the current account for firms
*/
v[0]=V("KProfit");
v[1]=V("KWagePrem");
v[2] = V("TaxK");

v[3]=v[0]-v[1]-v[2];
RESULT(v[3])


Parameter:  KRevenues

Contained in:  BankK
Used in:  IncomeBeforeDebtPaymentsKF, GOSKShare, GOSK, StatKFirms, KProfit, KFirmControlCurrent, SumKRevenues, KProductionFlow


Parameter:  DebtK

Contained in:  BankK
Used in:  DebtKCh, DebtKL, Production, TestFinance


Variable:  DebtKL

Contained in:  BankK
Used in:  DebtKCh
Using:  DebtK

Equation code:

EQUATION("DebtKL")//xxx
/*
Lagged value of DebtK
 */
//v[10]=t; //sprintf(msg, "\n DebtFKL(%g)", v[10]); plog(msg);

v[0]=V("DebtK");
RESULT(v[0] )


Parameter:  KDistributedProfits

Contained in:  BankK
Used in:  (never used)


Variable:  DebtKCh

Contained in:  BankK
Used in:  (never used)
Using:  DebtK, DebtKL

Equation code:

EQUATION("DebtKCh") //xxx
/*
Change of DebtF
*/
v[0]=V("DebtK");
v[1]=V("DebtKL");
RESULT(v[0]-v[1] )


Variable:  KRevenues2

Contained in:  BankK
Used in:  (never used)
Using:  KPrice, KDelivered

Equation code:

EQUATION("KRevenues2")
/*
wrong, because KPrice is not the order's price
*/
v[0]=V("KPrice");
v[1]=V("KDelivered");
v[10]=v[0]*v[1];
RESULT(v[10] )


Variable:  CashKF

Contained in:  BankK
Used in:  KWagePrem, LiabilitiesKF, FinancialTrading, BankCapital, CashKF, CashKFAdjustment, CashInjectionKF, OverdraftPaymentKF, InterestDepositsKF, KFirmControlCurrent, SumCashKF, CheckFinBalance, CheckFinBalanceLag
Using:  BalanceK, CashKF, CashInjectionKF, OrganicCashKF

Equation code:

EQUATION("CashKF")
/*
Cash in bank deposit
*/
v[0] = VL("CashKF", 1);
v[1] = V("BalanceK");
v[2] = V("CashInjectionKF");

v[3]=v[0]+v[1]+v[2];
WRITE("OrganicCashKF", v[3]);
RESULT(v[3] )


Variable:  InterestDepositsKF

Contained in:  BankK
Used in:  IncomeBeforeDebtPaymentsKF, SumInterestDepositsKF, BankCapital, KProfit, KFirmControlCurrent, CheckFinBalance
Using:  CashKFInterestRateDeposits

Equation code:

EQUATION("InterestDepositsKF")
/*
Cash obtained as interest on deposits
*/
v[0] = V("InterestRateDeposits");
v[1] = VL("CashKF",1);/**/
if(v[1]>0)
 v[3]=v[0]*v[1];
else
 v[3]=0;
RESULT(v[3] )


Variable:  OverdraftPaymentKF

Contained in:  BankK
Used in:  SumOverdraftPaymentKF, FinancialTrading, BankCapital, KProfit, KFirmControlCurrent, CheckFinBalance
Using:  CashKFInterestRate

Equation code:

EQUATION("OverdraftPaymentKF")
/*
Interest paid on overdraft KF
*/
v[0] = VL("CashKF",1);/**/
if(v[0]>0)
 END_EQUATION(0);
v[1] = VL("InterestRate",1);

v[2]=-v[0]*v[1];
RESULT(v[2] )


Variable:  sProfitKF

Contained in:  BankK
Used in:  RRoKKF, sProfitKF
Using:  KProfitsProfitKF

Equation code:

EQUATION("sProfitKF")
/*
Smoothed ProfitKF
*/
v[0]=VL("sProfitKF",1);
v[1]=V("KProfit");

v[2]=v[0]*0.95+0.05*v[1];
RESULT(v[2] )


Variable:  RRoKKF

Contained in:  BankK
Used in:  CashInjectionKF
Using:  sIncomeBeforeDebtPaymentsKFsProfitKF

Equation code:

EQUATION("RRoKKF")
/*
*/
v[1]=V("sIncomeBeforeDebtPaymentsKF");
v[2]=V("sProfitKF");

if(v[1]<0.001)
 v[1]=0.001;

v[3]=v[2]/v[1];
RESULT(v[3] )


Variable:  CashInjectionKF

Contained in:  BankK
Used in:  CashKF, SumCashInjectionKF
Using:  minRRoKExitCashKF, RRoKKF

Equation code:

EQUATION("CashInjectionKF")
/*
Remove debt for KF with too poor Health
*/
v[22]=0;

v[19]=VL("minRRoKExit",1);
v[20]=VL("RRoKKF",1);
v[21]=VL("CashKF",1);

if(v[19]>v[20] && v[21]<0)
 {
 v[22]= -v[21];
 }

RESULT(v[22])


Parameter:  OrganicCashKF

Contained in:  BankK
Used in:  CashKF, CashKFAdjustment


Variable:  CashKFAdjustment

Contained in:  BankK
Used in:  KFirmControlCurrent
Using:  CashKF, OrganicCashKFBankCapital

Equation code:

EQUATION("CashKFAdjustment")
/*
Variation of CashKF due to Bank's actions
*/

V("BankCapital");
v[0] = V("CashKF");
v[1] = V("OrganicCashKF");
v[2]=v[1]-v[0];
RESULT(v[2] )


Object:  Sectors

Contained in:  Root—>Stats—>Country
Containing:  sFirm

Variables:  
Parameters:  

Parameter:  IdGood

Contained in:  Sectors
Used in:  Entry, TTB_multiplWinner, Trade, Init, HerfIndexS, SectEmployment, InitInProgress


Parameter:  NFirmsS

Contained in:  Sectors
Used in:  Exit, Demography, Trade, Init


Parameter:  SInvHerf

Contained in:  Sectors
Used in:  Avx


Parameter:  TotSalesS

Contained in:  Sectors
Used in:  HerfIndexS


Parameter:  AvxS

Contained in:  Sectors
Used in:  Avx, FrontierX


Parameter:  AvpS

Contained in:  Sectors
Used in:  Avx


Variable:  FrontierX

Contained in:  Sectors
Used in:  Entry
Using:  AvxS, maxXS, aFrontierX

Equation code:

EQUATION("FrontierX")
/*
Imitable value of X for new entrants
*/
//DEBUG_START;

V("AvxS");
v[0]=V("maxXS");

v[1]=V("aFrontierX");

v[3]=CURRENT;

//INTERACT("current",v[3]);


v[2]=v[1]*CURRENT+(1-v[1])*v[0];
if(v[2]==0)
INTERACT("ZeroFrontierX",v[2]);

//DEBUG_STOP;
RESULT(v[2] )


Parameter:  maxXS

Contained in:  Sectors
Used in:  Avx, FrontierX


Parameter:  aFrontierX

Contained in:  Sectors
Used in:  FrontierX


Parameter:  probEntry

Contained in:  Sectors
Used in:  Demography


Parameter:  minHealth

Contained in:  Sectors
Used in:  Exit


Variable:  Demography

Contained in:  Sectors
Used in:  Avx
Using:  FinancialTrading, ControlPremiaIncomeEntry, Exit, NFirmsS, probEntry, numExit, AvAgeDeath, TotalAssets, RetainedProfitsBank, BankControlCapital, BankControlCurrent

Equation code:

EQUATION("Demography")
/*
Comment
*/
V("ControlPremiaIncome");
V("FinancialTrading");
V("TotalAssets");
V("BankControlCurrent");
V("BankControlCapital");
V("RetainedProfitsBank");


cur=SEARCHS(p->up,"Supply");


VS(cur,"Exit");
v[3]=V("numExit");
//v[5]=INCR("NFirmsS",-v[3]);
//if(v[5]<=0)
 //INTERACT("Removed last firm in sector. Likely crash will follow", v[3]);
if(v[3]>0)
 MULT("AvAgeDeath",1/v[3]);

v[4]=V("probEntry");
if(RND<v[4])
 { //v[1]=VS_CHEAT(cur,"Entry",p);
v[1]=V_CHEATS(cur,"Entry",p);
   INCR("NFirmsS",v[1]);
 }
RESULT( 1)


Parameter:  SUnitSales

Contained in:  Sectors
Used in:  Entry, Avx


Parameter:  SQ

Contained in:  Sectors
Used in:  Avx


Parameter:  SRevenues

Contained in:  Sectors
Used in:  Avx


Parameter:  SProfits

Contained in:  Sectors
Used in:  Avx


Parameter:  SNumFirms

Contained in:  Sectors
Used in:  Avx


Parameter:  SMonetarySales

Contained in:  Sectors
Used in:  Avx


Parameter:  SAvHealth

Contained in:  Sectors
Used in:  Avx


Parameter:  SAvBacklog

Contained in:  Sectors
Used in:  Avx


Parameter:  SAvStock

Contained in:  Sectors
Used in:  Avx


Parameter:  numExit

Contained in:  Sectors
Used in:  ClearExitRecord, Exit, Demography


Parameter:  AvAgeDeath

Contained in:  Sectors
Used in:  ClearExitRecord, Exit, Demography


Parameter:  SKProductivity

Contained in:  Sectors
Used in:  Avx


Parameter:  SULC

Contained in:  Sectors
Used in:  Avx


Parameter:  Sapp

Contained in:  Sectors
Used in:  Avx


Parameter:  SnumBLI

Contained in:  Sectors
Used in:  Avx


Parameter:  SNetWorth

Contained in:  Sectors
Used in:  Avx


Parameter:  SAvAge

Contained in:  Sectors
Used in:  Avx


Parameter:  SectEmploymentShare

Contained in:  Sectors
Used in:  SectEmployment, Mechanisation, EmploymentConcentration


Variable:  SectEmployment

Contained in:  Sectors
Used in:  (never used)
Using:  GDP, GDPnom, NbrWorkersCapitalStock, ConstPrice, Revenues, UnitSalesNumWorkersIdGood, SectEmploymentShare, SectSales, SectNomGDPShare, SectOutputShare, SectMechanisation

Equation code:

EQUATION("SectEmployment")
/*
Herfindahl indexin each sector
*/

v[0]=v[10]=v[20]=v[30]=0;
v[1]=V("IdGood");
v[4]=V("NbrWorkers");
v[14]=V("GDPnom");
v[24]=V("GDP");
  CYCLE( cur1, "sFirm")
   {
      v[3]=VS(cur1->hook,"NumWorkers");
      v[11]=VS(cur1->hook,"Revenues");
      v[21]=VS(cur1->hook,"UnitSales");
      v[22]=VS(cur1->hook,"ConstPrice");
      v[31]=VS(cur1->hook,"CapitalStock");
      v[23]=v[21]*v[22];
      v[0]+=v[3];
      v[10]+=v[11];
      v[20]+=v[23];
      v[30]+=v[31];
   }

v[7]=v[0]/v[4];
v[17]=v[10]/v[14];
v[24]==0 ? v[27]=0 : v[27]=v[20]/v[24];
WRITE("SectEmploymentShare",v[7]);
WRITE("SectSales",v[10]);
WRITE("SectNomGDPShare",v[17]);
WRITE("SectOutputShare",v[27]);
v[32]=v[30]/v[0];
WRITE("SectMechanisation",v[32]);
RESULT(v[0] )


Parameter:  SectSales

Contained in:  Sectors
Used in:  SectEmployment, ConsumptionConcentration


Parameter:  SectNomGDPShare

Contained in:  Sectors
Used in:  SectEmployment, EmploymentConcentration


Parameter:  SectOutputShare

Contained in:  Sectors
Used in:  SectEmployment, EmploymentConcentration


Parameter:  SectSalesShare

Contained in:  Sectors
Used in:  ConsumptionConcentration


Parameter:  SectMechanisation

Contained in:  Sectors
Used in:  SectEmployment, Mechanisation


Parameter:  RedistributeSales

Contained in:  Sectors
Used in:  TradeXXX


Parameter:  SBacklogShare

Contained in:  Sectors
Used in:  Avx


Variable:  newFirmKNeed

Contained in:  Sectors
Used in:  Entry
Using:  CapitalStockmsEntrants

Equation code:

EQUATION("newFirmKNeed")
/*
Estimation of the capital newly entered firm need to order
*/
v[0]=v[1]=v[2]=0;
CYCLE(cur, "sFirm")
 {
  v[0] += VS(cur->hook, "CapitalStock");
 }
v[1] = V("msEntrants");
v[2]=v[0]*v[1];
if(v[2]==0)//***
v[2]=100;//***
RESULT(v[2] )


Variable:  msEntrants

Contained in:  Sectors
Used in:  Entry, newFirmKNeed
Using:  NbrFirms

Equation code:

EQUATION("msEntrants")
/*
Estimation of the capital newly entered firm need to order
*/
v[1]=V("NbrFirms");
v[0]=0.1/v[1];
RESULT(v[0] )


Object:  Bank

Contained in:  Root—>Stats—>Country

Variables:  
Parameters:  

Parameter:  InterestRateDeposits

Contained in:  Bank
Used in:  InterestDepositsC, InterestDepositsF, InterestDepositsKF, InterestDepositsEF, TotalInterestDeposits, InterestRateSpread, InterestRate


Parameter:  TotalDeposits

Contained in:  Bank
Used in:  FinancialTrading, BankCapital, ControlBankBS, TotalDepositsV


Parameter:  TotalOverdraft

Contained in:  Bank
Used in:  FinancialTrading, TotalAssets


Parameter:  TotalOutstandingDebt

Contained in:  Bank
Used in:  FinancialTrading, TotalOutstandingDebtV, TotalAssets


Parameter:  TotalInterestCollected

Contained in:  Bank
Used in:  FinancialTrading, BankCapital, BankControlCurrent, TotalInterestCollectedV, TotalProfitsBank


Parameter:  TotalCapitalPayment

Contained in:  Bank
Used in:  FinancialTrading


Variable:  TotalInterestDeposits

Contained in:  Bank
Used in:  BankControlCurrent, TotalInterestDepositsV, TotalProfitsBank
Using:  FinancialTradingInterestRateDeposits, TotalDepositsLag

Equation code:

EQUATION("TotalInterestDeposits")
/*
Interest paid on deposits
*/
V("FinancialTrading");
v[1] = V("InterestRateDeposits");
v[2] = V("TotalDepositsLag");

v[0] = v[1]*v[2];
RESULT(v[0] )


Variable:  TotalAssets

Contained in:  Bank
Used in:  CheckFinBalanceRatio, BankCapital, ControlBankBS, OwnFundsTargetLRBank, InterestRateSpread, CapitalAdequacyRatio, ExpectedLoanDefaultsPC, Demography
Using:  FinancialTradingTotalOverdraft, TotalOutstandingDebt

Equation code:

EQUATION("TotalAssets")
/*
Total values of assets
*/
V("FinancialTrading");
v[1] = V("TotalOverdraft");
v[2] = V("TotalOutstandingDebt");

v[3]=v[1]+v[2];
RESULT(v[3] )


Variable:  OwnFundsBank

Contained in:  Bank
Used in:  OwnFundsBank
Using:  FinancialTradingOwnFundsBank, RetainedProfitsBank, NonPerformingLoansTotal

Equation code:

EQUATION("OwnFundsBank")
/*
*/
V("FinancialTrading");
v[1] = VL("OwnFundsBank",1);
v[2] = V("RetainedProfitsBank");
v[3] = V("NonPerformingLoansTotal");

v[0]= v[1]+v[2]-v[3];
RESULT(v[0] )


Variable:  TotalProfitsBank

Contained in:  Bank
Used in:  RetainedProfitsBank
Using:  FinancialTradingTotalInterestCollected, TotalInterestDeposits

Equation code:

EQUATION("TotalProfitsBank")
/*
*/
V("FinancialTrading");
//v[1] = VL("TotalInterestCollectedV",1);
//v[2] = VL("TotalInterestDepositsV",1);

v[1] = V("TotalInterestCollected");
v[2] = V("TotalInterestDeposits");

v[0]= v[1]-v[2];
RESULT(v[0] )


Variable:  RetainedProfitsBank

Contained in:  Bank
Used in:  BankControlCurrent, OwnFundsBank, Demography
Using:  FinancialTradingTotalProfitsBank, DistributedProfitsBank

Equation code:

EQUATION("RetainedProfitsBank")
/*
*/
V("FinancialTrading");
v[1] = V("TotalProfitsBank");
v[2] = V("DistributedProfitsBank");

v[0] = v[1] - v[2];
RESULT(v[0] )


Variable:  DistributedProfitsBank

Contained in:  Bank
Used in:  BankControlCurrent, BankProfitIncome, RetainedProfitsBank, TotalProfitsTargetBank
Using:  FinancialTrading, GDPnomProfitShareTargetBank

Equation code:

EQUATION("DistributedProfitsBank")
/*
*/
V("FinancialTrading");
//v[1] = V("GDPF");
//v[2] = V("GDPK");
v[3] = V("ProfitShareTargetBank"); // parameter
v[4] = VL("GDPnom",1);


v[0] = (v[4]) * v[3];
RESULT(v[0] )


Parameter:  ProfitShareTargetBank

Contained in:  Bank
Used in:  BankCapital, DistributedProfitsBank


Variable:  OwnFundsTargetLRBank

Contained in:  Bank
Used in:  OwnFundsTargetSRBank
Using:  FinancialTradingTotalAssets, CapitalAdequacyRatioTargetBank

Equation code:

EQUATION("OwnFundsTargetLRBank")
/*
*/
V("FinancialTrading");
v[1] = V("TotalAssets");
v[2] = V("CapitalAdequacyRatioTargetBank"); //parameter set in line with Basel III regulations

v[0] = v[1] * v[2];
RESULT(v[0] )


Parameter:  CapitalAdequacyRatioTargetBank

Contained in:  Bank
Used in:  OwnFundsTargetLRBank


Variable:  OwnFundsTargetSRBank

Contained in:  Bank
Used in:  RetainedProfitsTargetBank
Using:  FinancialTradingOwnFundsTargetLRBank, OwnFundsParameterBank, BankCapital

Equation code:

EQUATION("OwnFundsTargetSRBank")
/*
*/
V("FinancialTrading");
v[1] = VL("BankCapital",1);
v[2] = V("OwnFundsParameterBank"); //parameter that determines the proportion of the difference between the target and actual levels made up in each period
v[3] = V("OwnFundsTargetLRBank");

v[0] = v[1] + (v[2]* (v[3] - v[1] ));
RESULT(v[0] )


Parameter:  OwnFundsParameterBank

Contained in:  Bank
Used in:  OwnFundsTargetSRBank


Variable:  RetainedProfitsTargetBank

Contained in:  Bank
Used in:  TotalProfitsTargetBank
Using:  FinancialTradingOwnFundsTargetSRBank, TotalOutstandingDebtV, ExpectedLoanDefaultsPC, BankCapital

Equation code:

EQUATION("RetainedProfitsTargetBank")
/*
*/
V("FinancialTrading");
v[1] = V("OwnFundsTargetSRBank");
v[2] = VL("BankCapital",1);
v[3] = V("ExpectedLoanDefaultsPC");
v[4] = VL("TotalOutstandingDebtV",1);

v[0] = (v[1] - v[2]) + (v[3] * v[4]);
RESULT(v[0] )


Variable:  TotalOutstandingDebtV

Contained in:  Bank
Used in:  RetainedProfitsTargetBank
Using:  FinancialTradingTotalOutstandingDebt

Equation code:

EQUATION("TotalOutstandingDebtV")
/*
variable of TotalOutstandingDebt (for calculating lag)
 */
 V("FinancialTrading");
v[0]=V("TotalOutstandingDebt");
RESULT(v[0] )


Variable:  ExpectedLoanDefaultsPC

Contained in:  Bank
Used in:  RetainedProfitsTargetBank, InterestRateSpread, ExpectedLoanDefaultsPC
Using:  FinancialTradingTotalAssets, ExpectedLoanDefaultsPC, NonPerformingLoansTotal

Equation code:

EQUATION("ExpectedLoanDefaultsPC")
/*
*/
V("FinancialTrading");


v[1] = VL("NonPerformingLoansTotal",1);
v[2] = VL("TotalAssets",1);
v[3] = VL("ExpectedLoanDefaultsPC",1);


v[0] = (0.9*v[3]) + (0.1*(v[1]/v[2]));
RESULT(v[0] )


Variable:  TotalProfitsTargetBank

Contained in:  Bank
Used in:  InterestRateSpread
Using:  FinancialTradingDistributedProfitsBank, RetainedProfitsTargetBank

Equation code:

EQUATION("TotalProfitsTargetBank")
/*
*/
V("FinancialTrading");
v[1] = V("RetainedProfitsTargetBank");
v[2] = V("DistributedProfitsBank");

v[0] = v[1] + v[2];
RESULT(v[0] )


Variable:  InterestRateSpread

Contained in:  Bank
Used in:  InterestRate
Using:  FinancialTradingInterestRateDeposits, TotalAssets, ExpectedLoanDefaultsPC, TotalProfitsTargetBank, TotalDepositsV, MinInterestRateSpread, MaxInterestRateSpread

Equation code:

EQUATION("InterestRateSpread")
/*
*/
V("FinancialTrading");
v[1] = V("TotalProfitsTargetBank");
v[2] = V("InterestRateDeposits"); // parameter
v[3] = VL("TotalDepositsV",1);
v[4] = V("ExpectedLoanDefaultsPC"); // parameter
v[5] = VL("TotalAssets",1);

//v[10]=(1-v[4]) * v[5];
//sprintf(msg, "\n InterestRateSpreadTest(%g)", v[10]); plog(msg);


v[0] = (v[1] + (v[2] * (v[3] - ( (1-v[4]) * v[5] ) ) ) ) / ( (1-v[4]) * v[5]);//xxx
//sprintf(msg, "\n InterestRateSpread(%g)", v[0]); plog(msg);


v[6]=V("MinInterestRateSpread");
if(v[0]<v[6])
v[0]=v[6];

v[6]=V("MaxInterestRateSpread");
if(v[0]>v[6])
v[0]=v[6];


RESULT(v[0] )


Variable:  InterestRate

Contained in:  Bank
Used in:  sInterestRate, InterestGovFund, InterestF, InterestEF, OverdraftPaymentC, OverdraftPaymentF, OverdraftPaymentKF, OverdraftPaymentEF, KapitalNeed
Using:  InterestRateDeposits, InterestRateSpread

Equation code:

EQUATION("InterestRate")
/*
*/

v[1] = V("InterestRateDeposits");
v[2] = V("InterestRateSpread");

v[0] = v[1] + v[2];//xxx
RESULT(v[0] )


Variable:  CapitalAdequacyRatio

Contained in:  Bank
Used in:  (never used)
Using:  FinancialTradingTotalAssets, BankCapital

Equation code:

EQUATION("CapitalAdequacyRatio")
/*
*/
V("FinancialTrading");
v[1] = V("BankCapital");
v[2] = V("TotalAssets");

v[0] = v[1] / v[2];
RESULT(v[0] )


Variable:  TotalInterestCollectedV

Contained in:  Bank
Used in:  (never used)
Using:  FinancialTradingTotalInterestCollected

Equation code:

EQUATION("TotalInterestCollectedV")
/*
variable of TotalInterestCollected (for calculating lag)
 */
 V("FinancialTrading");
v[0]=V("TotalInterestCollected");
RESULT(v[0] )


Variable:  TotalInterestDepositsV

Contained in:  Bank
Used in:  (never used)
Using:  FinancialTradingTotalInterestDeposits

Equation code:

EQUATION("TotalInterestDepositsV")
/*
variable of TotalInterestDeposits (for calculating lag)
 */
 V("FinancialTrading");
v[0]=V("TotalInterestDeposits");
RESULT(v[0] )


Variable:  TotalDepositsV

Contained in:  Bank
Used in:  InterestRateSpread
Using:  FinancialTradingTotalDeposits

Equation code:

EQUATION("TotalDepositsV")
/*
variable of TotalOutstandingDebt (for calculating lag)
 */
 V("FinancialTrading");
v[0]=V("TotalDeposits");
RESULT(v[0] )


Variable:  BankControlCapital

Contained in:  Bank
Used in:  Demography
Using:  FinancialTrading, Production, TradeSumCashF, SumOutstandingDebtFCh, SumCashC, SumCashKF, DemographyEN, SumCashEF, SumOutstandingDebtEFCh

Equation code:

EQUATION("BankControlCapital")
/*
*/
V("Trade");
V("FinancialTrading");
V("Production");
V("DemographyEN");

v[1]=V("SumCashC");
v[2]=VL("SumCashC",1);
v[3]=V("SumCashF");
v[4]=VL("SumCashF",1);
v[5]=V("SumCashEF");
v[6]=VL("SumCashEF",1);
v[7]=V("SumCashKF");
v[8]=VL("SumCashKF",1);
v[9]=V("SumOutstandingDebtFCh");
v[10]=V("SumOutstandingDebtEFCh");

v[0]=(v[1]-v[2])+(v[3]-v[4])+(v[5]-v[6])+(v[7]-v[8])-v[9]-v[10];
RESULT(v[0] )


Variable:  BankControlCurrent

Contained in:  Bank
Used in:  Demography
Using:  CheckFinBalanceFinancialTrading, Production, TradeInvestmentDecisionTotalInterestCollected, TotalInterestDeposits, RetainedProfitsBank, DistributedProfitsBank

Equation code:

EQUATION("BankControlCurrent")
/*
*/
V("Trade");
V("FinancialTrading");
V("InvestmentDecision");
V("Production");

v[1]=V("TotalInterestCollected");
v[2]=V("TotalInterestDeposits");
v[3]=V("RetainedProfitsBank");
v[4]=V("DistributedProfitsBank");

//v[7] = VL("BankCapital", 1);
//v[8] = V("BankCapital");

v[0]=v[1]-v[2]-v[3]-v[4];
v[5] = V("CheckFinBalance");
//LOG("\n%lf",v[5]);
RESULT(v[0] )


Parameter:  TotalDepositsLag

Contained in:  Bank
Used in:  FinancialTrading, TotalInterestDeposits


Variable:  BankCapital

Contained in:  Bank
Used in:  HHWealth, BankCapital, CashFAdjustment, CashKFAdjustment, CashEFAdjustment, ExitEF, CashCAdjustment, ControlBankBS, OwnFundsTargetSRBank, RetainedProfitsTargetBank, CapitalAdequacyRatio, CheckFinBalance
Using:  FinancialTrading, GDPnom, sGDPnom, InterestGovFundExit, SumInterestDepositsFInterestPaymentFCashF, InterestDepositsF, OverdraftPaymentF, SumInterestDepositsCCashC, InterestDepositsCOverdraftPaymentC, SumInterestDepositsKF, SumCashInjectionKFCashKF, InterestDepositsKF, OverdraftPaymentKF, TotalDeposits, TotalInterestCollected, TotalAssets, ProfitShareTargetBank, BankCapital, Adjustment, RatioAdjGDPm, RelAdj, ExitEF, SumInterestDepositsEFCashEF, InterestDepositsEF, InterestPaymentEF, OverdraftPaymentEF

Equation code:

EQUATION("BankCapital")
/*
Bank capital buffer increased by interest rate differences and reduced by non-returned loans
*/

V("FinancialTrading");

if(t==1)
 {
  v[70] = V("TotalDeposits");
  v[71] = V("TotalAssets");
  v[72]=v[71]-v[70];
  END_EQUATION(v[72]);
 }

v[0] = VL("BankCapital", 1);
v[1] = V("TotalInterestCollected");
v[2] = V("SumInterestDepositsF");
v[3] = V("SumInterestDepositsC");
v[4] = V("SumInterestDepositsKF");
v[5] = V("SumInterestDepositsEF");
v[6] = VL("ExitEF",1);
v[7] = VL("Exit",1);
v[50] = V("SumCashInjectionKF");
v[30] = VL("InterestGovFund",1);
v[8]=v[0]+v[1]+v[30]-v[2]-v[3]-v[4]-v[5]-v[6]-v[7]-v[50];

WRITE("Adjustment", 0);
WRITE("RelAdj", 0);
if(v[8]<0)
 {//HAIRCUT, reduction of positive bank accounts to finance the loss of central bank
  
  WRITE("Adjustment", v[8]);
  v[20]=v[21]=v[22]=v[23]=v[24]=0;
  v[9] = V("TotalDeposits");
  v[10]= 1+v[8]/v[9];
  WRITE("RelAdj", v[10]);

  if(v[10]<0)
   INTERACT("Neg. tot assets",v[9]-v[8]);
  v[11]=0;
  cur2 = SEARCHS(p->up, "Supply");
  CYCLES(cur2, cur, "Firm")
  {v[20]=1;
   cur1 = SEARCHS(cur, "BankF");
   v[25]=VS(cur1, "CashF");
   if(v[25]>0)
   {
   v[24] += v[25];
   v[11] += MULTS(cur1, "CashF", v[10]);
   }
  }
  
  cur2 = SEARCHS(p->up, "Demand");
  CYCLES(cur2, cur, "Class")
  {v[21]=1;

   v[25]=VS(cur, "CashC");
   if(v[25]>0)
   {
   v[24] += v[25];
   v[11] += MULTS(cur, "CashC", v[10]);
   }
  }

  cur2 = SEARCHS(p->up, "Machinery");
  CYCLES(cur2, cur, "KFirm")
  {v[22]=1;
   cur1 = SEARCHS(cur, "BankK");

   v[25]=VS(cur1, "CashKF");
   if(v[25]>0)
   {
   v[24] += v[25];
   v[11] += MULTS(cur1, "CashKF", v[10]);
   }
  }

  cur2 = SEARCHS(p->up, "Energy");
  CYCLES(cur2, cur, "EnergyFirm")
  {
   v[23]=1;
   
   v[25]=VS(cur, "CashEF");
   if(v[25]>0)
   {
   v[24] += VS(cur, "CashEF");
   v[11] += MULTS(cur, "CashEF", v[10]);
   }
  }

 //LOG("\nHaircut: bankK %lf. Haircut: %lf \n\n)",v[8], v[10]);

 if(abs(v[9]+v[8]-v[11])/v[11]>0.1)
  INTERACT("\nWrong haircut %lf\n", (v[9]+v[8]-v[11])/v[11]);
 INCR("TotalDeposits", v[8]);
 v[8]=0;
 }


v[31] = V("TotalAssets");
v[37] = V("ProfitShareTargetBank"); // parameter
v[38] = V("sGDPnom");


if(v[8]>0)
  v[35]=min(v[8],v[38]*v[37]);
 else
  v[35]=0;



if(v[35]>0 )
 {//SOCIAL DIVIDEND, distribution to HH of excessive BankCapital
  //v[35]=v[37] * v[38]; //Capital to distribute
  v[32]=0;
  WRITE("Adjustment", v[35]);
  cur2 = SEARCHS(p->up, "Demand");
  CYCLES(cur2, cur, "Class")
   v[32]+=VS(cur, "CashC");
  v[33]=1+v[35]/v[32];
  WRITE("RelAdj", v[33]);

  v[34]=0;
  CYCLES(cur2, cur, "Class")
   v[34]+=MULTS(cur, "CashC",v[33]);
  
// LOG("\nSocial Dividend: percentage increment %lf. BankK/GDP %lf. BankK/Assets %lf\n\n)",v[35]/v[32], (v[8]-v[35])/v[38], v[8]/v[31]);
  if(abs((v[34]-v[32]-v[35])/v[34])>0.01)
   INTERACT("Error in Social Dividend", (v[34]-v[32]-v[35])/v[34]);
  
  v[8]-=v[35];
  INCR("TotalDeposits", v[35]);
 
 }


v[80] = V("GDPnom");
v[81] = V("Adjustment");
WRITE("RatioAdjGDPm", v[81]/v[80]);

/*
//Control code to check the correct computation of the interest flow. To be used for debugging purposes

v[11]=v[12]=v[13]=v[14]=v[15]=0;

CYCLES(p->up, cur, "Firm")
{
 v[12] += VS(cur, "InterestDepositsF");
 v[11] += VS(cur, "InterestPaymentF");
 v[11] += VS(cur, "OverdraftPaymentF");
}

CYCLES(p->up, cur, "KFirm")
{
 v[14] += VS(cur, "InterestDepositsKF");
 v[11] += VS(cur, "OverdraftPaymentKF");
}

CYCLES(p->up, cur, "Class")
{
 v[13] += VS(cur, "InterestDepositsC");
 v[11] += VS(cur, "OverdraftPaymentC");
}

CYCLES(p->up, cur, "EnergyFirm")
{
 v[15] += VS(cur, "InterestDepositsEF");
 v[11] += VS(cur, "InterestPaymentEF");
 v[11] += VS(cur, "OverdraftPaymentEF");
}

PLOG("\nFirm:\nTotal %lf\nCompu %lf\nDiffe %lf\n",v[2],v[12],v[2]-v[12]);
PLOG("\nConsumer:\nTotal %lf\nCompu %lf\nDiffe %lf\n",v[3],v[13],v[3]-v[13]);
PLOG("\nKapital Firm:\nTotal %lf\nCompu %lf\nDiffe %lf\n",v[4],v[14],v[4]-v[14]);
PLOG("\nEnergy Firm:\nTotal %lf\nCompu %lf\nDiffe %lf\n",v[5],v[15],v[5]-v[15]);

PLOG("\nCollected:\nTotal %lf\nCompu %lf\nDiffe %lf\n",v[1],v[11],v[1]-v[11]);

v[10]=v[0]+v[11]-v[12]-v[13]-v[14]-v[15]-v[6]-v[7];
*/
RESULT(v[8] )


Parameter:  MinInterestRateSpread

Contained in:  Bank
Used in:  InterestRateSpread


Parameter:  NonPerformingLoansTotal

Contained in:  Bank
Used in:  ExitEF, OwnFundsBank, ExpectedLoanDefaultsPC, Exit


Parameter:  ShareBankKonAssets

Contained in:  Bank
Used in:  (never used)


Parameter:  MaxInterestRateSpread

Contained in:  Bank
Used in:  InterestRateSpread


Parameter:  TotPCLiabilitiesEF

Contained in:  Bank
Used in:  FinancialTrading


Parameter:  TotPCLiabilitiesF

Contained in:  Bank
Used in:  FinancialTrading


Parameter:  TotPCLiabilitiesHH

Contained in:  Bank
Used in:  FinancialTrading


Parameter:  TotPCLiabilitiesKF

Contained in:  Bank
Used in:  FinancialTrading


Parameter:  TotLiabilitiesEF

Contained in:  Bank
Used in:  FinancialTrading, TotLiabilitiesEFV


Parameter:  TotLiabilitiesF

Contained in:  Bank
Used in:  FinancialTrading, TotLiabilitiesFV


Parameter:  TotLiabilitiesHH

Contained in:  Bank
Used in:  FinancialTrading


Parameter:  TotLiabilitiesKF

Contained in:  Bank
Used in:  FinancialTrading, TotLiabilitiesKFV


Variable:  ControlBankBS

Contained in:  Bank
Used in:  (never used)
Using:  TotalDeposits, TotalAssets, BankCapital

Equation code:

EQUATION("ControlBankBS")
/*
Desired level of consumption
*/

v[0]=V("TotalAssets");
v[1]=V("TotalDeposits");
v[2]=V("BankCapital");

v[3]=v[0]-v[1]-v[2];

RESULT(v[3] )


Variable:  sInterestRate

Contained in:  Bank
Used in:  sInterestEF, sInterestRate, ExpCostENK, PlaceOrderEF, MaxKExpenditureEF, MaxKExpenditureF
Using:  InterestRate, sInterestRate

Equation code:

EQUATION("sInterestRate")
/*
*/
v[1]=V("InterestRate");
v[2]=VL("sInterestRate",1);

v[3]=v[2]*0.95+0.05*v[1];

RESULT(v[3] )


Variable:  TotLiabilitiesEFV

Contained in:  Bank
Used in:  sTotLiabilitiesEFV
Using:  TotLiabilitiesEF

Equation code:

EQUATION("TotLiabilitiesEFV")
/*
*/
v[0]=V("TotLiabilitiesEF");
RESULT(v[0] )


Variable:  TotLiabilitiesFV

Contained in:  Bank
Used in:  sTotLiabilitiesFV
Using:  TotLiabilitiesF

Equation code:

EQUATION("TotLiabilitiesFV")
/*
*/
v[0]=V("TotLiabilitiesF");
RESULT(v[0] )


Variable:  TotLiabilitiesKFV

Contained in:  Bank
Used in:  sTotLiabilitiesKFV
Using:  TotLiabilitiesKF

Equation code:

EQUATION("TotLiabilitiesKFV")
/*
*/
v[0]=V("TotLiabilitiesKF");
RESULT(v[0] )


Variable:  sTotLiabilitiesEFV

Contained in:  Bank
Used in:  sTotLiabilitiesEFV
Using:  TotLiabilitiesEFV, sTotLiabilitiesEFV

Equation code:

EQUATION("sTotLiabilitiesEFV")
/*
*/
v[0]=VL("sTotLiabilitiesEFV",1);
v[1]=V("TotLiabilitiesEFV");
v[2]=v[0]*0.95+0.05*v[1];
RESULT(v[2] )


Variable:  sTotLiabilitiesFV

Contained in:  Bank
Used in:  sTotLiabilitiesFV
Using:  TotLiabilitiesFV, sTotLiabilitiesFV

Equation code:

EQUATION("sTotLiabilitiesFV")
/*
*/
v[0]=VL("sTotLiabilitiesFV",1);
v[1]=V("TotLiabilitiesFV");
v[2]=v[0]*0.95+0.05*v[1];
RESULT(v[2] )


Variable:  sTotLiabilitiesKFV

Contained in:  Bank
Used in:  sTotLiabilitiesKFV
Using:  TotLiabilitiesKFV, sTotLiabilitiesKFV

Equation code:

EQUATION("sTotLiabilitiesKFV")
/*
*/
v[0]=VL("sTotLiabilitiesKFV",1);
v[1]=V("TotLiabilitiesKFV");
v[2]=v[0]*0.95+0.05*v[1];
RESULT(v[2] )


Parameter:  NPLE

Contained in:  Bank
Used in:  (never used)


Parameter:  NPLF

Contained in:  Bank
Used in:  Exit


Parameter:  Adjustment

Contained in:  Bank
Used in:  BankCapital


Parameter:  RatioAdjGDPm

Contained in:  Bank
Used in:  BankCapital


Parameter:  RelAdj

Contained in:  Bank
Used in:  BankCapital


Object:  Energy

Contained in:  Root—>Stats—>Country
Containing:  EnergyFirm, PP

Variables:  
Parameters:  

Function:  CallalphaBrown

Contained in:  Energy
Used in:  ExpectedIncomePP, KProductionFlow
Using:  FactorBrown, HistoricalCapitalEN, TotENCapacity, alphaBrown

Equation code:

EQUATION("CallalphaBrown")
/*
Decreasing return to scale
*/
V("TotENCapacity");
v[1]=V("HistoricalCapitalEN");
v[2]=V("FactorBrown");
v[0]=pow((1-v[2]),v[1]);
WRITE("alphaBrown", v[0]);
//INTERACT("CallalphaBrown",v[0]);
RESULT(1 )


Function:  CallalphaGreen

Contained in:  Energy
Used in:  ExpectedIncomePP, KProductionFlow
Using:  FactorGreen, TotENCapacity, TotGreenCapacity, alphaGreen

Equation code:

EQUATION("CallalphaGreen")
/*
Decreasing return to scale
*/
V("TotENCapacity");
v[1]=V("TotGreenCapacity");
v[2]=V("FactorGreen");
v[0]=pow((1-v[2]),v[1]);
WRITE("alphaGreen", v[0]);
//INTERACT("CallalphaGreen",v[0]);
RESULT(1 )


Parameter:  CapitalDepressEN

Contained in:  Energy
Used in:  KENCapacity


Parameter:  CapitalDestroyedEF

Contained in:  Energy
Used in:  DemographyEN


Parameter:  CopyTotalEnergy

Contained in:  Energy
Used in:  PriceEN


Variable:  DemographyEN

Contained in:  Energy
Used in:  ExitEF, BankControlCapital, InvestmentDecisionEFXXX, InvestmentDecisionEF
Using:  CapitalDestroyedEF, EntryEF, MinUtilization, TimeRepaymentEF, probEntryEF, ExitFlagEF, minTimeEntryEF, CounterEntryEF, minShareKENCashEF, MaxEnergyCapacity, NumPP, PPremovedPPKAge, KENCapacity, MAUtilizationPP, PrincipalEF

Equation code:

EQUATION("DemographyEN")
/*
Comment
*/
WRITE("CapitalDestroyedEF",0);

v[0] = V("MinUtilization");
v[30] = V("TimeRepaymentEF");
v[21]=0;
v[43] = V("minShareKEN");
CYCLE(cur, "EnergyFirm")
{
 v[1]=0;
  v[7] = VS(cur, "NumPP");
  WRITES(cur, "PPremoved", 0);
CYCLE_SAFES(cur, cur1, "CapitalEF")
{
v[2] = VLS(cur1, "MAUtilizationPP",1);
v[20]=VS(cur1, "PrincipalEF");
v[4] = VS(cur, "PPKAge");
v[5] = VS(cur1, "KENCapacity");
v[6] = VS(cur1, "MaxEnergyCapacity");

if(v[4]>v[30]*3)
v[31]=1-pow(0.999,v[4]-v[30]*3); //prob. to die increasing with age being 0 when capital is just repaid and becoming 1 when age=4 x TimeRepayment
else
v[31]=-1;
if(v[5]/v[6]<v[43] || v[2]<v[0] || v[4]>v[30]*4 )
{
v[3] = VS(cur, "NumPP");
if(v[3]>1)
{
if(V("ExitFlagEF")==1)
INTERACTS(cur1, "Scrap KEF", v[5]);
INCRS(cur, "NumPP", -1);
        cur5=SEARCHS(p->up,"Bank");
        if(cur5==NULL)
         INTERACT("NULL cur5 DemographyEN", v[20]);
DELETE(cur1->hook);
DELETE(cur1);
INCRS(cur, "CashEF", v[20]*-1);
//cur5 = SEARCHS(p->up,"Bank");
//INCRS(cur5,"NonPerformingLoansTotal",v[20]);
//INCRS(cur5,"NPLE",v[20]);
v[21]+=v[20];
v[1]=1;
INCRS(cur, "PPremoved", v[20]);
}
}
if(v[1]==1)
break;
}
}

cur1=SEARCHS(p->up,"Energy");
v[4]=V("probEntryEF");
v[40] = V("minTimeEntryEF");
v[41] = INCR("CounterEntryEF", 1);
if(RND<v[4] && t>1 && v[41]>v[40] )
 {
v[1]=V_CHEATS(cur1,"EntryEF",p);
WRITE("CounterEntryEF", 0);
 }
RESULT(v[21] )


Function:  EntryEF

Contained in:  Energy
Used in:  DemographyEN
Using:  MinWageNumClassBalanceEF, CashEF, DebtEF, EFType, FossilFuel, IdFirmEN, IdTechEN, InvestmentSpendingEF, KapitalNeedEF, MaxKExpenditureEF, NumPP, OutstandingDebtEF, ProfitEF, SafetyCoefEF, WaitingEF, sBalanceEF, sCashEFPPKAge, KENCapacity, KENProductivity, EnergyProductionPP, MAUtilizationPP, KExpendituresEN, CapitalEN, PrincipalEF, ShareENPP, FairEnergyPP, IdLaborEF, NumWorkersEF, wageEF, wagecoeffEF, PremiaEF

Equation code:

EQUATION("EntryEF")
/*
Entry of new energy firms
*/
// v[0]=t; //sprintf(msg, "\n EntryEF(%g)", v[0]); plog(msg);
//V("PriceEN");


cur1=ADDOBJ("EnergyFirm");
//INTERACT("New EnergyFirm added",v[1]);
cur1->hook=c;
WRITELS(cur1,"BalanceEF",0, t);
WRITELS(cur1,"CashEF",0, t);
WRITES(cur1,"DebtEF",0);
WRITES(cur1,"FossilFuel",0);
WRITES(cur1,"IdFirmEN",MAX("IdFirmEN")+1);
WRITES(cur1,"IdTechEN",1);
WRITES(cur1,"InvestmentSpendingEF",0);
WRITES(cur1,"KapitalNeedEF",0);
WRITES(cur1,"NumPP",0);
WRITELS(cur1,"ProfitEF",0, t);
WRITES(cur1,"WaitingEF",-1);
WRITES(cur1,"sBalanceEF",0);
WRITES(cur1,"sCashEF",0);
WRITES(cur1,"MaxKExpenditureEF",99999);
WRITES(cur1,"OutstandingDebtEF",0);

WRITES(cur1,"SafetyCoefEF",0.1);

v[0]=t;

if(RND < 0.5) // New EnergyFirm can be either brown (0) or green (1)
  v[1]=0;
else
  v[1]=1;

//if(t < V("StepGreenEntry"))
// v[1]=0;
//else
// v[1]=1;
  
  

 
WRITES(cur1,"EFType",v[1]);

cur2=SEARCHS(cur1,"CapitalEF");
WRITELS(cur2,"PPKAge",0, t);
WRITELS(cur2,"KENCapacity",0, t);
WRITES(cur2,"KENProductivity",1);
WRITES(cur2,"EnergyProductionPP",0);
WRITES(cur2, "FairEnergyPP", 0);
WRITES(cur2,"MAUtilizationPP",1);
WRITES(cur2,"KExpendituresEN",0);
WRITES(cur2,"CapitalEN",0);
WRITELS(cur2,"PrincipalEF",0, t);
WRITES(cur2,"ShareENPP",0);


//cur3=SEARCHS(cur1,"Engineers");
//cur4=SEARCH_CND("NumClass",0);
//cur3->hook=cur4;

cur3=SEARCH_CNDS(cur1,"IdLaborEF",1);
cur4=SEARCH_CND("NumClass",1);
cur3->hook=cur4;

cur2=SEARCHS(cur1,"LaborEF");
//WRITES(cur2,"IdLabor",1);
//WRITES(cur2,"nuEF",3);
WRITELS(cur2,"NumWorkersEF",0,t);
//WRITES(cur2,"wagecoeffEF",1.6);
WRITES(cur2,"PremiaEF",0);

cur=ADDOBJS(cur1,"LaborEF");
WRITES(cur,"IdLaborEF",2);
cur4=SEARCH_CND("NumClass",2);
cur->hook=cur4;

cur5=SEARCH_CND("IdLaborEF",2);//
v[78]=VS(cur5,"wagecoeffEF");
WRITES(cur,"wagecoeffEF",v[78]);

v[4]=V("MinWage");
CYCLES(cur1, cur2, "LaborEF")
 {
  v[5]=VS(cur2,"wagecoeffEF");
  v[6]=v[5]*v[4];
  WRITELS(cur2,"wageEF",v[6],t);
  v[4]=v[6];
  WRITELS(cur2,"NumWorkersEF",10,t);
 }


//cur3=SEARCHS(cur1,"BankEF");
//cur4=SEARCHS(p->up,"Bank");
//if(cur4==NULL)
// INTERACT("cur4 NULL", v[0]);
//if(cur3==NULL)
// INTERACT("cur3 NULL", v[0]);

//cur3->hook=cur4;

// The new firm place an order to get capital

//VS(cur1,"InvestmentDecisionEF");


/*
WRITES(cur1, "KapitalNeedEF", 1000);

cur = SEARCHS(p->up->up, "Machinery");
WRITES(cur, "IsEnergyK", 1);
V("markupEFF");
WRITES(cur1,"WaitingEF",1);
*/


//INTERACT("EntryEF",v[0]);
RESULT( 1)


Parameter:  ExcessEnergy

Contained in:  Energy
Used in:  ExcessEnergyRatio, TotExcessCost, PriceEN


Parameter:  ExcessEnergyL

Contained in:  Energy
Used in:  PriceEN, InvestmentDecisionEFXXX, InvestmentDecisionEF


Variable:  ExitEF

Contained in:  Energy
Used in:  BankCapital
Using:  ExitNumOrdersKAmount, KCompletion, TimeWaited, Kproductivity, IdClient, KEfficiency, BankCapital, NonPerformingLoansTotal, DemographyEN, PriceEN, TotENCapacity, minAgeExitEF, minRRoKExitEF, RatioNPLEBC, minSize, ExitFlagEFAgeEF, CashEF, IdFirmEN, MaxEnergyCapacity, RRoKEF, WaitingEFPrincipalEF

Equation code:

EQUATION("ExitEF")
/*
Remove energy firms with too poor Health
*/

V("PriceEN");
//v[0]=t;
//sprintf(msg, "\n ExitEF(%g)", v[0]); plog(msg);
V("Exit"); // to be sure that NonPerformingLoansTotal is reset by Exit equation
V("DemographyEN"); // make sure that CapitalDestroyedEF is reset by DemographyEN before


v[4]=v[70]=0;
v[18]=V("minAgeExitEF");
v[19]=V("minRRoKExitEF");
//WRITE("CapitalDestroyedEF", 0); // done in DemographyEN
CYCLE_SAFE(cur, "EnergyFirm")
 {

  v[6]=VS(cur,"WaitingEF");
  v[16]=VS(cur,"AgeEF");
  v[36] = VS(cur, "MaxEnergyCapacity");
  v[37] = V("TotENCapacity");
  v[38] = V("minSize");
  if( v[6]!=-1 && (double) t>v[18]) //don't kill new firms waiting for their first capital good to be delivered.
   {
    v[17]=VS(cur,"RRoKEF");
    v[7] = VS(cur, "CashEF");

    if( (v[17]<v[19] && v[7]<0) || (v[36]>0 && v[36]/v[37] < v[38]))
     {
     /****
     v[20]=0;
     CYCLES(cur, cur1, "CapitalEF")
       {
       if(cur1->hook==NULL)
       INTERACTS(cur1, "Merde", v[20]);
       v[20]+=VS(cur1->hook, "PricePP");
       }
     *****/
     v[39]=v[36]/v[37];
// if(v[39]>0.2)
  // INTERACTS(cur, "Kill Big", v[39]);
       if(v[6]==1)
        {//firm is waiting an order, to be removed
         v[30] = VS(cur, "IdFirmEN");
         cur2 = SEARCH_CND("IdClient", -v[30]);
         cur2=cur->hook;
         if(cur2->hook!=cur)
          INTERACTS(cur, "Error exit EF", v[30]);
         if(cur2==NULL)
          INTERACTS(cur, "Err. exiting waiting firm", v[30]);
         else
          {
           if(INCRS(cur2->up, "NumOrders",-1)==0)
            {
             WRITES(cur2,"KAmount",0);
             WRITES(cur2,"KCompletion",0);
             WRITES(cur2,"TimeWaited",0);
             WRITES(cur2,"Kproductivity",0);
             WRITES(cur2,"KEfficiency",0);
             WRITES(cur2, "IdClient", -1);
             cur2->hook=NULL;
            }
           else
            {
             DELETE(cur2);
            }
          }
        }
       v[4]-=v[7];
      if(V("ExitFlagEF")==1 )
        INTERACTS(cur,"Dying EF", v[17]);
      v[20]=0;
      CYCLES(cur, cur1, "CapitalEF")
      {
       v[20]+=VS(cur1, "PrincipalEF");
      }
v[4]+=v[20];

v[31]=VS(cur,"IdFirmEN");
CYCLES(cur, cur6, "CapitalEF")
{
if(cur6->hook!=NULL)
{
         DELETE(cur6->hook); // remove the PP owned by the exited firm
        }
       else
        {
         INTERACTS(cur6, "Null PP", v[0]);
        }
}
DELETE(cur); // Delete the firm

     }
   }
 }
cur5 = SEARCHS(p->up,"Bank");
INCRS(cur5,"NonPerformingLoansTotal",v[4]);

v[66] = V("BankCapital");
if(v[66]>0)
 WRITE("RatioNPLEBC", v[4]/v[66]);
else
 WRITE("RatioNPLEBC", -1);
  
RESULT(v[4] )


Parameter:  FactorBrown

Contained in:  Energy
Used in:  CallalphaBrown


Parameter:  FactorGreen

Contained in:  Energy
Used in:  CallalphaGreen


Parameter:  FactorSize

Contained in:  Energy
Used in:  alphaSize


Variable:  FirstOrderEF

Contained in:  Energy
Used in:  (never used)
Using:  TotEnergyConsumptionFirstOrderEFFrac

Equation code:

EQUATION("FirstOrderEF")
/*
*/
v[0]=V("TotEnergyConsumption");
v[1]=V("FirstOrderEFFrac");

RESULT(v[0]*v[1] )


Parameter:  FirstOrderEFFrac

Contained in:  Energy
Used in:  FirstOrderEF, InvestmentDecisionEFXXX, InvestmentDecisionEF


Parameter:  GPstep

Contained in:  Energy
Used in:  GreenPremium


Variable:  GreenPremium

Contained in:  Energy
Used in:  GreenPremium, PricePPDoped
Using:  GPstep, GreenPremium, StepGreenPremium, minGPremium

Equation code:

EQUATION("GreenPremium")
/*
Energy rice reduction due to the use of green capital
*/
v[0] = VL("GreenPremium", 1);
v[1] = V("GPstep");


if(t < V("StepGreenPremium"))
v[10]=v[0];
else
  v[10]=v[0]+v[1];

v[2] = V("minGPremium");
if(v[10]<v[2])
 v[10]=v[2];

RESULT(v[10] )


Parameter:  HistoricalCapitalEN

Contained in:  Energy
Used in:  CallalphaBrown, KProductionFlow


Function:  InitPP

Contained in:  Energy
Used in:  InitInProgress
Using:  IdFirmEN, PricePP, IdEF

Equation code:

EQUATION("InitPP")
/*
Initalize the objects required to compute the price of energy. A hook links every PP object to a CapitalEF object in one of the energy producers
*/
v[0]=0;

CYCLE(cur, "EnergyFirm")
{
CYCLES(cur, cur1, "CapitalEF")
v[0]++;
}

v[1]=0;
CYCLE(cur, "PP")
{v[1]++;
}
v[2]=v[0]-v[1];
if(v[2]>0)
 ADDNOBJ("PP", v[2]);
if(v[2]<0)
 INTERACT("Error in # of PP",v[2]);
CYCLE(cur, "PP")
WRITELS(cur, "PricePP", -2, 0);

cur2 = SEARCH("PP");
CYCLE(cur, "EnergyFirm")
{
CYCLES(cur, cur1, "CapitalEF")
{
cur2->hook=cur1;
cur1->hook=cur2;
cur2=cur2->next;
v[20]=VS(cur1,"IdFirmEN");
WRITES(cur1->hook, "IdEF", v[20]);
}
}
//CYCLE(cur, "PP")
// {
// v[20]=VS(cur2->hook,"IdFirmEN");
// WRITES(cur, "IdEF", 0);
// }

PARAMETER
RESULT(1 )


Parameter:  InterestLoansEF

Contained in:  Energy
Used in:  (never used)


Parameter:  InvestmentProportionEF

Contained in:  Energy
Used in:  (never used)


Parameter:  MaxGrowthEF

Contained in:  Energy
Used in:  InvestmentDecisionEFXXX, InvestmentDecisionEF


Parameter:  MaxMUEF

Contained in:  Energy
Used in:  markupEF


Parameter:  MinMUEF

Contained in:  Energy
Used in:  markupEF


Parameter:  MinUtilization

Contained in:  Energy
Used in:  DemographyEN


Parameter:  MultiplierCapacityENBrown

Contained in:  Energy
Used in:  KProductionFlow, InvestmentDecisionEFXXX, InvestmentDecisionEF, Init


Parameter:  MultiplierCapacityENGreen

Contained in:  Energy
Used in:  KProductionFlow, InvestmentDecisionEFXXX, InvestmentDecisionEF, Init


Parameter:  MultiplierProductivityEN

Contained in:  Energy
Used in:  (never used)


Parameter:  NbrBrown

Contained in:  Energy
Used in:  NbrEF


Variable:  NbrEF

Contained in:  Energy
Used in:  WaitingEFRatio, probEntryEF
Using:  NbrBrown, NbrGreenEFType

Equation code:

EQUATION("NbrEF")
/*
*/
v[0]=v[1]=0;
CYCLE(cur,"EnergyFirm")
{
if(VS(cur,"EFType")==0)
{ // it's a brown firm
v[0]+=1;
}
else
{ // it's a green firm
v[1]+=1;
}
}
WRITE("NbrBrown",v[0]);
WRITE("NbrGreen",v[1]);
RESULT(COUNT("EnergyFirm") )


Parameter:  NbrGreen

Contained in:  Energy
Used in:  NbrEF


Variable:  NbrPP

Contained in:  Energy
Used in:  (never used)
Using:  (none)

Equation code:

EQUATION("NbrPP")
/*
*/
RESULT(COUNT("PP") )


Parameter:  OverCostMarkup

Contained in:  Energy
Used in:  (never used)


Variable:  PriceEN

Contained in:  Energy
Used in:  BalanceEF, CashEF, ControlENEF, ShareENPP, ExcessCostEF, ExcessENPP, ExitEF, TotENCapacity, PriceENMA, EFirmControlCurrent, EFirmControlCapital, KENCost, ENCost, ControlTotEN, KENCost, ENCost, SumEnergyProductionEF, SumEnergyProductionPP, EnergyProductionEF, RevenuesEF, MAUtilizationPP, PriceEK, UnitEnergyCost, KUnitEnergyCost, betaEff, NumActiveOrders, GDPnom
Using:  TotEnergyConsumptionCopyTotalEnergy, ExcessEnergy, ExcessEnergyL, SumMaxEnergyCapacity, FairEnergy, PriceENBrown, PriceENGreenEFTypeKENCapacity, EnergyProductionPP, ShareENPP, FairEnergyPP, PricePP, PricePPDoped

Equation code:

EQUATION("PriceEN")
/*
Uniform price of energy computed as the cost of the marginal firm ranked according to increasing unit costs of production
*/
v[30]=V("ExcessEnergy");
WRITE("ExcessEnergyL", v[30]); // save lagged value of ExcessEnergy
WRITE("ExcessEnergy", 0); // reset ExcessEnergy
v[40]=V("SumMaxEnergyCapacity");
v[5]=v[0]=V("TotEnergyConsumption") - V("FairEnergy");
WRITE("CopyTotalEnergy", v[0]);
//CYCLE(cur, "PP")
//VS(cur, "PricePP");

//sprintf(msg, "\n TotEnergyConsumption(%g)", v[5]); plog(msg);


//SORT("PP", "PricePP", "UP");
SORT("PP", "PricePPDoped", "UP");

CYCLE(cur, "PP")
{
WRITES(cur->hook, "EnergyProductionPP", 0); // reset EnergyProductionPP
WRITES(cur->hook, "ShareENPP", 0);

}


v[4]=v[7]=v[30]=v[31]=v[32]=v[41]=v[42]=v[43]=v[44]=0;
v[3]=V("PricePP"); //
CYCLE(cur, "PP")
{
v[1]=VS(cur->hook,"KENCapacity") - VS(cur->hook, "FairEnergyPP");
v[2]=max(min(v[0],v[1]) , 0);
WRITES(cur->hook, "EnergyProductionPP", v[2]);
v[0]-=v[2];
if(v[2]>0)
{
if(VS(cur->hook, "EFType")==0)
{
v[41]+=v[2]; //brown
v[43] = VS(cur, "PricePP");//highest brown price
}
else
{
  v[42]+=v[2]; //green energy
v[44] = VS(cur, "PricePP");//highest green price
}
}
WRITES(cur->hook, "ShareENPP", v[2]/v[40]);

v[30] = VS(cur, "PricePP"); // record the last producer

if(v[7]==0 ) // energy demand is satisfied
{
v[3] = VS(cur, "PricePP"); // record the price for non-null producers
    v[4]+=v[2];
    if(v[0]==0)
    v[7]=1;
    }
}

WRITE("PriceENBrown", v[43]);
WRITE("PriceENGreen", v[44]);

v[3]=(v[43]*v[41]+v[44]*v[42])/(v[41]+v[42]);
//sprintf(msg, "\n ExcessEnergy(%g)", v[0]); plog(msg);
WRITE("ExcessEnergy", v[0]);
//v[10]=t;sprintf(msg, "\n ExcessEnergy(%g)", v[10]); plog(msg);

v[90]=0;
if(v[0]>0)
 {
CYCLE(cur, "PP")
{
v[20]=VS(cur->hook,"ShareENPP");
//v[20]=V("ShareCapacityPP");
v[21]=v[20]*v[0]; // Distribute excess demand to PP proportionaly to their capacity
INCRS(cur->hook, "EnergyProductionPP", v[21]);
v[90]+=v[21];
}
 
 }

//v[91]=v[0]-v[90];
//sprintf(msg, "\n v91(%g)", v[91]); plog(msg);

RESULT(v[3])


Variable:  PriceENMA

Contained in:  Energy
Used in:  KExpCostEN, PriceENMAGr, PriceENMA, ExpectedIncomePP
Using:  PriceEN, PriceENMA, SpeedPriceENMA

Equation code:

EQUATION("PriceENMA")
/*
Moving average of PriceEN
*/
v[1]=V("PriceEN");
v[2]=VL("PriceENMA",1);
v[3]=V("SpeedPriceENMA");

v[0]=v[3]*v[2]+(1-v[3])*v[1];
RESULT(v[0] )


Parameter:  ShareBrownEnergy

Contained in:  Energy
Used in:  TotENCapacity


Parameter:  ShareGreenEnergy

Contained in:  Energy
Used in:  TotENCapacity


Parameter:  SpeedMA

Contained in:  Energy
Used in:  MAUtilizationPP


Parameter:  SpeedPriceENMA

Contained in:  Energy
Used in:  PriceENMA


Parameter:  StepGreenPremium

Contained in:  Energy
Used in:  GreenPremium, InvestmentDecisionEF


Variable:  SumCashEF

Contained in:  Energy
Used in:  BankControlCapital
Using:  FinancialTradingCashEF

Equation code:

EQUATION("SumCashEF")
/*
*/
V("FinancialTrading");
v[0]=v[1]=0;
CYCLE(cur, "EnergyFirm")
{
  v[0]=VS(cur,"CashEF");
v[1]+=v[0];
}
RESULT(v[1] )


Variable:  SumCashEFCh

Contained in:  Energy
Used in:  (never used)
Using:  FinancialTrading, Production, TradeInvestmentDecisionCashEFCh

Equation code:

EQUATION("SumCashEFCh")
/*
*/
V("Trade");
V("FinancialTrading");
V("InvestmentDecision");
V("Production");
RESULT(SUM("CashEFCh") )


Variable:  SumEFirmControlCapital

Contained in:  Energy
Used in:  (never used)
Using:  EFirmControlCapital

Equation code:

EQUATION("SumEFirmControlCapital")
/*
*/
RESULT(SUM("EFirmControlCapital") )


Variable:  SumEFirmControlCurrent

Contained in:  Energy
Used in:  (never used)
Using:  EFirmControlCurrent

Equation code:

EQUATION("SumEFirmControlCurrent")
/*
*/
RESULT(SUM("EFirmControlCurrent") )


Variable:  SumEnergyProductionEF

Contained in:  Energy
Used in:  probEntryEF, ControlENEF, msEN, PercUnusedENCapacity, ControlTotEN
Using:  PriceENEnergyProductionEF

Equation code:

EQUATION("SumEnergyProductionEF")
/*
*/
V("PriceEN");
v[0]=0;
CYCLE(cur,"EnergyFirm")
{
v[1]=VS(cur,"EnergyProductionEF");
v[0]+=v[1];
}
RESULT(v[0] )


Variable:  SumEnergyProductionPP

Contained in:  Energy
Used in:  ControlENEF, ShareENPP, TotENCapacity, ControlTotEN
Using:  PriceENEnergyProductionPP, FairEnergyPP

Equation code:

EQUATION("SumEnergyProductionPP")
/*
*/

//v[10]=t;sprintf(msg, "\n SumEnergyProductionPP(%g)", v[10]); plog(msg);

V("PriceEN");
v[0]=0;
CYCLE(cur,"EnergyFirm")
{
CYCLES(cur,cur1,"CapitalEF")
{
v[1]=VS(cur1,"EnergyProductionPP");
v[2] = VS(cur1,"FairEnergyPP");
v[0]+=v[1]+v[2];
}
}
RESULT(v[0] )


Variable:  SumInterestDepositsEF

Contained in:  Energy
Used in:  BankCapital
Using:  InterestDepositsEF

Equation code:

EQUATION("SumInterestDepositsEF")
/*
*/
RESULT(SUM("InterestDepositsEF") )


Variable:  SumInterestPaymentEF

Contained in:  Energy
Used in:  (never used)
Using:  InterestPaymentEF

Equation code:

EQUATION("SumInterestPaymentEF")
/*
*/
RESULT(SUM("InterestPaymentEF") )


Variable:  SumInvestmentEF

Contained in:  Energy
Used in:  ControlInvestment
Using:  InvestmentSpendingEF

Equation code:

EQUATION("SumInvestmentEF")
/*
Sum of investment spending of EnergyFirms
*/
 v[0]=t;
//sprintf(msg, "\n SumInvestmentEF(%g)", v[0]); plog(msg);
v[0]=v[1]=0;
CYCLE(cur, "EnergyFirm")
{
  v[0]=VS(cur,"InvestmentSpendingEF"); //sprintf(msg, " InvestmentSpendingEF(%g)\n", v[0]); plog(msg);
  v[1]+=v[0]; //sprintf(msg, " total(%g)\n", v[1]); plog(msg);
}
RESULT(v[1] )


Variable:  SumInvestmentSpendingEF

Contained in:  Energy
Used in:  (never used)
Using:  KProductionFlowInvestmentSpendingEF

Equation code:

EQUATION("SumInvestmentSpendingEF")
/*
*/
USE_ZERO_INSTANCE
CYCLE(cur,"KFirm")
{
VS(cur,"KProductionFlow");
}
v[0]=SUM("InvestmentSpendingEF");
RESULT(v[0] )


Variable:  SumLaborCostEF

Contained in:  Energy
Used in:  ControlLaborCost
Using:  LaborCostEF

Equation code:

EQUATION("SumLaborCostEF")
/*
Sum of wages distributed by Energy Firms
 */
v[0]=v[1]=0;
CYCLE(cur, "EnergyFirm")
{
  v[0]=VS(cur,"LaborCostEF");
  v[1]+=v[0];
}
RESULT(v[1] )


Variable:  SumMaxEnergyCapacity

Contained in:  Energy
Used in:  ShareCapacityPP, PriceEN, InvestmentDecisionEFXXX, InvestmentDecisionEF
Using:  MaxEnergyCapacity

Equation code:

EQUATION("SumMaxEnergyCapacity")
/*
*/
RESULT(SUM("MaxEnergyCapacity") )


Variable:  SumOutstandingDebtEFCh

Contained in:  Energy
Used in:  BankControlCapital
Using:  FinancialTradingOutstandingDebtEFCh

Equation code:

EQUATION("SumOutstandingDebtEFCh")
/*
*/
V("FinancialTrading");
v[0]=v[1]=0;
CYCLE(cur, "EnergyFirm")
{
  v[0]=VS(cur,"OutstandingDebtEFCh");
v[1]+=v[0];
}
RESULT(v[1] )


Variable:  SumOverdraftPaymentEF

Contained in:  Energy
Used in:  (never used)
Using:  OverdraftPaymentEF

Equation code:

EQUATION("SumOverdraftPaymentEF")
/*
*/
RESULT(SUM("OverdraftPaymentEF") )


Variable:  SumTotNumWorkersEF

Contained in:  Energy
Used in:  ControlWorkers, WorkersEFRatio
Using:  TotNumWorkersEF

Equation code:

EQUATION("SumTotNumWorkersEF")
/*
*/
RESULT(SUM("TotNumWorkersEF") )


Variable:  SumWagePremEF

Contained in:  Energy
Used in:  ControlPremiaIncome
Using:  WagePremEF

Equation code:

EQUATION("SumWagePremEF")
/*
Sum of Premia distributed by EnergyFirms
 */
v[0]=v[1]=0;
CYCLE(cur, "EnergyFirm")
{
  v[0]=VS(cur,"WagePremEF");
  v[1]+=v[0];
}
RESULT(v[1] )


Variable:  SumWaitingEF

Contained in:  Energy
Used in:  WaitingEFRatio
Using:  WaitingEF

Equation code:

EQUATION("SumWaitingEF")
/*
Number of firms waiting for an ordered K to be delivered
*/
v[0]=0;
CYCLE(cur, "EnergyFirm")
{
 v[1] = VS(cur,"WaitingEF");
 if(v[1]==1)
  v[0]++;
}

RESULT(v[0] )


Parameter:  ThresholdCapacityEF

Contained in:  Energy
Used in:  (never used)


Parameter:  TimeRepaymentEF

Contained in:  Energy
Used in:  InstallmentEF, ExpCostENK, PlaceOrderEF, DemographyEN, KENCapacity, MaxKExpenditureEF


Parameter:  TotBrownCapacity

Contained in:  Energy
Used in:  TotENCapacity, InvestmentDecisionEF


Variable:  TotENCapacity

Contained in:  Energy
Used in:  probEntryEF, msEN, ExitEF, PercUnusedENCapacity, CallalphaGreen, CallalphaBrown
Using:  PriceEN, ShareBrownEnergy, ShareGreenEnergy, SumEnergyProductionPP, TotBrownCapacity, TotGreenCapacity, AvBrownProductivity, AvGreenProductivityEFType, EnergyProductionEF, MaxEnergyCapacity, AvKENProductivity

Equation code:

EQUATION("TotENCapacity")
/*
Function computing Green and Brown capacities
*/
v[0]=v[1]=v[2]=v[3]=v[4]=v[10]=v[11]=0;
V("PriceEN"); //ensure the computation of energy production and allocation of capital
CYCLE(cur, "EnergyFirm")
 {
if(VS(cur, "EFType")==0 )
{
    v[3] += VS(cur, "EnergyProductionEF");
v[0]+= VS(cur,"MaxEnergyCapacity");
v[10]+=VS(cur, "AvKENProductivity");
}
if(VS(cur, "EFType")==1 )
{
    v[4]+= VS(cur, "EnergyProductionEF");
v[1]+= VS(cur,"MaxEnergyCapacity");
v[11]+=VS(cur, "AvKENProductivity");
}
 }
WRITE("TotBrownCapacity",v[0]);
WRITE("TotGreenCapacity",v[1]);

WRITE("AvBrownProductivity",v[10]);
WRITE("AvGreenProductivity",v[11]);

v[5] = V("SumEnergyProductionPP");
WRITE("ShareBrownEnergy", v[3]/v[5]);
WRITE("ShareGreenEnergy", v[4]/v[5]);

RESULT(v[0]+v[1] )


Variable:  TotExcessCost

Contained in:  Energy
Used in:  ExcessCostIncome
Using:  ExcessEnergy, PriceENBrown, PriceENGreenEFType

Equation code:

EQUATION("TotExcessCost")
/*
Total excess cost to be distrubuted to classes
*/
v[0]=V("ExcessEnergy");
//v[1]=V("OverCostMarkup");

if(V("EFType")==0)
 v[2]=V("PriceENBrown");
else
 v[2]=V("PriceENGreen");
//v[10]=v[0]*v[1]*v[2];
v[10]=v[0]*v[2];
if(v[10]<0)
v[10]=0;
RESULT(v[10] )


Parameter:  TotGreenCapacity

Contained in:  Energy
Used in:  TotENCapacity, CallalphaGreen


Variable:  WaitingEFRatio

Contained in:  Energy
Used in:  (never used)
Using:  NbrEF, SumWaitingEF

Equation code:

EQUATION("WaitingEFRatio")
/*
*/
v[0]=V("SumWaitingEF");
v[1]=V("NbrEF");
RESULT(v[0]/v[1] )


Parameter:  alphaBrown

Contained in:  Energy
Used in:  CallalphaBrown, ExpectedIncomePP, KProductionFlow


Parameter:  alphaGreen

Contained in:  Energy
Used in:  CallalphaGreen, ExpectedIncomePP, KProductionFlow


Parameter:  alphaMUEF

Contained in:  Energy
Used in:  markupEF


Parameter:  betaPriceEN

Contained in:  Energy
Used in:  PlaceOrderEF


Parameter:  betaProdEN

Contained in:  Energy
Used in:  PlaceOrderEF


Parameter:  betaTimeEN

Contained in:  Energy
Used in:  PlaceOrderEF


Parameter:  minAgeExitEF

Contained in:  Energy
Used in:  ExitEF


Parameter:  minRRoKExitEF

Contained in:  Energy
Used in:  ExitEF


Variable:  probEntryEF

Contained in:  Energy
Used in:  DemographyEN
Using:  NbrEF, SumEnergyProductionEF, TotENCapacity, expPREF, MaxEFirms, MinEFirms

Equation code:

EQUATION("probEntryEF")
/*
*/
v[0] = V("SumEnergyProductionEF");
v[1] = V("TotENCapacity");
v[2] = V("expPREF");
v[3] = pow(v[0]/v[1],v[2]);

v[4] = V("NbrEF");

v[8] = V("MaxEFirms");
v[9] = V("MinEFirms");
v[6]=v[3];
if(v[4]>v[8])
 v[6]=0;
if(v[4]<v[9])
 v[6]=1;
 
RESULT(v[6])


Parameter:  probEntryEFbase

Contained in:  Energy
Used in:  (never used)


Parameter:  minGPremium

Contained in:  Energy
Used in:  GreenPremium


Parameter:  AvBrownProductivity

Contained in:  Energy
Used in:  TotENCapacity


Parameter:  AvGreenProductivity

Contained in:  Energy
Used in:  TotENCapacity


Parameter:  RatioNPLEBC

Contained in:  Energy
Used in:  ExitEF


Parameter:  reductionKENC

Contained in:  Energy
Used in:  KENCapacity


Variable:  OrderedKEN

Contained in:  Energy
Used in:  InvestmentDecisionEFXXX, InvestmentDecisionEF
Using:  KAmountWaitingEF

Equation code:

EQUATION("OrderedKEN")
/*
Sum of capital ordered by EN firms waiting to be delivered
*/
v[0]=v[1]=0;

CYCLE(cur, "EnergyFirm")
{
 if(VS(cur, "WaitingEF")==1)
  {
   v[0] += VS(cur->hook, "KAmount");
  }
}

RESULT(v[0] )


Parameter:  maxCapacityProductionEN

Contained in:  Energy
Used in:  InvestmentDecisionEFXXX, InvestmentDecisionEF


Parameter:  minSize

Contained in:  Energy
Used in:  ExitEF


Variable:  FairEnergy

Contained in:  Energy
Used in:  FairEnergyPP, PriceEN
Using:  TotEnergyConsumptionshareFairEnergy

Equation code:

EQUATION("FairEnergy")
/*
Share of energy demand distributed in proportion to capacity and not on competitive bidding process
*/
v[0] = V("shareFairEnergy");
v[1] = V("TotEnergyConsumption");

RESULT(v[0]*v[1] )


Parameter:  shareFairEnergy

Contained in:  Energy
Used in:  FairEnergy


Variable:  MarketEnergyCapacity

Contained in:  Energy
Used in:  FairEnergyPP
Using:  MaxEnergyCapacity

Equation code:

EQUATION("MarketEnergyCapacity")
/*
Total Energy Capacity
*/
v[0]=0;
CYCLE(cur, "EnergyFirm")
{
 v[0] += VS(cur, "MaxEnergyCapacity");
}

RESULT(v[0])


Parameter:  ExitFlagEF

Contained in:  Energy
Used in:  ExitEF, DemographyEN


Function:  PermissionInv

Contained in:  Energy
Used in:  (never used)
Using:  WaitingEF, TimeSinceLastInv

Equation code:

EQUATION("PermissionInv")
/*
Permission to invest, allowed only to the firm with the longest time since last investment and if no other firm is waiting for K
*/
v[4] = VS(c, "WaitingEF");
if(v[4]==-1)
 END_EQUATION(1);
v[1]=-1;
CYCLE(cur, "EnergyFirm")
{
 v[0] = VS(cur, "WaitingEF");
 if(v[0]==1)
  END_EQUATION(0);
 v[2] = VS(cur, "TimeSinceLastInv");
 if(v[2]>v[1])
  {
   v[1]=v[2];
   cur1=cur;
  }
  
}

END_EQUATION(1);


RESULT(v[3] )


Parameter:  smoothPPP

Contained in:  Energy
Used in:  PricePP


Variable:  PercUnusedENCapacity

Contained in:  Energy
Used in:  (never used)
Using:  SumEnergyProductionEF, TotENCapacity

Equation code:

EQUATION("PercUnusedENCapacity")
/*
Percentage of unused EN capacity
*/

v[0] = V("TotENCapacity");
v[1] = V("SumEnergyProductionEF");
v[2]=(v[0]-v[1])/v[0];
RESULT( v[2] )


Parameter:  expPREF

Contained in:  Energy
Used in:  probEntryEF


Parameter:  MaxEFirms

Contained in:  Energy
Used in:  probEntryEF


Parameter:  MinEFirms

Contained in:  Energy
Used in:  probEntryEF


Parameter:  minTimeEntryEF

Contained in:  Energy
Used in:  DemographyEN


Parameter:  CounterEntryEF

Contained in:  Energy
Used in:  DemographyEN


Variable:  SumTaxEF

Contained in:  Energy
Used in:  GovernmentFund, TaxRevenues
Using:  TaxEF

Equation code:

EQUATION("SumTaxEF")
/*
Total tax EFFirm
*/

RESULT(SUM("TaxEF") )


Parameter:  minShareKEN

Contained in:  Energy
Used in:  DemographyEN


Parameter:  PriceENBrown

Contained in:  Energy
Used in:  IncomeBeforeDebtPaymentsEF, GOSEF, ProfitEF, ExcessCostPP, TotExcessCost, PriceEN, RevenuesEF


Parameter:  PriceENGreen

Contained in:  Energy
Used in:  IncomeBeforeDebtPaymentsEF, GOSEF, ProfitEF, ExcessCostPP, TotExcessCost, PriceEN, RevenuesEF


Parameter:  FrequencyInvEF

Contained in:  Energy
Used in:  InvestmentDecisionEF


Object:  EnergyFirm

Contained in:  Root—>Stats—>Country—>Energy
Containing:  CapitalEF, LaborEF

Variables:  
Parameters:  

Variable:  AgeEF

Contained in:  EnergyFirm
Used in:  ExitEF, AgeEF, markupEF
Using:  AgeEF

Equation code:

EQUATION("AgeEF")
/*
*/
v[1]=VL("AgeEF",1);
RESULT(v[1]+1 )


Variable:  AvUtilization

Contained in:  EnergyFirm
Used in:  AvUtilisationGreen, AvUtilisationBrown
Using:  EnergyProductionEF, MaxEnergyCapacity

Equation code:

EQUATION("AvUtilization")
/*
Comment
*/
v[0]=V("MaxEnergyCapacity");
v[1] = V("EnergyProductionEF");

if(v[0]>0)
 v[2]=v[1]/v[0];
else
 v[2]=0;
RESULT(v[2] )


Variable:  BalanceEF

Contained in:  EnergyFirm
Used in:  CashEF, EntryEF, sBalanceEF
Using:  PriceENProfitEF, WagePremEF, TaxEF

Equation code:

EQUATION("BalanceEF")
/*
Cash revenues for energy firms
*/
V("PriceEN");
v[0] = V("ProfitEF");
v[1] = V("WagePremEF");
v[2] = V("TaxEF");

v[3]=v[0]-v[1]-v[2];
RESULT(v[3])


Variable:  CapitalCostEF

Contained in:  EnergyFirm
Used in:  EFirmControlCurrent
Using:  CapitalPaymentEF, InterestPaymentEF

Equation code:

EQUATION("CapitalCostEF")
/*
Cost of repayment loans
*/
v[0]=V("CapitalPaymentEF");
v[1]=V("InterestPaymentEF");/**/

RESULT(v[0]+v[1] )


Variable:  CapitalPaymentEF

Contained in:  EnergyFirm
Used in:  sCapitalCostEF, FinancialTrading, ProfitEF, CapitalCostEF, EFirmControlCapital
Using:  InstallmentEF

Equation code:

EQUATION("CapitalPaymentEF")
/*
Cost of repayment principal
*/
v[0]=0;
CYCLE(cur, "CapitalEF")
{
v[0]+=VS(cur, "InstallmentEF");
}
RESULT(v[0] )


Variable:  CashEF

Contained in:  EnergyFirm
Used in:  WagePremEF, LiabilitiesEF, FinancialTrading, BankCapital, CashEF, CashEFAdjustment, OverdraftPaymentEF, InterestDepositsEF, ExitEF, EntryEF, EFirmControlCurrent, SumCashEF, CashEFCh, DemographyEN, sCashEF, CheckFinBalance, CheckFinBalanceLag
Using:  PriceENBalanceEF, CashEF, OrganicCashEF

Equation code:

EQUATION("CashEF")
/*
Comulative cash of energy firms
*/
V("PriceEN");
v[0] = VL("CashEF", 1);
v[1] = V("BalanceEF");

v[3]=v[0]+v[1];
WRITE("OrganicCashEF", v[3]);
RESULT(v[3])


Variable:  CashEFCh

Contained in:  EnergyFirm
Used in:  SumCashEFCh
Using:  CashEF

Equation code:

EQUATION("CashEFCh")
/*
*/
v[10]=V("CashEF");
v[11]=VL("CashEF",1);

v[20]=v[10]-v[11]; //UNRECOGNISE GRAMMAR ERROR
RESULT(v[20] )


Variable:  ControlENEF

Contained in:  EnergyFirm
Used in:  (never used)
Using:  PriceEN, SumEnergyProductionEF, SumEnergyProductionPPEnergyProductionEF, MaxEnergyCapacity

Equation code:

EQUATION("ControlENEF")
/*
*/
//v[10]=t;sprintf(msg, "\n ControlTotEN(%g)", v[10]); plog(msg);

V("SumEnergyProductionPP");
V("SumEnergyProductionEF");
V("PriceEN");

v[0]=V("EnergyProductionEF");
v[1]=V("MaxEnergyCapacity");
v[3]=v[0]-v[1];

if(v[0]>v[1])
//INTERACT("ControlENEF",v[3]);

RESULT(v[3] )


Variable:  ControlPremiaEF

Contained in:  EnergyFirm
Used in:  (never used)
Using:  WagePremEFPremiaEF

Equation code:

EQUATION("ControlPremiaEF") //ok
/*
*/
v[0]=v[1]=0;
CYCLE(cur, "LaborEF")
{
  v[0]=VS(cur,"PremiaEF");
  v[1]+=v[0];
}
v[2]=V("WagePremEF");
v[3]=v[1]-v[2];
//if(v[3]>0.001 | v[3]<-0.001) // avoid approximation issue
//INTERACT("ControlPremiaEF",v[3]);
RESULT(v[3] )


Parameter:  DebtEF

Contained in:  EnergyFirm
Used in:  EntryEF


Parameter:  EFType

Contained in:  EnergyFirm
Used in:  IncomeBeforeDebtPaymentsEF, StatEF, GOSEF, AvUtilisationGreen, AvUtilisationBrown, NbrEF, ProfitEF, ExcessCostPP, TotExcessCost, TotENCapacity, EntryEF, ExpectedIncomePP, PlaceOrderEF, KProductionFlow, PriceEN, RevenuesEF, PricePPDoped, InvestmentDecisionEFXXX, InvestmentDecisionEF, Init


Variable:  EFirmControlCapital

Contained in:  EnergyFirm
Used in:  SumEFirmControlCapital
Using:  FinancialTrading, Production, TradePriceENCapitalPaymentEF, InvestmentDecisionEF, InvestmentSpendingEF, OutstandingDebtEF, OutstandingDebtEFCh

Equation code:

EQUATION("EFirmControlCapital")
/*
*/
V("Trade");
V("FinancialTrading");
V("InvestmentDecisionEF");
V("Production");
V("PriceEN");

v[6]=V("CapitalPaymentEF");
v[5]=V("InvestmentSpendingEF");
v[10]=V("OutstandingDebtEF");
v[11]=VL("OutstandingDebtEF",1);

v[12]=V("OutstandingDebtEFCh");


//v[20]=(v[10]-v[11])-v[5]+v[6];
v[20]=v[12]-v[5]+v[6];

//if(abs(v[20])>0.001 )
//INTERACT("EFirmControlCapital",v[20]);
RESULT(v[20] )


Variable:  EFirmControlCurrent

Contained in:  EnergyFirm
Used in:  SumEFirmControlCurrent
Using:  FinancialTrading, Production, TradeInvestmentDecisionPriceENCapitalCostEF, CashEF, ExcessCostEF, InterestDepositsEF, LaborCostEF, OverdraftPaymentEF, RevenuesEF, WagePremEF, CashEFAdjustment

Equation code:

EQUATION("EFirmControlCurrent")
/*
*/
V("Trade");
V("FinancialTrading");
V("InvestmentDecision");
V("Production");
V("PriceEN");

v[0]=V("RevenuesEF");
v[1]=V("WagePremEF");
v[2]=V("LaborCostEF");
v[6]=V("CapitalCostEF");
v[7]=VL("OverdraftPaymentEF",0);
v[8]=VL("InterestDepositsEF",0);
v[12]=V("CashEF");
v[13]=VL("CashEF",1);
v[14]=V("ExcessCostEF");

v[15]=V("CashEFAdjustment");

v[20]=v[0]-v[1]-v[2]-v[6]-v[7]+v[8]-(v[12]-v[13])-v[14]-v[15];
//if(abs(v[20])>1000 && V("ExitFlagEF")==1)
 //INTERACT("Spike EF",v[20]);
RESULT(v[20] )


Variable:  EnergyProductionEF

Contained in:  EnergyFirm
Used in:  IncomeBeforeDebtPaymentsEF, GOSEF, ProfitEF, ControlENEF, msEN, TotENCapacity, SumEnergyProductionEF, RevenuesEF, AvUtilization
Using:  PriceENEnergyProductionPP, FairEnergyPP

Equation code:

EQUATION("EnergyProductionEF")
/*
Total energy produced by the firm
*/
V("PriceEN");
v[0]=0;
CYCLE(cur, "CapitalEF")
{
v[0]+=VS(cur, "EnergyProductionPP")+VS(cur,"FairEnergyPP");
}
RESULT(v[0] )


Parameter:  ExcessCostEF

Contained in:  EnergyFirm
Used in:  IncomeBeforeDebtPaymentsEF, ProfitEF, EFirmControlCurrent


Variable:  ExpectedIncomePP

Contained in:  EnergyFirm
Used in:  PlaceOrderEF
Using:  CallalphaBrown, CallalphaGreen, PriceENMA, alphaBrown, alphaGreenEFType, KapitalNeedEF, alphaSize

Equation code:

EQUATION("ExpectedIncomePP")
/*
*/
v[2]=VL("PriceENMA",1);
v[3]=V("KapitalNeedEF");

v[99]=V("EFType");
if(v[99]==0)
 { // its a brown firm
V("CallalphaBrown");
v[41]=V("alphaBrown");
 }
else
 { // its a green firm
V("CallalphaGreen");
v[41]=V("alphaGreen");
 }

v[42]=V("alphaSize");

//v[0]=v[3]*v[2];
v[0]=v[3]*v[2]*v[41]*v[42];

RESULT(v[0] )


Parameter:  FossilFuel

Contained in:  EnergyFirm
Used in:  EntryEF


Parameter:  IdFirmEN

Contained in:  EnergyFirm
Used in:  ExitEF, EntryEF, PlaceOrderEF, KProductionFlow, InitPP, Init, InitInProgress


Parameter:  IdTechEN

Contained in:  EnergyFirm
Used in:  EntryEF, PlaceOrderEF


Variable:  InterestDepositsEF

Contained in:  EnergyFirm
Used in:  IncomeBeforeDebtPaymentsEF, SumInterestDepositsEF, BankCapital, ProfitEF, EFirmControlCurrent, CheckFinBalance
Using:  InterestRateDepositsCashEF

Equation code:

EQUATION("InterestDepositsEF")
/*
Cash obtained as interest on deposits
*/
v[0] = V("InterestRateDeposits");
v[1] = VL("CashEF",1);/**/
if(v[1]>0)
 v[3]=v[0]*v[1];
else
 v[3]=0;
RESULT(v[3] )


Variable:  InterestPaymentEF

Contained in:  EnergyFirm
Used in:  SumInterestPaymentEF, FinancialTrading, BankCapital, ProfitEF, CapitalCostEF, CheckFinBalance
Using:  InterestEF

Equation code:

EQUATION("InterestPaymentEF")
/*
Interest payments on outstanding debt
*/
v[0]=0;
CYCLE(cur, "CapitalEF")
{
v[0]+=VS(cur, "InterestEF");
}

RESULT(v[0] )


Variable:  InvestmentDecisionEF

Contained in:  EnergyFirm
Used in:  OutstandingDebtEF, EFirmControlCapital, KProductionFlow
Using:  TotEnergyConsumptionIsEnergyK, PlaceOrderEF, DemographyEN, ExcessEnergyL, FirstOrderEFFrac, MaxGrowthEF, MultiplierCapacityENBrown, MultiplierCapacityENGreen, StepGreenPremium, SumMaxEnergyCapacity, TotBrownCapacity, OrderedKEN, maxCapacityProductionEN, FrequencyInvEFEFType, InvestmentSpendingEF, KapitalNeedEF, MaxEnergyCapacity, MaxKExpenditureEF, WaitingEF, msENCapacity, TimeDeliveryPP

Equation code:

EQUATION("InvestmentDecisionEF")
/*
Place an order of K if you need it and did not place an order as yet
*/
V("DemographyEN");
v[3] = V("WaitingEF");
if(v[3]==1)
 {
 //sprintf(msg, "\n EF Waiting %lf", v[0] ); plog(msg);
  END_EQUATION(1); //skip the equation if you already placed an order. To be edited to give the possibility to remove a too late order
 }
//we are here only if there is no pending order

v[0]=t; //INTERACT("InvestmentDecisionEF", v[0]);
v[50] = V("TimeDeliveryPP");
v[51] = V("FrequencyInvEF");
if(v[0]-v[50]<v[51])
  END_EQUATION(1);
WRITE("InvestmentSpendingEF",0); //sprintf(msg, "\n InvestmentDecisionEF(%g)", v[12]); plog(msg);
v[1]=V("SumMaxEnergyCapacity");
v[41] = V("OrderedKEN");
v[2]=V("TotEnergyConsumption");
v[42] = V("maxCapacityProductionEN");
if(v[1]+v[41]>v[2]*v[42] && v[3]!=-1)
{
  //sprintf(msg, "\n MaxKExpenditureEF<=0 %lf", v[7] ); plog(msg);
  END_EQUATION(1);
  }
v[50]=V("MaxEnergyCapacity");
v[7] = V("MaxKExpenditureEF");
if(v[7]<=0 && v[50]>1 && v[3]!=-1)
{
  //sprintf(msg, "\n MaxKExpenditureEF<=0 %lf", v[7] ); plog(msg);
  END_EQUATION(1);
  }

v[30]=V("ExcessEnergyL");
v[11]=V("MaxEnergyCapacity");
v[55]=V("EFType");
if(v[55]==0)
{//brown firm
  if(v[11]!=0)
   { //not new entrant
   v[9]=V("msENCapacity");
   v[10]=v[2]*v[42]-v[1];
   if(v[10]<0)
   INTERACT("NEG KEN ORDER",v[10]);
   v[20]=v[9]*v[10];
   v[12]=V("MaxGrowthEF"); //
   v[21]=v[11]*v[12];
   v[22]=min(v[20],v[21]);
   if(v[10]<0)
   INTERACT("OPS", v[10]);
   }
  else
   {//new entrant
  v[60]=V("TotEnergyConsumption");
     v[61]=V("FirstOrderEFFrac");
  //v[22]=v[61]*(v[60]+v[30]);
  v[22]=max(v[61]*v[60],v[30]);
   }
}
else
{//green firm
  v[56]=V("StepGreenPremium");
  if(t<v[56])
  {//before transition
    if(v[11]!=0)
     { //not new entrant
     v[9]=V("msENCapacity");
     v[10]=v[2]*v[42]-v[1];
     v[20]=v[9]*v[10];
     v[12]=V("MaxGrowthEF"); //
     v[21]=v[11]*v[12];
     v[22]=min(v[20],v[21]);
     if(v[10]<0)
     INTERACT("OPS", v[10]);
     }
    else
     {//new entrant
      v[60]=V("TotEnergyConsumption");
      v[61]=V("FirstOrderEFFrac");
     //v[22]=v[61]*(v[60]+v[30]);
      v[22]=max(v[61]*v[60],v[30]);
     }
   }
   else
   {//after transition
      v[72]=V("TotBrownCapacity");
      if(v[11]!=0)
       { //not new entrant
       v[9]=V("msENCapacity");
       v[10]=v[2]*v[42]-v[1]+v[72];
       v[20]=v[9]*v[10];
       v[12]=V("MaxGrowthEF"); //
       v[21]=v[11]*v[12];
       v[22]=min(v[20],v[21]);
       if(v[10]<0)
       INTERACT("OPS", v[10]);
       }
      else
       {//new entrant
         v[60]=V("TotEnergyConsumption");
          v[61]=V("FirstOrderEFFrac");
       //v[22]=v[61]*(v[60]+v[30]);
       v[22]=max(v[61]*v[60],v[30]);
       }
   }
}

if(v[22]>0)
{
if(V("EFType")==0)
   v[5] = V("MultiplierCapacityENBrown");
  else
   v[5] = V("MultiplierCapacityENGreen");
  
v[3]= v[22]/v[5];
  WRITE("KapitalNeedEF", v[3]);
  //sprintf(msg, "\n WRITE KapitalNeedEF %lf", v[3] ); plog(msg);
  cur = SEARCHS(p->up->up, "Machinery");
  WRITES(cur, "IsEnergyK", 1);
  V_CHEATS(cur,"PlaceOrderEF", p);
}
RESULT( 1)


Parameter:  InvestmentSpendingEF

Contained in:  EnergyFirm
Used in:  SumInvestmentSpendingEF, EntryEF, EFirmControlCapital, SumInvestmentEF, KProductionFlow, InvestmentDecisionEFXXX, InvestmentDecisionEF


Parameter:  KapitalNeedEF

Contained in:  EnergyFirm
Used in:  EntryEF, ExpectedIncomePP, PlaceOrderEF, InvestmentDecisionEFXXX, InvestmentDecisionEF


Variable:  LaborCostEF

Contained in:  EnergyFirm
Used in:  IncomeBeforeDebtPaymentsEF, GOSEF, ProfitEF, EFirmControlCurrent, SumLaborCostEF, UnitCostKEN, PricePP
Using:  NumWorkersEF, wageEF

Equation code:

EQUATION("LaborCostEF")
/*
Labor cost of Energy Firms
*/
v[0]=0;

CYCLE(cur, "LaborEF")
 {
  v[1]=VS(cur,"NumWorkersEF");
  v[2]=VS(cur,"wageEF");
  v[0]+=v[1]*v[2];
 }

RESULT(v[0] )


Variable:  MaxEnergyCapacity

Contained in:  EnergyFirm
Used in:  AvUtilisationGreen, AvUtilisationBrown, SumMaxEnergyCapacity, ControlENEF, msEN, ExitEF, alphaSize, MarketEnergyCapacity, TotENCapacity, DemographyEN, UnitCostKEN, PricePP, AvUtilization, InvestmentDecisionEFXXX, InvestmentDecisionEF, MaxKExpenditureEF
Using:  KENCapacity

Equation code:

EQUATION("MaxEnergyCapacity")
/*
Maximum capacity
*/


v[0]=0;
CYCLE(cur, "CapitalEF")
{
v[1] = VS(cur, "KENCapacity");
v[0]+=v[1];
}

RESULT(v[0] )


Variable:  MaxKExpenditureEF

Contained in:  EnergyFirm
Used in:  EntryEF, PlaceOrderEF, InvestmentDecisionEFXXX, InvestmentDecisionEF
Using:  sInterestRate, TimeRepaymentEFMaxEnergyCapacity, sCashEF, sProfitEF

Equation code:

EQUATION("MaxKExpenditureEF")
/*
Maximum costs of purchasing capital for energy firms.
It is computed assuming a flow of free cash available represented by sBalanceF plus a share of the available unused cash for the foreseeable future to finance additional capital interests and repayment.
We approximate the single time repayment cost of borrowing K to be repayed in L periods at interest i as:
R=K [ i / z]

where

z=(1-(1/(1+i)^L))

Consequently, the maximum K the firm can expect to pay is:
K=sBalanceF/[i/z]
*/

v[5] = VL("sCashEF", 1);
v[0] = VL("sProfitEF", 1);
v[1] = V("TimeRepaymentEF");
v[2] = VL("sInterestRate",1);//xxx

v[3]=1-pow(1/(1+v[2]),v[1]);
if(v[5]<0)
 v[5]=0;
if(v[0]<0)
 v[0]=0;
v[4]=(v[0]+v[5]/v[1])/(v[2]/v[3]);

if(V("MaxEnergyCapacity")<=1000) // Allow new firms to invest
v[4]=9999999999.0;

RESULT(v[4] )


Parameter:  NumPP

Contained in:  EnergyFirm
Used in:  EntryEF, KProductionFlow, DemographyEN


Variable:  OutstandingDebtEF

Contained in:  EnergyFirm
Used in:  LiabilitiesEF, FinancialTrading, EntryEF, EFirmControlCapital, OutstandingDebtEFCh, OutstandingDebtEFCh, Init
Using:  InvestmentDecisionEFPrincipalEF

Equation code:

EQUATION("OutstandingDebtEF")
/*
Stock of existing debt
*/
v[0]=0;
V("InvestmentDecisionEF");
CYCLE(cur, "CapitalEF")
{
v[0]+=VS(cur, "PrincipalEF");
}

RESULT(v[0] )


Variable:  OutstandingDebtEFCh

Contained in:  EnergyFirm
Used in:  EFirmControlCapital, SumOutstandingDebtEFCh
Using:  FinancialTrading, Production, TradeInvestmentDecisionOutstandingDebtEF

Equation code:

EQUATION("OutstandingDebtEFCh")
/*
*/
V("Trade");
V("FinancialTrading");
V("InvestmentDecision");
V("Production");

v[10]=V("OutstandingDebtEF");
v[11]=VL("OutstandingDebtEF",1);

RESULT(v[10]-v[11] )


Variable:  OverdraftPaymentEF

Contained in:  EnergyFirm
Used in:  SumOverdraftPaymentEF, FinancialTrading, BankCapital, ProfitEF, EFirmControlCurrent, UnitCostKEN, CheckFinBalance
Using:  InterestRateCashEF

Equation code:

EQUATION("OverdraftPaymentEF")
/*
Interest paid on overdraft EF
*/
v[0] = VL("CashEF",1);/**/
if(v[0]>0)
 END_EQUATION(0);
v[1] = VL("InterestRate",1);

v[2]=-v[0]*v[1];
RESULT(v[2] )


Variable:  ProfitEF

Contained in:  EnergyFirm
Used in:  WagePremEF, sProfitEF, TaxEF, BalanceEF, EntryEF, markupEF
Using:  PriceENBrown, PriceENGreenCapitalPaymentEF, EFType, EnergyProductionEF, ExcessCostEF, InterestDepositsEF, InterestPaymentEF, LaborCostEF, OverdraftPaymentEF

Equation code:

EQUATION("ProfitEF")
/*
Energy firm profits
*/
if(V("EFType")==0)
 v[0]=V("PriceENBrown");
else
 v[0]=V("PriceENGreen");
v[1]=V("EnergyProductionEF");
v[3]=V("LaborCostEF");
v[4]=V("OverdraftPaymentEF");/**/
v[5]=V("ExcessCostEF");
v[6] = V("InterestDepositsEF");/**/
//v[7]=V("CapitalCostEF");
v[9]=V("CapitalPaymentEF");
v[10]=V("InterestPaymentEF");/**/

RESULT(v[0]*v[1]-v[3]-v[4]-v[5]+v[6]-v[9]-v[10])


Variable:  RRoKEF

Contained in:  EnergyFirm
Used in:  ExitEF
Using:  sProfitEF, sIncomeBeforeDebtPaymentsEF

Equation code:

EQUATION("RRoKEF")
/*
*/
v[1]=V("sIncomeBeforeDebtPaymentsEF");
v[2]=V("sProfitEF");

if(v[1]<0.001)
 v[1]=0.001;

v[3]=v[2]/v[1];
RESULT(v[3] )


Variable:  RequiredWorkersEF

Contained in:  EnergyFirm
Used in:  shareLaborKEN, PricePP, NumWorkersEF
Using:  KENProductivity, InitKENCapacity

Equation code:

EQUATION("RequiredWorkersEF")
/*
Compute the number of workers for the energy firms
*/

v[0]=0;
CYCLE(cur, "CapitalEF")
{
 v[1] = VS(cur, "KENProductivity");
 v[2] = VS(cur, "InitKENCapacity");
 v[0] +=v[2]/v[1];
}

RESULT(v[0] )


Variable:  RevenuesEF

Contained in:  EnergyFirm
Used in:  StatEF, SumRevenuesEF, EFirmControlCurrent
Using:  PriceEN, PriceENBrown, PriceENGreenEFType, EnergyProductionEF

Equation code:

EQUATION("RevenuesEF")
/*
Revenues of Energy Firms
*/

v[0]=V("PriceEN");
if(V("EFType")==0)
 v[0] = V("PriceENBrown");
else
 v[0] = V("PriceENGreen");
 
v[1]=V("EnergyProductionEF");


RESULT(v[0]*v[1] )


Parameter:  SafetyCoefEF

Contained in:  EnergyFirm
Used in:  EntryEF, PlaceOrderEF


Parameter:  TotalCapacityEF

Contained in:  EnergyFirm
Used in:  (never used)


Parameter:  UnitKENCost

Contained in:  EnergyFirm
Used in:  (never used)


Variable:  WagePremEF

Contained in:  EnergyFirm
Used in:  BalanceEF, EFirmControlCurrent, ControlPremiaEF, SumWagePremEF, Production, CheckFinBalance
Using:  roPremia, roCashPremiaIncomeCashEF, ProfitEFIdLaborEF, wageEF, PremiaEF

Equation code:

EQUATION("WagePremEF")
/*
Wage premia distributed, when available to all classes of executives.
*/

v[0]=V("ProfitEF");
v[1]=VL("CashEF",1);
v[50]=V("roPremia");
v[4]=V("roCash");

if(v[0]>0)
 v[5]=max(0,(v[0])*v[50]+v[1]*v[4]);
else
 v[5]=0;

v[3]=0;

if(v[5]>0)
 {
  CYCLE(cur, "LaborEF")
   {
    v[10]=VS(cur,"IdLaborEF");
    if(v[10]>1)
     {
      v[2]=VS(cur,"wageEF");
      v[3]+=v[2];
     }
   }

  CYCLE(cur, "LaborEF")
   {
    v[10]=VS(cur,"IdLaborEF");
    if(v[10]>1)
     {v[2]=VS(cur,"wageEF");
      WRITES(cur,"PremiaEF",v[5]*v[2]/v[3]);
      INCRS(cur->hook,"PremiaIncome",v[5]*v[2]/v[3]);
     }
   }
 }
else
 {
   CYCLE(cur, "LaborEF")
   {
    WRITES(cur,"PremiaEF",0);
   }
 }

RESULT(v[5] )


Parameter:  WaitingEF

Contained in:  EnergyFirm
Used in:  ExitEF, EntryEF, SumWaitingEF, PlaceOrderEF, KProductionFlow, OrderedKEN, TimeSinceLastInv, PermissionInv, InvestmentDecisionEFXXX, InvestmentDecisionEF


Variable:  alphaSize

Contained in:  EnergyFirm
Used in:  ExpectedIncomePP, KProductionFlow
Using:  FactorSizeMaxEnergyCapacity

Equation code:

EQUATION("alphaSize")
/*
Increasing return to scale
*/
v[1]=V("MaxEnergyCapacity");
v[2]=V("FactorSize");
v[0]=1+log(v[1]+1)/v[2];
RESULT(v[0] )


Variable:  markupEF

Contained in:  EnergyFirm
Used in:  PricePP, markupEF
Using:  MaxMUEF, MinMUEF, alphaMUEFAgeEF, ProfitEF, markupEF

Equation code:

EQUATION("markupEF")
/*
Markup for energy firms. Decreases in case of null sales and increases otherwise
*/
v[0] = VL("ProfitEF",1);
v[6] = V("MaxMUEF");
v[7] = V("MinMUEF");
v[1] = VL("markupEF", 1);
v[2] = V("alphaMUEF");
if(v[0]>0)
 v[3]=v[2]*v[1]+(1-v[2])*v[6]; //maximum markup=2
else
 v[3]=v[2]*v[1]+(1-v[2])*v[7]; //minimum markup=1

if(V("AgeEF")<=1)
 v[3]=v[6];
RESULT(v[3] )


Variable:  sBalanceEF

Contained in:  EnergyFirm
Used in:  EntryEF
Using:  BalanceEF

Equation code:

EQUATION("sBalanceEF")
/*
Smoothed BalanceEF
*/
v[0]=V("BalanceEF");

v[1]=CURRENT*0.95+0.05*v[0];

RESULT(v[1] )


Variable:  sCashEF

Contained in:  EnergyFirm
Used in:  EntryEF, MaxKExpenditureEF
Using:  CashEF

Equation code:

EQUATION("sCashEF")
/*
Smoothed cash
*/
v[0]=V("CashEF");

v[1]=CURRENT*0.95+0.05*v[0];
RESULT(v[1] )


Variable:  NbrLaborEF

Contained in:  EnergyFirm
Used in:  (never used)
Using:  (none)

Equation code:

EQUATION("NbrLaborEF")
/*
*/
RESULT(COUNT("LaborEF") )


Variable:  TotNumWorkersEF

Contained in:  EnergyFirm
Used in:  SumTotNumWorkersEF
Using:  NumWorkersEF

Equation code:

EQUATION("TotNumWorkersEF")
/*
*/
v[0]=0;
CYCLE(cur,"LaborEF")
{
v[0]+=VS(cur,"NumWorkersEF");
}
RESULT(v[0] )


Variable:  sProfitEF

Contained in:  EnergyFirm
Used in:  RRoKEF, sProfitEF, MaxKExpenditureEF
Using:  ProfitEF, sProfitEF

Equation code:

EQUATION("sProfitEF")
/*
Smoothed ProfitEF
*/
v[1]=V("ProfitEF");
if(t>1)
 v[0]=VL("sProfitEF",1);
else
 v[0]=v[1];

v[2]=v[0]*0.95+0.05*v[1];
RESULT(v[2] )


Variable:  GOSEF

Contained in:  EnergyFirm
Used in:  StatEF
Using:  PriceENBrown, PriceENGreenEFType, EnergyProductionEF, LaborCostEF

Equation code:

EQUATION("GOSEF")
/*
Gross Operating Surplus of energy firm, difference between revenues and labor costs
*/
if(V("EFType")==0)
 v[0]=V("PriceENBrown");
else
 v[0]=V("PriceENGreen");

v[1]=V("EnergyProductionEF");
v[2]=V("LaborCostEF");
v[10]=v[0]*v[1]-v[2];
RESULT(v[10])


Variable:  CashEFAdjustment

Contained in:  EnergyFirm
Used in:  EFirmControlCurrent
Using:  BankCapitalCashEF, OrganicCashEF

Equation code:

EQUATION("CashEFAdjustment")
/*
CashEF correction to the Bank's action
*/

V("BankCapital");
v[0] = V("CashEF");
v[1] = V("OrganicCashEF");
v[2]=v[1]-v[0];
RESULT(v[2] )


Parameter:  OrganicCashEF

Contained in:  EnergyFirm
Used in:  CashEF, CashEFAdjustment


Variable:  sInterestPaymentEF

Contained in:  EnergyFirm
Used in:  sCapitalCostEF
Using:  sInterestEF

Equation code:

EQUATION("sInterestPaymentEF")
/*
Interest payments on outstanding debt
*/
v[0]=0;
CYCLE(cur, "CapitalEF")
{
v[0]+=VS(cur, "sInterestEF");
}

RESULT(v[0] )


Variable:  sCapitalCostEF

Contained in:  EnergyFirm
Used in:  PricePP
Using:  CapitalPaymentEF, sInterestPaymentEF

Equation code:

EQUATION("sCapitalCostEF")
/*
Cost of repayment loans
*/
v[0]=V("CapitalPaymentEF");
v[1]=V("sInterestPaymentEF");/**/

RESULT(v[0]+v[1] )


Variable:  AvKENProductivity

Contained in:  EnergyFirm
Used in:  TotENCapacity
Using:  KENCapacity, KENProductivity

Equation code:

EQUATION("AvKENProductivity")
/*
Average productivity of K for EN firms
*/
v[0]=v[1]=0;
CYCLE(cur, "CapitalEF")
{
  v[2] = VS(cur, "KENProductivity");
  v[3] = VS(cur, "KENCapacity");
  v[0]+=v[2]*v[3];
  v[1]+=v[3];
}

if(v[1]!=0)
 v[2]=v[0]/v[1];
else
 v[2]=0;
RESULT(v[2] )


Variable:  msEN

Contained in:  EnergyFirm
Used in:  (never used)
Using:  SumEnergyProductionEF, TotENCapacityEnergyProductionEF, MaxEnergyCapacity, msENCapacity

Equation code:

EQUATION("msEN")
/*
Market share of EN firms
*/
v[0] = V("TotENCapacity");
v[1] = V("MaxEnergyCapacity");
WRITE("msENCapacity", v[1]/v[0]);
v[2] = V("SumEnergyProductionEF");
v[3] = V("EnergyProductionEF");
RESULT(v[3]/v[2] )


Parameter:  msENCapacity

Contained in:  EnergyFirm
Used in:  msEN, InvestmentDecisionEFXXX, InvestmentDecisionEF


Variable:  TimeSinceLastInv

Contained in:  EnergyFirm
Used in:  TimeSinceLastInv, PermissionInv
Using:  WaitingEF, TimeSinceLastInv

Equation code:

EQUATION("TimeSinceLastInv")
/*
Time steps since last investment
*/

v[1] = V("WaitingEF");
if(v[1]==1)
 v[2]=0;
else
 v[2] = VL("TimeSinceLastInv", 1)+1;
RESULT(v[2] )


Parameter:  TimeDeliveryPP

Contained in:  EnergyFirm
Used in:  KProductionFlow, InvestmentDecisionEFXXX, InvestmentDecisionEF


Variable:  IncomeBeforeDebtPaymentsEF

Contained in:  EnergyFirm
Used in:  sIncomeBeforeDebtPaymentsEF
Using:  PriceENBrown, PriceENGreenEFType, EnergyProductionEF, ExcessCostEF, InterestDepositsEF, LaborCostEF

Equation code:

EQUATION("IncomeBeforeDebtPaymentsEF")
/*
*/
if(V("EFType")==0)
 v[0]=V("PriceENBrown");
else
 v[0]=V("PriceENGreen");
  
v[1]=V("EnergyProductionEF");
v[3]=V("LaborCostEF");
v[5]=V("ExcessCostEF");
v[6] = V("InterestDepositsEF");

v[7]=v[0]*v[1]-v[3]-v[5]+v[6];
RESULT(v[7])


Variable:  sIncomeBeforeDebtPaymentsEF

Contained in:  EnergyFirm
Used in:  sIncomeBeforeDebtPaymentsEF, RRoKEF
Using:  IncomeBeforeDebtPaymentsEF, sIncomeBeforeDebtPaymentsEF

Equation code:

EQUATION("sIncomeBeforeDebtPaymentsEF")
/*
*/
v[1]=VL("sIncomeBeforeDebtPaymentsEF",1);
v[2]=V("IncomeBeforeDebtPaymentsEF");

v[3]=v[1]*0.95+0.05*v[2];
RESULT(v[3] )


Variable:  LiabilitiesEF

Contained in:  EnergyFirm
Used in:  sLiabilitiesEF
Using:  CashEF, OutstandingDebtEF

Equation code:

EQUATION("LiabilitiesEF")
/*
*/
v[36]= -1 * V("CashEF");
v[34]=V("OutstandingDebtEF");

v[37]=v[36] + v[34];

if(v[37]<0.000)
 v[38]=0.000;
else
 v[38]=v[36]+v[34];

RESULT(v[38] )


Variable:  sLiabilitiesEF

Contained in:  EnergyFirm
Used in:  sLiabilitiesEF
Using:  LiabilitiesEF, sLiabilitiesEF

Equation code:

EQUATION("sLiabilitiesEF")
/*
*/
v[1]=VL("sLiabilitiesEF",1);
v[2]=V("LiabilitiesEF");

v[3]=v[1]*0.95+0.05*v[2];
RESULT(v[3] )


Parameter:  PPremoved

Contained in:  EnergyFirm
Used in:  DemographyEN


Variable:  TaxEF

Contained in:  EnergyFirm
Used in:  SumTaxEF, BalanceEF
Using:  taxrateProfitEF

Equation code:

EQUATION("TaxEF")
/*
Tax paid on profit of F firm
*/

v[0] = V("taxrate");
v[1] = V("ProfitEF");
if(v[1]>0)
 v[2]=v[0]*v[1];
else
 v[2]=0;
RESULT(v[2] )


Object:  CapitalEF

Contained in:  Root—>Stats—>Country—>Energy—>EnergyFirm

Variables:  
Parameters:  

Variable:  PPKAge

Contained in:  CapitalEF
Used in:  EntryEF, KProductionFlow, DemographyEN, KENCapacity
Using:  (none)

Equation code:

EQUATION("PPKAge")
/*
Comment
*/

RESULT(CURRENT+1 )


Variable:  KENCapacity

Contained in:  CapitalEF
Used in:  ShareCapacityPP, ExcessENPP, AvKENProductivity, EntryEF, DemographyEN, FairEnergyPP, PriceEN, MAUtilizationPP, UnitCostKEN, PricePP, MaxEnergyCapacity
Using:  CapitalDepressEN, TimeRepaymentEF, reductionKENCPPKAge, InitKENCapacity

Equation code:

EQUATION("KENCapacity")
/*
Comment
*/

/***********************/
v[0] = V("InitKENCapacity");
v[1]=V("reductionKENC");
v[4] = V("PPKAge");

/*************************/
v[0] = V("InitKENCapacity");

v[2] = V("CapitalDepressEN");

v[11]=floor(V("TimeRepaymentEF"));

v[3]=1-1/(1.2+exp(0.05*(v[11]-v[4])));
v[5]=v[0]*v[3];
if(v[4]>2*v[11])
 {
  v[7]=v[4]-2*v[11];
  v[6]=v[5]*(1-v[7]*v[1]);
  v[5]=max(0.01*v[0],v[6]);
 }
/*****************************/
RESULT(v[5] )


Parameter:  KENProductivity

Contained in:  CapitalEF
Used in:  AvKENProductivity, EntryEF, KProductionFlow, shareLaborKEN, PricePP, RequiredWorkersEF, Init


Parameter:  EnergyProductionPP

Contained in:  CapitalEF
Used in:  ShareENPP, ExcessENPP, EntryEF, SumEnergyProductionPP, KProductionFlow, PriceEN, EnergyProductionEF, MAUtilizationPP


Variable:  MAUtilizationPP

Contained in:  CapitalEF
Used in:  EntryEF, DemographyEN, MAUtilizationPP, Init
Using:  PriceEN, SpeedMAKENCapacity, EnergyProductionPP, MAUtilizationPP, FairEnergyPP

Equation code:

EQUATION("MAUtilizationPP")
/*
Moving average of PP utilization
*/
V("PriceEN");//to ensure that the current production is set
v[0] = VL("MAUtilizationPP", 1);
v[1] = V("EnergyProductionPP");
v[5] = V("FairEnergyPP");
v[3] = V("SpeedMA");
v[4] = V("KENCapacity");


if(v[4]==0) // this avoid to scrap pp of new entrants
v[2]=1;
else
  v[2]=v[3]*v[0]+(1-v[3])*(v[1]+v[5])/v[4];
// v[2]=v[3]*v[0]+(1-v[3])*(v[1])/(v[4]-v[5]);
//v[2]=v[3]*v[0]+(1-v[3])*(v[1]+v[5])/v[4];
RESULT(v[2] )


Variable:  InitKENCapacity

Contained in:  CapitalEF
Used in:  shareLaborKEN, UnitCostKEN, RequiredWorkersEF, KENCapacity
Using:  CapitalEN, alphaSizePP, alphaPP

Equation code:

EQUATION("InitKENCapacity")
/*
Comment
*/
v[0] = V("CapitalEN");
v[1]=V("alphaPP");
v[2]=V("alphaSizePP");

RESULT(v[0]*v[1]*v[2] )


Parameter:  KExpendituresEN

Contained in:  CapitalEF
Used in:  InstallmentEF, EntryEF, KProductionFlow, Init


Parameter:  CapitalEN

Contained in:  CapitalEF
Used in:  InitKENCapacity, EntryEF, KProductionFlow, Init


Variable:  InterestEF

Contained in:  CapitalEF
Used in:  InterestPaymentEF, UnitCostKEN
Using:  InterestRatePrincipalEF

Equation code:

EQUATION("InterestEF")
/*
Total interest to pay on the loan
*/
v[0] = VL("PrincipalEF",1);
v[1] = VL("InterestRate",1);

RESULT(v[0]*v[1] )


Variable:  PrincipalEF

Contained in:  CapitalEF
Used in:  sInterestEF, InstallmentEF, PrincipalEF, InterestEF, OutstandingDebtEF, ExitEF, EntryEF, KProductionFlow, DemographyEN, Init, CheckFinBalance, CheckFinBalanceLag
Using:  PrincipalEF, InstallmentEF

Equation code:

EQUATION("PrincipalEF")
/*
Remaining loan to be returned
*/
v[0] = VL("PrincipalEF", 1);
v[1] = V("InstallmentEF");

RESULT(v[0]-v[1] )


Variable:  InstallmentEF

Contained in:  CapitalEF
Used in:  CapitalPaymentEF, PrincipalEF, UnitCostKEN
Using:  TimeRepaymentEFKExpendituresEN, PrincipalEF

Equation code:

EQUATION("InstallmentEF")
/*
Remaining loan to be returned
*/
v[0] = VL("PrincipalEF", 1);
if(v[0]<=0)
 END_EQUATION(0);
v[2] = V("KExpendituresEN");
v[1] = V("TimeRepaymentEF");

v[4]=min(v[0],v[2]/v[1]);
RESULT(v[4] )


Parameter:  alphaSizePP

Contained in:  CapitalEF
Used in:  InitKENCapacity, KProductionFlow


Parameter:  ShareENPP

Contained in:  CapitalEF
Used in:  ControlShareENPP, EntryEF, PriceEN


Variable:  ExcessCostPP

Contained in:  CapitalEF
Used in:  ExcessCostEF
Using:  PriceENBrown, PriceENGreenEFTypeExcessENPP

Equation code:

EQUATION("ExcessCostPP")
/*
Excess cost due to overutilization
*/
v[0]=V("ExcessENPP");
if(V("EFType")==0)
 v[1]=V("PriceENBrown");
else
 v[1]=V("PriceENGreen");
 
v[10]=v[0]*v[1];
RESULT(v[10] )


Variable:  ExcessENPP

Contained in:  CapitalEF
Used in:  ExcessCostPP
Using:  PriceENKENCapacity, EnergyProductionPP, FairEnergyPP

Equation code:

EQUATION("ExcessENPP")
/*
Excess production due to overutilization
*/
V("PriceEN");
v[0]=V("KENCapacity");
v[2] = V("FairEnergyPP");
v[1]=V("EnergyProductionPP");
v[10]=v[1]+v[2]-v[0];
if(v[10]<0)
v[10]=0;
RESULT(v[10] )


Variable:  ShareCapacityPP

Contained in:  CapitalEF
Used in:  (never used)
Using:  SumMaxEnergyCapacityKENCapacity

Equation code:

EQUATION("ShareCapacityPP")
/*
*/
//v[10]=t;sprintf(msg, "\n aa(%g)", v[10]); plog(msg);
v[0]=V("SumMaxEnergyCapacity");
v[1]=V("KENCapacity");
v[10]=v[1]/v[0];
RESULT(v[10] )


Variable:  sInterestEF

Contained in:  CapitalEF
Used in:  sInterestPaymentEF
Using:  sInterestRatePrincipalEF

Equation code:

EQUATION("sInterestEF")
/*
Total interest to pay on the loan
*/
v[0] = VL("PrincipalEF",1);
v[1] = VL("sInterestRate",1);

RESULT(v[0]*v[1] )


Parameter:  alphaPP

Contained in:  CapitalEF
Used in:  InitKENCapacity, KProductionFlow


Variable:  FairEnergyPP

Contained in:  CapitalEF
Used in:  ShareENPP, ExcessENPP, EntryEF, SumEnergyProductionPP, KProductionFlow, PriceEN, EnergyProductionEF, MAUtilizationPP
Using:  FairEnergy, MarketEnergyCapacityKENCapacity

Equation code:

EQUATION("FairEnergyPP")
/*
FairEnergy for capital unit, a PP
*/
v[0] = V("FairEnergy");
v[1] = V("KENCapacity");
v[2] = V("MarketEnergyCapacity");
RESULT(v[0]*v[1]/v[2] )


Variable:  PriceEK

Contained in:  CapitalEF
Used in:  (never used)
Using:  PriceENPricePP

Equation code:

EQUATION("PriceEK")
/*
Price of the power plant
*/
V("PriceEN");
if(p->hook!=NULL)
 v[0] = VS(p->hook, "PricePP");
else
 v[0]=0;
RESULT(v[0] )


Variable:  shareLaborKEN

Contained in:  CapitalEF
Used in:  UnitCostKEN
Using:  RequiredWorkersEFKENProductivity, InitKENCapacity

Equation code:

EQUATION("shareLaborKEN")
/*
Share of workers used in the capital
*/
v[0] = V("InitKENCapacity");
v[1] = V("KENProductivity");
v[2] = V("RequiredWorkersEF");
if(v[2]>0)
 v[3]=(v[0]/v[1])/v[2];
else
 v[3]=0;
RESULT(v[3] )


Variable:  UnitCostKEN

Contained in:  CapitalEF
Used in:  PricePP
Using:  LaborCostEF, MaxEnergyCapacity, OverdraftPaymentEFKENCapacity, InitKENCapacity, InterestEF, InstallmentEF, shareLaborKEN

Equation code:

EQUATION("UnitCostKEN")
/*
Cost of units of energy computing labor and capital
*/

v[0] = V("LaborCostEF");//total labor cost
v[1] = V("shareLaborKEN");
v[2] = V("InstallmentEF");
v[3] = V("InterestEF");

v[8] = V("OverdraftPaymentEF");
v[9] = V("MaxEnergyCapacity");

v[5] = V("KENCapacity");

v[4]=v[8]*v[5]/v[9]+v[3]+v[2]+v[0]*v[1]; // total cost

v[11] = V("InitKENCapacity");

if(v[5]>0)
 v[6]=v[4]/v[11];
else
 v[6]=0;
RESULT(v[6] )


Object:  LaborEF

Contained in:  Root—>Stats—>Country—>Energy—>EnergyFirm

Variables:  
Parameters:  

Parameter:  IdLaborEF

Contained in:  LaborEF
Used in:  WagePremEF, EntryEF, NumWorkersEF, wageEF, Init, InitInProgress


Parameter:  nuEF

Contained in:  LaborEF
Used in:  NumWorkersEF, Init


Variable:  NumWorkersEF

Contained in:  LaborEF
Used in:  TotNumWorkersEF, EntryEF, LaborCostEF, NumWorkersEF, wageEF, NbrWorkers, Init, CheckFinBalance, GlobalFlows
Using:  tauMax, tauMin, tauMultiplierSRMultiplier, TopSavingRateNumClass, Expenditure, ShareWageIncome, SharePremiaIncome, ShareIncome, Individuals, LorenzInd, ComputeShare, Income, WageIncome, Consumption, SavingRate, CashCIdNeedIdDCh, tau, NegativeQuality, BalanceC, OverdraftPaymentCRequiredWorkersEFIdLaborEF, nuEF, NumWorkersEF

Equation code:

EQUATION("NumWorkersEF")
/*
Number of workers, working for EnergyFirms
*/

v[15]=0;
CYCLES(p->up, cur, "LaborEF")
 { //check how many tiers already exist
  v[15]++;
 }
v[14]=V("IdLaborEF");
if(v[14]==1)
 { // compute the first tier workers given their productivity and production needs
  v[6]=V("RequiredWorkersEF");
 }
else
 {// when above the first tier workers...
  v[18]=V("IdLaborEF");
  cur=SEARCH_CNDS(p->up,"IdLaborEF",v[18]-1);
  v[21]=VS(cur,"nuEF"); //given the worker ratio between tiers (defined by the tier below)
  v[19]=VS(cur,"NumWorkersEF"); //and the number of workers in the previous tier
  v[6]=v[19]/v[21]; // compute the required executives for the current tier
  v[17]=V("nuEF");
  if(v[6]>=v[17] && v[18]==v[15])
   { // if they are above the workers ratio of this tier and this is the last tier, create a new working class
    cur1=ADDOBJ_EXS(p->up,"LaborEF",p);
    WRITES(cur1,"IdLaborEF",v[18]+1);
    v[20]=v[6]/v[17];
    WRITELS(cur1,"NumWorkersEF",v[20], t);
    WRITELLS(cur1,"NumWorkersEF",0, t,1); // write also that the number of workers in the previous period is equal to 0, as it is used in the inequality statistics
    cur3=SEARCH_CND("NumClass",v[18]+1);
    if(cur3==NULL)
     {
//INTERACT("NULL cur3 missing class",v[1]);
if(v[22]-1<v[18]+1 )
    { //starting from the second class (the first are engineers), if it does not exist a class that represnt the new layer of executives, create it
      cur2=SEARCH_CNDS(p->up->up->up,"NumClass",v[18]);
      cur3=ADDOBJ_EXS(cur2->up,"Class",cur2);
      //cur3=ADDOBJS(cur2->up,"Class");
      //INTERACTS(cur3,"New class",v[22]);
      cur8=SEARCHS(cur3,"BankC");
      WRITELS(cur8,"BalanceC",0, t-1);
      WRITELS(cur8,"OverdraftPaymentC",0, t-1);
      
      cur8->hook=cur7;
      cur1->hook=cur3;
      v[44]=VS(cur2,"SavingRate");
      v[45]=VS(cur2->up,"SRMultiplier");
      v[47] = VS(cur2->up, "TopSavingRate");
      v[46]=v[44]*v[45]+(1-v[45])*v[47];
      WRITES(cur3,"SavingRate",v[46]);
      // INTERACTS(cur3,"Inspect SavingRate", v[46]);
      
      WRITES(cur3,"NumClass",v[18]+1);
      WRITELLS(cur3,"Expenditure",0, t-1,1);
      WRITELS(cur3,"Expenditure",0, t);
      WRITELS(cur3,"Income",0, t-1);
      WRITES(cur3,"WageIncome",0);
      WRITELS(cur3,"Consumption",0, t-1);
      WRITELS(cur3,"ShareWageIncome",0, t-1);
      WRITELS(cur3,"SharePremiaIncome",0, t-1);
      WRITELS(cur3, "CashC", 0, t-1);
      WRITELS(cur3,"ShareIncome",0, t-1); // reset the share income to be recomputed
      WRITES(cur3,"Individuals",v[20]); // set the number of individuals to nu;ber of workers of the new class
      v[35]=VS(cur2,"LorenzInd");
      WRITES(cur3,"LorenzInd",v[35]+v[20]); // set total number of workers as previous total plus new workers
      //WRITELS(cur3,"NoConsumption",0, t-1); // set the savongs due to unavailability of the good to 0
      //INTERACTS(cur3,"Created class",v[44]);
      CYCLES(cur3, cur, "Need")
      { // enter in neds and characterisitcs to change the tau parameter (the minimum is set every period)
        v[27]=VS(cur,"IdNeed");
        CYCLES(cur, cur1, "DCh")
        {
          v[26]=VS(cur1,"IdDCh");
          CYCLES(cur2, cur4, "Need")
          { // cycle among the needs of the preceding class
            v[28]=VS(cur4,"IdNeed");
            if(v[28]==v[27])
            { // when in the same need as the one the new class is cycling cycle through the char of the preceding class
              CYCLES(cur4, cur5, "DCh")
              {
                v[29]=VS(cur5,"IdDCh");
                if(v[29]==v[26])// when in the same characteristic the new class is cycling
                  v[30]=VS(cur5,"tau"); // read the value of the tau parameter
              }
              
            }
          }
          v[31]=VS(cur1,"tauMultiplier"); // the speed of adjustment of the tolerance level from one class to the following one
          v[34]=VS(cur1,"NegativeQuality");
          if(v[34]>0)
            v[33]=VS(p->up->up->up,"tauMax"); // the asympthotic level of the tolerance level (1 for qualities and 0 for price)
          if(v[34]<0)
            v[33]=VS(p->up->up->up,"tauMin"); // the asympthotic level of the tolerance level (1 for qualities and 0 for price)
          v[32]=v[30]*(1-v[31])+v[31]*v[33]; // adjustment in the treshold level of tolerance
          WRITES(cur1,"tau",v[32]); // finally write the tau for the new consumer class in each of its characteristic for each need
        }
        
      }
      v[35]=VS(cur3,"ComputeShare"); // set the distribution of expenditure shares across needs for the new class
      //INTERACTS(cur3,"NewClass END", v[20]);
    }
    else
    {
      cur1->hook=cur3;
    }
     }
    else
     {
      cur1->hook=cur3;
      }
   }
  if(v[18]>2 && v[19]<v[21])
   v[6]=0;
 }


RESULT(v[6] )


Variable:  wageEF

Contained in:  LaborEF
Used in:  WagePremEF, EntryEF, LaborCostEF, wageEF, Init, CheckFinBalance, GlobalFlows
Using:  MinWagePayTimeIndividuals, WageIncomeIdLaborEF, NumWorkersEF, wageEF, wagecoeffEF

Equation code:

EQUATION("wageEF")
/*
Wage of the workers in this layer of the firm
*/
v[5]=V("NumWorkersEF");
v[2]=V("IdLaborEF");
if(v[2]==1)
 { // first tier workers
  v[0]=V("MinWage");
  v[1]=V("wagecoeffEF"); // wage coefficient as the minimum wage multiplier
 }
else
 { // executives
  cur=SEARCH_CNDS(p->up,"IdLaborEF",v[2]-1);
  v[0]=VS(cur,"wageEF");
  v[1]=V("wagecoeffEF"); // wage coefficient as the wage tier multiplier
 }

VS(p->hook,"PayTime");
INCRS(p->hook,"Individuals",v[5]);
INCRS(p->hook,"WageIncome",v[5]*v[0]*v[1]);

RESULT((v[0]*v[1]) )


Parameter:  wagecoeffEF

Contained in:  LaborEF
Used in:  EntryEF, wageEF, Init


Parameter:  PremiaEF

Contained in:  LaborEF
Used in:  WagePremEF, EntryEF, ControlPremiaEF, GlobalFlows


Object:  PP

Contained in:  Root—>Stats—>Country—>Energy

Variables:  
Parameters:  

Variable:  PricePP

Contained in:  PP
Used in:  InitPP, PriceEN, PricePPDoped, PriceEK, PricePP, Init
Using:  smoothPPPLaborCostEF, MaxEnergyCapacity, RequiredWorkersEF, markupEF, sCapitalCostEFKENCapacity, KENProductivity, UnitCostKEN, PricePP

Equation code:

EQUATION("PricePP")
/*
Price computed as the markup on the cost of unit of energy
for this capital unit
*/

v[0] = VS(p->hook,"LaborCostEF");
v[1] = VS(p->hook,"markupEF");
v[3] = VS(p->hook,"sCapitalCostEF");
v[5] = VS(p->hook, "RequiredWorkersEF");
v[6] = VS(p->hook,"KENCapacity");
v[7] = VS(p->hook,"KENProductivity");

v[10] = VS(p->hook, "MaxEnergyCapacity");

if(v[5]==0 || v[10]==0 || v[6]==0)
 INTERACT("Err PPP", v[5]);
v[8]= ((v[6]/v[7])/v[5])*v[0];//labor costs for this plant
v[9]= v[3]*v[6]/v[10]; //capital costs for this plant
v[4]=v[1]*(v[8]+v[9])/v[6];


v[20] = VS(p->hook,"UnitCostKEN");
v[21]=v[20]*v[1];

v[11]=VL("PricePP",1);
v[12] = V("smoothPPP");
//v[13]=v[11]*v[12]+(1-v[12])*v[4];
v[13]=v[11]*v[12]+(1-v[12])*v[21];
if(t==1)
 v[13]=v[21];
RESULT(v[13] )


Parameter:  IdEF

Contained in:  PP
Used in:  KProductionFlow, InitPP, Init


Variable:  PricePPDoped

Contained in:  PP
Used in:  PriceEN, Init
Using:  GreenPremiumEFType, PricePP

Equation code:

EQUATION("PricePPDoped")
/*
Competitive price of energy producers.
It is based on the standard price reduced in case it uses green capital
*/

v[0] = V("PricePP");
v[1] = VS(p->hook, "EFType");
if(v[1]==0)
 v[3]=v[0]; // it's a brown firm
else
 { // it's a green firm
  v[2] = VS(p->up, "GreenPremium");
  v[3]=v[0]*v[2];
 }
RESULT(v[3])