You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

Reply
 
Thread Tools Display Modes
Old October 7th, 2021, 10:43 AM   #31
JesperMP
Lifetime Supporting Member + Moderator
Denmark

JesperMP is offline
 
JesperMP's Avatar
 
Join Date: Feb 2003
Location: Copenhagen.
Posts: 14,966
Quote:
Originally Posted by thewalkerist View Post
It is actually lower than what we expect isnt it? 10kg is 10000 gram, right? So giving me 6000-7000 is actually giving me a lower value then i expected. Could this be a energy value though? Maybe i need to scale this so that i can find my actual weight.
That is too much difference for it to be just calibration that is needed. Something else is wrong.
I suspect that you need to set the transmitter to match the mV/V of the loadcell. On the side of the transmitter it says range 1-10mV/V, so it must be configurable.
If for example, the loadcell has an output of 3mV/V and the transmitter is set to 4mV/V, then it can explain the greater part of the error you are seeing.
__________________
Jesper
See my profile interests for Q&A
  Reply With Quote
Old October 7th, 2021, 11:06 AM   #32
drbitboy
Lifetime Supporting Member
United States

drbitboy is offline
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 3,565
Quote:
Originally Posted by thewalkerist View Post
It is actually lower than what we expect isnt it? 10kg is 10000 gram, right? So giving me 6000-7000 is actually giving me a lower value then i expected. Could this be a energy value though? Maybe i need to scale this so that i can find my actual weight.
If 10kg was 10000 in Register.Reading_val[1], then 100kg would be 100000 (100k), which would be too large to put into 16-bit two's complement (signed) Int Register.Reading_val[1], even if negative values (-32768 to -1) were converted to positve (+32768 to +65535). The next register, Register.Reading_val[2], (TUNA Register 9 = Modbus Address 40010) would be non-zero to handle the overflow.

If 10kg was 6000-7000, then 100kg might not overflow and be -536 signed = 60000 unsigned, but I think that is unlikely.

What is the value in Register.Reading_val[2] when there is a 10kg object on the loadcells? Better yet, expand the array Register.Reading_val to [0..25], and read all 26 TUNA registers, 0 to 26, by assigning 40001 and 26 to DATA_ADDR and DATA_LEN, respectively, and posting the results here.
__________________
i) Take care of the bits, and the bytes will take care of themselves.
ii) There is no software problem that cannot be solved with another layer of indirection.
  Reply With Quote
Old October 7th, 2021, 01:54 PM   #33
thewalkerist
Member
Turkey

thewalkerist is offline
 
Join Date: May 2021
Location: Izmir
Posts: 104
Quote:
Originally Posted by drbitboy View Post
If 10kg was 10000 in Register.Reading_val[1], then 100kg would be 100000 (100k), which would be too large to put into 16-bit two's complement (signed) Int Register.Reading_val[1], even if negative values (-32768 to -1) were converted to positve (+32768 to +65535). The next register, Register.Reading_val[2], (TUNA Register 9 = Modbus Address 40010) would be non-zero to handle the overflow.

If 10kg was 6000-7000, then 100kg might not overflow and be -536 signed = 60000 unsigned, but I think that is unlikely.

What is the value in Register.Reading_val[2] when there is a 10kg object on the loadcells? Better yet, expand the array Register.Reading_val to [0..25], and read all 26 TUNA registers, 0 to 26, by assigning 40001 and 26 to DATA_ADDR and DATA_LEN, respectively, and posting the results here.
Register.Reading_val[2] is still 0 when there is a 10kg object on the loadcell. I will try to expand the array and see how that works out.


Quote:
Originally Posted by JesperMP View Post
That is too much difference for it to be just calibration that is needed. Something else is wrong.
I suspect that you need to set the transmitter to match the mV/V of the loadcell. On the side of the transmitter it says range 1-10mV/V, so it must be configurable.
If for example, the loadcell has an output of 3mV/V and the transmitter is set to 4mV/V, then it can explain the greater part of the error you are seeing.
OK so this worked out. I changed my mV/V to 1 and my 10kg weight gave me big numbers, 9 gave me really small numbers on my 10kg(500-600). So i played around and found that the 2mv/V is the right one. I Now can see my 10kg without a problem. But something really did stuck in my head.

Quote:
Originally Posted by drbitboy View Post
If 10kg was 10000 in Register.Reading_val[1], then 100kg would be 100000 (100k), which would be too large to put into 16-bit two's complement (signed) Int Register.Reading_val[1], even if negative values (-32768 to -1) were converted to positve (+32768 to +65535). The next register, Register.Reading_val[2], (TUNA Register 9 = Modbus Address 40010) would be non-zero to handle the overflow.
What would my plc show if i put up a 100kg weight?
  Reply With Quote
Old October 7th, 2021, 02:36 PM   #34
thewalkerist
Member
Turkey

thewalkerist is offline
 
Join Date: May 2021
Location: Izmir
Posts: 104
Quote:
Originally Posted by Lare View Post
I undestand it that way that first register [0] is parameter number on TUNA which you want to change, registers [1] and [2] are setting numbers fro that parameter.


So you send Write command start from 40001, 2 or 3 registers, 40001 = value 122, and 40001, 40002 values are your calibrate numbers?
Nope, tried that didnt work. So the manual says "Special commands are executed using addresses 0-1-2". and under the 122 where i marked with blue arrow it says "Calibration to zero. No further action is required."

Oh and btw if you look to this pic there is also some stuff called Reg1 and Reg2. According to the manual to calibrate to 100000, i need to write 108 to Address 0 and put 34464(low) on Reg1(address 1) and put 1(high) on Reg2(address 2).

Here is the real kicker though, how can first put 40000 and then change it up to 40108 and then go 40001 and then do 40001? Didnt you guys say that i can only have 1 address active? how this would be possible?
Attached Images
File Type: jpg Screenshot (668)_LI.jpg (129.1 KB, 32 views)
  Reply With Quote
Old October 7th, 2021, 02:42 PM   #35
JesperMP
Lifetime Supporting Member + Moderator
Denmark

JesperMP is offline
 
JesperMP's Avatar
 
Join Date: Feb 2003
Location: Copenhagen.
Posts: 14,966
Quote:
Originally Posted by thewalkerist View Post
I changed my mV/V to 1 and my 10kg weight gave me big numbers, 9 gave me really small numbers on my 10kg(500-600). So i played around and found that the 2mv/V is the right one.
You should find out what is correct value from the loadcell specs. Sometimes it is labelled on the loadcell itself.
__________________
Jesper
See my profile interests for Q&A
  Reply With Quote
Old October 7th, 2021, 03:09 PM   #36
drbitboy
Lifetime Supporting Member
United States

drbitboy is offline
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 3,565
Quote:
Originally Posted by thewalkerist View Post

What would my plc show if i put up a 100kg weight?
Assuming 1 count per gram, 100kg is 100,000g = 100,000count.

The binary for 100,000:
100k - 1 x 65536 = 34464
34464 - 1 x 32768 = 1696
1696 - 0 x 16384 = 1696
1696 - 0 x 8192 = 1696
1696 - 0 x 4096 = 1696
1696 - 0 x 2048 = 1696
1696 - 1 x 1024 = 672
672 - 1 x 512 = 160
160 - 0 x 256 = 160
160 - 1 x 128 = 32
32 - 0 x 64 = 32
32 - 1 x 32 = 0
0 - 0 x 16 = 0
0 - 0 x 8 = 0
0 - 0 x 4 = 0
0 - 0 x 2 = 0
0 - 0 x 1 = 0

so 1 1000 0110 1010 0000

So Register.Reading_val[2] (TUNA Reg. 9) should be 1 and Register.Reading_val[1] (TUNA Reg. 8) should be -31072 (-32768 + 1696).

Maybe; try sitting on it.
__________________
i) Take care of the bits, and the bytes will take care of themselves.
ii) There is no software problem that cannot be solved with another layer of indirection.
  Reply With Quote
Old October 14th, 2021, 04:29 AM   #37
thewalkerist
Member
Turkey

thewalkerist is offline
 
Join Date: May 2021
Location: Izmir
Posts: 104
Quote:
Originally Posted by drbitboy View Post
Maybe; try sitting on it.
I am currently sick so i cant go to uni rn. I will try that for sure . Thats why i didnt reply in time
  Reply With Quote
Old Today, 10:04 AM   #38
thewalkerist
Member
Turkey

thewalkerist is offline
 
Join Date: May 2021
Location: Izmir
Posts: 104
ok so here is the thing. I was trying to make it more stable by these math equations and it kinda worked. Rounding goes well and i divided it again and got myself a good value. 1.65kg's. But here's the kicker. How can i make it show like 1.65 as a 1 kg 650 grams? i am kind of stuck here
Attached Images
File Type: png Screenshot (686).png (245.8 KB, 14 views)
  Reply With Quote
Old Today, 10:27 AM   #39
thewalkerist
Member
Turkey

thewalkerist is offline
 
Join Date: May 2021
Location: Izmir
Posts: 104
oh and btw i know this pic is useless because i kinda repeat the same steps going back and forth but i just tried experimenting with it
  Reply With Quote
Old Today, 12:25 PM   #40
Lare
Member
Finland

Lare is offline
 
Join Date: Jan 2006
Location: Finland
Posts: 1,694
Not sure if I undestanded your question right?


Your online view is showing 1.47, do you want it to show 1.650 (scaling) or 1.470?


If case is 1.47 -> 1.470 then it is maybe easier to use two different ints. One for Kg and other for grams.
As real (float) value is number with exponent part, it is difficult to show number with fixed decimal point on PLC.


On scada or HMI you maybe have setting for that, but usually only for forcing leading digits.



First divide your int with 1000, then move remaining part to different int variable.


For grams you can use Decimal to BCD covnert, then shifting 4 bits to right and lastly BCD to Decimal convert.


Then you have your Kg and grams seperated and grams is with 3 numbers.
  Reply With Quote
Old Today, 12:48 PM   #41
drbitboy
Lifetime Supporting Member
United States

drbitboy is offline
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 3,565
If #silly is a real e.g. with a value of 1.65:
TRUNC(Real to Dint) #silly #silly_dint_kg
CONV(Dint to Real) #silly_dint_kg #silly_real_kg
SUB(Real) #silly #silly_real_kg #silly_real_kgfrac
MUL(Real) silly_real_kgfrac 1000.0 #silly_real_gram
ROUND(Real to Dint) #silly_real_gram #silly_dint_gram
= #silly_dint_gram 1000 ADD #silly_dint_kg 1 #silly_dint_kg MOV 0 #silly_dint_gram
#silly_dint_kg will be 1 (kg)
#silly_dint_gram will be 650 (gram, from 0-999)

Caveat: Assumes #silly is non-negative.

A simpler approach, assuming MOD (modulo) is available:
MUL(Real) #silly 1000.0 #silly_real_kggram
ROUND(Real to Dint) #silly_real_kggram #silly_dint_kggram
MOD(Dint) #silly_dint_kggram 1000 #silly_dint_gram
SUB(Dint) #silly_dint_kggram #silly_dint_gram #silly_dint_kg
DIV(Dint) #silly_dint_kg 1000 #silly_dint_kg

__________________
i) Take care of the bits, and the bytes will take care of themselves.
ii) There is no software problem that cannot be solved with another layer of indirection.
  Reply With Quote
Old Today, 01:16 PM   #42
Lare
Member
Finland

Lare is offline
 
Join Date: Jan 2006
Location: Finland
Posts: 1,694
Quote:
Originally Posted by drbitboy View Post
If #silly is a real e.g. with a value of

Caveat: Assumes #silly is non-negative.

Would it matter



If value would be -1,23kg
then full kilograms is -1.0


and subtract -1,23-(-1.0) = -1,23+1.0 = -0.23 kg




So it converts allways right no matter if original value is + or - weight.


If dividing is done on UINT variables then it would show weird numbers if negative values.


But negative value for weighter is probably wrong for start.
  Reply With Quote
Old Today, 02:04 PM   #43
drbitboy
Lifetime Supporting Member
United States

drbitboy is offline
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 3,565
Quote:
Originally Posted by Lare View Post
Would it matter

Whoops, right, thanks, I was thinking FLOOR (round toward -Inf) not TRUNC (round toward 0).


Negative weight is problematic anyway, as you note.
__________________
i) Take care of the bits, and the bytes will take care of themselves.
ii) There is no software problem that cannot be solved with another layer of indirection.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Delta PLC communication with barcode scanner over RS485 HARRY1489 LIVE PLC Questions And Answers 1 November 8th, 2019 08:25 AM
Issue Changing IP on TP700 (WinCC / TIA Portal v14) kdcui LIVE PLC Questions And Answers 8 October 8th, 2019 02:28 PM
TIA portal and PLC SIM rQx LIVE PLC Questions And Answers 2 January 25th, 2017 01:48 PM
Siemens WinCC TIA Portal v14 Synchronize with PLC Tags not working! DenZ_P LIVE PLC Questions And Answers 0 January 18th, 2017 09:24 PM
Post subject: Mitsubishi PLC RS485 2W Communication to Weintek HMI.. Ray_Z LIVE PLC Questions And Answers 1 December 26th, 2014 08:23 AM


All times are GMT -4. The time now is 10:59 PM.


.