on 07-19-2010 3:40 PM
Dear all,
from a scale I get the result as a string in the following way:
gk017.000+
Is there a possibility to flip it to
+000.710kg
in a transaction? With a built in function?
of course I can do it in a comlicated way (e.g. assigning every single fugure to a transaction variable and assemble it again; or using stringleft(string , length) to assemble it) but is there a function which can do this?
Regards,
Martin
Where are you getting the scale string from, directly from the scale or via a PLC/OPC Tag query? I would be very surprised if the scale is outputing a reversed-order string. If it is PLC/OPC could be the PLC is not properly receiving the data.
I would focus on getting the format fixed prior to processing in MII.
- Steve
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Steve!
Thanks for your quick reply!
But unfortunately I really get it like this from the scale.
It says so even in the manual of the scale. Please don´t ask me why!!! I was stunned too.
Is there a possibility to turn it around in the OPC? I would prefer this of course.
Currently I´m doing it in this way:
stringpart(tag_waageRxD_0.Results{/Rowsets/Rowset/Row/RxD} , 10 , 1)
& stringpart(tag_waageRxD_0.Results{/Rowsets/Rowset/Row/RxD} , 9 , 1)
& stringpart(tag_waageRxD_0.Results{/Rowsets/Rowset/Row/RxD} , 8 , 1)
& stringpart(tag_waageRxD_0.Results{/Rowsets/Rowset/Row/RxD} , 7 , 1)
& stringpart(tag_waageRxD_0.Results{/Rowsets/Rowset/Row/RxD} , 6 , 1)
& stringpart(tag_waageRxD_0.Results{/Rowsets/Rowset/Row/RxD} , 5 , 1)
& stringpart(tag_waageRxD_0.Results{/Rowsets/Rowset/Row/RxD} , 4 , 1)
& stringpart(tag_waageRxD_0.Results{/Rowsets/Rowset/Row/RxD} , 3 , 1)
& stringpart(tag_waageRxD_0.Results{/Rowsets/Rowset/Row/RxD} , 2 , 1)
& stringpart(tag_waageRxD_0.Results{/Rowsets/Rowset/Row/RxD} , 1 , 1)
Luckily the scale always returns the same amount of digits.
Regards,
Martin
Hi Martin,
You could consider building a simple utility transaction that you could call when you need it. Just for experimentation purposes, I built one that consists of 2 action blocks, a stringIn and a stringOut transaction property.
The first action block uses a For_Next_Loop that is configured with To = 1 and Step = -1. In the Link Editor for this, I assign the length of the string to the From property of the loop:
stringlength(Transaction.stringIn)
Then, I use an Assignment block to concatenate the string in reverse order, and assign it to the Transaction.stringOut property:
Transaction.stringOut & stringpart(Transaction.stringIn, For_Next_Loop_0.CurrentItem, 1)
What is nice is that the length of the string does not matter. Just a suggestion
Kind Regards,
Diana Hoppe
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Martin,
If the scale is connected to a PLC or OPC it may be possible to reverse the order in either of those. so:
scale vendor/model?
PLC vendor/model?
OPC Server vendor/version?
- Steve
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Steve!
Scale is a very cheap one:
MAUL logic S:
Transfer:
At every call-up 11 Bytes are transferred.
2 bytes ASCII ; codes the weight unit g, kg, oz or lb.
7 bytes ASCII; codes the weight value including the comma and point
1 byte codes the sign
1 byte codes the carriage return.
Example for the transfer:
g^7300000+ ASCII 13, gives 73g
( ^means a space) bl3.10:20+ ASCII 13, 2lb and 1.3oz
----^^^^^^ASCII 13, ---- under load
LLUF^^^^^^ASCII 13, FULL overload
(Tip: If you hold the key longer than 5 seconds, when the scales is turned off, then you switch
the scales between kg/g and lb/oz and vice versa.
Calculation: 1oz= 28,35g 1lb= 453,59g 1lb= 16oz
ComServer from W&T (WUT), Wiesemann&Theis (Com-Server Highspeed Industry) via LAN/RS232.
OPC is also W&T (WUT), Wiesemann&Theis, Version 4.31
UDS is from SAP.
Martin
OK, you have stumped me now. I am not familiar with the WuT product line. Unless there is some documentation that comes with the Com-Server to indicate how to modify the string format, you will have to use the current design and character-swap within MII transaction. Hopefully this will not impact performance.
My guess is that the scale outputs the reverse format to support another product they offer like a printer.
- Steve
User | Count |
---|---|
9 | |
7 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.