交通技术。
设为首页
收藏本页
联系我们
首页 >> 软件技术 >> 规划软件 >> 正文
推荐新闻
APTA Online Publications and S
美国BRT资源
2005年中国物流行业的五大特点和
我国应加大对物流新技术进行基础
2005年中国物流行业的五大特点和
我国应加大对物流新技术进行基础
GIS based Road Information and
Evaluation of Accident Black S
Representing ride check survey
Optimization of GIS Informatio
新闻搜索
专题文章导航

拥挤收费 十一五规划
PTV EMME2
TRANSCAD TOD
交通白皮书 交通影响分析
停车换乘P&R 快速公交BRT



 
EMME/2常见问题解答8:Macros
[ 作者: | 来源:emme2官方网站 | 时间:2005-12-19 17:52:00 ]

8.0.1: Why is my macro running with no problem interactively but stops when running it in batch mode?

The reason is that the EMME/2 literal differs slightly when run in batch. Please refer to the EMME/2 User's Manual, Chapter 2, Section 2.3.6 Executing EMME/2 in batch mode (UNIX). Be sure to include a test before the answer to a question that will not appear in batch mode. For example, the following macro will work in both interactive or batch modes:

2.11
~?q=2
2

8.0.2: How can I redirect the output of a macro to a file?

Assuming the macro starts at the main menu level (Module 0.00):

Note that, when calling emme2 with the 000 (module number) option, the usual data bank validation is not performed and the log book is not updated. Therefore, it is recommended that you enter and quit emme2 with no option, prior to calling a macro using emme2 000.

8.0.3: I have a macro which requires 8 arguments. This macro used to run perfectly well until I moved it in a new directory. Now, it seems that the last argument is lost when I recall the macro. What is the problem?

Since your macro needs 8 arguments, the length of the macro line may be quite long and it is probable that, by changing the path for your macro, the macro line then exceeded the limit of 128 characters. This could also happen if the macro was renamed with a longer name or if the length of the macro parameters was longer.

8.0.4: Under DOS, I cannot specify more than 8 parameters for a macro called from the emme2 command line. What is the problem?

The maximum number of macro parameters which can be processed via the DOS emme2.bat command is 8. This is because a DOS command can have a maximum of 9 parameters (%1 to %9); so, emme2.bat can accept only the macro filename and 8 macro parameters (%1% to %8%).

On the other hand, since Release 9, if a macro is called from within EMME/2, it can access up to 32 parameters (%1% to %32%).

Here is an example:

The simple macro (referred to as simple.mac):

~/ %0% %1% %2% %3% %4% %5% %6% %7% %8% %9% %10%
~/ %0% %11% %12% %13% %14% %15% %16% %17% %18% %19% %20%
~/ %0% %21% %22% %23% %24% %25% %26% %27% %28% %29% %30%
~/ %0% %31% %32%

should display the list of the 32 parameters:

<~/ 32 1 2 3 4 5 6 7 8 9 10
<~/ 32 11 12 13 14 15 16 17 18 19 20
<~/ 32 21 22 23 24 25 26 27 28 29 30
<~/ 32 31 32

If the macro is called with the 32 parameters directly from the DOS prompt or from a batch file:

  • DOS prompt:
    emme2 -m simple.mac 1 2 3 4 5 6 7 ... 25 26 27 28 29 30 31 32

  • batch file:
    call emme2 -m simple.mac 1 2 3 4 5 6 7 ... 25 26 27 28 29 30 31 32

    the result will be:

    <~/ 8 1 2 3 4 5 6 7 8
    <~/ 8
    <~/ 8
    <~/ 8

    instead of the one expected. Unfortunately, as explained above, this is due to the DOS limitation.

However, it is possible to circumvent this problem by creating a macro with 32 parameters that can be called from within EMME/2, as follows:

  • create a starting macro (referred to as starting.mac) which contains the original line that was in the batch file, slightly modified. Starting mac should contain the line:
    ~< simple.mac 1 2 3 4 5 6 7 ... 25 26 27 28 29 30 31 32

  • in the batch file, call the macro starting.mac which has no parameters (instead of the macro simple.mac):
    call emme2 -m starting.mac

    The result will be:

    <~/ 32 1 2 3 4 5 6 7 8 9 10
    <~/ 32 11 12 13 14 15 16 17 18 19 20
    <~/ 32 21 22 23 24 25 26 27 28 29 30
    <~/ 32 31 32


 
上一篇:EMME/2常见问题解答7:Plot Manipulations
下一篇:EMME/2常见问题解答9:Data Banks
[打印本页]  [关闭窗口]  [返回顶部]
特别声明:本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有, 本站不凭借所收集资料获取商业利益。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。 本站所有技术文章、专业软件资料仅供技术人员、高校师生学习交流之用,目的旨在促进与提高中国的交通技术水平;用户获取后不得用于商业目的,否则,所产生的法律责任本站概不负责。