Cex2.gms : 전문가 수준 C API를 테스트하여 GDX를 읽고 쓰고, 옵션을 설정하고 메가 슬롯를 실행합니다.

설명

기고자: Lutz Westermann, 2012년 10월

소형 모델 유형 :C 및 CPP


카테고리 : 메가 슬롯 API 라이브러리


메인 파일 : Cex2.gms

$title 'GDX를 읽고 쓰고, 옵션을 설정하고 메가 슬롯를 실행하기 위한 전문가 수준 C API 테스트' (CEX2,SEQ=14)

$onText
기고자: Lutz Westermann, 2012년 10월
$offText

$set srcRoot %메가 슬롯sysdir%apifiles%system.dirsep%C%system.dirsep%

$ifThen %system.filesys% == UNIX
$ 설정되지 않은 경우 COMPILER $set COMPILER GNU
$else
$ 설정되지 않은 경우 COMPILER $set COMPILER INTEL
$endIf

$ifThen %COMPILER% == GNU
$ CCOMP gcc 설정
$ ifThen %system.filesys% == UNIX
$ OUT 설정 -oxp_example2
$ 플래그 설정 -ldl -lpthread
$ 다른
$ OUT 설정 -oxp_example2.exe
$ 플래그 설정
$ endIf
$elseIf %COMPILER% == INTEL
$ CCOMP cl 설정
$ 플래그 설정
$ OUT 설정 -Fexp_example2.exe
$else
$ 중단 알 수 없는 컴파일러: %COMPILER%
$endIf

$call rm -rf Demanddata.gdx

$call.checkErrorLevel cp "%srcRoot%api%system.dirsep%gdxcc.c" .
$call.checkErrorLevel cp "%srcRoot%api%system.dirsep%optcc.c" .
$call.checkErrorLevel cp "%srcRoot%xp_example2.c" .
$call %CCOMP% xp_example2.c gdxcc.c optcc.c -I"%srcRoot%api" %OUT% %FLAGS%
$if errorlevel 1 $abort 'xp_example2.c 컴파일 문제'
$call .%system.dirsep%xp_example2 "%메가 슬롯sysdir%." model2.gms
$if errorlevel 1 $abort 'xp_example2 실행 문제'
$call gdxdiffdemanddata.gdxdemandwant.gdx
$if errorlevel 1 $abort '수요 데이터가 예상과 다릅니다.'