Re: [foxboro] Reading Text Data from a File into a Sequence Block
- From: "Johnson, Alex P \(IPS\)" <alex.johnson@xxxxxxxxxxxxxxxx>
- To: <foxboro@xxxxxxxxxxxxx>
- Date: Wed, 30 Apr 2008 17:50:31 -0400
I would write a script to read the file and use omsetimp to set the
values.
Let's assume your file had the following:
C01:B01.SN0001 s "This is a string."
C01:B01.RI0001 f 100
and is called Recipe.txt
Try this script:
#!/bin/sh
# Setup a logs directory for this script
HOME=3D/opt/myScripts
LOGS=3D$HOME/logs
mkdir -p $LOGS
# Redirect the script's output to the log file whose name =
# is the same as the script.
exec 1>$LOGS/`basename $0` 2>&1
# Turn on tracing
set -x
while read CBP TYPE VALUE
do
/opt/fox/bin/tools/omsetimp -$TYPE $VALUE $CBP
done
You invoke the command with:
/opt/myScripts/scripts/LoadRecipe </opt/myScripts/data/Recipe.txt
You can look at the results in /opt/myScripts/logs/LoadRecipe.
In you file the syntax would be:
<cbp> <dt> <value>
Where =
<cbp> =3D Compound:Block.Parameter or other OM variable
<dt> =3D data type of the OM variable. Type
/opt/fox/bin/tools/omsetimp
Without arguments to set the supported data types.
<value> =3D value to send
Let us know how it goes.
Regards,
=
Alex Johnson
Invensys Process Systems
10900 Equity Drive
Houston, TX 77041
713 329 8472 (voice)
713 329 1600 (switchboard)
713 329 1700 (fax)
alex.johnson@xxxxxxxxxxxxxxxx
=
-----Original Message-----
From: foxboro-bounce@xxxxxxxxxxxxx [mailto:foxboro-bounce@xxxxxxxxxxxxx]
On Behalf Of Badura, Tom
Sent: Wednesday, April 30, 2008 3:56 PM
To: foxboro@xxxxxxxxxxxxx
Subject: [foxboro] Reading Text Data from a File into a Sequence Block
Hello Everyone,
=
We have the need to read and parse data from a text file into a Sequence
block. The data consists of several fields of text and numeric values
in each record (line). These values need to be parsed into several
sequence block string and real variables. I have been able to use the
rdfile dm command to access and parse the file and the setl dm command
to write the numeric data into one of the sequence block RI variables.
However, I have not found a way to write the string data to the sequence
block. Does anyone know of a command for writing text similar to the
setl, seti, setb commands? Or perhaps someone knows of a better way to
accomplish this whole task. I would certainly appreciate any ideas and
suggestions from anyone who may have done this already.
=
Sincerely,
Tom Badura
Plastics Engineering Company
=
Here is a listing of the data file and sequence code I have using as a
test.
=
testfile
TestLine01 12345 67890
TestLine02 54321 09876
TestLine03 12345 67890
TestLine04 54321 09876
TestLine05 12345 67890
TestLine06 54321 09876
=
=
Test_Seq
DEPENDENT_SEQUENCE
=
VARIABLES =
Index : I;
Width : I;
Offset : I;
FileName : S;
=
STATEMENTS
<<LOOP>>
=
WAIT UNTIL BI0001;
BO0001 :=3D FALSE;
=
FileName :=3D "D:/usr/plenco/displays/Develop/testfile.txt";
Index :=3D II0001;
Width :=3D II0002;
Offset :=3D II0003;
=
/* Read Field From Data File and Set Into Real Input */ =
:AW9101DMCMD :=3D "rdfile ",FileName," r24i",Index,"w",Width,"o",Offset,"
P8";
:AW9101DMCMD :=3D "setl IA02_TEST:DEP1.RI0001 $P8";
=
BI0001 :=3D FALSE;
BO0001 :=3D TRUE;
=
GOTO LOOP
=
ENDSEQUENCE
=
=
_______________________________________________________________________
This mailing list is neither sponsored nor endorsed by Invensys Process
Systems (formerly The Foxboro Company). Use the info you obtain here at
your own risks. Read http://www.thecassandraproject.org/disclaimer.html
=
foxboro mailing list: http://www.freelists.org/list/foxboro
to subscribe: mailto:foxboro-request@xxxxxxxxxxxxx?subject=3Djoin
to unsubscribe: mailto:foxboro-request@xxxxxxxxxxxxx?subject=3Dleave
=
* Confidentiality Notice:
This e-mail and any associated files are intended solely for the individual=
or entity to whom they are addressed. Please do not copy it or use it for =
any purposes, or disclose its contents to any other person. Further, this e=
-mail and any associated files may be confidential and further may be legal=
ly privileged. This email is from the Invensys Process Systems business uni=
t of Invensys plc which is a company registered in England and Wales with i=
ts registered office at Portland House, Bressenden Place, London, SW1E 5BF =
(Registered number 166023). For a list of European legal entities within t=
he Invensys Process Systems business group, please click here http://www.in=
vensys.com/legal/default.asp?top_nav_id=3D77&nav_id=3D80&prev_id=3D77.
If you have received this e-mail in error, you are on notice of its status.=
Please notify us immediately by reply e-mail and then delete this message =
from your system. Thank you for your co-operation. You may contact our Help=
desk on +44 (0)20 7821 3859 / 2105 or email inet.hqhelpdesk@xxxxxxxxxxxxx T=
his e-mail and any attachments thereto may be subject to the terms of any a=
greements between Invensys (and/or its subsidiaries and affiliates) and the=
recipient (and/or its subsidiaries and affiliates).
_______________________________________________________________________
This mailing list is neither sponsored nor endorsed by Invensys Process
Systems (formerly The Foxboro Company). Use the info you obtain here at
your own risks. Read http://www.thecassandraproject.org/disclaimer.html
foxboro mailing list: http://www.freelists.org/list/foxboro
to subscribe: mailto:foxboro-request@xxxxxxxxxxxxx?subject=join
to unsubscribe: mailto:foxboro-request@xxxxxxxxxxxxx?subject=leave
- References:
- [foxboro] Reading Text Data from a File into a Sequence Block
- From: Badura, Tom
Other related posts:
- » Re: [foxboro] Reading Text Data from a File into a Sequence Block
- [foxboro] Reading Text Data from a File into a Sequence Block
- From: Badura, Tom