24.08.2013 Views

VISSIM 5.30-05 User Manual

VISSIM 5.30-05 User Manual

VISSIM 5.30-05 User Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

3.5 The COM Interface (Optional Module)<br />

The COM Interface (Optional Module)<br />

<strong>VISSIM</strong> offers an additional module which provides COM (component object<br />

model) functionality for use with external programming environments (e.g.<br />

VBA in Microsoft Excel). This way it is possible to automate certain tasks<br />

in <strong>VISSIM</strong> by executing COM commands from an external program.<br />

A list of all available functions and commands in the COM interface is<br />

included in the documentation <strong>VISSIM</strong>_COM.PDF which is contained in the<br />

folder \DOC.<br />

Please note that neither the external COM interface nor the SCRIPTS menu is<br />

provided with <strong>VISSIM</strong> demo or viewer versions, cf. section 2.4.<br />

3.5.1 Loading and Running Scripts in <strong>VISSIM</strong><br />

Example<br />

*.VBS<br />

External scripts can be read from file interactively via<br />

menu SCRIPTS - RUN SCRIPT FILE.<br />

The execution of the script will start automatically then.<br />

Open script file<br />

► Click menu SCRIPTS – RUN SCRIPT FILE.<br />

► The window Open Script File appears.<br />

► Select a file and click OPEN.<br />

In <strong>VISSIM</strong>, script files have the extensions *.VBS, *.JS, *.PYS or *.PY.<br />

Notes to users starting a script file interactively<br />

The global variable Vissim can be used throughout the script without prior<br />

initialization. It always refers to the <strong>VISSIM</strong> instance from which the script is<br />

run.<br />

This object Vissim on top of the script file has not been created with<br />

CreateObject, because <strong>VISSIM</strong> is already running (it is possible however, to<br />

do so if further Vissim instances are needed in the script). Scripts can use<br />

the entire command set of the Visual Basic Scripting Edition (VBS), e.g.<br />

loops, if-then-else, I/O functions and error handling. Scripts may not contain<br />

any global declarations.<br />

This script serves for dividing all input flow volumes by two:<br />

Set all_flows = <strong>VISSIM</strong>.Net.VehicleInputs<br />

For i = 1 To all_flows.Count<br />

all_flows(i).AttValue("VOLUME") = 0.5 * all_flows(i).AttValue("VOLUME")<br />

Next<br />

<strong>User</strong> <strong>Manual</strong> © PTV AG 2011 57

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!