Jump to content

volume flow meter with jz20-R16


Recommended Posts

Hi, I am a newby in this environment.

I want to measure the amount of water flowing into a storage. I use the HSI counter and correct it with a constant value. it soon happens, that the MI is larger than 32767 and it start counting in the reverse direction. I tried with long integer (SB82) however, it does not work. I do not know why.

does anybody has an example?

 

Thank you indeed.

Link to comment
Share on other sites

  • MVP 2023

MIs are signed 16 bit integers.  The most significant bit is the sign bit, and when the value gets greater than 2^15 (32,767) the sign bit is set and register reports as negative.

What is the largest value you anticipate?

A long integer example is installed with the U90 software.  Did you look at Help->Sample U90 Projects->Long Integers..U90  ?

Otherwise, upload your program with a more detailed explanation of your math.

 

Joe T.

Link to comment
Share on other sites

Dear Joe

Thank you indeed for your replay. I have checked the long integer help section. however, it seems, that long integers do not work in my script. I attached the file. 

I will divide the signal from the HSI (MI30) by 435, this will give me the cumulated amount in litres. I would expect litre-values of about 1000 . This would then give a value for MI30 (and MI31) of 435'000.

Have a look at section 18 (the above mentioned calculation) and 17 (reset of the display)

As in the help menu, I used

MI30 and MI31 (input from HSI) 

MI32 and MI33

MI34 and MI35

MI36 and MI37 (display)

as a long integer pair

Thank you indeed and kind regards Thomas

HSI.png

Teich Steuerung v70.U90

Link to comment
Share on other sites

  • 4 weeks later...
On 7/23/2023 at 6:58 PM, Flex727 said:

Other than this message, I don't see any unapproved content.

Dear Flex727, Thank you indeed for your replay.

I want to measure the amount of water flowing into a storage. I use the HSI counter and correct it with a constant value. it soon happens, that the MI is larger than 32767 and it start counting in the reverse direction. I tried with long integer (SB82) however, it does not work. I do not know why. I have a Jz20-R16

I checked the long integer help section. however, it seems, that long integers do not work in my script. I attached the file. 

I will divide the signal from the HSI (MI30) by 435, this will give me the cumulated amount in litres. I would expect litre-values of about 1000 . This would then give a value for MI30 (and MI31) of 435'000.

Have a look at section 18 (the above mentioned calculation) and 17 (reset of the display)

As in the help menu, I used

MI30 and MI31 (input from HSI) 

MI32 and MI33

MI34 and MI35

MI36 and MI37 (display)

as a long integer pair

Thank you indeed and kind regards Thomas

HSI.png

Teich Steuerung v70.U9079.76 kB · 3 downloads

Link to comment
Share on other sites

  • MVP 2023

Hi Thomas - 

I didn't have the U90 software on this computer so I finally downloaded the latest version (6.6.45) and installed it to look at your program.

First I looked at your HSI configuration mapped to MI 30.  The Jazz series has limited data type functionality and the HSC can only be mapped to a single MI.  From the Help-

image.png.a183b90a81918762a749435cbe40b607.png

You mention above that you have MI 30 and MI 31 mapped to the HSI input.  I looked through the Help and I didn't see anything about the HSI input being automatically mapped to two consecutive registers.  I think your basic assumption here is wrong.  Please correct me if you have information indicating otherwise.

So we're going to have to do it the ancient way.  In the Long Ago (1980s and 90s) most PLCs only had 16 bit integer values and there were no Long Integers, so we had to come up with tricky ways to work with the tools we were given.  The Jazz is a handy little PLC but it sucks at math, which always seems to come up in an application.  I personally call this the "Jazz Wall" and it's the main reason I don't use them anymore.  For your next application get yourself a Samba, which is a low cost Vision PLC that doesn't have issues like this.

Anyway, moving on with what we have to work with here the first thing to do is address the 32767 count limitation of the HSI so we'll have to do some program gymnastics.

We do this by counting to 1,000 and then incrementing another register (MI 100) and resetting the HSC (MI 30).   This will give us two split integers representing up to 32,767,000 to work with.  Note that you will be limited in the counter reset by the scan time of the PLC so you may lose a couple of pulses during the 5 ms or so that it takes the Jazz to reset the HSI counter.  You'll have to tell us how fast the pulses are coming in. 

Since we will be using this in a Long Integer calculation, I clamped the High Byte of the HSI (MI 31) to 0.

image.png.99f7dcaec333b6937ea9023e8f1676ef.png

 

Now we can use the 1,000 counter with a Multiply function to get an actual Long Integer number containing the virtual high value of the counter.  I also clamped the High Byte of the 1,000 counter (MI 101) to 0 so there are no surprises.

image.png.7f194d370bfd46eae0e34de7c385b404.png

 

We add the current HSI counter value to this number to get a full representation of your counter value - 

image.png.40d296b644c2e5617a264477a68ddc66.png

 

Now your divide by 435 block should work.

I don't have a Jazz here to test this so I don't know if this will work for sure.  I've attached the program.  Load it into your unit and let us know how it goes.

 

Joe T.

 

 

 

Teich Steuerung v70 JT.U90

Link to comment
Share on other sites

  • 2 months later...

Dear Joe, thank you indeed for your valuable input and sorry for my late replay.

Instead of the 1000 pulse counter you suggested, I made a 435 pulse counter in the same manner. This gives me directly the litre value I actually want. No issues with Long Integer anymore! :-))

Thank you for your inspiration.

Have a nice Sunday.

Thomas

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...