Description Usage Arguments Value Note Author(s) See Also Examples
Connect to a compatible WTW instrument using a serial (com) port through the control cable AK340/B and send commands and/or read values of pH, O2, etc.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | wtw_open(port = getOption("wtw_port"))
wtw_close(port = getOption("wtw_port"))
wtw_ready(port = getOption("wtw_port"))
wtw_sim()
wtw_cmd(code, port = getOption("wtw_port"))
wtw_echo(port = getOption("wtw_port"))
wtw_info(port = getOption("wtw_port"), timeout = 1000)
wtw_read(port = getOption("wtw_port"), timeout = 1000, O2 = FALSE)
wtw_record(
file = NULL,
interval = 10,
Nmax = 10,
port = getOption("wtw_port"),
timeout = 1000,
O2 = TRUE,
init.data = NULL,
graph = TRUE,
title = "WTW record",
...
)
|
port |
A serial port as |
code |
Code to send to the WTW instrument, i.e., |
timeout |
Maximum time to wait in ms for the answer from the instrument. |
O2 |
For instruments that support it, do we also read O2 values? |
file |
The file where to write the records. If |
interval |
Interval between two measurements, in second. |
Nmax |
Maximum number of readings to record. |
init.data |
A data frame with data to start with (append data to it). |
graph |
Do we update a graph each time new item is read? |
title |
The title of the graph. |
... |
Further graph arguments. |
wtw_open()
returns TRUE
in case of success, FALSE
otherwise.
wtw_ready()
does the same if the instrument is ready or not.
wtw_close()
returns the com port that was closed.
wtw_info
reads the identifier of the WTW instrument and returns it (if it
is one of the recognized devices).
wtw_echo()
echo data send by the instrument to the console (mainly for
debugging purpose). Use wtw_read()
instead to read measurements.
wtw_sim()
simulates data read from a fake instrument. You can define your
own function, if you like.
wtw_record()
records a series of measurement on a disk file, and possibly
plot the data in real time. Note that this is the only function that does not
require that you open (wtw_open()
) before, and close (wtw_close()
) the
port before interacting with the instrument.
A fake instrument for test and set up of control programs is available
if you specify "com0"
as serial port. Note that, for simulations, you can
speed up globally data acquisition by defining option(econum_speed = X)
. If
'X'
is higher that 1, it means everything is done faster (X = 10
means
ten times faster). If 'X'
is lower that 1, everything is acquired at a
slower pace: X = 0.1
means ten times slower.
Do not forget to close the port after use!
Philippe Grosjean Philippe.Grosjean@umons.ac.be
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # Use the fake WTW instrument on com0
oport <- options(wtw_port = "com0") # Change this to connect to a real instrument
wtw_open()
wtw_echo() # Echo data send by run/enter from the instrument
wtw_read() # Read data from the instrument
wtw_ready() # Check that instrument is ready
wtw_close()
wtw_ready() # Not ready any more, because we closed the port
# Record 10 data with an interval of 1 sec and make a graph...
# but speed up things by ten times if we use a fake instrument
if (getOption("wtw_port") == "com0") options(econum_speed = 10)
# Record ten data points (and do not save to a file)
# Note that you don't have to open/close the port with this function!
wtw_record(file = NA, interval = 1, Nmax = 10)
# Restore default speed
options(econum_speed = NULL)
# Restore port
options(oport); rm(oport)
rm(wtw_dat)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.