Jump to content

Recommended Posts

Posted

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.

  • MVP 2023
Posted

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.

Posted

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

  • 4 weeks later...
Posted
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

  • MVP 2023
Posted

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

  • 2 months later...
Posted

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.