IPAT-S Tutorial IPAT-S home

Producing HTML Using Print: Blocks

Using report statements is just one way to produce output in IPAT-S. An alternative way that gives a great deal more control over formatting, is to use print: blocks. Print: blocks allow you to mix outputs from IPAT-S with text. When the text includes HTML codes, then the output from IPAT-S is HTML, which can be viewed in an web browser.

For example, the file “Tut3.ips” that is distributed with IPAT-S contains a print: block with embedded HTML codes:

base year 2002
scenario year 2012

# US Census Bureau pop projection categories
dimension Population 'Low', 'Medium', 'High'

summvar Emissions{Population}, Pop{Population}
ratio EmissionIntensity, GDPperCap

# Emissions given by an index relative to the base year
Emissions.by = 100

# US Census Bureau population projections
# http://www.census.gov (Accessed 7 Dec 2002)
Pop{Population = 'Low'} = 278.8, 294.1
Pop{Population = 'Medium'} = 280.3, 304.8
Pop{Population = 'High'} = 282.1, 318.9

# Bush Administration emission reduction target is
# 18% decrease in intensity over next 10 years
# (from Feb 2002)
EmissionIntensity = incr[-18%]

# This is key input: GDP per cap growth rate
number IncomeGR = <2.0%>
GDPperCap = growth(IncomeGR)

chain Pop >> GDPperCap * EmissionIntensity -> Emissions

report Emissions as "Emissions (2002 = 100)"

# HTML Output
print:
<html>

<head>
<title>Emissions Scenarios for the U.S.</title>
</head>

<body>

<h1>CO<sub>2</sub> Emissions for the U.S.: An Outlook to 2012</h1>

<h2>Introduction</h2>
<p>
In early 2002, President Bush of the United States put forward a
plan for mitigating the country’s greenhouse gas emissions.
The goal of the plan is to decrease the <i>emission intensity</i> 
(emissions per dollar GDP) by 18 percent over the following 10 years. Whether this
will also lead to a decrease in total emissions depends on how rapidly
GDP increases. Increases in GDP, in turn, depend on how fast incomes (GDP/capita)
grow, and how fast the population itself grows.
</p>

<h2>Scenario Assumptions</h2>
<p>
Emission intensity is assumed to drop by 18% over the next 10 years, 
following the Bush Administration plan.
Income per capita is assumed to grow in the scenario at 
["%.1f", 100 * IncomeGR]% per year between [y.first] and [y.last],
leading to an overall increase of
["%.0f", 100 * ((1 + IncomeGR)^(y.last - y.first) - 1)]%
over the scenario period. For population, three scenarios are presented,
corresponding to the middle, low and high population projections of
the <a href = "http://www.census.gov">U.S. Census Bureau</a>. In the
middle projection, population increases by
["%.1f", 100 * ((Pop.last{Population = 'Medium'}/ \
       Pop.first{Population = 'Medium'})^(1/(year.last - year.first)) - 1)]%
per year on average, compared to a rate of
["%.1f", 100 * ((Pop.last{Population = 'Low'}/ \
       Pop.first{Population = 'Low'})^(1/(year.last - year.first)) - 1)]%
per year for the low projection, and
["%.1f", 100 * ((Pop.last{Population = 'High'}/ \
       Pop.first{Population = 'High'})^(1/(year.last - year.first)) - 1)]%
per year for the high projection.
</p>

<h2>Scenario Results</h2>
<p>
Population and income growth lead to rising GDP, offsetting
the 18% decline in emission intensity over the decade. The net effect is
an increase in emissions in all scenarios, with an annual rate of
["%.1f", 100 * ((Emissions.last{Population = 'Medium'}/ \
        Emissions.first{Population = 'Medium'})^(1/(year.last - year.first)) - 1)]%
in the medium scenario, and with
rates ranging from
["%.1f", 100 * ((Emissions.last{Population = 'Low'}/ \
        Emissions.first{Population = 'Low'})^(1/(year.last - year.first)) - 1)]%
per year for the low projection to
["%.1f", 100 * ((Emissions.last{Population = 'High'}/ \
        Emissions.first{Population = 'High'})^(1/(year.last - year.first)) - 1)]%
for the high projection.
</p>

<br>
</body>

</html>
:print


When this script is loaded into IPAT Studio and the HTML tab is selected, the output can be viewed as formatted HTML. Everywhere there are calculations in square brackets - inline calculations - the calculated result has been inserted into the HTML output by IPAT-S:

Color coding in the GUI

Previous Index