Title: Automated Plotting with the Emme Desktop API
1Automated Plotting with the Emme Desktop API
- Peter HidasBureau of Transport Statistics
- Transport NSW
2Plotting in the Emme3 Desktop
- Emme Desktop provides excellent plotting
functionality - A wide range of model outputs can be represented
graphically - Frequent request for STM outputs
- Examples
3STM plots Road V/C-ratios
4STM plots Rail V/C-ratios
5STM plots Rail Stn Entries
6STM plots PT Time Savings
7STM plots PT mode share
8STM plots Access to Jobs
9Plotting in STM projects
- STM projects scenario modelling
- Up to 30-50 scenarios
- Steady increase in request for thematic plots
- Manual plotting
- Slow, expensive, error-prone
- Solution
- Automation
10Emme Desktop API
- Allows automation of user interaction with the
Emme Desktop GUI - Using Python scripts
- Easy to learn
- Basic knowledge of Python language
- Desktop API Guide and Reference
- Practical Example
- Develop own scripts
11Plotting Script
- Aim
- Automate frequent plotting tasks
- Create a reusable script for a variety of tasks
- Solution
- Separate the code from the input data
- Create an easy coding system for the input data
- Outcome
- make_plots.py
12make_plots.py (version 1)
- Based on Desktop API Reference
- Functions
- Connect to Emme Application
- Activate a Database
- Open a Worksheet
- Apply a View
- Set Base Scenario
- Set Active Scenario
- Set Path to save plot files
- Export Screen View
- Process input data
13Coding the Input Data
- Based on Emme input coding principle
- Use the first character in a line to identify the
type of input - Codes used
- p ltproject filenamegt or open
- d ltdatabase titlegt
- f ltfolder path to save filesgt
- w ltworksheet namegt
- v ltview namegt
- b ltbase scenario numbergt
- s ltscenario numbergt ltscenario numbergt
- Lines starting with any other character are
ignored
14The Process Input Data Code
- Read input file line by line
- Split the line by space list of words
- If line0 p
- call setApp function with rest of the line as
project name OR open - If line0 d
- call setDatabase function with rest of the line
as database title - Etc
15Example Input Data Code
16Make_plots (v1) Evaluation
- Worked well for simple cases
- Limitations
- Only works with predefined fix worksheets
- without any change in parameters
- Needs automated Legend Title updating done by
Emme synchronization - Problems with bandwidth scaling
- fixed or automatically updated
17Make_Plots.py (version 2)
- Additional functions coded
- Force synchronisation of Legend Title
- not working?
- Set Legend Title
- Set values in layer parameters
- Define new input codes
- use first word instead of first character
18Example plot bus services
- Bus services by Bus Contract Region
- Special coding
- Select bus itins by region code
- Set view boundaries move with selected bus itins
19Input Code for Bus regions
New input code r for region call plotRegions
function with list of regions as input
20Version 3 set Title, scale, etc
- Many plots using same worksheet
- Combine input data for one plot in same line
separated by - New input code plot
- Input line structure
- plot ltTitlegtltdataFilegtltscalegtltFileNamegt
21Example Input Code
parts of the Legend Title
22Summary - Current Status
- Work in progress
- Updated/improved for each new task
- Issues
- bandwidth scale setting
- synchronization
- layer parameter names
- maximize worksheet window in Emme
- switch off panels (left/right)
- maximize Emme window
- integrate with Emme data (e.g. PT services)