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.
- DotNet Core 3.0 SDK
- EMME version 4.4.2 or above.
git submodule update --recursive --remote
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"
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 |
In addition to the command below you will also need to have an active license for EMME.
cd TMG.EMME
dotnet test
Tools in the TMGToolbox2 are designed to have up to three entry points. They are:
- run() - An entry point called when using the Modeller interface from within EMME.
- __call__() - An entry point for scripting the tool into a Python script.
- run_xtmf() - An entry point for being called from XTMF2.
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"