OpenOPC for Python |
About Library module Command-line client Gateway service Who is using it Download License Contact |
OpenOPC Command-line ClientTo the best of our knowledge, the OpenOPC project includes the only publically available command-line based OPC client. Unlike graphical OPC clients, this client can be easily used in scripts or batch files. And because of its piping capability (i.e. chaining commands together), it is far more powerful than other OPC clients.Read itemsC:\> opc -r Random.String Random.Int4 Random.Real8 Random.String Your Good 06/25/07 23:46:33 Random.Int4 19169 Good 06/25/07 23:46:33 Random.Real8 8009.5730 Good 06/25/07 23:46:33 Read 3 of 3 items (0.02 seconds) Multiple output stylesC:\> opc -r Random.String Random.Int4 Random.Real8 -o csv Random.String,--,Good,06/25/07 23:58:16 Random.Int4,15724,Good,06/25/07 23:58:16 Random.Real8,5846.7234,Good,06/25/07 23:58:16 List available itemsC:\> opc -f Random.*Int* Random.Int1 Random.Int2 Random.Int4 Random.UInt1 Random.UInt2 Random.UInt4 Combine commands using pipesC:\> opc -f Random.*Int* | opc -r - Random.Int1 0 Good 06/25/07 23:52:16 Random.Int2 18467 Good 06/25/07 23:52:16 Random.Int4 6334 Good 06/25/07 23:52:16 Random.UInt1 206 Good 06/25/07 23:52:16 Random.UInt2 19169 Good 06/25/07 23:52:16 Random.UInt4 15724.0000 Good 06/25/07 23:52:16 Read 6 of 6 items (0.02 seconds)Read a collection of items and values into a CSV file, edit the item values using a spreadsheet or other software, then write the new values back to the OPC server... C:\> opc -f "Triangle Waves.*Int*" | opc -r - -o csv >data.csv C:\> opc -w - < data.csv Triangle Waves.Int1 Success Triangle Waves.Int2 Success Triangle Waves.Int4 Success Triangle Waves.UInt1 Success Triangle Waves.UInt2 Success Triangle Waves.UInt4 Success Wrote 6 of 6 items (0.02 seconds) Data loggerRead values of items every 60 seconds, continually logging the results to a file until stopped by Ctrl-C...C:\> opc Random.Int4 Random.Real8 -L 60 >data.log Command usage summaryC:\> opc OpenOPC Command Line Client 1.1.6 Copyright (c) 2007-2008 Barry Barnreiter (barry_b@users.sourceforge.net) Usage: opc [OPTIONS] [ACTION] [ITEM|PATH...] Actions: -r, --read Read ITEM values (default action) -w, --write Write values to ITEMs (use ITEM=VALUE) -p, --properties View properties of ITEMs -l, --list List items at specified PATHs (tree browser) -f, --flat List all ITEM names (flat browser) -i, --info Display OPC server information -q, --servers Query list of available OPC servers -S, --sessions List sessions in OpenOPC Gateway Service Options: -m MODE, --mode=MODE Protocol MODE (dcom, open) (default: OPC_MODE) -C CLASS,--class=CLASS OPC Automation CLASS (default: OPC_CLASS) -n NAME, --name=NAME Set OPC Client NAME (default: OPC_CLIENT) -h HOST, --host=HOST DCOM OPC HOST (default: OPC_HOST) -s SERV, --server=SERVER DCOM OPC SERVER (default: OPC_SERVER) -H HOST, --gate-host=HOST OpenOPC Gateway HOST (default: OPC_GATE_HOST) -P PORT, --gate-port=PORT OpenOPC Gateway PORT (default: OPC_GATE_PORT) -F FUNC, --function=FUNC Read FUNCTION to use (sync, async) -c SRC, --source=SOURCE Set data SOURCE for reads (cache, device, hybrid) -g SIZE, --size=SIZE Group tags into SIZE items per transaction -z MSEC, --pause=MSEC Sleep MSEC milliseconds between transactions -u MSEC, --update=MSEC Set update rate for group to MSEC milliseconds -t MSEC, --timeout=MSEC Set read timeout to MSEC mulliseconds -o FMT, --output=FORMAT Output FORMAT (table, values, pairs, csv, html) -L SEC, --repeat=SEC Loop ACTION every SEC seconds until stopped -y ID, --id=ID,... Retrieve only specific Property IDs -a STR, --append=STR,... Append STRINGS to each input item name -x N --rotate=N Rotate output orientation in groups of N values -v, --verbose Verbose mode showing all OPC function calls -e, --errors Include descriptive error message strings -R, --recursive List items recursively when browsing tree -, --pipe Pipe item/value list from standard input |