Q10051 Pre-configuring commands with data tables
Is it possible to pre-load relatively large tables of configuration data into a custom processing command, so that there isn't such a large start-up delay when the time comes to run it?
You can do this by using a communication pipe from your host, and by organizing your custom command code carefully.
In your host environment, configure a special communication pipe for transfers of the initialization data, in the usual way. After opening the host side of the connection, copy in the desired initialization data.
On the DAPL side, the DAPL configuration script routes the special
initialization data pipe to the custom command task. It is very common to
place a START
command at the end of the configuration script,
to run everything as soon as possible. Here, you only want enough processing
to run so that the initialization data can be received, so provide a
START
command that names the PDEFINE
section
containing the task that you need to initialize.
Within your custom command coding, the order of initializing things
matters. You need to have the communication channel fully functioning so
that initialization data can pass, but you don't want other things to
get in the way. The DAPL system can open connections to things that
exist: pre-existing communications pipes, shared variables and suchlike.
But the DAPL system cannot open a connection to an input sampling channel
pipe that does not exist; it won't exist until a sampling configuration
is selected and started. If a pipe_open
operation cannot be
completed, the task will wait at that point. Normally, such delays are
harmless, but this is not a good idea if it locks out the processing for
your initialization data.
As a practical matter, there are only certain parameters where
an input channel pipe could sensibly be used. Defer opening these
connections for a while. Instead, opened the connection to the special
communications pipe for initialization data first. Immediately allocate
your bulk memory storage buffers and proceed to invoke fgets()
or pbuf_get()
operations to buffer the data sent by the host
system.
Then continue with the rest of the initializations. Eventually you
will reach the place where no more progress can be made without
setting up the connections to your input data stream. So open it.
This is a good place for your task to wait until everything
else starts to run. The operation will finish after your host
application sends another START
command, listing all of
the rest of the input, output, and processing procedures to run.
L23571
Manuals for the custom processing command DTD interface are available at the manuals download page.