Skip to content

Latest commit

 

History

History
123 lines (89 loc) · 3.84 KB

README.md

File metadata and controls

123 lines (89 loc) · 3.84 KB

TMG.EMME

This repository contains two tightly integrated software packages. The first is TMGToolbox2 for EMME, a toolbox for working with Inro's EMME software. The second is TMG.EMME a set of modules for XTMF2 to call the TMGToolbox2 in order to iterate them into larger model systems.

In addition to XTMF2 this repository depends on the TMG-Framework repository for integrating into larger model systems.

Building TMG.EMME

Requirements

  1. DotNet Core 3.0 SDK
  2. EMME version 4.4.2 or above.

Clone the TMG.EMME repository

git clone https://github.com/TravelModellingGroup/TMG.EMME

Update Submodules

git submodule update --recursive --remote

Building

There are two steps for compiling. First we can compile TMG.EMME's modules for XTMF2. The second step is to create a toolbox for EMME. There are two batch files for automating that call inside of the TMGToolbox2. "Build Toolbox.bat" will create a toolbox that references the files within the TMGToolbox2 project. This toolbox is not portable to other machines. In order to compile a portable toolbox use "Build Consolidated Toolbox.bat". If you build a consolidated toolbox you will need to rebuild it every time you alter the TMGToolbox2 source code.

cd TMG.EMME
dotnet build --configuration Release
cd TMGToolbox2
"Build Toolbox.bat"

Testing

Initial Setup

TMG.EMME's unit tests are currently setup to expect a EMME project named DebugProject inside of the test project configuration's output directory. That project will then need to have a reference to a the built 'TMG_Toolbox.mtbx' that was created from running either "Build Toolbox.bat" or "Build Consolidated Toolbox.bat". If you are going to be editing the toolbox's source code it is recommended to use "Build Toolbox.bat" so you only need to rebuild it if you add or remove a tool.

The recommended database dimensions for the DebugProject is shown below:

Component Dimension
Scenarios 5
Full matrices 10
Centroids 3750
Regular nodes 43124
Links 187500
Transit vehicles 30
Transit lines 15000
Transit segments 600000
Extra attribute values 5000000

Unit Tests

In addition to the command below you will also need to have an active license for EMME.

cd TMG.EMME
dotnet test

TMGToolbox2 for EMME tool Format

Overview

Tools in the TMGToolbox2 are designed to have up to three entry points. They are:

  1. run() - An entry point called when using the Modeller interface from within EMME.
  2. __call__() - An entry point for scripting the tool into a Python script.
  3. run_xtmf() - An entry point for being called from XTMF2.

Example

In the following example we are going to see a tool that implements all three entry points. If a tool does not make sense to be included with a Python script, or XTMF2 please do not implement those functions.

import inro.modeller as _m
_tmg_tpb = _MODELLER.module('tmg2.utilities.TMG_tool_page_builder')
class HelloWorld(m.tool()):

  version = '1.0.0'

  def __init__(self):
    pass

  def page(self):
    pb = _tmg_tpb.TmgToolPageBuilder(self, 
             title="Hello World v%s" % self.version,
             description="Prints out a Hello world for each entry point.",
             branding_text="- TMG Toolbox")
    return pb.render()

  # The entry point for Modeller
  def run(self):
    print "Hello World, Modeller!"

  # The entry point for a Python script
  def __call__(self):
    print "Hello World, Python Script!"

  # The entry point for a call from XTMF2
  def run_xtmf(self, parameters):
    # parameters is a parsed JSON object
    print "Hello World, XTMF2"