/*(Tue Jul 14 23:35:43 2026) From World3 ISDC2026 Workshop.mdl - C equations for the model */

#if !defined(_VDFX)
#define _VDFX
#endif
#if !defined(VDFX)
#define VDFX
#endif

#include <map>

#include "/Users/Shared/Vensim/comp/wasm/mdl_wasm.h"

#include "/Users/Shared/Vensim/comp/wasm/VariableInfoStructure.h"

#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif

#pragma warning (disable : 4101) //Turn off warning for unreferenced local variable
#pragma warning (disable : 4005) //Turn off warnings for macro redefinition
#pragma warning (disable : 4305) //Turn off warnings for truncation from 'double' to 'REAL'

#define setpos(a) VGV->lastpos = a 
#define setposF(a) VGV->lastpos = a 

#if !defined(WASM)
#define WASM
#endif 
#if !defined(_WASM)
#define _WASM
#endif 

typedef unsigned char charutf8;
#define __GLOB_VARS WASM_GLOB_VARS

//Function prototypes.
static void vec_arglist_init(__GLOB_VARS* VGV);

#define NUM_VARS 337
#define NUM_LEVELS 42
#define NUM_DELAYS 0
#define NUM_AUX 295
#define NUM_LOOKUPS 72
#define NUM_STRINGS 1



#define NUM_FILES 0

charutf8* Get_FileName(long nIndex)
{
return (charutf8*)"";
}


#define NUM_DATA_FILES 0

charutf8* Get_DataFileName(long nIndex)
{
return (charutf8*)"";
}

extern "C" bool bUseExternalFileForStrings = true;
std::map<unsigned long, VariableInfoStructure> varInfo;
std::map<unsigned long, VariableInfoStructure> *pVarInfo = &varInfo;

COMPREAL* pInitVector = NULL;
size_t nInitVectorSize = 2696;

typedef struct pair_long_int { long nVarIndex; int nFuncType; }pair_long_int;pair_long_int structFuncIndexData[] = { 
{-1, -1}};
charutf8 *strLookupNames[NUM_LOOKUPS] = { 
(charutf8*)"assimilation half life mult table" 	/*0*/
, (charutf8*)"average life of agricultural inputs scenario table" 	/*1*/
, (charutf8*)"average life of industrial capital scenario table" 	/*2*/
, (charutf8*)"average life of service capital scenario table" 	/*3*/
, (charutf8*)"capacity utilization fraction table" 	/*4*/
, (charutf8*)"completed multiplier from perceived lifetime table" 	/*5*/
, (charutf8*)"crowding multiplier from industry table" 	/*6*/
, (charutf8*)"development cost per hectare table" 	/*7*/
, (charutf8*)"Education Index LOOKUP" 	/*8*/
, (charutf8*)"family response to social norm table" 	/*9*/
, (charutf8*)"fecundity multiplier table" 	/*10*/
, (charutf8*)"fertility control effectiveness table" 	/*11*/
, (charutf8*)"fertility control effectiveness time scenario table" 	/*12*/
, (charutf8*)"fraction industrial output allocated to agriculture table 1" 	/*13*/
, (charutf8*)"fraction industrial output allocated to agriculture table 2" 	/*14*/
, (charutf8*)"fraction of agricultural inputs allocated to land development table" 	/*15*/
, (charutf8*)"fraction of agricultural inputs for land maintenance table" 	/*16*/
, (charutf8*)"fraction of capital allocated to obtaining resources 1 table" 	/*17*/
, (charutf8*)"fraction of capital allocated to obtaining resources 2 table" 	/*18*/
, (charutf8*)"fraction of industrial capital allocated to obtaining resources switch time scenario table" 	/*19*/
, (charutf8*)"fraction of industrial output allocated to consumption variable table" 	/*20*/
, (charutf8*)"fraction of industrial output allocated to services table 1" 	/*21*/
, (charutf8*)"fraction of industrial output allocated to services table 2" 	/*22*/
, (charutf8*)"fraction of population urban table" 	/*23*/
, (charutf8*)"fraction services allocated to fertility control table" 	/*24*/
, (charutf8*)"GDP per capita LOOKUP" 	/*25*/
, (charutf8*)"health services per capita table" 	/*26*/
, (charutf8*)"indicated food per capita table 1" 	/*27*/
, (charutf8*)"indicated food per capita table 2" 	/*28*/
, (charutf8*)"indicated services output per capita table 1" 	/*29*/
, (charutf8*)"indicated services output per capita table 2" 	/*30*/
, (charutf8*)"industrial capital output ratio multiplier from pollution table" 	/*31*/
, (charutf8*)"industrial capital output ratio multiplier from resource table" 	/*32*/
, (charutf8*)"industrial capital output ratio multiplier table" 	/*33*/
, (charutf8*)"industrial equilibrium time scenario table" 	/*34*/
, (charutf8*)"industrial output per capita desired scenario table" 	/*35*/
, (charutf8*)"initial nonrenewable resources scenario table" 	/*36*/
, (charutf8*)"jobs per hectare table" 	/*37*/
, (charutf8*)"jobs per industrial capital unit table" 	/*38*/
, (charutf8*)"jobs per service capital unit table" 	/*39*/
, (charutf8*)"land fertility degredation rate table" 	/*40*/
, (charutf8*)"land fertility regeneration time table" 	/*41*/
, (charutf8*)"land life multiplier from land yield table 1" 	/*42*/
, (charutf8*)"land life multiplier from land yield table 2" 	/*43*/
, (charutf8*)"land life policy time scenario table" 	/*44*/
, (charutf8*)"land yield multipler from air pollution table 1" 	/*45*/
, (charutf8*)"land yield multipler from air pollution table 2" 	/*46*/
, (charutf8*)"land yield multiplier from capital table" 	/*47*/
, (charutf8*)"land yield policy time scenario table" 	/*48*/
, (charutf8*)"land yield technology change rate multiplier table 1" 	/*49*/
, (charutf8*)"land yield technology change rate multiplier table 2" 	/*50*/
, (charutf8*)"Life Expectancy Index LOOKUP" 	/*51*/
, (charutf8*)"lifetime multiplier from food table" 	/*52*/
, (charutf8*)"lifetime multiplier from health services 1 table" 	/*53*/
, (charutf8*)"lifetime multiplier from health services 2 table" 	/*54*/
, (charutf8*)"lifetime multiplier from persistent pollution table" 	/*55*/
, (charutf8*)"marginal land yield multiplier from capital table" 	/*56*/
, (charutf8*)"mortality 0 to 14 table" 	/*57*/
, (charutf8*)"mortality 15 to 44 table" 	/*58*/
, (charutf8*)"mortality 45 to 64 table" 	/*59*/
, (charutf8*)"mortality 65 plus table" 	/*60*/
, (charutf8*)"per capita resource use mult table" 	/*61*/
, (charutf8*)"persistent pollution technology change mult table 1" 	/*62*/
, (charutf8*)"persistent pollution technology change mult table 2" 	/*63*/
, (charutf8*)"persistent pollution technology change scenario table" 	/*64*/
, (charutf8*)"POLICY YEAR scenario table" 	/*65*/
, (charutf8*)"resource technology change table 1" 	/*66*/
, (charutf8*)"resource technology change table 2" 	/*67*/
, (charutf8*)"resource technology change time scenario table" 	/*68*/
, (charutf8*)"social family size normal table" 	/*69*/
, (charutf8*)"urban and industrial land required per capita table" 	/*70*/
, (charutf8*)"zero population growth time scenario table" 	/*71*/
};


charutf8 *strStringNames[NUM_STRINGS] = { 
(charutf8*)"help link" 	/*0*/
};

COMPREAL temp0 ; 
COMPREAL temp1 ; 
COMPREAL temp2 ; 
COMPREAL temp3 ; 
COMPREAL temp4 ; 
COMPREAL temp5 ; 
COMPREAL temp6 ; 
COMPREAL temp7 ; 
COMPREAL temp8 ; 
COMPREAL temp9 ; 
COMPREAL temp10 ; 
COMPREAL temp11 ; 
COMPREAL temp12 ; 
COMPREAL temp13 ; 
COMPREAL temp14 ; 
COMPREAL temp15 ; 
COMPREAL temp16 ; 
COMPREAL temp17 ; 
COMPREAL temp18 ; 
COMPREAL temp19 ; 
COMPREAL temp20 ; 
COMPREAL temp21 ; 
COMPREAL temp22 ; 
COMPREAL temp23 ; 
COMPREAL temp24 ; 
COMPREAL temp25 ; 
COMPREAL temp26 ; 
COMPREAL temp27 ; 
COMPREAL temp28 ; 
COMPREAL temp29 ; 
COMPREAL temp30 ; 
COMPREAL temp31 ; 
COMPREAL temp32 ; 
COMPREAL temp33 ; 
COMPREAL temp34 ; 
COMPREAL temp35 ; 
COMPREAL temp36 ; 
COMPREAL temp37 ; 
COMPREAL temp38 ; 
COMPREAL temp39 ; 
COMPREAL temp40 ; 
COMPREAL temp41 ; 
COMPREAL temp42 ; 
COMPREAL temp43 ; 
COMPREAL temp44 ; 
COMPREAL temp45 ; 
COMPREAL temp46 ; 
COMPREAL temp47 ; 
COMPREAL temp48 ; 
COMPREAL temp49 ; 
COMPREAL temp50 ; 
COMPREAL temp51 ; 
COMPREAL temp52 ; 
COMPREAL temp53 ; 
COMPREAL temp54 ; 
COMPREAL temp55 ; 
COMPREAL temp56 ; 
COMPREAL temp57 ; 
COMPREAL temp58 ; 
COMPREAL temp59 ; 
COMPREAL temp60 ; 
COMPREAL temp61 ; 
COMPREAL temp62 ; 
COMPREAL temp63 ; 
COMPREAL temp64 ; 
COMPREAL temp65 ; 
COMPREAL temp66 ; 
COMPREAL temp67 ; 
COMPREAL temp68 ; 
COMPREAL temp69 ; 
COMPREAL temp70 ; 
COMPREAL temp71 ; 
COMPREAL temp72 ; 
COMPREAL temp73 ; 
COMPREAL temp74 ; 
COMPREAL temp75 ; 
COMPREAL temp76 ; 
COMPREAL temp77 ; 
COMPREAL temp78 ; 
COMPREAL temp79 ; 
COMPREAL temp80 ; 
COMPREAL temp81 ; 
COMPREAL temp82 ; 
COMPREAL temp83 ; 
COMPREAL temp84 ; 
COMPREAL temp85 ; 
COMPREAL temp86 ; 
COMPREAL temp87 ; 
COMPREAL temp88 ; 
COMPREAL temp89 ; 
COMPREAL temp90 ; 
COMPREAL temp91 ; 
COMPREAL temp92 ; 
COMPREAL temp93 ; 
COMPREAL temp94 ; 
COMPREAL temp95 ; 
COMPREAL temp96 ; 
COMPREAL temp97 ; 
COMPREAL temp98 ; 
COMPREAL temp99 ; 
COMPREAL temp100 ; 
COMPREAL temp101 ; 
COMPREAL temp102 ; 
COMPREAL temp103 ; 
COMPREAL temp104 ; 
COMPREAL temp105 ; 
COMPREAL temp106 ; 
COMPREAL temp107 ; 
COMPREAL temp108 ; 
COMPREAL temp109 ; 
COMPREAL temp110 ; 
COMPREAL temp111 ; 
COMPREAL temp112 ; 
COMPREAL temp113 ; 
COMPREAL temp114 ; 
COMPREAL temp115 ; 
COMPREAL temp116 ; 
COMPREAL temp117 ; 
COMPREAL temp118 ; 
COMPREAL temp119 ; 
COMPREAL temp120 ; 
COMPREAL temp121 ; 
COMPREAL temp122 ; 
COMPREAL temp123 ; 
COMPREAL temp124 ; 
COMPREAL temp125 ; 
COMPREAL temp126 ; 
COMPREAL temp127 ; 
COMPREAL temp128 ; 
COMPREAL temp129 ; 
COMPREAL temp130 ; 
COMPREAL temp131 ; 

int sumind0 ; 
int forind0 ; 

int sumind1 ; 
int forind1 ; 

int sumind2 ; 
int forind2 ; 

int sumind3 ; 
int forind3 ; 

int sumind4 ; 
int forind4 ; 

int sumind5 ; 
int forind5 ; 

int sumind6 ; 
int forind6 ; 

int sumind7 ; 
int forind7 ; 

int simultid ; 
void InitConstants()
{
	if (nInitVectorSize == 0)
	{
		printf("Error initializing constants. Initial vector size is zero.\n");
		return;
	}
	if (pInitVector == NULL)
	{
		printf("Error initializing constants. Initial vector is NULL.\n");
		return;
	}
	memmove(VGV->LEVEL, pInitVector, nInitVectorSize);
	printf("Initial vector set.\n");
{
	// assimilation half life mult table
	REAL fxVals[5] = { 1, 251, 501, 751, 1001};
	REAL fyVals[5] = { 1, 11, 21, 31, 41};
	SetLookup(0, (charutf8*)"assimilation half life mult table", 5, fxVals, fyVals);
}
{
	// average life of agricultural inputs scenario table
	REAL fxVals[2] = { 7, 8};
	REAL fyVals[2] = { 2, 2.5};
	SetLookup(1, (charutf8*)"average life of agricultural inputs scenario table", 2, fxVals, fyVals);
}
{
	// average life of industrial capital scenario table
	REAL fxVals[2] = { 7, 8};
	REAL fyVals[2] = { 14, 18};
	SetLookup(2, (charutf8*)"average life of industrial capital scenario table", 2, fxVals, fyVals);
}
{
	// average life of service capital scenario table
	REAL fxVals[2] = { 7, 8};
	REAL fyVals[2] = { 20, 25};
	SetLookup(3, (charutf8*)"average life of service capital scenario table", 2, fxVals, fyVals);
}
{
	// capacity utilization fraction table
	REAL fxVals[6] = { 1, 3, 5, 7, 9, 11};
	REAL fyVals[6] = { 1, 0.9, 0.7, 0.3, 0.1, 0.1};
	SetLookup(4, (charutf8*)"capacity utilization fraction table", 6, fxVals, fyVals);
}
{
	// completed multiplier from perceived lifetime table
	REAL fxVals[9] = { 0, 10, 20, 30, 40, 50, 60, 70, 80};
	REAL fyVals[9] = { 3, 2.1, 1.6, 1.4, 1.3, 1.2, 1.1, 1.05, 1};
	SetLookup(5, (charutf8*)"completed multiplier from perceived lifetime table", 9, fxVals, fyVals);
}
{
	// crowding multiplier from industry table
	REAL fxVals[9] = { 0, 200, 400, 600, 800, 1000, 1200, 1400, 1600};
	REAL fyVals[9] = { 0.5, 0.05, -0.1, -0.08, -0.02, 0.05, 0.1, 0.15, 0.2};
	SetLookup(6, (charutf8*)"crowding multiplier from industry table", 9, fxVals, fyVals);
}
{
	// development cost per hectare table
	REAL fxVals[11] = { 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1};
	REAL fyVals[11] = { 100000, 7400, 5200, 3500, 2400, 1500, 750, 300, 150, 75, 50};
	SetLookup(7, (charutf8*)"development cost per hectare table", 11, fxVals, fyVals);
}
{
	// Education Index LOOKUP
	REAL fxVals[8] = { 0, 1000, 2000, 2100, 3000, 5000, 6000, 7000};
	REAL fyVals[8] = { 0, 0.81, 0.88, 0.95, 0.92, 0.98, 0.99, 1};
	SetLookup(8, (charutf8*)"Education Index LOOKUP", 8, fxVals, fyVals);
}
{
	// family response to social norm table
	REAL fxVals[5] = { -0.2, -0.1, 0, 0.1, 0.2};
	REAL fyVals[5] = { 0.5, 0.6, 0.7, 0.85, 1};
	SetLookup(9, (charutf8*)"family response to social norm table", 5, fxVals, fyVals);
}
{
	// fecundity multiplier table
	REAL fxVals[9] = { 0, 10, 20, 30, 40, 50, 60, 70, 80};
	REAL fyVals[9] = { 0, 0.2, 0.4, 0.6, 0.7, 0.75, 0.79, 0.84, 0.87};
	SetLookup(10, (charutf8*)"fecundity multiplier table", 9, fxVals, fyVals);
}
{
	// fertility control effectiveness table
	REAL fxVals[7] = { 0, 0.5, 1, 1.5, 2, 2.5, 3};
	REAL fyVals[7] = { 0.75, 0.85, 0.9, 0.95, 0.98, 0.99, 1};
	SetLookup(11, (charutf8*)"fertility control effectiveness table", 7, fxVals, fyVals);
}
{
	// fertility control effectiveness time scenario table
	REAL fxVals[5] = { 6, 7, 9, 10, 11};
	REAL fyVals[5] = { 2100, 2002, 2002, 1982, 2012};
	SetLookup(12, (charutf8*)"fertility control effectiveness time scenario table", 5, fxVals, fyVals);
}
{
	// fraction industrial output allocated to agriculture table 1
	REAL fxVals[6] = { 0, 0.5, 1, 1.5, 2, 2.5};
	REAL fyVals[6] = { 0.4, 0.2, 0.1, 0.025, 0, 0};
	SetLookup(13, (charutf8*)"fraction industrial output allocated to agriculture table 1", 6, fxVals, fyVals);
}
{
	// fraction industrial output allocated to agriculture table 2
	REAL fxVals[6] = { 0, 0.5, 1, 1.5, 2, 2.5};
	REAL fyVals[6] = { 0.4, 0.2, 0.1, 0.025, 0, 0};
	SetLookup(14, (charutf8*)"fraction industrial output allocated to agriculture table 2", 6, fxVals, fyVals);
}
{
	// fraction of agricultural inputs allocated to land development table
	REAL fxVals[9] = { 0, 0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2};
	REAL fyVals[9] = { 0, 0.05, 0.15, 0.3, 0.5, 0.7, 0.85, 0.95, 1};
	SetLookup(15, (charutf8*)"fraction of agricultural inputs allocated to land development table", 9, fxVals, fyVals);
}
{
	// fraction of agricultural inputs for land maintenance table
	REAL fxVals[5] = { 0, 1, 2, 3, 4};
	REAL fyVals[5] = { 0, 0.04, 0.07, 0.09, 0.1};
	SetLookup(16, (charutf8*)"fraction of agricultural inputs for land maintenance table", 5, fxVals, fyVals);
}
{
	// fraction of capital allocated to obtaining resources 1 table
	REAL fxVals[11] = { 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1};
	REAL fyVals[11] = { 1, 0.9, 0.7, 0.5, 0.2, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05};
	SetLookup(17, (charutf8*)"fraction of capital allocated to obtaining resources 1 table", 11, fxVals, fyVals);
}
{
	// fraction of capital allocated to obtaining resources 2 table
	REAL fxVals[11] = { 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1};
	REAL fyVals[11] = { 1, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05};
	SetLookup(18, (charutf8*)"fraction of capital allocated to obtaining resources 2 table", 11, fxVals, fyVals);
}
{
	// fraction of industrial capital allocated to obtaining resources switch time scenario table
	REAL fxVals[4] = { 1, 2, 10, 11};
	REAL fyVals[4] = { 2100, 2002, 2002, 2012};
	SetLookup(19, (charutf8*)"fraction of industrial capital allocated to obtaining resources switch time scenario table", 4, fxVals, fyVals);
}
{
	// fraction of industrial output allocated to consumption variable table
	REAL fxVals[11] = { 0, 0.2, 0.4, 0.6, 0.8, 1, 1.2, 1.4, 1.6, 1.8, 2};
	REAL fyVals[11] = { 0.3, 0.32, 0.34, 0.36, 0.38, 0.43, 0.73, 0.77, 0.81, 0.82, 0.83};
	SetLookup(20, (charutf8*)"fraction of industrial output allocated to consumption variable table", 11, fxVals, fyVals);
}
{
	// fraction of industrial output allocated to services table 1
	REAL fxVals[5] = { 0, 0.5, 1, 1.5, 2};
	REAL fyVals[5] = { 0.3, 0.2, 0.1, 0.05, 0};
	SetLookup(21, (charutf8*)"fraction of industrial output allocated to services table 1", 5, fxVals, fyVals);
}
{
	// fraction of industrial output allocated to services table 2
	REAL fxVals[5] = { 0, 0.5, 1, 1.5, 2};
	REAL fyVals[5] = { 0.3, 0.2, 0.1, 0.05, 0};
	SetLookup(22, (charutf8*)"fraction of industrial output allocated to services table 2", 5, fxVals, fyVals);
}
{
	// fraction of population urban table
	REAL fxVals[9] = { 0, 2e+09, 4e+09, 6e+09, 8e+09, 1e+10, 1.2e+10, 1.4e+10, 1.6e+10};
	REAL fyVals[9] = { 0, 0.2, 0.4, 0.5, 0.58, 0.65, 0.72, 0.78, 0.8};
	SetLookup(23, (charutf8*)"fraction of population urban table", 9, fxVals, fyVals);
}
{
	// fraction services allocated to fertility control table
	REAL fxVals[6] = { 0, 2, 4, 6, 8, 10};
	REAL fyVals[6] = { 0, 0.005, 0.015, 0.025, 0.03, 0.035};
	SetLookup(24, (charutf8*)"fraction services allocated to fertility control table", 6, fxVals, fyVals);
}
{
	// GDP per capita LOOKUP
	REAL fxVals[6] = { 0, 200, 400, 600, 800, 1000};
	REAL fyVals[6] = { 120, 600, 1200, 1800, 2500, 3200};
	SetLookup(25, (charutf8*)"GDP per capita LOOKUP", 6, fxVals, fyVals);
}
{
	// health services per capita table
	REAL fxVals[9] = { 0, 250, 500, 750, 1000, 1250, 1500, 1750, 2000};
	REAL fyVals[9] = { 0, 20, 50, 95, 140, 175, 200, 220, 230};
	SetLookup(26, (charutf8*)"health services per capita table", 9, fxVals, fyVals);
}
{
	// indicated food per capita table 1
	REAL fxVals[9] = { 0, 200, 400, 600, 800, 1000, 1200, 1400, 1600};
	REAL fyVals[9] = { 230, 480, 690, 850, 970, 1070, 1150, 1210, 1250};
	SetLookup(27, (charutf8*)"indicated food per capita table 1", 9, fxVals, fyVals);
}
{
	// indicated food per capita table 2
	REAL fxVals[9] = { 0, 200, 400, 600, 800, 1000, 1200, 1400, 1600};
	REAL fyVals[9] = { 230, 480, 690, 850, 970, 1070, 1150, 1210, 1250};
	SetLookup(28, (charutf8*)"indicated food per capita table 2", 9, fxVals, fyVals);
}
{
	// indicated services output per capita table 1
	REAL fxVals[9] = { 0, 200, 400, 600, 800, 1000, 1200, 1400, 1600};
	REAL fyVals[9] = { 40, 300, 640, 1000, 1220, 1450, 1650, 1800, 2000};
	SetLookup(29, (charutf8*)"indicated services output per capita table 1", 9, fxVals, fyVals);
}
{
	// indicated services output per capita table 2
	REAL fxVals[9] = { 0, 200, 400, 600, 800, 1000, 1200, 1400, 1600};
	REAL fyVals[9] = { 40, 300, 640, 1000, 1220, 1450, 1650, 1800, 2000};
	SetLookup(30, (charutf8*)"indicated services output per capita table 2", 9, fxVals, fyVals);
}
{
	// industrial capital output ratio multiplier from pollution table
	REAL fxVals[11] = { 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1};
	REAL fyVals[11] = { 1.25, 1.2, 1.15, 1.11, 1.08, 1.05, 1.03, 1.02, 1.01, 1, 1};
	SetLookup(31, (charutf8*)"industrial capital output ratio multiplier from pollution table", 11, fxVals, fyVals);
}
{
	// industrial capital output ratio multiplier from resource table
	REAL fxVals[11] = { 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1};
	REAL fyVals[11] = { 3.75, 3.6, 3.47, 3.36, 3.25, 3.16, 3.1, 3.06, 3.02, 3.01, 3};
	SetLookup(32, (charutf8*)"industrial capital output ratio multiplier from resource table", 11, fxVals, fyVals);
}
{
	// industrial capital output ratio multiplier table
	REAL fxVals[6] = { 1, 1.2, 1.4, 1.6, 1.8, 2};
	REAL fyVals[6] = { 1, 1.05, 1.12, 1.25, 1.35, 1.5};
	SetLookup(33, (charutf8*)"industrial capital output ratio multiplier table", 6, fxVals, fyVals);
}
{
	// industrial equilibrium time scenario table
	REAL fxVals[5] = { 7, 8, 9, 10, 11};
	REAL fyVals[5] = { 2100, 2002, 2002, 1982, 2012};
	SetLookup(34, (charutf8*)"industrial equilibrium time scenario table", 5, fxVals, fyVals);
}
{
	// industrial output per capita desired scenario table
	REAL fxVals[2] = { 7, 8};
	REAL fyVals[2] = { 400, 350};
	SetLookup(35, (charutf8*)"industrial output per capita desired scenario table", 2, fxVals, fyVals);
}
{
	// initial nonrenewable resources scenario table
	REAL fxVals[2] = { 1, 2};
	REAL fyVals[2] = { 1e+12, 2e+12};
	SetLookup(36, (charutf8*)"initial nonrenewable resources scenario table", 2, fxVals, fyVals);
}
{
	// jobs per hectare table
	REAL fxVals[8] = { 2, 6, 10, 14, 18, 22, 26, 30};
	REAL fyVals[8] = { 2, 0.5, 0.4, 0.3, 0.27, 0.24, 0.2, 0.2};
	SetLookup(37, (charutf8*)"jobs per hectare table", 8, fxVals, fyVals);
}
{
	// jobs per industrial capital unit table
	REAL fxVals[6] = { 50, 200, 350, 500, 650, 800};
	REAL fyVals[6] = { 0.37, 0.18, 0.12, 0.09, 0.07, 0.06};
	SetLookup(38, (charutf8*)"jobs per industrial capital unit table", 6, fxVals, fyVals);
}
{
	// jobs per service capital unit table
	REAL fxVals[6] = { 50, 200, 350, 500, 650, 800};
	REAL fyVals[6] = { 1.1, 0.6, 0.35, 0.2, 0.15, 0.15};
	SetLookup(39, (charutf8*)"jobs per service capital unit table", 6, fxVals, fyVals);
}
{
	// land fertility degredation rate table
	REAL fxVals[4] = { 0, 10, 20, 30};
	REAL fyVals[4] = { 0, 0.1, 0.3, 0.5};
	SetLookup(40, (charutf8*)"land fertility degredation rate table", 4, fxVals, fyVals);
}
{
	// land fertility regeneration time table
	REAL fxVals[6] = { 0, 0.02, 0.04, 0.06, 0.08, 0.1};
	REAL fyVals[6] = { 20, 13, 8, 4, 2, 2};
	SetLookup(41, (charutf8*)"land fertility regeneration time table", 6, fxVals, fyVals);
}
{
	// land life multiplier from land yield table 1
	REAL fxVals[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
	REAL fyVals[10] = { 1.2, 1, 0.63, 0.36, 0.16, 0.055, 0.04, 0.025, 0.015, 0.01};
	SetLookup(42, (charutf8*)"land life multiplier from land yield table 1", 10, fxVals, fyVals);
}
{
	// land life multiplier from land yield table 2
	REAL fxVals[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
	REAL fyVals[10] = { 1.2, 1, 0.63, 0.36, 0.29, 0.26, 0.24, 0.22, 0.21, 0.2};
	SetLookup(43, (charutf8*)"land life multiplier from land yield table 2", 10, fxVals, fyVals);
}
{
	// land life policy time scenario table
	REAL fxVals[8] = { 4, 5, 6, 7, 8, 9, 10, 11};
	REAL fyVals[8] = { 2100, 2002, 2002, 2100, 2100, 2002, 1982, 2012};
	SetLookup(44, (charutf8*)"land life policy time scenario table", 8, fxVals, fyVals);
}
{
	// land yield multipler from air pollution table 1
	REAL fxVals[4] = { 0, 10, 20, 30};
	REAL fyVals[4] = { 1, 1, 0.7, 0.4};
	SetLookup(45, (charutf8*)"land yield multipler from air pollution table 1", 4, fxVals, fyVals);
}
{
	// land yield multipler from air pollution table 2
	REAL fxVals[4] = { 0, 10, 20, 30};
	REAL fyVals[4] = { 1, 1, 0.98, 0.95};
	SetLookup(46, (charutf8*)"land yield multipler from air pollution table 2", 4, fxVals, fyVals);
}
{
	// land yield multiplier from capital table
	REAL fxVals[26] = { 0, 40, 80, 120, 160, 200, 240, 280, 320, 360, 400, 440, 480, 520, 560, 600, 
		640, 680, 720, 760, 800, 840, 880, 920, 960, 1000};
	REAL fyVals[26] = { 1, 3, 4.5, 5, 5.3, 5.6, 5.9, 6.1, 6.35, 6.6, 6.9, 7.2, 7.4, 7.6, 7.8, 8, 
		8.2, 8.4, 8.6, 8.8, 9, 9.2, 9.4, 9.6, 9.8, 10};
	SetLookup(47, (charutf8*)"land yield multiplier from capital table", 26, fxVals, fyVals);
}
{
	// land yield policy time scenario table
	REAL fxVals[8] = { 3, 4, 6, 7, 8, 9, 10, 11};
	REAL fyVals[8] = { 2100, 2002, 2002, 2100, 2100, 2002, 1982, 2012};
	SetLookup(48, (charutf8*)"land yield policy time scenario table", 8, fxVals, fyVals);
}
{
	// land yield technology change rate multiplier table 1
	REAL fxVals[2] = { 0, 1};
	REAL fyVals[2] = { 0, 0};
	SetLookup(49, (charutf8*)"land yield technology change rate multiplier table 1", 2, fxVals, fyVals);
}
{
	// land yield technology change rate multiplier table 2
	REAL fxVals[2] = { 0, 1};
	REAL fyVals[2] = { 0, 0.04};
	SetLookup(50, (charutf8*)"land yield technology change rate multiplier table 2", 2, fxVals, fyVals);
}
{
	// Life Expectancy Index LOOKUP
	REAL fxVals[7] = { 25, 35, 45, 55, 65, 75, 85};
	REAL fyVals[7] = { 0, 0.16, 0.33, 0.5, 0.67, 0.84, 1};
	SetLookup(51, (charutf8*)"Life Expectancy Index LOOKUP", 7, fxVals, fyVals);
}
{
	// lifetime multiplier from food table
	REAL fxVals[6] = { 0, 1, 2, 3, 4, 5};
	REAL fyVals[6] = { 0, 1, 1.43, 1.5, 1.5, 1.5};
	SetLookup(52, (charutf8*)"lifetime multiplier from food table", 6, fxVals, fyVals);
}
{
	// lifetime multiplier from health services 1 table
	REAL fxVals[6] = { 0, 20, 40, 60, 80, 100};
	REAL fyVals[6] = { 1, 1.1, 1.4, 1.6, 1.7, 1.8};
	SetLookup(53, (charutf8*)"lifetime multiplier from health services 1 table", 6, fxVals, fyVals);
}
{
	// lifetime multiplier from health services 2 table
	REAL fxVals[6] = { 0, 20, 40, 60, 80, 100};
	REAL fyVals[6] = { 1, 1.5, 1.9, 2, 2, 2};
	SetLookup(54, (charutf8*)"lifetime multiplier from health services 2 table", 6, fxVals, fyVals);
}
{
	// lifetime multiplier from persistent pollution table
	REAL fxVals[11] = { 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100};
	REAL fyVals[11] = { 1, 0.99, 0.97, 0.95, 0.9, 0.85, 0.75, 0.65, 0.55, 0.4, 0.2};
	SetLookup(55, (charutf8*)"lifetime multiplier from persistent pollution table", 11, fxVals, fyVals);
}
{
	// marginal land yield multiplier from capital table
	REAL fxVals[16] = { 0, 40, 80, 120, 160, 200, 240, 280, 320, 360, 400, 440, 480, 520, 560, 600};
	REAL fyVals[16] = { 0.075, 0.03, 0.015, 0.011, 0.009, 0.008, 0.007, 0.006, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005, 0.005};
	SetLookup(56, (charutf8*)"marginal land yield multiplier from capital table", 16, fxVals, fyVals);
}
{
	// mortality 0 to 14 table
	REAL fxVals[7] = { 20, 30, 40, 50, 60, 70, 80};
	REAL fyVals[7] = { 0.0567, 0.0366, 0.0243, 0.0155, 0.0082, 0.0023, 0.001};
	SetLookup(57, (charutf8*)"mortality 0 to 14 table", 7, fxVals, fyVals);
}
{
	// mortality 15 to 44 table
	REAL fxVals[7] = { 20, 30, 40, 50, 60, 70, 80};
	REAL fyVals[7] = { 0.0266, 0.0171, 0.011, 0.0065, 0.004, 0.0016, 0.0008};
	SetLookup(58, (charutf8*)"mortality 15 to 44 table", 7, fxVals, fyVals);
}
{
	// mortality 45 to 64 table
	REAL fxVals[7] = { 20, 30, 40, 50, 60, 70, 80};
	REAL fyVals[7] = { 0.0562, 0.0373, 0.0252, 0.0171, 0.0118, 0.0083, 0.006};
	SetLookup(59, (charutf8*)"mortality 45 to 64 table", 7, fxVals, fyVals);
}
{
	// mortality 65 plus table
	REAL fxVals[7] = { 20, 30, 40, 50, 60, 70, 80};
	REAL fyVals[7] = { 0.13, 0.11, 0.09, 0.07, 0.06, 0.05, 0.04};
	SetLookup(60, (charutf8*)"mortality 65 plus table", 7, fxVals, fyVals);
}
{
	// per capita resource use mult table
	REAL fxVals[9] = { 0, 200, 400, 600, 800, 1000, 1200, 1400, 1600};
	REAL fyVals[9] = { 0, 0.85, 2.6, 3.4, 3.8, 4.1, 4.4, 4.7, 5};
	SetLookup(61, (charutf8*)"per capita resource use mult table", 9, fxVals, fyVals);
}
{
	// persistent pollution technology change mult table 1
	REAL fxVals[2] = { -1, 0};
	REAL fyVals[2] = { 0, 0};
	SetLookup(62, (charutf8*)"persistent pollution technology change mult table 1", 2, fxVals, fyVals);
}
{
	// persistent pollution technology change mult table 2
	REAL fxVals[2] = { -1, 0};
	REAL fyVals[2] = { -0.04, 0};
	SetLookup(63, (charutf8*)"persistent pollution technology change mult table 2", 2, fxVals, fyVals);
}
{
	// persistent pollution technology change scenario table
	REAL fxVals[8] = { 2, 3, 6, 7, 8, 9, 10, 11};
	REAL fyVals[8] = { 2100, 2002, 2002, 2100, 2100, 2002, 1982, 2012};
	SetLookup(64, (charutf8*)"persistent pollution technology change scenario table", 8, fxVals, fyVals);
}
{
	// POLICY YEAR scenario table
	REAL fxVals[9] = { 0, 1, 2, 3, 6, 7, 8, 9, 10};
	REAL fyVals[9] = { 2100, 2100, 2100, 2002, 2002, 2100, 2002, 2002, 1982};
	SetLookup(65, (charutf8*)"POLICY YEAR scenario table", 9, fxVals, fyVals);
}
{
	// resource technology change table 1
	REAL fxVals[2] = { -1, 0};
	REAL fyVals[2] = { 0, 0};
	SetLookup(66, (charutf8*)"resource technology change table 1", 2, fxVals, fyVals);
}
{
	// resource technology change table 2
	REAL fxVals[2] = { -1, 0};
	REAL fyVals[2] = { -0.04, 0};
	SetLookup(67, (charutf8*)"resource technology change table 2", 2, fxVals, fyVals);
}
{
	// resource technology change time scenario table
	REAL fxVals[7] = { 4, 6, 7, 8, 9, 10, 11};
	REAL fyVals[7] = { 2100, 2002, 2100, 2100, 2002, 1982, 2012};
	SetLookup(68, (charutf8*)"resource technology change time scenario table", 7, fxVals, fyVals);
}
{
	// social family size normal table
	REAL fxVals[5] = { 0, 200, 400, 600, 800};
	REAL fyVals[5] = { 1.25, 0.94, 0.715, 0.59, 0.5};
	SetLookup(69, (charutf8*)"social family size normal table", 5, fxVals, fyVals);
}
{
	// urban and industrial land required per capita table
	REAL fxVals[9] = { 0, 200, 400, 600, 800, 1000, 1200, 1400, 1600};
	REAL fyVals[9] = { 0.005, 0.008, 0.015, 0.025, 0.04, 0.055, 0.07, 0.08, 0.09};
	SetLookup(70, (charutf8*)"urban and industrial land required per capita table", 9, fxVals, fyVals);
}
{
	// zero population growth time scenario table
	REAL fxVals[5] = { 6, 7, 9, 10, 11};
	REAL fyVals[5] = { 2100, 2002, 2002, 1982, 2012};
	SetLookup(71, (charutf8*)"zero population growth time scenario table", 5, fxVals, fyVals);
}
SetStringVar(0, (charutf8*)"help link", (charutf8*)"https://www.vensim.com/documentation/sample_models.html");
}

long Get_NUM_VARS() { return NUM_VARS; }
long Get_NUM_LEVELS() { return NUM_LEVELS; }
long Get_NUM_DELAYS() { return NUM_DELAYS; }
long Get_NUM_AUX() { return NUM_AUX; }
long Get_NUM_LOOKUPS() { return NUM_LOOKUPS; }
long Get_NUM_STRINGS() { return NUM_STRINGS; }
long Get_NUM_DATA_FILES() { return NUM_DATA_FILES; }
long Get_NUM_FILES() { return NUM_FILES; }
int Get_VarType(long nIndex) {
	if ( pVarInfo == NULL )
		return 0;
	auto it = pVarInfo->find(nIndex);
	if (it != pVarInfo->end())
		return it->second.nType;
	return 0;
}
void* Get_VariableInfoStructure(long nIndex)
{
if (pVarInfo == NULL)
	return 0;
auto it = pVarInfo->find(nIndex);

if (it != pVarInfo->end())
	return (void*)&(it->second);
return 0;
}

int Get_VarSaveType(long nIndex) {
	if ( pVarInfo == NULL )
		return 0;
	auto it = pVarInfo->find(nIndex);
	if (it != pVarInfo->end())
		return it->second.nSaveType;
	return 0;
}
unsigned short Get_VarBitSwitch(long nIndex) {
	if ( pVarInfo == NULL )
		return 0;
	auto it = pVarInfo->find(nIndex);
	if (it != pVarInfo->end())
		return it->second.nBitSwitch;
	return 0;
}
charutf8 *Get_VarName(long nIndex){
	if ( pVarInfo == NULL )
		return NULL;
	auto it = pVarInfo->find(nIndex);
	if (it != pVarInfo->end())
		return (charutf8*)it->second.strVariableName.c_str();
	return NULL;
}
charutf8* Get_LookupName(long nIndex)
{
	if (nIndex >= 0 && nIndex < NUM_LOOKUPS)
	{
		return strLookupNames[nIndex];
	}
	return NULL;
}
int Get_VarFuncIndex(long nIndex)
{
	long nCount = 0;
	while (structFuncIndexData[nCount].nVarIndex != -1)
	{
		if (nIndex == structFuncIndexData[nCount].nVarIndex)
			return structFuncIndexData[nCount].nFuncType;
		else if (structFuncIndexData[nCount].nVarIndex > nIndex)
			return -1;
		nCount++;
	}
	return -1;
}
void SetupDIMS(){
CreateDIMS(1);
SetDIM_INFO(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1);
};
#include <math.h>
#include <float.h>
#include <fenv.h>
#pragma STDC FENV_ACCESS ON
#ifndef LINKEXTERN
#endif
unsigned char *mdl_desc()
{
return((charutf8*)"(Tue Jul 14 23:35:43 2026) From World3 ISDC2026 Workshop.mdl") ;
}



/* compute the model rates comp_rate */
void mdl_func0(__GLOB_VARS *VGV)
{double temp[10];
  double x ;
VGV->RATE[0] = 1.0 ;/* this is time */
/* #Agricultural Inputs>SMOOTH# */
 {
  setpos( 1) ;
  x = 
  VGV->RATE[1] = (VGV->LEVEL[86]-VGV->LEVEL[1])/VGV->LEVEL[62] ;
} /* #Agricultural Inputs>SMOOTH# */

/* #average industrial output per capita>SMOOTH# */
 {
  setpos( 2) ;
  x = 
  VGV->RATE[2] = (VGV->LEVEL[177]-VGV->LEVEL[2])/VGV->LEVEL[155] ;
} /* #average industrial output per capita>SMOOTH# */

/* #delayed industrial output per capita>SMOOTH3# */
 {
  setpos( 3) ;
  x = 
  VGV->RATE[3] = (VGV->LEVEL[5]-VGV->LEVEL[3])/VGV->LEVEL[42] ;
} /* #delayed industrial output per capita>SMOOTH3# */

/* #delayed industrial output per capita>SMOOTH3>LV1# */
 {
  setpos( 4) ;
  x = 
  VGV->RATE[4] = (VGV->LEVEL[177]-VGV->LEVEL[4])/VGV->LEVEL[42] ;
} /* #delayed industrial output per capita>SMOOTH3>LV1# */

/* #delayed industrial output per capita>SMOOTH3>LV2# */
 {
  setpos( 5) ;
  x = 
  VGV->RATE[5] = (VGV->LEVEL[4]-VGV->LEVEL[5])/VGV->LEVEL[42] ;
} /* #delayed industrial output per capita>SMOOTH3>LV2# */

/* #Delayed Labor Utilization Fraction>SMOOTHI# */
 {
  setpos( 6) ;
  x = 
  VGV->RATE[6] = (VGV->LEVEL[204]-VGV->LEVEL[6])/VGV->LEVEL[205] ;
} /* #Delayed Labor Utilization Fraction>SMOOTHI# */

/* #effective health services per capita>SMOOTH# */
 {
  setpos( 7) ;
  x = 
  VGV->RATE[7] = (VGV->LEVEL[152]-VGV->LEVEL[7])/VGV->LEVEL[151] ;
} /* #effective health services per capita>SMOOTH# */

/* #fertility control facilities per capita>SMOOTH3# */
 {
  setpos( 8) ;
  x = 
  VGV->RATE[8] = (VGV->LEVEL[10]-VGV->LEVEL[8])/VGV->LEVEL[43] ;
} /* #fertility control facilities per capita>SMOOTH3# */

/* #fertility control facilities per capita>SMOOTH3>LV1# */
 {
  setpos( 9) ;
  x = 
  VGV->RATE[9] = (VGV->LEVEL[107]-VGV->LEVEL[9])/VGV->LEVEL[43] ;
} /* #fertility control facilities per capita>SMOOTH3>LV1# */

/* #fertility control facilities per capita>SMOOTH3>LV2# */
 {
  setpos( 10) ;
  x = 
  VGV->RATE[10] = (VGV->LEVEL[9]-VGV->LEVEL[10])/VGV->LEVEL[43] ;
} /* #fertility control facilities per capita>SMOOTH3>LV2# */

/* #land yield factor 2>SMOOTH3# */
 {
  setpos( 11) ;
  x = 
  VGV->RATE[11] = (VGV->LEVEL[13]-VGV->LEVEL[11])/VGV->LEVEL[44] ;
} /* #land yield factor 2>SMOOTH3# */

/* #land yield factor 2>SMOOTH3>LV1# */
 {
  setpos( 12) ;
  x = 
  VGV->RATE[12] = (VGV->LEVEL[30]-VGV->LEVEL[12])/VGV->LEVEL[44] ;
} /* #land yield factor 2>SMOOTH3>LV1# */

/* #land yield factor 2>SMOOTH3>LV2# */
 {
  setpos( 13) ;
  x = 
  VGV->RATE[13] = (VGV->LEVEL[12]-VGV->LEVEL[13])/VGV->LEVEL[44] ;
} /* #land yield factor 2>SMOOTH3>LV2# */

/* #Perceived Food Ratio>SMOOTH# */
 {
  setpos( 14) ;
  x = 
  VGV->RATE[14] = (VGV->LEVEL[116]-VGV->LEVEL[14])/VGV->LEVEL[117] ;
} /* #Perceived Food Ratio>SMOOTH# */

/* #perceived life expectancy>SMOOTH3# */
 {
  setpos( 15) ;
  x = 
  VGV->RATE[15] = (VGV->LEVEL[17]-VGV->LEVEL[15])/VGV->LEVEL[45] ;
} /* #perceived life expectancy>SMOOTH3# */

/* #perceived life expectancy>SMOOTH3>LV1# */
 {
  setpos( 16) ;
  x = 
  VGV->RATE[16] = (VGV->LEVEL[236]-VGV->LEVEL[16])/VGV->LEVEL[45] ;
} /* #perceived life expectancy>SMOOTH3>LV1# */

/* #perceived life expectancy>SMOOTH3>LV2# */
 {
  setpos( 17) ;
  x = 
  VGV->RATE[17] = (VGV->LEVEL[16]-VGV->LEVEL[17])/VGV->LEVEL[45] ;
} /* #perceived life expectancy>SMOOTH3>LV2# */

/* #persistent pollution appearance rate>DELAY3>LV1# */
 {
  setpos( 18) ;
  x = 
  VGV->RATE[18] = VGV->LEVEL[270]-VGV->LEVEL[48] ;
} /* #persistent pollution appearance rate>DELAY3>LV1# */

/* #persistent pollution appearance rate>DELAY3>LV2# */
 {
  setpos( 19) ;
  x = 
  VGV->RATE[19] = VGV->LEVEL[48]-VGV->LEVEL[49] ;
} /* #persistent pollution appearance rate>DELAY3>LV2# */

/* #persistent pollution appearance rate>DELAY3>LV3# */
 {
  setpos( 20) ;
  x = 
  VGV->RATE[20] = VGV->LEVEL[49]-VGV->LEVEL[46] ;
} /* #persistent pollution appearance rate>DELAY3>LV3# */

/* #persistent pollution generation factor 2>SMOOTH3# */
 {
  setpos( 21) ;
  x = 
  VGV->RATE[21] = (VGV->LEVEL[23]-VGV->LEVEL[21])/VGV->LEVEL[50] ;
} /* #persistent pollution generation factor 2>SMOOTH3# */

/* #persistent pollution generation factor 2>SMOOTH3>LV1# */
 {
  setpos( 22) ;
  x = 
  VGV->RATE[22] = (VGV->LEVEL[33]-VGV->LEVEL[22])/VGV->LEVEL[50] ;
} /* #persistent pollution generation factor 2>SMOOTH3>LV1# */

/* #persistent pollution generation factor 2>SMOOTH3>LV2# */
 {
  setpos( 23) ;
  x = 
  VGV->RATE[23] = (VGV->LEVEL[22]-VGV->LEVEL[23])/VGV->LEVEL[50] ;
} /* #persistent pollution generation factor 2>SMOOTH3>LV2# */

/* #resource use fact 2>SMOOTH3# */
 {
  setpos( 24) ;
  x = 
  VGV->RATE[24] = (VGV->LEVEL[26]-VGV->LEVEL[24])/VGV->LEVEL[51] ;
} /* #resource use fact 2>SMOOTH3# */

/* #resource use fact 2>SMOOTH3>LV1# */
 {
  setpos( 25) ;
  x = 
  VGV->RATE[25] = (VGV->LEVEL[39]-VGV->LEVEL[25])/VGV->LEVEL[51] ;
} /* #resource use fact 2>SMOOTH3>LV1# */

/* #resource use fact 2>SMOOTH3>LV2# */
 {
  setpos( 26) ;
  x = 
  VGV->RATE[26] = (VGV->LEVEL[25]-VGV->LEVEL[26])/VGV->LEVEL[51] ;
} /* #resource use fact 2>SMOOTH3>LV2# */

/* Arable Land */
 {
  setpos( 27) ;
  x = 
  VGV->RATE[27] = VGV->LEVEL[206]-VGV->LEVEL[207]-VGV->LEVEL[220] ;
} /* Arable Land */

/* Industrial Capital */
 {
  setpos( 28) ;
  x = 
  VGV->RATE[28] = (VGV->LEVEL[164]-VGV->LEVEL[163]) ;
} /* Industrial Capital */

/* Land Fertility */
 {
  setpos( 29) ;
  x = 
  VGV->RATE[29] = (VGV->LEVEL[210]-VGV->LEVEL[208]) ;
} /* Land Fertility */

/* Land Yield Technology */
 {
  setpos( 30) ;
  x = 
  VGV->RATE[30] = VGV->LEVEL[232] ;
} /* Land Yield Technology */

/* Nonrenewable Resources */
 {
  setpos( 31) ;
  x = 
  VGV->RATE[31] = ((-VGV->LEVEL[303])) ;
} /* Nonrenewable Resources */

/* Persistent Pollution */
 {
  setpos( 32) ;
  x = 
  VGV->RATE[32] = (VGV->LEVEL[263]-VGV->LEVEL[264]) ;
} /* Persistent Pollution */

/* Persistent Pollution Technology */
 {
  setpos( 33) ;
  x = 
  VGV->RATE[33] = VGV->LEVEL[277] ;
} /* Persistent Pollution Technology */

/* Population 0 To 14 */
 {
  setpos( 34) ;
  x = 
  VGV->RATE[34] = (VGV->LEVEL[80]-VGV->LEVEL[89]-VGV->LEVEL[249]) ;
} /* Population 0 To 14 */

/* Population 15 To 44 */
 {
  setpos( 35) ;
  x = 
  VGV->RATE[35] = (VGV->LEVEL[249]-VGV->LEVEL[90]-VGV->LEVEL[250]) ;
} /* Population 15 To 44 */

/* Population 45 To 64 */
 {
  setpos( 36) ;
  x = 
  VGV->RATE[36] = (VGV->LEVEL[250]-VGV->LEVEL[91]-VGV->LEVEL[251]) ;
} /* Population 45 To 64 */

/* Population 65 Plus */
 {
  setpos( 37) ;
  x = 
  VGV->RATE[37] = (VGV->LEVEL[251]-VGV->LEVEL[92]) ;
} /* Population 65 Plus */

/* Potentially Arable Land */
 {
  setpos( 38) ;
  x = 
  VGV->RATE[38] = ((-VGV->LEVEL[206])) ;
} /* Potentially Arable Land */

/* Resource Conservation Technology */
 {
  setpos( 39) ;
  x = 
  VGV->RATE[39] = VGV->LEVEL[296] ;
} /* Resource Conservation Technology */

/* Service Capital */
 {
  setpos( 40) ;
  x = 
  VGV->RATE[40] = (VGV->LEVEL[311]-VGV->LEVEL[310]) ;
} /* Service Capital */

/* Urban and Industrial Land */
 {
  setpos( 41) ;
  x = 
  VGV->RATE[41] = (VGV->LEVEL[220]) ;
} /* Urban and Industrial Land */

} /* comp_rate */



/* compute the delays comp_delay */
void mdl_func1(__GLOB_VARS *VGV)
{double temp[10];
} /* comp_delay */



/* initialize time init_time */
void mdl_func2(__GLOB_VARS *VGV)
{ double temp[10]; 
vec_arglist_init(VGV);
  double x ;
VGV->LEVEL[0] = VGV->LEVEL[196] ;
} /* initialize time init_time */



/* initialize time step init_tstep */
void mdl_func3(__GLOB_VARS *VGV)
{double temp[10];
  double x ;
/* a constant no need to do anything */
} /* initialize time step init_tstep */



/* State variable initial value computation comp_init */
void mdl_func4(__GLOB_VARS *VGV)
{double temp[10];
  double x ;
/* current agricultural inputs */
 {
  setpos( 86) ;
  x = 
  VGV->LEVEL[86] = 5000000000.000000 ;
}
/* #Agricultural Inputs>SMOOTH# */
 {
  setpos( 1) ;
  x = 
  VGV->LEVEL[1] = VGV->LEVEL[86] ;
}
/* Industrial Capital */
 {
  setpos( 28) ;
  x = 
  VGV->LEVEL[28] = VGV->LEVEL[183] ;
}
/* Time */
 {
  setpos( 0) ;
  x = 
  VGV->LEVEL[0] = VGV->LEVEL[196] ;
}
/* fraction of industrial capital allocated to obtaining resources switch time s */
 {
  setpos( 125) ;
  x = 
  VGV->LEVEL[125] = IF_THEN_ELSE(VGV->LEVEL[309]==0||VGV->LEVEL[126]==1.000000,VGV->LEVEL[124],TABLE(
&VGV->TAB[19],VGV->LEVEL[309])) ;
}
/* initial nonrenewable resources */
 {
  setpos( 185) ;
  x = 
  VGV->LEVEL[185] = VGV->LEVEL[186]*VGV->LEVEL[327] ;
}
/* initial nonrenewable resources s */
 {
  setpos( 187) ;
  x = 
  VGV->LEVEL[187] = IF_THEN_ELSE(VGV->LEVEL[309]==0||VGV->LEVEL[188]==1.000000,VGV->LEVEL[185],TABLE(
&VGV->TAB[36],VGV->LEVEL[309])) ;
}
/* Nonrenewable Resources */
 {
  setpos( 31) ;
  x = 
  VGV->LEVEL[31] = VGV->LEVEL[187] ;
}
/* fraction of resources remaining */
 {
  setpos( 144) ;
  x = 
  VGV->LEVEL[144] = VGV->LEVEL[31]/VGV->LEVEL[187] ;
}
/* fraction of capital allocated to obtaining resources 2 */
 {
  setpos( 122) ;
  x = 
  VGV->LEVEL[122] = TABLE(&VGV->TAB[18],VGV->LEVEL[144]) ;
}
/* fraction of capital allocated to obtaining resources 1 */
 {
  setpos( 121) ;
  x = 
  VGV->LEVEL[121] = TABLE(&VGV->TAB[17],VGV->LEVEL[144]) ;
}
/* fraction of industrial capital allocated to obtaining resources */
 {
  setpos( 123) ;
  x = 
  VGV->LEVEL[123] = IF_THEN_ELSE(VGV->LEVEL[0]>=VGV->LEVEL[125],VGV->LEVEL[122],VGV->LEVEL[121]) ;
}
/* capacity utilization fraction */
 {
  setpos( 81) ;
  x = 
  VGV->LEVEL[81] = 1.000000 ;
}
/* POLICY YEAR s */
 {
  setpos( 283) ;
  x = 
  VGV->LEVEL[283] = IF_THEN_ELSE(VGV->LEVEL[309]==0||VGV->LEVEL[284]==1.000000,VGV->LEVEL[282],TABLE(
&VGV->TAB[65],VGV->LEVEL[309])) ;
}
/* Resource Conservation Technology */
 {
  setpos( 39) ;
  x = 
  VGV->LEVEL[39] = 1.000000 ;
}
/* #resource use fact 2>SMOOTH3# */
 {
  setpos( 24) ;
  x = 
  VGV->LEVEL[24] = VGV->LEVEL[39] ;
}
/* resource use fact 2 */
 {
  setpos( 304) ;
  x = 
  VGV->LEVEL[304] = VGV->LEVEL[24] ;
}
/* resource use factor */
 {
  setpos( 305) ;
  x = 
  VGV->LEVEL[305] = IF_THEN_ELSE(VGV->LEVEL[0]>=VGV->LEVEL[283],VGV->LEVEL[304],VGV->LEVEL[306]) ;
}
/* industrial capital output ratio multiplier from resource conservation technology */
 {
  setpos( 170) ;
  x = 
  VGV->LEVEL[170] = TABLE(&VGV->TAB[32],VGV->LEVEL[305]) ;
}
/* Land Yield Technology */
 {
  setpos( 30) ;
  x = 
  VGV->LEVEL[30] = 1.000000 ;
}
/* #land yield factor 2>SMOOTH3# */
 {
  setpos( 11) ;
  x = 
  VGV->LEVEL[11] = VGV->LEVEL[30] ;
}
/* land yield factor 2 */
 {
  setpos( 223) ;
  x = 
  VGV->LEVEL[223] = VGV->LEVEL[11] ;
}
/* land yield multiplier from technology */
 {
  setpos( 228) ;
  x = 
  VGV->LEVEL[228] = IF_THEN_ELSE(VGV->LEVEL[0]>=VGV->LEVEL[283],VGV->LEVEL[223],VGV->LEVEL[222]) ;
}
/* industrial capital output ratio multiplier from land yield technology */
 {
  setpos( 168) ;
  x = 
  VGV->LEVEL[168] = TABLE(&VGV->TAB[33],VGV->LEVEL[228]) ;
}
/* Persistent Pollution Technology */
 {
  setpos( 33) ;
  x = 
  VGV->LEVEL[33] = 1.000000 ;
}
/* #persistent pollution generation factor 2>SMOOTH3# */
 {
  setpos( 21) ;
  x = 
  VGV->LEVEL[21] = VGV->LEVEL[33] ;
}
/* persistent pollution generation factor 2 */
 {
  setpos( 268) ;
  x = 
  VGV->LEVEL[268] = VGV->LEVEL[21] ;
}
/* persistent pollution generation factor */
 {
  setpos( 266) ;
  x = 
  VGV->LEVEL[266] = IF_THEN_ELSE(VGV->LEVEL[0]>=VGV->LEVEL[283],VGV->LEVEL[268],VGV->LEVEL[267]) ;
}
/* industrial capital output ratio multiplier from pollution technology */
 {
  setpos( 169) ;
  x = 
  VGV->LEVEL[169] = TABLE(&VGV->TAB[31],VGV->LEVEL[266]) ;
}
/* industrial capital output ratio 2 */
 {
  setpos( 167) ;
  x = 
  VGV->LEVEL[167] = VGV->LEVEL[170]*VGV->LEVEL[168]*VGV->LEVEL[169] ;
}
/* industrial capital output ratio */
 {
  setpos( 165) ;
  x = 
  VGV->LEVEL[165] = IF_THEN_ELSE(VGV->LEVEL[0]>=VGV->LEVEL[283],VGV->LEVEL[167],VGV->LEVEL[166]) ;
}
/* industrial output */
 {
  setpos( 176) ;
  x = 
  VGV->LEVEL[176] = (((VGV->LEVEL[28]))*(1.000000-VGV->LEVEL[123]))*(VGV->LEVEL[81])/VGV->LEVEL[165] ;
}
/* Population 0 To 14 */
 {
  setpos( 34) ;
  x = 
  VGV->LEVEL[34] = VGV->LEVEL[190] ;
}
/* Population 15 To 44 */
 {
  setpos( 35) ;
  x = 
  VGV->LEVEL[35] = VGV->LEVEL[191] ;
}
/* Population 45 To 64 */
 {
  setpos( 36) ;
  x = 
  VGV->LEVEL[36] = VGV->LEVEL[192] ;
}
/* Population 65 Plus */
 {
  setpos( 37) ;
  x = 
  VGV->LEVEL[37] = VGV->LEVEL[193] ;
}
/* population */
 {
  setpos( 285) ;
  x = 
  VGV->LEVEL[285] = VGV->LEVEL[34]+VGV->LEVEL[35]+VGV->LEVEL[36]+VGV->LEVEL[37] ;
}
/* industrial output per capita */
 {
  setpos( 177) ;
  x = 
  VGV->LEVEL[177] = VGV->LEVEL[176]/VGV->LEVEL[285] ;
}
/* #average industrial output per capita>SMOOTH# */
 {
  setpos( 2) ;
  x = 
  VGV->LEVEL[2] = VGV->LEVEL[177] ;
}
/* #delayed industrial output per capita>SMOOTH3# */
 {
  setpos( 3) ;
  x = 
  VGV->LEVEL[3] = VGV->LEVEL[177] ;
}
/* #delayed industrial output per capita>SMOOTH3>LV1# */
 {
  setpos( 4) ;
  x = 
  VGV->LEVEL[4] = VGV->LEVEL[177] ;
}
/* #delayed industrial output per capita>SMOOTH3>LV2# */
 {
  setpos( 5) ;
  x = 
  VGV->LEVEL[5] = VGV->LEVEL[177] ;
}
/* #Delayed Labor Utilization Fraction>SMOOTHI# */
 {
  setpos( 6) ;
  x = 
  VGV->LEVEL[6] = (1.000000) ;
}
/* Service Capital */
 {
  setpos( 40) ;
  x = 
  VGV->LEVEL[40] = VGV->LEVEL[195] ;
}
/* service capital output ratio */
 {
  setpos( 312) ;
  x = 
  VGV->LEVEL[312] = IF_THEN_ELSE(VGV->LEVEL[0]>=VGV->LEVEL[283],VGV->LEVEL[314],VGV->LEVEL[313]) ;
}
/* service output */
 {
  setpos( 315) ;
  x = 
  VGV->LEVEL[315] = ((VGV->LEVEL[40]))*(VGV->LEVEL[81])/VGV->LEVEL[312] ;
}
/* service output per capita */
 {
  setpos( 316) ;
  x = 
  VGV->LEVEL[316] = VGV->LEVEL[315]/VGV->LEVEL[285] ;
}
/* health services per capita */
 {
  setpos( 152) ;
  x = 
  VGV->LEVEL[152] = TABLE(&VGV->TAB[26],VGV->LEVEL[316]/VGV->LEVEL[147]) ;
}
/* #effective health services per capita>SMOOTH# */
 {
  setpos( 7) ;
  x = 
  VGV->LEVEL[7] = VGV->LEVEL[152] ;
}
/* Land Fertility */
 {
  setpos( 29) ;
  x = 
  VGV->LEVEL[29] = VGV->LEVEL[184] ;
}
/* Agricultural Inputs */
 {
  setpos( 54) ;
  x = 
  VGV->LEVEL[54] = VGV->LEVEL[1] ;
}
/* food ratio */
 {
  setpos( 116) ;
  x = 
  VGV->LEVEL[116] = 1.000000 ;
}
/* #Perceived Food Ratio>SMOOTH# */
 {
  setpos( 14) ;
  x = 
  VGV->LEVEL[14] = VGV->LEVEL[116] ;
}
/* Perceived Food Ratio */
 {
  setpos( 261) ;
  x = 
  VGV->LEVEL[261] = VGV->LEVEL[14] ;
}
/* fraction of agricultural inputs for land maintenance */
 {
  setpos( 119) ;
  x = 
  VGV->LEVEL[119] = TABLE(&VGV->TAB[16],VGV->LEVEL[261]) ;
}
/* Arable Land */
 {
  setpos( 27) ;
  x = 
  VGV->LEVEL[27] = VGV->LEVEL[182] ;
}
/* agricultural input per hectare */
 {
  setpos( 53) ;
  x = 
  VGV->LEVEL[53] = VGV->LEVEL[54]*(1.000000-VGV->LEVEL[119])/VGV->LEVEL[27] ;
}
/* land yield multiplier from capital */
 {
  setpos( 227) ;
  x = 
  VGV->LEVEL[227] = TABLE(&VGV->TAB[47],VGV->LEVEL[53]/VGV->LEVEL[328]) ;
}
/* land yield multiplier from air pollution 2 */
 {
  setpos( 226) ;
  x = 
  VGV->LEVEL[226] = TABLE(&VGV->TAB[46],VGV->LEVEL[176]/VGV->LEVEL[156]) ;
}
}
void mdl_func5(__GLOB_VARS *VGV) ;
void mdl_func5(__GLOB_VARS *VGV){double temp[10];
  double x ;
/* land yield multipler from air pollution 1 */
 {
  setpos( 224) ;
  x = 
  VGV->LEVEL[224] = TABLE(&VGV->TAB[45],VGV->LEVEL[176]/VGV->LEVEL[156]) ;
}
/* land yield multiplier from air pollution */
 {
  setpos( 225) ;
  x = 
  VGV->LEVEL[225] = IF_THEN_ELSE(VGV->LEVEL[0]>=VGV->LEVEL[56],VGV->LEVEL[226],VGV->LEVEL[224]) ;
}
/* land yield */
 {
  setpos( 221) ;
  x = 
  VGV->LEVEL[221] = VGV->LEVEL[228]*VGV->LEVEL[29]*VGV->LEVEL[227]*VGV->LEVEL[225] ;
}
/* food */
 {
  setpos( 114) ;
  x = 
  VGV->LEVEL[114] = VGV->LEVEL[221]*VGV->LEVEL[27]*VGV->LEVEL[213]*(1.000000-VGV->LEVEL[292]) ;
}
/* food per capita */
 {
  setpos( 115) ;
  x = 
  VGV->LEVEL[115] = VGV->LEVEL[114]/VGV->LEVEL[285] ;
}
/* lifetime multiplier from food */
 {
  setpos( 240) ;
  x = 
  VGV->LEVEL[240] = TABLE(&VGV->TAB[52],VGV->LEVEL[115]/VGV->LEVEL[320]) ;
}
/* effective health services per capita */
 {
  setpos( 103) ;
  x = 
  VGV->LEVEL[103] = VGV->LEVEL[7] ;
}
/* lifetime multiplier from health services 2 */
 {
  setpos( 243) ;
  x = 
  VGV->LEVEL[243] = TABLE(&VGV->TAB[54],VGV->LEVEL[103]/VGV->LEVEL[147]) ;
}
/* lifetime multiplier from health services 1 */
 {
  setpos( 242) ;
  x = 
  VGV->LEVEL[242] = TABLE(&VGV->TAB[53],VGV->LEVEL[103]/VGV->LEVEL[147]) ;
}
/* lifetime multiplier from health services */
 {
  setpos( 241) ;
  x = 
  VGV->LEVEL[241] = IF_THEN_ELSE(VGV->LEVEL[0]>1940.000000,VGV->LEVEL[243],VGV->LEVEL[242]) ;
}
/* Persistent Pollution */
 {
  setpos( 32) ;
  x = 
  VGV->LEVEL[32] = VGV->LEVEL[189] ;
}
/* persistent pollution index */
 {
  setpos( 272) ;
  x = 
  VGV->LEVEL[272] = VGV->LEVEL[32]/VGV->LEVEL[271] ;
}
/* lifetime multiplier from persistent pollution */
 {
  setpos( 244) ;
  x = 
  VGV->LEVEL[244] = TABLE(&VGV->TAB[55],VGV->LEVEL[272]) ;
}
/* crowding multiplier from industry */
 {
  setpos( 85) ;
  x = 
  VGV->LEVEL[85] = TABLE(&VGV->TAB[6],VGV->LEVEL[177]/VGV->LEVEL[147]) ;
}
/* fraction of population urban */
 {
  setpos( 142) ;
  x = 
  VGV->LEVEL[142] = TABLE(&VGV->TAB[23],VGV->LEVEL[285]/VGV->LEVEL[329]) ;
}
/* lifetime multiplier from crowding */
 {
  setpos( 239) ;
  x = 
  VGV->LEVEL[239] = 1.000000-(VGV->LEVEL[85]*VGV->LEVEL[142]) ;
}
/* life expectancy */
 {
  setpos( 236) ;
  x = 
  VGV->LEVEL[236] = VGV->LEVEL[238]*VGV->LEVEL[240]*VGV->LEVEL[241]*VGV->LEVEL[244]*VGV->LEVEL[239] ;
}
/* fecundity multiplier */
 {
  setpos( 106) ;
  x = 
  VGV->LEVEL[106] = TABLE(&VGV->TAB[10],VGV->LEVEL[236]/VGV->LEVEL[259]) ;
}
/* maximum total fertility */
 {
  setpos( 252) ;
  x = 
  VGV->LEVEL[252] = VGV->LEVEL[253]*VGV->LEVEL[106] ;
}
/* zero population growth time s */
 {
  setpos( 335) ;
  x = 
  VGV->LEVEL[335] = IF_THEN_ELSE(VGV->LEVEL[309]==0||VGV->LEVEL[336]==1.000000,VGV->LEVEL[334],TABLE(
&VGV->TAB[71],VGV->LEVEL[309])) ;
}
/* average industrial output per capita */
 {
  setpos( 61) ;
  x = 
  VGV->LEVEL[61] = VGV->LEVEL[2] ;
}
/* family income expectation */
 {
  setpos( 104) ;
  x = 
  VGV->LEVEL[104] = (VGV->LEVEL[177]-VGV->LEVEL[61])/VGV->LEVEL[61] ;
}
/* family response to social norm */
 {
  setpos( 105) ;
  x = 
  VGV->LEVEL[105] = TABLE(&VGV->TAB[9],VGV->LEVEL[104]) ;
}
/* delayed industrial output per capita */
 {
  setpos( 93) ;
  x = 
  VGV->LEVEL[93] = VGV->LEVEL[3] ;
}
/* social family size normal */
 {
  setpos( 319) ;
  x = 
  VGV->LEVEL[319] = TABLE(&VGV->TAB[69],VGV->LEVEL[93]/VGV->LEVEL[147]) ;
}
/* desired completed family size */
 {
  setpos( 95) ;
  x = 
  VGV->LEVEL[95] = IF_THEN_ELSE(VGV->LEVEL[0]>=VGV->LEVEL[335],2.000000,VGV->LEVEL[96]*VGV->LEVEL[105
]*VGV->LEVEL[319]) ;
}
/* #perceived life expectancy>SMOOTH3# */
 {
  setpos( 15) ;
  x = 
  VGV->LEVEL[15] = VGV->LEVEL[236] ;
}
/* perceived life expectancy */
 {
  setpos( 262) ;
  x = 
  VGV->LEVEL[262] = VGV->LEVEL[15] ;
}
/* completed multiplier from perceived lifetime */
 {
  setpos( 82) ;
  x = 
  VGV->LEVEL[82] = TABLE(&VGV->TAB[5],VGV->LEVEL[262]/VGV->LEVEL[259]) ;
}
/* desired total fertility */
 {
  setpos( 100) ;
  x = 
  VGV->LEVEL[100] = VGV->LEVEL[95]*VGV->LEVEL[82] ;
}
/* need for fertility control */
 {
  setpos( 258) ;
  x = 
  VGV->LEVEL[258] = (VGV->LEVEL[252]/VGV->LEVEL[100])-1.000000 ;
}
/* fraction services allocated to fertility control */
 {
  setpos( 145) ;
  x = 
  VGV->LEVEL[145] = TABLE(&VGV->TAB[24],VGV->LEVEL[258]) ;
}
/* fertility control allocation per capita */
 {
  setpos( 107) ;
  x = 
  VGV->LEVEL[107] = VGV->LEVEL[145]*VGV->LEVEL[316] ;
}
/* #fertility control facilities per capita>SMOOTH3# */
 {
  setpos( 8) ;
  x = 
  VGV->LEVEL[8] = VGV->LEVEL[107] ;
}
/* #fertility control facilities per capita>SMOOTH3>LV1# */
 {
  setpos( 9) ;
  x = 
  VGV->LEVEL[9] = VGV->LEVEL[107] ;
}
/* #fertility control facilities per capita>SMOOTH3>LV2# */
 {
  setpos( 10) ;
  x = 
  VGV->LEVEL[10] = VGV->LEVEL[107] ;
}
/* #land yield factor 2>SMOOTH3>LV1# */
 {
  setpos( 12) ;
  x = 
  VGV->LEVEL[12] = VGV->LEVEL[30] ;
}
/* #land yield factor 2>SMOOTH3>LV2# */
 {
  setpos( 13) ;
  x = 
  VGV->LEVEL[13] = VGV->LEVEL[30] ;
}
/* #perceived life expectancy>SMOOTH3>LV1# */
 {
  setpos( 16) ;
  x = 
  VGV->LEVEL[16] = VGV->LEVEL[236] ;
}
/* #perceived life expectancy>SMOOTH3>LV2# */
 {
  setpos( 17) ;
  x = 
  VGV->LEVEL[17] = VGV->LEVEL[236] ;
}
/* #persistent pollution appearance rate>DELAY3>DL# */
 {
  setpos( 47) ;
  x = 
  VGV->LEVEL[47] = VGV->LEVEL[281]/3.000000 ;
}
/* per capita resource use multiplier */
 {
  setpos( 260) ;
  x = 
  VGV->LEVEL[260] = TABLE(&VGV->TAB[61],VGV->LEVEL[177]/VGV->LEVEL[147]) ;
}
/* persistent pollution generation industry */
 {
  setpos( 269) ;
  x = 
  VGV->LEVEL[269] = VGV->LEVEL[260]*VGV->LEVEL[285]*VGV->LEVEL[143]*VGV->LEVEL[174]*VGV->LEVEL[175] ;
}
/* persistent pollution generation agriculture */
 {
  setpos( 265) ;
  x = 
  VGV->LEVEL[265] = VGV->LEVEL[53]*VGV->LEVEL[27]*VGV->LEVEL[120]*VGV->LEVEL[55] ;
}
/* persistent pollution generation rate */
 {
  setpos( 270) ;
  x = 
  VGV->LEVEL[270] = (VGV->LEVEL[269]+VGV->LEVEL[265])*(VGV->LEVEL[266]) ;
}
/* #persistent pollution appearance rate>DELAY3>LV3# */
 {
  setpos( 20) ;
  x = 
  VGV->LEVEL[20] = VGV->LEVEL[47]*VGV->LEVEL[270] ;
}
/* #persistent pollution appearance rate>DELAY3>LV1# */
 {
  setpos( 18) ;
  x = 
  VGV->LEVEL[18] = VGV->LEVEL[20] ;
}
/* #persistent pollution appearance rate>DELAY3>LV2# */
 {
  setpos( 19) ;
  x = 
  VGV->LEVEL[19] = VGV->LEVEL[20] ;
}
/* #persistent pollution generation factor 2>SMOOTH3>LV1# */
 {
  setpos( 22) ;
  x = 
  VGV->LEVEL[22] = VGV->LEVEL[33] ;
}
/* #persistent pollution generation factor 2>SMOOTH3>LV2# */
 {
  setpos( 23) ;
  x = 
  VGV->LEVEL[23] = VGV->LEVEL[33] ;
}
/* #resource use fact 2>SMOOTH3>LV1# */
 {
  setpos( 25) ;
  x = 
  VGV->LEVEL[25] = VGV->LEVEL[39] ;
}
/* #resource use fact 2>SMOOTH3>LV2# */
 {
  setpos( 26) ;
  x = 
  VGV->LEVEL[26] = VGV->LEVEL[39] ;
}
/* Potentially Arable Land */
 {
  setpos( 38) ;
  x = 
  VGV->LEVEL[38] = VGV->LEVEL[194] ;
}
/* Urban and Industrial Land */
 {
  setpos( 41) ;
  x = 
  VGV->LEVEL[41] = VGV->LEVEL[197] ;
}
} /* State variable initial value computation comp_init  */



/* State variable re-initial value computation comp_reinit */
void mdl_func6(__GLOB_VARS *VGV)
{
double temp[10];
  double x ;
} /* State variable re-initial value computation comp_reinit  */



/* Active Time Step Equation comp_tstep */
void mdl_func7(__GLOB_VARS *VGV)
{double temp[10];
  double x ;
} /* Active Time Step Equation comp_tstep */


/* Auxiliary variable equations comp_aux */
void mdl_func8(__GLOB_VARS *VGV)
{
double temp[10];
  double x ;
/* #delayed industrial output per capita>SMOOTH3>DL# */
 {
  setpos( 42) ;
  x = 
  VGV->LEVEL[42] = VGV->LEVEL[317]/3.000000 ;
}
/* #fertility control facilities per capita>SMOOTH3>DL# */
 {
  setpos( 43) ;
  x = 
  VGV->LEVEL[43] = VGV->LEVEL[151]/3.000000 ;
}
/* #land yield factor 2>SMOOTH3>DL# */
 {
  setpos( 44) ;
  x = 
  VGV->LEVEL[44] = VGV->LEVEL[321]/3.000000 ;
}
/* #perceived life expectancy>SMOOTH3>DL# */
 {
  setpos( 45) ;
  x = 
  VGV->LEVEL[45] = VGV->LEVEL[245]/3.000000 ;
}
/* #persistent pollution appearance rate>DELAY3>DL# */
 {
  setpos( 47) ;
  x = 
  VGV->LEVEL[47] = VGV->LEVEL[281]/3.000000 ;
}
/* #persistent pollution appearance rate>DELAY3# */
 {
  setpos( 46) ;
  x = 
  VGV->LEVEL[46] = VGV->LEVEL[20]/VGV->LEVEL[47] ;
}
/* #persistent pollution appearance rate>DELAY3>RT1# */
 {
  setpos( 48) ;
  x = 
  VGV->LEVEL[48] = VGV->LEVEL[18]/VGV->LEVEL[47] ;
}
/* #persistent pollution appearance rate>DELAY3>RT2# */
 {
  setpos( 49) ;
  x = 
  VGV->LEVEL[49] = VGV->LEVEL[19]/VGV->LEVEL[47] ;
}
/* #persistent pollution generation factor 2>SMOOTH3>DL# */
 {
  setpos( 50) ;
  x = 
  VGV->LEVEL[50] = VGV->LEVEL[321]/3.000000 ;
}
/* #resource use fact 2>SMOOTH3>DL# */
 {
  setpos( 51) ;
  x = 
  VGV->LEVEL[51] = VGV->LEVEL[321]/3.000000 ;
}
/* fraction of industrial capital allocated to obtaining resources switch time s */
 {
  setpos( 125) ;
  x = 
  VGV->LEVEL[125] = IF_THEN_ELSE(VGV->LEVEL[309]==0||VGV->LEVEL[126]==1.000000,VGV->LEVEL[124],TABLE(
&VGV->TAB[19],VGV->LEVEL[309])) ;
}
/* initial nonrenewable resources */
 {
  setpos( 185) ;
  x = 
  VGV->LEVEL[185] = VGV->LEVEL[186]*VGV->LEVEL[327] ;
}
/* initial nonrenewable resources s */
 {
  setpos( 187) ;
  x = 
  VGV->LEVEL[187] = IF_THEN_ELSE(VGV->LEVEL[309]==0||VGV->LEVEL[188]==1.000000,VGV->LEVEL[185],TABLE(
&VGV->TAB[36],VGV->LEVEL[309])) ;
}
/* fraction of resources remaining */
 {
  setpos( 144) ;
  x = 
  VGV->LEVEL[144] = VGV->LEVEL[31]/VGV->LEVEL[187] ;
}
/* fraction of capital allocated to obtaining resources 2 */
 {
  setpos( 122) ;
  x = 
  VGV->LEVEL[122] = TABLE(&VGV->TAB[18],VGV->LEVEL[144]) ;
}
/* fraction of capital allocated to obtaining resources 1 */
 {
  setpos( 121) ;
  x = 
  VGV->LEVEL[121] = TABLE(&VGV->TAB[17],VGV->LEVEL[144]) ;
}
/* fraction of industrial capital allocated to obtaining resources */
 {
  setpos( 123) ;
  x = 
  VGV->LEVEL[123] = IF_THEN_ELSE(VGV->LEVEL[0]>=VGV->LEVEL[125],VGV->LEVEL[122],VGV->LEVEL[121]) ;
}
/* Delayed Labor Utilization Fraction */
 {
  setpos( 94) ;
  x = 
  VGV->LEVEL[94] = VGV->LEVEL[6] ;
}
/* capacity utilization fraction */
 {
  setpos( 81) ;
  x = 
  VGV->LEVEL[81] = TABLE(&VGV->TAB[4],VGV->LEVEL[94]) ;
}
/* POLICY YEAR s */
 {
  setpos( 283) ;
  x = 
  VGV->LEVEL[283] = IF_THEN_ELSE(VGV->LEVEL[309]==0||VGV->LEVEL[284]==1.000000,VGV->LEVEL[282],TABLE(
&VGV->TAB[65],VGV->LEVEL[309])) ;
}
/* resource use fact 2 */
 {
  setpos( 304) ;
  x = 
  VGV->LEVEL[304] = VGV->LEVEL[24] ;
}
/* resource use factor */
 {
  setpos( 305) ;
  x = 
  VGV->LEVEL[305] = IF_THEN_ELSE(VGV->LEVEL[0]>=VGV->LEVEL[283],VGV->LEVEL[304],VGV->LEVEL[306]) ;
}
/* industrial capital output ratio multiplier from resource conservation technology */
 {
  setpos( 170) ;
  x = 
  VGV->LEVEL[170] = TABLE(&VGV->TAB[32],VGV->LEVEL[305]) ;
}
/* land yield factor 2 */
 {
  setpos( 223) ;
  x = 
  VGV->LEVEL[223] = VGV->LEVEL[11] ;
}
/* land yield multiplier from technology */
 {
  setpos( 228) ;
  x = 
  VGV->LEVEL[228] = IF_THEN_ELSE(VGV->LEVEL[0]>=VGV->LEVEL[283],VGV->LEVEL[223],VGV->LEVEL[222]) ;
}
/* industrial capital output ratio multiplier from land yield technology */
 {
  setpos( 168) ;
  x = 
  VGV->LEVEL[168] = TABLE(&VGV->TAB[33],VGV->LEVEL[228]) ;
}
/* persistent pollution generation factor 2 */
 {
  setpos( 268) ;
  x = 
  VGV->LEVEL[268] = VGV->LEVEL[21] ;
}
/* persistent pollution generation factor */
 {
  setpos( 266) ;
  x = 
  VGV->LEVEL[266] = IF_THEN_ELSE(VGV->LEVEL[0]>=VGV->LEVEL[283],VGV->LEVEL[268],VGV->LEVEL[267]) ;
}
/* industrial capital output ratio multiplier from pollution technology */
 {
  setpos( 169) ;
  x = 
  VGV->LEVEL[169] = TABLE(&VGV->TAB[31],VGV->LEVEL[266]) ;
}
/* industrial capital output ratio 2 */
 {
  setpos( 167) ;
  x = 
  VGV->LEVEL[167] = VGV->LEVEL[170]*VGV->LEVEL[168]*VGV->LEVEL[169] ;
}
/* industrial capital output ratio */
 {
  setpos( 165) ;
  x = 
  VGV->LEVEL[165] = IF_THEN_ELSE(VGV->LEVEL[0]>=VGV->LEVEL[283],VGV->LEVEL[167],VGV->LEVEL[166]) ;
}
/* industrial output */
 {
  setpos( 176) ;
  x = 
  VGV->LEVEL[176] = (((VGV->LEVEL[28]))*(1.000000-VGV->LEVEL[123]))*(VGV->LEVEL[81])/VGV->LEVEL[165] ;
}
/* population */
 {
  setpos( 285) ;
  x = 
  VGV->LEVEL[285] = VGV->LEVEL[34]+VGV->LEVEL[35]+VGV->LEVEL[36]+VGV->LEVEL[37] ;
}
/* industrial output per capita */
 {
  setpos( 177) ;
  x = 
  VGV->LEVEL[177] = VGV->LEVEL[176]/VGV->LEVEL[285] ;
}
/* per capita resource use multiplier */
 {
  setpos( 260) ;
  x = 
  VGV->LEVEL[260] = TABLE(&VGV->TAB[61],VGV->LEVEL[177]/VGV->LEVEL[147]) ;
}
/* persistent pollution generation industry */
 {
  setpos( 269) ;
  x = 
  VGV->LEVEL[269] = VGV->LEVEL[260]*VGV->LEVEL[285]*VGV->LEVEL[143]*VGV->LEVEL[174]*VGV->LEVEL[175] ;
}
/* Agricultural Inputs */
 {
  setpos( 54) ;
  x = 
  VGV->LEVEL[54] = VGV->LEVEL[1] ;
}
/* Perceived Food Ratio */
 {
  setpos( 261) ;
  x = 
  VGV->LEVEL[261] = VGV->LEVEL[14] ;
}
/* fraction of agricultural inputs for land maintenance */
 {
  setpos( 119) ;
  x = 
  VGV->LEVEL[119] = TABLE(&VGV->TAB[16],VGV->LEVEL[261]) ;
}
/* agricultural input per hectare */
 {
  setpos( 53) ;
  x = 
  VGV->LEVEL[53] = VGV->LEVEL[54]*(1.000000-VGV->LEVEL[119])/VGV->LEVEL[27] ;
}
/* persistent pollution generation agriculture */
 {
  setpos( 265) ;
  x = 
  VGV->LEVEL[265] = VGV->LEVEL[53]*VGV->LEVEL[27]*VGV->LEVEL[120]*VGV->LEVEL[55] ;
}
/* persistent pollution generation rate */
 {
  setpos( 270) ;
  x = 
  VGV->LEVEL[270] = (VGV->LEVEL[269]+VGV->LEVEL[265])*(VGV->LEVEL[266]) ;
}
/* Absorption Land (GHA) */
 {
  setpos( 52) ;
  x = 
  VGV->LEVEL[52] = VGV->LEVEL[270]*VGV->LEVEL[150]/VGV->LEVEL[149] ;
}
/* Arable Land in Gigahectares (GHA) */
 {
  setpos( 57) ;
  x = 
  VGV->LEVEL[57] = VGV->LEVEL[27]/VGV->LEVEL[149] ;
}
/* persistent pollution index */
 {
  setpos( 272) ;
  x = 
  VGV->LEVEL[272] = VGV->LEVEL[32]/VGV->LEVEL[271] ;
}
/* assimilation half life multiplier */
 {
  setpos( 60) ;
  x = 
  VGV->LEVEL[60] = TABLE(&VGV->TAB[0],VGV->LEVEL[272]) ;
}
/* assimilation half life */
 {
  setpos( 58) ;
  x = 
  VGV->LEVEL[58] = VGV->LEVEL[59]*VGV->LEVEL[60] ;
}
}
void mdl_func9(__GLOB_VARS *VGV) ;
void mdl_func9(__GLOB_VARS *VGV){double temp[10];
  double x ;
/* average industrial output per capita */
 {
  setpos( 61) ;
  x = 
  VGV->LEVEL[61] = VGV->LEVEL[2] ;
}
/* average life of agricultural inputs 2 s */
 {
  setpos( 65) ;
  x = 
  VGV->LEVEL[65] = IF_THEN_ELSE(VGV->LEVEL[309]==0||VGV->LEVEL[66]==1.000000,VGV->LEVEL[64],TABLE(&VGV->TAB[
1],VGV->LEVEL[309])) ;
}
/* average life agricultural inputs */
 {
  setpos( 62) ;
  x = 
  VGV->LEVEL[62] = IF_THEN_ELSE(VGV->LEVEL[0]>=VGV->LEVEL[283],VGV->LEVEL[65],VGV->LEVEL[63]) ;
}
/* average life of industrial capital 2 s */
 {
  setpos( 70) ;
  x = 
  VGV->LEVEL[70] = IF_THEN_ELSE(VGV->LEVEL[309]==0||VGV->LEVEL[71]==1.000000,VGV->LEVEL[69],TABLE(&VGV->TAB[
2],VGV->LEVEL[309])) ;
}
/* average life of industrial capital */
 {
  setpos( 67) ;
  x = 
  VGV->LEVEL[67] = IF_THEN_ELSE(VGV->LEVEL[0]>=VGV->LEVEL[283],VGV->LEVEL[70],VGV->LEVEL[68]) ;
}
/* land life policy implementation time s */
 {
  setpos( 218) ;
  x = 
  VGV->LEVEL[218] = IF_THEN_ELSE(VGV->LEVEL[309]==0||VGV->LEVEL[219]==1.000000,VGV->LEVEL[217],TABLE(
&VGV->TAB[44],VGV->LEVEL[309])) ;
}
/* land yield multiplier from capital */
 {
  setpos( 227) ;
  x = 
  VGV->LEVEL[227] = TABLE(&VGV->TAB[47],VGV->LEVEL[53]/VGV->LEVEL[328]) ;
}
/* land yield multiplier from air pollution 2 */
 {
  setpos( 226) ;
  x = 
  VGV->LEVEL[226] = TABLE(&VGV->TAB[46],VGV->LEVEL[176]/VGV->LEVEL[156]) ;
}
/* land yield multipler from air pollution 1 */
 {
  setpos( 224) ;
  x = 
  VGV->LEVEL[224] = TABLE(&VGV->TAB[45],VGV->LEVEL[176]/VGV->LEVEL[156]) ;
}
/* land yield multiplier from air pollution */
 {
  setpos( 225) ;
  x = 
  VGV->LEVEL[225] = IF_THEN_ELSE(VGV->LEVEL[0]>=VGV->LEVEL[56],VGV->LEVEL[226],VGV->LEVEL[224]) ;
}
/* land yield */
 {
  setpos( 221) ;
  x = 
  VGV->LEVEL[221] = VGV->LEVEL[228]*VGV->LEVEL[29]*VGV->LEVEL[227]*VGV->LEVEL[225] ;
}
/* land life multiplier from land yield 1 */
 {
  setpos( 215) ;
  x = 
  VGV->LEVEL[215] = TABLE(&VGV->TAB[42],VGV->LEVEL[221]/VGV->LEVEL[181]) ;
}
/* land life multiplier from land yield 2 */
 {
  setpos( 216) ;
  x = 
  VGV->LEVEL[216] = TABLE(&VGV->TAB[43],VGV->LEVEL[221]/VGV->LEVEL[181]) ;
}
/* land life multiplier from land yield */
 {
  setpos( 214) ;
  x = 
  VGV->LEVEL[214] = IF_THEN_ELSE(VGV->LEVEL[0]>=VGV->LEVEL[218],(POWER(0.950000,((VGV->LEVEL[0]-VGV->LEVEL[218
])/VGV->LEVEL[259])))*VGV->LEVEL[215]+(1.000000-POWER(0.950000,((VGV->LEVEL[0]-VGV->LEVEL[218])/VGV->LEVEL[259
])))*VGV->LEVEL[216],VGV->LEVEL[215]) ;
}
/* average life of land */
 {
  setpos( 72) ;
  x = 
  VGV->LEVEL[72] = VGV->LEVEL[73]*VGV->LEVEL[214] ;
}
/* average life of service capital 2 s */
 {
  setpos( 77) ;
  x = 
  VGV->LEVEL[77] = IF_THEN_ELSE(VGV->LEVEL[309]==0||VGV->LEVEL[78]==1.000000,VGV->LEVEL[76],TABLE(&VGV->TAB[
3],VGV->LEVEL[309])) ;
}
/* average life of service capital */
 {
  setpos( 74) ;
  x = 
  VGV->LEVEL[74] = IF_THEN_ELSE(VGV->LEVEL[0]>=VGV->LEVEL[283],VGV->LEVEL[77],VGV->LEVEL[75]) ;
}
/* food */
 {
  setpos( 114) ;
  x = 
  VGV->LEVEL[114] = VGV->LEVEL[221]*VGV->LEVEL[27]*VGV->LEVEL[213]*(1.000000-VGV->LEVEL[292]) ;
}
/* food per capita */
 {
  setpos( 115) ;
  x = 
  VGV->LEVEL[115] = VGV->LEVEL[114]/VGV->LEVEL[285] ;
}
/* lifetime multiplier from food */
 {
  setpos( 240) ;
  x = 
  VGV->LEVEL[240] = TABLE(&VGV->TAB[52],VGV->LEVEL[115]/VGV->LEVEL[320]) ;
}
/* effective health services per capita */
 {
  setpos( 103) ;
  x = 
  VGV->LEVEL[103] = VGV->LEVEL[7] ;
}
/* lifetime multiplier from health services 2 */
 {
  setpos( 243) ;
  x = 
  VGV->LEVEL[243] = TABLE(&VGV->TAB[54],VGV->LEVEL[103]/VGV->LEVEL[147]) ;
}
/* lifetime multiplier from health services 1 */
 {
  setpos( 242) ;
  x = 
  VGV->LEVEL[242] = TABLE(&VGV->TAB[53],VGV->LEVEL[103]/VGV->LEVEL[147]) ;
}
/* lifetime multiplier from health services */
 {
  setpos( 241) ;
  x = 
  VGV->LEVEL[241] = IF_THEN_ELSE(VGV->LEVEL[0]>1940.000000,VGV->LEVEL[243],VGV->LEVEL[242]) ;
}
/* lifetime multiplier from persistent pollution */
 {
  setpos( 244) ;
  x = 
  VGV->LEVEL[244] = TABLE(&VGV->TAB[55],VGV->LEVEL[272]) ;
}
/* crowding multiplier from industry */
 {
  setpos( 85) ;
  x = 
  VGV->LEVEL[85] = TABLE(&VGV->TAB[6],VGV->LEVEL[177]/VGV->LEVEL[147]) ;
}
/* fraction of population urban */
 {
  setpos( 142) ;
  x = 
  VGV->LEVEL[142] = TABLE(&VGV->TAB[23],VGV->LEVEL[285]/VGV->LEVEL[329]) ;
}
/* lifetime multiplier from crowding */
 {
  setpos( 239) ;
  x = 
  VGV->LEVEL[239] = 1.000000-(VGV->LEVEL[85]*VGV->LEVEL[142]) ;
}
/* life expectancy */
 {
  setpos( 236) ;
  x = 
  VGV->LEVEL[236] = VGV->LEVEL[238]*VGV->LEVEL[240]*VGV->LEVEL[241]*VGV->LEVEL[244]*VGV->LEVEL[239] ;
}
/* mortality 0 to 14 */
 {
  setpos( 254) ;
  x = 
  VGV->LEVEL[254] = TABLE(&VGV->TAB[57],VGV->LEVEL[236]/VGV->LEVEL[259]) ;
}
/* deaths 0 to 14 */
 {
  setpos( 89) ;
  x = 
  VGV->LEVEL[89] = VGV->LEVEL[34]*VGV->LEVEL[254] ;
}
/* mortality 15 to 44 */
 {
  setpos( 255) ;
  x = 
  VGV->LEVEL[255] = TABLE(&VGV->TAB[58],VGV->LEVEL[236]/VGV->LEVEL[259]) ;
}
/* deaths 15 to 44 */
 {
  setpos( 90) ;
  x = 
  VGV->LEVEL[90] = VGV->LEVEL[35]*VGV->LEVEL[255] ;
}
/* mortality 45 to 64 */
 {
  setpos( 256) ;
  x = 
  VGV->LEVEL[256] = TABLE(&VGV->TAB[59],VGV->LEVEL[236]/VGV->LEVEL[259]) ;
}
/* deaths 45 to 64 */
 {
  setpos( 91) ;
  x = 
  VGV->LEVEL[91] = VGV->LEVEL[36]*VGV->LEVEL[256] ;
}
/* mortality 65 plus */
 {
  setpos( 257) ;
  x = 
  VGV->LEVEL[257] = TABLE(&VGV->TAB[60],VGV->LEVEL[236]/VGV->LEVEL[259]) ;
}
/* deaths 65 plus */
 {
  setpos( 92) ;
  x = 
  VGV->LEVEL[92] = VGV->LEVEL[37]*VGV->LEVEL[257] ;
}
/* deaths */
 {
  setpos( 88) ;
  x = 
  VGV->LEVEL[88] = VGV->LEVEL[89]+VGV->LEVEL[90]+VGV->LEVEL[91]+VGV->LEVEL[92] ;
}
/* fecundity multiplier */
 {
  setpos( 106) ;
  x = 
  VGV->LEVEL[106] = TABLE(&VGV->TAB[10],VGV->LEVEL[236]/VGV->LEVEL[259]) ;
}
/* maximum total fertility */
 {
  setpos( 252) ;
  x = 
  VGV->LEVEL[252] = VGV->LEVEL[253]*VGV->LEVEL[106] ;
}
/* fertility control effectiveness time s */
 {
  setpos( 110) ;
  x = 
  VGV->LEVEL[110] = IF_THEN_ELSE(VGV->LEVEL[309]==0||VGV->LEVEL[111]==1.000000,VGV->LEVEL[109],TABLE(
&VGV->TAB[12],VGV->LEVEL[309])) ;
}
/* fertility control facilities per capita */
 {
  setpos( 112) ;
  x = 
  VGV->LEVEL[112] = VGV->LEVEL[8] ;
}
/* fertility control effectiveness */
 {
  setpos( 108) ;
  x = 
  VGV->LEVEL[108] = IF_THEN_ELSE(VGV->LEVEL[0]>=VGV->LEVEL[110],1.000000,(TABLE(&VGV->TAB[11],VGV->LEVEL[112
]/VGV->LEVEL[147]))) ;
}
/* zero population growth time s */
 {
  setpos( 335) ;
  x = 
  VGV->LEVEL[335] = IF_THEN_ELSE(VGV->LEVEL[309]==0||VGV->LEVEL[336]==1.000000,VGV->LEVEL[334],TABLE(
&VGV->TAB[71],VGV->LEVEL[309])) ;
}
/* family income expectation */
 {
  setpos( 104) ;
  x = 
  VGV->LEVEL[104] = (VGV->LEVEL[177]-VGV->LEVEL[61])/VGV->LEVEL[61] ;
}
/* family response to social norm */
 {
  setpos( 105) ;
  x = 
  VGV->LEVEL[105] = TABLE(&VGV->TAB[9],VGV->LEVEL[104]) ;
}
/* delayed industrial output per capita */
 {
  setpos( 93) ;
  x = 
  VGV->LEVEL[93] = VGV->LEVEL[3] ;
}
/* social family size normal */
 {
  setpos( 319) ;
  x = 
  VGV->LEVEL[319] = TABLE(&VGV->TAB[69],VGV->LEVEL[93]/VGV->LEVEL[147]) ;
}
/* desired completed family size */
 {
  setpos( 95) ;
  x = 
  VGV->LEVEL[95] = IF_THEN_ELSE(VGV->LEVEL[0]>=VGV->LEVEL[335],2.000000,VGV->LEVEL[96]*VGV->LEVEL[105
]*VGV->LEVEL[319]) ;
}
/* perceived life expectancy */
 {
  setpos( 262) ;
  x = 
  VGV->LEVEL[262] = VGV->LEVEL[15] ;
}
/* completed multiplier from perceived lifetime */
 {
  setpos( 82) ;
  x = 
  VGV->LEVEL[82] = TABLE(&VGV->TAB[5],VGV->LEVEL[262]/VGV->LEVEL[259]) ;
}
/* desired total fertility */
 {
  setpos( 100) ;
  x = 
  VGV->LEVEL[100] = VGV->LEVEL[95]*VGV->LEVEL[82] ;
}
/* total fertility */
 {
  setpos( 325) ;
  x = 
  VGV->LEVEL[325] = MIN(VGV->LEVEL[252],(VGV->LEVEL[252]*(1.000000-VGV->LEVEL[108])+VGV->LEVEL[100]*VGV->LEVEL[108
])) ;
}
/* births */
 {
  setpos( 80) ;
  x = 
  VGV->LEVEL[80] = IF_THEN_ELSE(VGV->LEVEL[0]>=VGV->LEVEL[286],VGV->LEVEL[88],(VGV->LEVEL[325]*VGV->LEVEL[35
]*0.500000/VGV->LEVEL[295])) ;
}
/* birth rate */
 {
  setpos( 79) ;
  x = 
  VGV->LEVEL[79] = VGV->LEVEL[322]*VGV->LEVEL[80]/VGV->LEVEL[285] ;
}
/* industrial equilibrium time s */
 {
  setpos( 172) ;
  x = 
  VGV->LEVEL[172] = IF_THEN_ELSE(VGV->LEVEL[309]==0||VGV->LEVEL[173]==1.000000,VGV->LEVEL[171],TABLE(
&VGV->TAB[34],VGV->LEVEL[309])) ;
}
/* industrial output per capita desired s */
 {
  setpos( 179) ;
  x = 
  VGV->LEVEL[179] = IF_THEN_ELSE(VGV->LEVEL[309]==0||VGV->LEVEL[180]==1.000000,VGV->LEVEL[178],TABLE(
&VGV->TAB[35],VGV->LEVEL[309])) ;
}
/* fraction of industrial output allocated to consumption variable */
 {
  setpos( 134) ;
  x = 
  VGV->LEVEL[134] = TABLE(&VGV->TAB[20],VGV->LEVEL[177]/VGV->LEVEL[179]) ;
}
/* fraction of industrial output allocated to consumption constant */
 {
  setpos( 131) ;
  x = 
  VGV->LEVEL[131] = IF_THEN_ELSE(VGV->LEVEL[0]>=VGV->LEVEL[283],VGV->LEVEL[133],VGV->LEVEL[132]) ;
}
/* fraction of industrial output allocated to consumption */
 {
  setpos( 130) ;
  x = 
  VGV->LEVEL[130] = IF_THEN_ELSE(VGV->LEVEL[0]>=VGV->LEVEL[172],VGV->LEVEL[134],VGV->LEVEL[131]) ;
}
/* consumed industrial output */
 {
  setpos( 83) ;
  x = 
  VGV->LEVEL[83] = VGV->LEVEL[176]*VGV->LEVEL[130] ;
}
/* consumed industrial output per capita */
 {
  setpos( 84) ;
  x = 
  VGV->LEVEL[84] = VGV->LEVEL[83]/VGV->LEVEL[285] ;
}
/* indicated food per capita 2 */
 {
  setpos( 159) ;
  x = 
  VGV->LEVEL[159] = TABLE(&VGV->TAB[28],VGV->LEVEL[177]/VGV->LEVEL[147]) ;
}
/* indicated food per capita 1 */
 {
  setpos( 158) ;
  x = 
  VGV->LEVEL[158] = TABLE(&VGV->TAB[27],VGV->LEVEL[177]/VGV->LEVEL[147]) ;
}
/* indicated food per capita */
 {
  setpos( 157) ;
  x = 
  VGV->LEVEL[157] = IF_THEN_ELSE(VGV->LEVEL[0]>=VGV->LEVEL[283],VGV->LEVEL[159],VGV->LEVEL[158]) ;
}
/* fraction of industrial output allocated to agriculture 2 */
 {
  setpos( 129) ;
  x = 
  VGV->LEVEL[129] = TABLE(&VGV->TAB[14],VGV->LEVEL[115]/VGV->LEVEL[157]) ;
}
/* fraction of industrial output allocated to agriculture 1 */
 {
  setpos( 128) ;
  x = 
  VGV->LEVEL[128] = TABLE(&VGV->TAB[13],VGV->LEVEL[115]/VGV->LEVEL[157]) ;
}
/* fraction of industrial output allocated to agriculture */
 {
  setpos( 127) ;
  x = 
  VGV->LEVEL[127] = IF_THEN_ELSE(VGV->LEVEL[0]>=VGV->LEVEL[283],VGV->LEVEL[129],VGV->LEVEL[128]) ;
}
/* total agricultural investment */
 {
  setpos( 324) ;
  x = 
  VGV->LEVEL[324] = VGV->LEVEL[176]*VGV->LEVEL[127] ;
}
/* development cost per hectare */
 {
  setpos( 101) ;
  x = 
  VGV->LEVEL[101] = TABLE(&VGV->TAB[7],VGV->LEVEL[38]/VGV->LEVEL[290]) ;
}
/* marginal productivity of land development */
 {
  setpos( 248) ;
  x = 
  VGV->LEVEL[248] = VGV->LEVEL[221]/(VGV->LEVEL[101]*VGV->LEVEL[318]) ;
}
/* marginal land yield multiplier from capital */
 {
  setpos( 246) ;
  x = 
  VGV->LEVEL[246] = TABLE(&VGV->TAB[56],VGV->LEVEL[53]/VGV->LEVEL[328]) ;
}
/* marginal productivity of agricultural inputs */
 {
  setpos( 247) ;
  x = 
  VGV->LEVEL[247] = VGV->LEVEL[62]*VGV->LEVEL[221]*VGV->LEVEL[246]/VGV->LEVEL[227] ;
}
/* fraction of agricultural inputs allocated to land development */
 {
  setpos( 118) ;
  x = 
  VGV->LEVEL[118] = TABLE(&VGV->TAB[15],(VGV->LEVEL[248]/VGV->LEVEL[247])) ;
}
/* current agricultural inputs */
 {
  setpos( 86) ;
  x = 
  VGV->LEVEL[86] = VGV->LEVEL[324]*(1.000000-VGV->LEVEL[118]) ;
}
/* death rate */
 {
  setpos( 87) ;
  x = 
  VGV->LEVEL[87] = VGV->LEVEL[322]*VGV->LEVEL[88]/VGV->LEVEL[285] ;
}
/* GDP per capita */
 {
  setpos( 148) ;
  x = 
  VGV->LEVEL[148] = TABLE(&VGV->TAB[25],VGV->LEVEL[177]/VGV->LEVEL[147]) ;
}
/* Education Index */
 {
  setpos( 102) ;
  x = 
  VGV->LEVEL[102] = TABLE(&VGV->TAB[8],VGV->LEVEL[148]/VGV->LEVEL[147]) ;
}
/* need for fertility control */
 {
  setpos( 258) ;
  x = 
  VGV->LEVEL[258] = (VGV->LEVEL[252]/VGV->LEVEL[100])-1.000000 ;
}
/* fraction services allocated to fertility control */
 {
  setpos( 145) ;
  x = 
  VGV->LEVEL[145] = TABLE(&VGV->TAB[24],VGV->LEVEL[258]) ;
}
/* service capital output ratio */
 {
  setpos( 312) ;
  x = 
  VGV->LEVEL[312] = IF_THEN_ELSE(VGV->LEVEL[0]>=VGV->LEVEL[283],VGV->LEVEL[314],VGV->LEVEL[313]) ;
}
/* service output */
 {
  setpos( 315) ;
  x = 
  VGV->LEVEL[315] = ((VGV->LEVEL[40]))*(VGV->LEVEL[81])/VGV->LEVEL[312] ;
}
/* service output per capita */
 {
  setpos( 316) ;
  x = 
  VGV->LEVEL[316] = VGV->LEVEL[315]/VGV->LEVEL[285] ;
}
/* fertility control allocation per capita */
 {
  setpos( 107) ;
  x = 
  VGV->LEVEL[107] = VGV->LEVEL[145]*VGV->LEVEL[316] ;
}
/* food ratio */
 {
  setpos( 116) ;
  x = 
  VGV->LEVEL[116] = VGV->LEVEL[115]/VGV->LEVEL[320] ;
}
/* indicated services output per capita 2 */
 {
  setpos( 162) ;
  x = 
  VGV->LEVEL[162] = TABLE(&VGV->TAB[30],VGV->LEVEL[177]/VGV->LEVEL[147]) ;
}
/* indicated services output per capita 1 */
 {
  setpos( 161) ;
  x = 
  VGV->LEVEL[161] = TABLE(&VGV->TAB[29],VGV->LEVEL[177]/VGV->LEVEL[147]) ;
}
/* indicated services output per capita */
 {
  setpos( 160) ;
  x = 
  VGV->LEVEL[160] = IF_THEN_ELSE(VGV->LEVEL[0]>=VGV->LEVEL[283],VGV->LEVEL[162],VGV->LEVEL[161]) ;
}
/* fraction of industrial output allocated to services 2 */
 {
  setpos( 138) ;
  x = 
  VGV->LEVEL[138] = TABLE(&VGV->TAB[22],VGV->LEVEL[316]/VGV->LEVEL[160]) ;
}
/* fraction of industrial output allocated to services 1 */
 {
  setpos( 137) ;
  x = 
  VGV->LEVEL[137] = TABLE(&VGV->TAB[21],VGV->LEVEL[316]/VGV->LEVEL[160]) ;
}
/* fraction of industrial output allocated to services */
 {
  setpos( 136) ;
  x = 
  VGV->LEVEL[136] = IF_THEN_ELSE(VGV->LEVEL[0]>=VGV->LEVEL[283],VGV->LEVEL[138],VGV->LEVEL[137]) ;
}
/* fraction of industrial output allocated to investment */
 {
  setpos( 135) ;
  x = 
  VGV->LEVEL[135] = (1.000000-VGV->LEVEL[127]-VGV->LEVEL[136]-VGV->LEVEL[130]) ;
}
/* fraction of output in agriculture */
 {
  setpos( 139) ;
  x = 
  VGV->LEVEL[139] = (VGV->LEVEL[291]*VGV->LEVEL[114])/(VGV->LEVEL[291]*VGV->LEVEL[114]+VGV->LEVEL[315
]+VGV->LEVEL[176]) ;
}
/* fraction of output in industry */
 {
  setpos( 140) ;
  x = 
  VGV->LEVEL[140] = VGV->LEVEL[176]/(VGV->LEVEL[291]*VGV->LEVEL[114]+VGV->LEVEL[315]+VGV->LEVEL[176])
 ;
}
/* fraction of output in services */
 {
  setpos( 141) ;
  x = 
  VGV->LEVEL[141] = VGV->LEVEL[315]/(VGV->LEVEL[291]*VGV->LEVEL[114]+VGV->LEVEL[315]+VGV->LEVEL[176])
 ;
}
/* GDP Index */
 {
  setpos( 146) ;
  x = 
  VGV->LEVEL[146] = LOG(VGV->LEVEL[148]/VGV->LEVEL[294],10.000000)/LOG(VGV->LEVEL[293]/VGV->LEVEL[294
],10.000000) ;
}
/* health services per capita */
 {
  setpos( 152) ;
  x = 
  VGV->LEVEL[152] = TABLE(&VGV->TAB[26],VGV->LEVEL[316]/VGV->LEVEL[147]) ;
}
/* Urban Land (GHA) */
 {
  setpos( 333) ;
  x = 
  VGV->LEVEL[333] = VGV->LEVEL[41]/VGV->LEVEL[149] ;
}
/* Human Ecological Footprint */
 {
  setpos( 153) ;
  x = 
  VGV->LEVEL[153] = (VGV->LEVEL[57]+VGV->LEVEL[333]+VGV->LEVEL[52])/VGV->LEVEL[326] ;
}
/* Life Expectancy Index */
 {
  setpos( 237) ;
  x = 
  VGV->LEVEL[237] = TABLE(&VGV->TAB[51],VGV->LEVEL[236]/VGV->LEVEL[259]) ;
}
/* Human Welfare Index */
 {
  setpos( 154) ;
  x = 
  VGV->LEVEL[154] = (VGV->LEVEL[237]+VGV->LEVEL[102]+VGV->LEVEL[146])/3.000000 ;
}
}
void mdl_func10(__GLOB_VARS *VGV) ;
void mdl_func10(__GLOB_VARS *VGV){double temp[10];
  double x ;
/* industrial capital depreciation */
 {
  setpos( 163) ;
  x = 
  VGV->LEVEL[163] = VGV->LEVEL[28]/VGV->LEVEL[67] ;
}
/* industrial capital investment */
 {
  setpos( 164) ;
  x = 
  VGV->LEVEL[164] = ((VGV->LEVEL[176]))*(VGV->LEVEL[135]) ;
}
/* jobs per industrial capital unit */
 {
  setpos( 200) ;
  x = 
  VGV->LEVEL[200] = (TABLE(&VGV->TAB[38],VGV->LEVEL[177]/VGV->LEVEL[147]))*0.001000 ;
}
/* potential jobs industrial sector */
 {
  setpos( 288) ;
  x = 
  VGV->LEVEL[288] = VGV->LEVEL[28]*VGV->LEVEL[200] ;
}
/* jobs per hectare */
 {
  setpos( 199) ;
  x = 
  VGV->LEVEL[199] = TABLE(&VGV->TAB[37],VGV->LEVEL[53]/VGV->LEVEL[328]) ;
}
/* potential jobs agricultural sector */
 {
  setpos( 287) ;
  x = 
  VGV->LEVEL[287] = ((VGV->LEVEL[199]))*(VGV->LEVEL[27]) ;
}
/* jobs per service capital unit */
 {
  setpos( 201) ;
  x = 
  VGV->LEVEL[201] = (TABLE(&VGV->TAB[39],VGV->LEVEL[316]/VGV->LEVEL[147]))*0.001000 ;
}
/* potential jobs service sector */
 {
  setpos( 289) ;
  x = 
  VGV->LEVEL[289] = ((VGV->LEVEL[40]))*(VGV->LEVEL[201]) ;
}
/* jobs */
 {
  setpos( 198) ;
  x = 
  VGV->LEVEL[198] = VGV->LEVEL[288]+VGV->LEVEL[287]+VGV->LEVEL[289] ;
}
/* labor force */
 {
  setpos( 202) ;
  x = 
  VGV->LEVEL[202] = (VGV->LEVEL[35]+VGV->LEVEL[36])*VGV->LEVEL[203] ;
}
/* labor utilization fraction */
 {
  setpos( 204) ;
  x = 
  VGV->LEVEL[204] = VGV->LEVEL[198]/VGV->LEVEL[202] ;
}
/* land development rate */
 {
  setpos( 206) ;
  x = 
  VGV->LEVEL[206] = VGV->LEVEL[324]*VGV->LEVEL[118]/VGV->LEVEL[101] ;
}
/* land erosion rate */
 {
  setpos( 207) ;
  x = 
  VGV->LEVEL[207] = VGV->LEVEL[27]/VGV->LEVEL[72] ;
}
/* land fertility degredation rate */
 {
  setpos( 209) ;
  x = 
  VGV->LEVEL[209] = TABLE(&VGV->TAB[40],VGV->LEVEL[272]) ;
}
/* land fertility degredation */
 {
  setpos( 208) ;
  x = 
  VGV->LEVEL[208] = VGV->LEVEL[29]*VGV->LEVEL[209] ;
}
/* land fertility regeneration time */
 {
  setpos( 211) ;
  x = 
  VGV->LEVEL[211] = TABLE(&VGV->TAB[41],VGV->LEVEL[119]) ;
}
/* land fertility regeneration */
 {
  setpos( 210) ;
  x = 
  VGV->LEVEL[210] = (VGV->LEVEL[181]-VGV->LEVEL[29])/VGV->LEVEL[211] ;
}
/* land fr cult */
 {
  setpos( 212) ;
  x = 
  VGV->LEVEL[212] = VGV->LEVEL[27]/VGV->LEVEL[290] ;
}
/* urban and industrial land required per capita */
 {
  setpos( 332) ;
  x = 
  VGV->LEVEL[332] = TABLE(&VGV->TAB[70],VGV->LEVEL[177]/VGV->LEVEL[147]) ;
}
/* urban and industrial land required */
 {
  setpos( 331) ;
  x = 
  VGV->LEVEL[331] = VGV->LEVEL[332]*VGV->LEVEL[285] ;
}
/* land removal for urban and industrial use */
 {
  setpos( 220) ;
  x = 
  VGV->LEVEL[220] = MAX(0,VGV->LEVEL[331]-VGV->LEVEL[41])/VGV->LEVEL[330] ;
}
/* land yield policy time s */
 {
  setpos( 230) ;
  x = 
  VGV->LEVEL[230] = IF_THEN_ELSE(VGV->LEVEL[309]==0||VGV->LEVEL[231]==1.000000,VGV->LEVEL[229],TABLE(
&VGV->TAB[48],VGV->LEVEL[309])) ;
}
/* land yield technology change rate multiplier 1 */
 {
  setpos( 234) ;
  x = 
  VGV->LEVEL[234] = TABLE(&VGV->TAB[49],VGV->LEVEL[97]-VGV->LEVEL[116]) ;
}
/* land yield technology change rate multiplier 2 */
 {
  setpos( 235) ;
  x = 
  VGV->LEVEL[235] = TABLE(&VGV->TAB[50],VGV->LEVEL[97]-VGV->LEVEL[116]) ;
}
/* land yield technology change rate multiplier */
 {
  setpos( 233) ;
  x = 
  VGV->LEVEL[233] = IF_THEN_ELSE(VGV->LEVEL[0]<VGV->LEVEL[230],VGV->LEVEL[234],VGV->LEVEL[235]) ;
}
/* land yield technology change rate */
 {
  setpos( 232) ;
  x = 
  VGV->LEVEL[232] = IF_THEN_ELSE(VGV->LEVEL[0]>=VGV->LEVEL[283],VGV->LEVEL[30]*VGV->LEVEL[233],0) ;
}
/* maturation 14 to 15 */
 {
  setpos( 249) ;
  x = 
  VGV->LEVEL[249] = ((VGV->LEVEL[34]))*(1.000000-VGV->LEVEL[254])/15.000000 ;
}
/* maturation 44 to 45 */
 {
  setpos( 250) ;
  x = 
  VGV->LEVEL[250] = ((VGV->LEVEL[35]))*(1.000000-VGV->LEVEL[255])/30.000000 ;
}
/* maturation 64 to 65 */
 {
  setpos( 251) ;
  x = 
  VGV->LEVEL[251] = ((VGV->LEVEL[36]))*(1.000000-VGV->LEVEL[256])/20.000000 ;
}
/* persistent pollution appearance rate */
 {
  setpos( 263) ;
  x = 
  VGV->LEVEL[263] = VGV->LEVEL[46] ;
}
/* persistent pollution assimilation rate */
 {
  setpos( 264) ;
  x = 
  VGV->LEVEL[264] = VGV->LEVEL[32]/(VGV->LEVEL[58]*1.400000) ;
}
/* persistent pollution intensity industry */
 {
  setpos( 273) ;
  x = 
  VGV->LEVEL[273] = VGV->LEVEL[269]*VGV->LEVEL[266]/VGV->LEVEL[176] ;
}
/* persistent pollution technology change time s */
 {
  setpos( 279) ;
  x = 
  VGV->LEVEL[279] = IF_THEN_ELSE(VGV->LEVEL[309]==0||VGV->LEVEL[280]==1.000000,VGV->LEVEL[278],TABLE(
&VGV->TAB[64],VGV->LEVEL[309])) ;
}
/* persistent pollution technology change multiplier 1 */
 {
  setpos( 275) ;
  x = 
  VGV->LEVEL[275] = TABLE(&VGV->TAB[62],1.000000-VGV->LEVEL[272]/VGV->LEVEL[98]) ;
}
/* persistent pollution technology change multiplier 2 */
 {
  setpos( 276) ;
  x = 
  VGV->LEVEL[276] = TABLE(&VGV->TAB[63],1.000000-VGV->LEVEL[272]/VGV->LEVEL[98]) ;
}
/* persistent pollution technology change multiplier */
 {
  setpos( 274) ;
  x = 
  VGV->LEVEL[274] = IF_THEN_ELSE(VGV->LEVEL[0]<VGV->LEVEL[279],VGV->LEVEL[275],VGV->LEVEL[276]) ;
}
/* persistent pollution technology change rate */
 {
  setpos( 277) ;
  x = 
  VGV->LEVEL[277] = IF_THEN_ELSE(VGV->LEVEL[0]>=VGV->LEVEL[283],VGV->LEVEL[33]*VGV->LEVEL[274],0) ;
}
/* resource technology change time s */
 {
  setpos( 301) ;
  x = 
  VGV->LEVEL[301] = IF_THEN_ELSE(VGV->LEVEL[309]==0||VGV->LEVEL[302]==1.000000,VGV->LEVEL[300],TABLE(
&VGV->TAB[68],VGV->LEVEL[309])) ;
}
/* resource usage rate */
 {
  setpos( 303) ;
  x = 
  VGV->LEVEL[303] = (((VGV->LEVEL[285]))*(VGV->LEVEL[260]))*(VGV->LEVEL[305]) ;
}
/* resource technology change rate multiplier 1 */
 {
  setpos( 298) ;
  x = 
  VGV->LEVEL[298] = TABLE(&VGV->TAB[66],1.000000-VGV->LEVEL[303]/VGV->LEVEL[99]) ;
}
/* resource technology change rate multiplier 2 */
 {
  setpos( 299) ;
  x = 
  VGV->LEVEL[299] = TABLE(&VGV->TAB[67],1.000000-VGV->LEVEL[303]/VGV->LEVEL[99]) ;
}
/* resource technology change rate multiplier */
 {
  setpos( 297) ;
  x = 
  VGV->LEVEL[297] = IF_THEN_ELSE(VGV->LEVEL[0]<VGV->LEVEL[301],VGV->LEVEL[298],VGV->LEVEL[299]) ;
}
/* resource technology change rate */
 {
  setpos( 296) ;
  x = 
  VGV->LEVEL[296] = IF_THEN_ELSE(VGV->LEVEL[0]>=VGV->LEVEL[283],VGV->LEVEL[39]*VGV->LEVEL[297],0) ;
}
/* resource use intensity */
 {
  setpos( 307) ;
  x = 
  VGV->LEVEL[307] = VGV->LEVEL[303]/VGV->LEVEL[176] ;
}
/* SAVEPER */
 {
  setpos( 308) ;
  x = 
  VGV->LEVEL[308] = VGV->LEVEL[323] ;
}
/* service capital depreciation */
 {
  setpos( 310) ;
  x = 
  VGV->LEVEL[310] = VGV->LEVEL[40]/VGV->LEVEL[74] ;
}
/* service capital investment */
 {
  setpos( 311) ;
  x = 
  VGV->LEVEL[311] = ((VGV->LEVEL[176]))*(VGV->LEVEL[136]) ;
}
} /* Auxiliary variable equations comp_aux */
int execute_curloop(__GLOB_VARS *VGV) {return(0);}
static void vec_arglist_init(__GLOB_VARS *VGV)
{
}
void VEFCC comp_rate(__GLOB_VARS *VGV)
{
mdl_func0(VGV);
}

void VEFCC comp_delay(__GLOB_VARS *VGV)
{
mdl_func1(VGV);
}

void VEFCC init_time(__GLOB_VARS *VGV)
{
mdl_func2(VGV);
}

void VEFCC init_tstep(__GLOB_VARS *VGV)
{
mdl_func3(VGV);
}

void VEFCC comp_init(__GLOB_VARS *VGV)
{
mdl_func4(VGV);
mdl_func5(VGV);
}

void VEFCC comp_reinit(__GLOB_VARS *VGV)
{
mdl_func6(VGV);
}

void VEFCC comp_tstep(__GLOB_VARS *VGV)
{
mdl_func7(VGV);
}

void VEFCC comp_aux(__GLOB_VARS *VGV)
{
mdl_func8(VGV);
mdl_func9(VGV);
mdl_func10(VGV);
}

