Frank Milthorpe 27 May 2011 Suite of Emme Macros to Enable Flexible Specification of Multiple Data Sources.

Slides:



Advertisements
Similar presentations
NAGIOS AND CACTI NETWORK MANAGEMENT AND MONITORING SYSTEMS.
Advertisements

© 2007 Eaton Corporation. All rights reserved. LabVIEW State Machine Architectures Presented By Scott Sirrine Eaton Corporation.
1 Chapter 16 Tuning RMAN. 2 Background One of the hardest chapters to develop material for Tuning RMAN can sometimes be difficult Authors tried to capture.
SERVICE MANAGER 9.2 VIEWS AND REPORTS July, 2011.
Using Asterisk to Implement Intelligent Call Center Solutions James Kleckner AMTELCO.
HWg-PDMS: New software Poseidon & Damocles Monitoring System 1 Included on every HWg DVD since September 2009.
Utilizing the GDB debugger to analyze programs Background and application.
Copyright © CAD-Computer GmbH & Co. KG January 2009 All rights reserved, property and © CAD-Computer GmbH & Co.KG 2009.
Water Quality Exchange XML Generation Tool A First Look November 28, 2007 Dwane Young, Office of Water, U.S. EPA Ryan Jorgensen, Gold Systems.
Data Management Seminar, 8-11th July 2008, Hamburg 1 WinW3S - Translation of Forms and Labels (Mail Merge)
8 Copyright © 2004, Oracle. All rights reserved. Creating LOVs and Editors.
Classmarker.com The Best Online Testing for Business and Education Group 4  Alifah Nuzulul Suwandi  Kartika Aprilianti  Nadiah Putri  Siti Resza Sani.
HomeViews: P2P Middleware for Personal Data Sharing Applications Roxana Geambasu, Magdalena Balazinska, Steve Gribble, Hank Levy University of Washington.
South Dakota Library Network ALEPH v21 Staff User Upgrade Information Circulation and ILL South Dakota Library Network 1200 University, Unit 9672 Spearfish,
Oracle HTMLDB introduction IT-AIS-HR Giovanni Chierico 1/16 Oracle HTMLDB introduction CERN Oracle Developers Forum: May 12 th 2005.
UIS Data Transformation and Validations As it pertains to the SDMX TWG EXL Initiative.
Sydney Strategic Travel Model Frank Milthorpe Transport Modelling Manager Transport Data Centre NSW Department of Transport Presentation to Sydney Emme/2.
Shadow Security Scanner Li,Guorui. Introduction Remote computer vulnerabilities scanner Runs on Windows Operating Systems SSS also scans servers built.
Y. Kotani · F. Ino · K. Hagihara Springer Science + Business Media B.V Reporter: 李長霖.
Combining survey and administrative data to create a new input data file for National Accounts processes Shaun McLaughlin Central Statistics Office, Ireland.
Running Kuali: A Technical Perspective Ailish Byrne - Indiana University Jay Sissom - Indiana University Foundation.
CSC 3210 Computer Organization and Programming Chapter 1 THE COMPUTER D.M. Rasanjalee Himali.
All rights reserved, property and © CAD Computer GmbH & Co.KG 2009 Cover page.
interactive logbook Larry Bridgefoot Paul Kiddie Neil Sandle Tom Marianczak Dan Williams Chet.
Populating a Data Warehouse. Overview Process Overview Methods of Populating a Data Warehouse Tools for Populating a Data Warehouse Populating a Data.
The Fast Optimal Voltage Partitioning Algorithm For Peak Power Density Minimization Jia Wang, Shiyan Hu Department of Electrical and Computer Engineering.
Dreamweaver MX. 2 Overview of Templates n Forms enable you to collect data from ______. n A form contains ________ such as text fields, radio buttons,
Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.
18 April 2005CSci 210 Spring Design Patterns 1 CSci 210.
Calculation of Net Energy for Load COPS. 2 2 Outline  Definition of Net Energy for Load  How Net Energy for Load is calculated in ERCOT.
Chapter 4: Threads. 4.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th edition, Jan 23, 2005 Chapter 4: Threads Overview Multithreading.
1 Writing Basic SQL Statements. 1-2 Objectives At the end of this lesson, you should be able to: List the capabilities of SQL SELECT statements Execute.
Project 1: Using Arrays and Manipulating Strings Essentials for Design JavaScript Level Two Michael Brooks.
Server-side Programming The combination of –HTML –JavaScript –DOM is sometimes referred to as Dynamic HTML (DHTML) Web pages that include scripting are.
Running Kuali: A Technical Perspective Ailish Byrne (Indiana University) Jonathan Keller (University of California, Davis)
CPSC 203 Introduction to Computers T59 & T64 By Jie (Jeff) Gao.
Creating FunctionstMyn1 Creating Functions Function can be divided into two groups: –Internal (built in) functions –User-defined functions.
EGR 115 Introduction to Computing for Engineers Loops and Vectorization – Part 3 Friday 17 Oct 2014 EGR 115 Introduction to Computing for Engineers.
CHAPTER 7 LESSON C Creating Database Reports. Lesson C Objectives  Display image data in a report  Manually create queries and data links  Create summary.
Dept. of Animal Breeding and Genetics Programming basics & introduction to PERL Mats Pettersson.
WMS baseline issues in Atlas Miguel Branco Alessandro De Salvo Outline  The Atlas Production System  WMS baseline issues in Atlas.
AliRoot Classes for access to Calibration and Alignment objects Magali Gruwé CERN PH/AIP ALICE Offline Meeting February 17 th 2005 To be presented to detector.
CS 281 – Fall 2010 Lab 4 Parametric Query and Forms in MS Access.
Overview of NSA Security Enhanced Linux Russell Coker.
Node.js Modules Header Mastering Node.js, Part 2 Eric W. Greene
Computer Fundamentals
Creating LOVs and Editors
Play Framework: Introduction
Thread Programming.
Creating an Oracle Database
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment Chapter 4: Implementing and Managing Group and Computer Accounts.
What’s New in Universal Access for ADP Workforce Now
AUTOCALL MACROS- A QUICK OVERVIEW
Single Event Upset Simulation
Automating SAS through the Power of VB Script
Implementing and Managing Group and Computer Accounts
Text for section 1 1 Text for section 2 2 Text for section 3 3
Text for section 1 1 Text for section 2 2 Text for section 3 3
Loading… Please Wait $ $ $100 $100 $100 $100 $100 $200 $200 $200 $200 $300 $300 $300 $300 $300 $400 $400 $400 $400 $400 $500 $500 $500 $500 $500.
Text for section 1 1 Text for section 2 2 Text for section 3 3
Text for section 1 1 Text for section 2 2 Text for section 3 3
HWg-PDMS: New software
Text for section 1 1 Text for section 2 2 Text for section 3 3
Text for section 1 1 Text for section 2 2 Text for section 3 3
Text for section 1 1 Text for section 2 2 Text for section 3 3
Text for section 1 1 Text for section 2 2 Text for section 3 3
Text for section 1 1 Text for section 2 2 Text for section 3 3
Status and plans for bookkeeping system and production tools
Text for section 1 1 Text for section 2 2 Text for section 3 3
Selenium IDE Installation and Use.
Presentation transcript:

Frank Milthorpe 27 May 2011 Suite of Emme Macros to Enable Flexible Specification of Multiple Data Sources

Outline 1.Goals 2.Text registers within Emme 3.Implementation Approach 4.Conclusions 5.Listing of macros

Goals Flexible definition of input data Easy to distinguish differences between model runs Implemented within Emme macros

Overview of Desired Specification Run 1 Standard Inputs except Employment_A Run 2 Standard Inputs except Population_B Employment_C

Text Registers t1.. t9 are text registers available t9 is global t1.. t8 local registers –can ’ t return arguments Can ’ t “ load-up ” registers with filenames from a lower macro

Implementation Approach Create a LIFO (last in first out) text file Write to text file with label and filename Read the text file in appropriate macro to retrieve and return filename via t9 Also allows an audit trail

Example Data File Created start_default === 27-Apr :23 zonal_data M:\STM_Core\Inputs\ZonalMtx\ emp_data M:\STM_Core\Inputs\Employment\2009_Oct\ pop_adjust_file m:\stm_gma\lu_adjust\pop_adjust_default.mtx emp_adjust_file m:\stm_gma\lu_adjust\emp_adjust_default.mtx timeskim_busonly_macro tskimfac carskim_data M:\STM_Core\Inputs\Calibration_data\Dec_09\ end_default === pop_adjust_file M:\Myproject\PopFac_2011.mtx carskim_data M:\Myproject\carskim_matrices\

Reading Data ~/... Start of macro read_emp.mac %ms02%... ~# ~t2=%t1%read_emp.rep ~<ifexist_delete %t2% reports=%t2% ~# batchin=? ~# ~# --- Find directory for the data ~<get_data_source_item emp_data ~<stm_log emp_data %t9% ~# ~t3=%t9% ~# ~# --- Non-Manufacturing employment: md3 --- ~+;3.11;%t3%nonmanemp%ms02%.mtx;2; ~#

Conclusions Macro suite designed and implemented to meet requirements Can be a filename or a directory Can be adapted for other purposes (eg specify assignment parameters) Text file provides an audit log of specifications

Core Macros delete_data_source_stackDelete the data_source_stack file create_data_source_stackCreate data_source_stack file write_data_sourceWrite an item to a data_source_stack file get_data_source_itemFind a return value for data item strip_leading_blanks Trim the leading spaces from a text string

delete_data_source_stack.mac ~:start ~/... Start of macro delete_data_source_stack.mac... ~# ~<ifexist_delete stmaudit\data_source_stack.dat ~# ~/... End of macro delete_data_source_stack.mac...

create_data_source_stack.mac ~:start ~/... Start of macro create_data_source_stack.mac... ~# ~<ifexist_delete stmaudit\data_source_stack.dat ~# ~# Write something to the data_stack to ensure other macros ~# have a file to open. ~# ~<make_directory stmaudit ~# ~<get_date_time ~<write_data_source data_stack_created %t9% ~# ~/... End of macro create_data_source_stack.mac...

write_data_source.mac Example macro call write_data_source %1% %2% %1% - source_name %2% - directory (or other item) eg ~<write_data_source pop_data m:\popdata\2008\ ~:start ~/... Start of macro write_data_source.mac %t0%... ~# ~t1=stmaudit\data_source_stack.dat ~t2=%t0% ~# ~# Strip leading blanks ~:continue_stripping ~t3=%t2.1% ~+;~?!t3= ;~$>stripped ~+;~t2=%t2.-1%;~$continue_stripping ~# ~:stripped ~# Write to output file ~+;~>>%t1%;~"%t2%;~>

get_data_source_item.mac (1) ~$>start Emme/2 macro "get_data_source_item.mac" Macro to obtain answer (normally directory) for a data item written to the data_source file. This is the last entry written. N.B. If macro used the first entry this may not be the entry that is needed. For example if the model was rerun with different defaults and the stack was not deleted, it would return the first (and wrong original entry). Example macro call ~<get_data_source %1% %1% - source_name ~<get_data_source pop_data Returns %t9% Item (directory or other data label)

get_data_source_item.mac (2) ~:start ~/... Start of macro get_data_source_item.mac %t0%... ~# ~t1=stmaudit\data_source_stack.dat ~# ~# --- Find length of macro argument %1% store in %x% ~t2=%1% ~# ~x=-1 ~:continue_counting ~x+1 ~t3=%t2.1% ~+;~?t3= ;~$>counted ~+;~t2=%t2.-1%;~$continue_counting ~# ~:counted ~# ~# length of argument %1% is %x% ~#

get_data_source_item.mac (3) ~# --- Find line in file with source_name ~# ~# t8 - line of data read in ~# t7 - line of data with a match ~# t3 - substring of t8 for trial match to source_name %1% ~# r1 - count of entries found (set to zero initially) ~# ~r1=0 ~# ~:process_line ~+;~?e;~$>end_of_file ~+;~t3=%%t8.%x%% ~+;~?t3=%1%;~t7=%t8% ~+;~?t3=%1%;~r1+1 ~$process_line ~# ~:end_of_file ~#

get_data_source_item.mac (4) ~# Was the source_name found? ~+;~?r1>0;~$>found ~# ~:not_found ~/ did not find %1% in get_data_source_item ~t9=Error %1% Not found in get_data_source_item ~$>end ~# ~:found ~# --- Extract the item label (probably directory) ~# remove first %x% chars ~+;~t2=%%t7.-%x%% ~# ~# remove leading blanks ~# result is returned in %t9% ~<strip_leading_blanks %t2% ~# returned value is %t9% ~:end ~# Close file ~> ~/... End of macro get_data_source_item.mac %1% %t9%...

Strip_leading_blanks.mac ~:start ~# Does this macro have an argument passed to it? ~x=%0% ~+;~?x>0;~$>valid_argument ~# No argument - nothing to strip ~t9=%t0% ~# ~$>end ~:valid_argument ~# remove leading blanks if they exist ~t2=%t0% ~:continue_stripping ~t3=%t2.1% ~+;~?!t3= ;~$>stripped ~+;~t2=%t2.-1%;~$continue_stripping ~:stripped ~t9=%t2% ~:end ~# returned value t9 is:%t9% ~#... End of macro stip_leading_blank.mac %t9%...

Implementation Macros set_default_data_sourcesWrite the default data sources to data_source_stack file read_empMacro to read employment matrices (similar macros exist to read other data files)

set_default_data_sources.mac ~/... Start of macro set_default_data_sources.mac... ~# ~# Make sure directory where data_source_stack.dat resides exists ~<make_directory stmaudit ~# ~# Delete data source stack if it exists (NOT IMPLEMENTED) ~# Stack operates as a permanent record, use last occurance of keyword ~# ~<get_date_time ~<write_data_source start_default === %t9% ~# ~# --- Set the default data sources ~<write_data_source zonal_data M:\STM_Core\Inputs\ZonalMtx\ ~<write_data_source emp_data M:\Inputs\Employment\2009_Oct\ ~<write_data_source lu_internal_data m:\stm\march_2005_gma\ and etc as per user needs

read_emp.mac ~:start ~/... Start of macro read_emp.mac %ms02%... ~# ~t2=%t1%read_emp.rep ~<ifexist_delete %t2% reports=%t2% ~# batchin=? ~# ~# --- Find directory for the data ~<get_data_source_item emp_data ~<stm_log emp_data %t9% ~# ~t3=%t9% ~# ~# --- Non-Manufacturing employment: md3 --- ~+;3.11;%t3%nonmanemp%ms02%.mtx;2; ~#

General Utility Macros ifexist_deleteDelete a file if it exists get_date_timeObtain and return the date and time make_directoryCreate a DOS directory stm_logWrite to logbook and a DOS file waitWait a specified number of seconds

ifexist_delete.mac ~:Start ~# ~!if exist %1% del %1% ~<wait 2 ~# ~:End ~#/... End of macro IfExist_Delete.mac... ~#

get_date_time.mac (1) ~:start ~# --- Get date string ~# Obtain current day - Global parameter p=2008 ~p=2008 ~x=%p% ~# Obtain current month - Global parameter p=2007 ~p=2007 ~y=%p% ~# Obtain current year - Global parameter p=2006 ~# Depending of status of switch 25 ~# This value may only be a 2-digit year. ~p=2006 ~z=%p% ~+;~?z<2000;~z+2000 ~# --- Obtain month character label ~+;~?y=1;~t2=Jan ~+;~?y=2;~t2=Feb..... ~# Consolidated Date String dd-mmm-yyyy ~# If d is less than 10 need a 0 to pad the field ~t1=%x% ~+;~?x<10;~t1=0%x% ~t4=%t1%-%t2%-%z%

get_date_time.mac (2) ~# --- Get date string ~# Obtain current hour - Global parameter p=2009 ~p=2009 ~x=%p% ~# Obtain current minute - Global parameter p=2010 ~p=2010 ~y=%p% ~# Obtain current second - Global parameter p=2011 ~p=2011 ~z=%p% ~# Consolidated Time String hh:mm ~# If hour or min is less than 10 need a 0 to pad the field ~t1=%x% ~+;~?x<10;~t1=0%x% ~t2=%y% ~+;~?y<10;~t2=0%y% ~t5=%t1%:%t2% ~t9=%t4% %t5% ~# ~# t9 (Date Time) is %t9%~#

make_directory.mac ~:start ~/... Start of macro Make_directory.mac %1%... ~# ~!IF not exist %1% MKDIR %1% ~# ~/... End of macro Make_directory.mac %1%...

stm_log.mac Example macro call stm_log %t0% %t0% - text to write to log file / logbook ~:start ~/... Start of macro stm_log.mac %t0%... ~# ~t1=stm_log.rep ~# ~# Write to output file ~+;~>>%t1%;~"%t0%;~> ~# ~# Write to logbook (with a max of 60 characters) c=%t0.60% ~# ~/... End of macro stm_log.mac %t0%...

wait.mac ~:Start ~# current cpu time since creation of database in 1/10 secs ~p=2005 ~x=%p% ~# current sec (1/10) since database creation %x% ~# ~# Add %1% * 10 to current 1/10 second to get new target ~r1=%1% ~r1*10 ~r1+%x% ~z=%r1% ~# ~# New target is %z% ~:Repeat ~# current cpu time since creation of database in 1/10 secs ~p=2005 ~x=%p% ~?x<%z% ~$Repeat ~#