For background, you should at least skim-read the paper Transient Astronomy with ACP Scheduler (PDF), as well as the RTML Programmer's Guide, which gives details on the meaning of the RTML tags, and finally RTML Mapping, which gives details on how RTML elements map to Scheduler observing requests. Constructing RTML templates is complex, however it offers considerable flexibility.
You have complete control over the observing request that is generated for each type of VOEvent that is passed by the filter for observing. As described in Customizing the Event Filter, the filter passes back the name of an RTML template to use for constructing the observing request for the event. The templates must be located in the Scheduler\ReceiverData folder (or a sub-folder). The standard templates are named XXXObsRequest.rtml, where XXX is the three letter code for the event type (SWF, INT, CAT, etc.). You can modify these as well as make your own and alter the filter to pass back the template name of your own template. If this is confusing, feel free to contact DC-3 Dreams, SP for help in understanding how all of this works.
Before trying to make your own template, have a look at the ones that come with Scheduler, in the ReceiverData folder. Try to understand what's going on with the RTML. Refer to RTML Mapping and the RTML Programmer's Guide (the schema diagram there is very useful).
An RTML tester is located in the ReceiverData folder. Drag and drop your RTML on to the TestRTML icon and you'll either get a report on the error or a message that it's OK.
For all but the most advanced uses, you can use ACP Planner to make your RTML templates. Here's how:
If you put multiple targets into the Planner, it will either produce RTML for multiple Plans with One Observation each (the most useful), or one Plan with multiple Observations. The selection of one Plan or multiple Plans is made in the Export RTML to Scheduler window. Note the receiver will replace the RA and Dec with the position of the object in the incoming VOEvent message, so this isn't really multiple targets. It can be useful, however, if you want to make a template with multiple Plans then hand-patch the generated RTML so that the Plans are run at different times by adding <TimeRange> elements with differential times.
Each VOEvent results in a separate Project being created. The project name is the "target name" returned by the filter. This allows observing requests for the event to contain multiple Plans, each of which is scheduled separately, providing great flexibility.
The receiver creates observing requests from the specified template as follows:
The third step is needed because there are some things that can't be expressed in RTML and some things that are more conveniently set after import.
If you include a <Schedule> section in the RTML, besides specifying constraints, you can give hints on timing of the observation or force the observations to be acquired immediately, or at a certain time delay after a Plan is started. Remember that multiple Plans can be specified by putting multiple <Requests>s in the RTML. Thus you can have, for example, one Plan that starts immediately, interrupting the dispatcher and killing all running plans, plus more plans that run normally with or without time hints. There is considerable flexibility in laying out your observing request(s) in the RTML template!
The <TimeRange> element, and its children <Earliest> and <Latest>, control timing hints and/or forced times. Normally, the date/times in this element are complete date-time strings (in XML/ISO format):
<TimeRange> <Earliest>2009-03-16T04:23:00</Earliest> <Latest>2009-03-16T05:23:00</Latest> </TimeRange>
The problem with using these in a template is that the template is re-used over and over, at different times on different days.
In order to make <TimeRange> useful in a templated environment, the VOEvent Receiver inspects the date/time strings and constructs the Earliest and Latest times for the scheduled request based on the current date/time. In order to activate this feature, the date/time string must specify date of 0001-01-01. If the VOEvent receiver sees this, it interprets the rest of the date/time as a differential time. It calculates the amount of time from 0001-01-01T00:00:00 to the given differential time, and adds that time interval to the current time to get the actual date/time for that field in the scheduler request.
To make this clearer, here is an example:
Current date time: 2009-03-16T04:23:32
<Earliest>: 0001-01-01T00:30:00
Actual Earliest time in request: 2009-03-16T04:53:32
The differential time in the RTML <Earliest> tag is 30 minutes, thus the Plan containing this <Earliest> will not start for at least 30 minutes after the VOEvent is received and the request is submitted. Note that you can specify Earliest and Latest differential times a day in the future to cause a Plan in your template to have a time restriction for the same times on the night after the event, etc.
In your RTML template, if you specify the exact same <Earliest> and <Latest> date/times, the RTML importer will turn on the Run At Time flag. This will force the Plan to be started at the given time. Combined with a differential time specification, you can force a Plan to start immediately or force it to start at some delta-time after the VOEvent. You can see this in the Swift template SWFObsRequest.rtml, which wants observing to start immediately:
<TimeRange> <Earliest>0001-01-01T00:00:00</Earliest> <!-- Special value: "immediately" --> <Latest>0001-01-01T00:00:00</Latest> <!-- Special value: equal to Earliest -> Run Now! See Scheduler docs! --> </TimeRange>
Note that the standard filter script DefaultEventFilter.js also returns the "timecrit" flag, telling the receiver to interrupt the dispatcher. The net effect of all of this is to interrupt the dispatcher, kill all running Plans, and start the Swift follow up request immediately.
If your follow up observations are not time-critical, and/or may extend over multiple nights, you can put some constraints into the Observations via the RTML <Request>/<Schedule> element. See RTML Mapping, Application of Constraints.
Before importing the RTML into the database, the following substitutions are made:
Many of these things can be overridden in the template itself. For example, you might want different Contact info for different types of event observations. After importing, the receiver does the following:
At this point the Project is enabled to run, and if indicated the dispatcher is interrupted, allowing the new Project to come into contention. If the special "run now" values of Earliest and Latest were set, the receiver kills all running plans, guaranteeing that the time-critical VOEvent Project's Plan(s) will be immediately started.
Sometimes, a static template just isn't good enough. You may want to alter the number of images, exposure intervals, and/or filter sequence based on the data in the incoming VOEvent message. Therefore, the VOEvent Receiver provides support for dynamic template creation. This is done in the event filter. The filter command line includes a named argument //rxdata which is the full path to the ReceiverData folder. This is the location into which the filter can write a dynamically created RTML template. After writing the template file into ReceiverData, the filter can return the name of the template to the receiver as usual, and the receiver will use the dynamic template to make the followup observing request.
ACP Scheduler includes an example of this for the User-Defined 1 (US1) event type. Look at DefaultEventFilter.js, where it handles the US1 events, and you'll see code that generates a template named US1ObsTemplate.rtml, then passes that name back to the receiver.