90 likes | 272 Views
GAMS Links. Text Excel Graphics Geographic Maps Powerpoint. Text Output. SET set1 /labor, water/ PARAMETER value(set1); value(set1) = ord(set1); FILE output1 /name.txt/; PUT output1; Output1.lw=0; Output1.nd=2; LOOP(set1, PUT @3 set1.tl," has a value of ",value(set1) /; );
E N D
GAMS Links Text Excel Graphics Geographic Maps Powerpoint
Text Output SET set1 /labor, water/ PARAMETER value(set1); value(set1) = ord(set1); FILE output1 /name.txt/; PUT output1; Output1.lw=0; Output1.nd=2; LOOP(set1, PUT @3 set1.tl," has a value of ",value(set1) /; ); PUTCLOSE;
Text Input $call awk -f script.awk data.txt > data.gms Raw data in text format Processed data in GAMS format
Load Input from Excel Parameter NewData(Set1,Index2); $CALL GDXXRW data.xls Par=NewData Rng=Sheet1!a1:e15 Rdim=1 Cdim=1 $GDXIN Data.gdx $LOAD NewData $GDXIN This statement must remain on one single line!
GAMS Example SETS Period, Region, Soil, Crop; Parameter water_report(period,region,soil,crop); $CALL GDXXRW landmodel.xls DSet=crop Rng=water!d1:f1 Rdim=0 Cdim=1 DSet=soil Rng=water!c2 Rdim=1 Cdim=0 DSet=period Rng=water!a2 Rdim=1 Cdim=0 DSet=region Rng=water!b2 Rdim=1 Cdim=0 Par=water_report Rng=water!a1 Rdim=3 Cdim=1 $GDXIN landmodel.gdx $LOAD period region soil crop water_report $GDXIN DISPLAY water_report;
Save Output to Excel Parameter water_report(period,region,soil,crop); water_report(period,region,soil,crop) = …; Execute_Unload 'model_report' water_report; Execute 'gdxxrw model_report.gdx Output=landmodel.xls Par=water_report Rng=water!A1 Rdim=3 Cdim=1'; This statement must remain on one single line!
GAMS Example SETS Period /January,March/ Region /World,Austria,Kenya/ Soil /Sand,Clay/ Crop /Cassava,Turnips,Figus/ ; Parameter water_report(period,region,soil,crop); water_report(period,region,soil,crop) = normal(200,10); Execute_Unload 'model_report' water_report; Execute 'gdxxrw model_report.gdx Output=landmodel.xls Par=water_report Rng=water!A1 Rdim=3 Cdim=1';