4/1/2020 6:45 PM  
Joined: 12/3/2018 Last visit: 1/13/2021 Posts: 75 Rating: (0) 
Hello, I would like to program a following problem:
I have a hunch that solution may be with use of "Mathematic instruction" setting "When En.=0 then output is Last Value" or something like that? But I don’t have quite a solution yet… I hope I have been clear enough with explanation. Any suggestion? 
4/1/2020 6:50 PM  
Joined: 12/18/2014 Last visit: 1/15/2021 Posts: 20926 Rating: (2304)

How big should the total value be? It ends at 32,767. The LOGO! can not more. 
4/1/2020 6:57 PM  
Joined: 12/3/2018 Last visit: 1/13/2021 Posts: 75 Rating: (0) 
Well, I guess this will be sooner then end of the world :) But it will be enough for three year approximately. 
4/1/2020 7:04 PM  
Joined: 12/18/2014 Last visit: 1/15/2021 Posts: 20926 Rating: (2304)

Example: You couldn't even add 3 whole days, since the maximum was reached at 32,767. 
4/1/2020 7:24 PM  
Joined: 12/18/2014 Last visit: 1/15/2021 Posts: 20926 Rating: (2304)

Please explain more what you want to do. Maybe a solution can be found. 
4/1/2020 11:49 PM  
Joined: 12/3/2018 Last visit: 1/13/2021 Posts: 75 Rating: (0) 
Well the number to be added each time would be much smaller, around 0.01 Can Logo deal with such small numbers? 
4/2/2020 4:36 AM  
Joined: 12/18/2014 Last visit: 1/15/2021 Posts: 20926 Rating: (2304)

LOGO! can't work with floats, LOGO! can only work with integers. For displaying you can manipulate the value, for the value e.g. 100 you can set for the display 2 decimal places. Then shows you the display 1.00 instead of 100. But the can you only show on the display values from 0.00  327.67. 
4/2/2020 8:14 AM  
Joined: 9/19/2018 Last visit: 1/15/2021 Posts: 160 Rating: (24)

An idea for getting bigger values is using Up/Down counter block. It can count up to 999999 (instead of 32767). As no floats are possible with the counter too, you may count 1 for each 0.01. But as the counter has no feature for decimal places in the message text, you get the 100 times bigger values as intended. And even 999999 (=9999.99 for your application) is not a very big number. And you may get problems with rounding effects; e.g. with this design you can’t add 0.009 or 0.012. Therefore I think for a good solution you need a SIMATIC PLC. In this way you can use floats and big values. 
4/2/2020 8:34 AM  
Joined: 9/19/2018 Last visit: 1/15/2021 Posts: 160 Rating: (24)

Another idea is combining blocks Mathematic instructions and Up/Down counter: E.g. you count always the 1000 time values and use 3 decimal places in the message text. Always when the result us >1 you subtract 1 and add 1 to the counter. In this way the counter shows the fix point part up to 999999 and the mathematic block shows the part behind the dot. And if your calculation tells you 999999.999 is not enough for you LOGO! livetime, you can reset this counter always if it reaches 1000 to 0 and add one to another counter… Nevertheless I still think a SIMATIC with a 64 bit doublefloat, is the better solution. 
4/2/2020 9:32 AM  
Joined: 12/3/2018 Last visit: 1/13/2021 Posts: 75 Rating: (0) 
LOGO support, thank you for the informations. Combining the counter for range extension seems as an interesting possibility. And I must stick with the Logo with this project.
I can change an approach because of those limitations. Instead of adding (approx., the figure is just an range example) 00.1 every minute, I could add 14.4 every day (rounded to 14 or 15 by LOGO). Thus the mistake would be 3% in a day which is totally acceptable. Since I am already using averaging function in front of some main factor of "math. instruction" bloc, I hope this will still give me a usable indicator on LOGO display. If rounding (= cutting the small number behind decimal point) is as usual in mathematics  sometimes to lower number and sometimes to higher (how is LOGO really rounding?), statistically this will somehow compensate itself and the overall result would be precise enough in one month or one year. I am planning to read out those numbers once per month. As far of the memory range  it will be OK for cca. 6 years (14 x 365 x 6). Then I can reset it. So, my dilemma basically stays the same, as I explained in first post: how can I add a previous result with the next one? I can put a programm which I have if this helps with suggestions. 
4/2/2020 9:43 AM  
Joined: 12/18/2014 Last visit: 1/15/2021 Posts: 20926 Rating: (2304)

Rounding example: The main problem remains the same: That's why I asked you to explain exactly what you want to do. But I don't get that explanation. If you e.g. want to weigh something and the weight is around 335 g, if it were 0.335 kg. 
4/2/2020 2:29 PM  
Joined: 12/3/2018 Last visit: 1/13/2021 Posts: 75 Rating: (0) 
ixo65, I didnt quite understand your weighting example. Here is what I am trying to do: I am calculating the heat energy from momental and average power. I have 2 sensors for temperature (Vorlauf, Rucklauf) and liquid (heating water) flow sensor. I have calculated momental power and then average it over some period (one hour for the test). The power results are in 5th row of LOGO display (first momental and then average power). Then I calculate the gained heat energy in that hour. That is displayed in the 6th row. I would need to store this value and then add it to new value which comes next hour. This is the part which I don`t know how to program. AttachmentTest program.zip (15 Downloads) 
4/2/2020 2:54 PM  
Joined: 12/3/2018 Last visit: 1/13/2021 Posts: 75 Rating: (0) 
Because one hour is very long time for testing, I change a bit the program to be more "test friendly". The averaging time is one minute (you have to wait one minute to see the average value) and energy calculation can be done sooner with a press on C1 button, just to see it working. Some examples: Power 1000W (= 1kW) .... that means 1kWh energy in one hour. Power 1350W (= 1.35kW) ...... again 1kWh (because of rounding to lower number) Power 2730W (= 2.73kW) ....... gives a result 3kWh energy in one hour (because of rounding to higher number) If I want to calculate the energy in two hours, I need to store this value and add it to next one for the second hour. And so on... 32767 is big enough at this point. AttachmentTest program (shorter times).zip (12 Downloads) 
Last edited by: Frayer at: 04/02/2020 14:56:10 

4/2/2020 3:43 PM  
Joined: 12/18/2014 Last visit: 1/15/2021 Posts: 20926 Rating: (2304)

Hello Frayer, take a look at attachment. It's a possible solution. This solution counted your kW/h up to 999.999 kWh. With a litte trick and two counters more you can count up to 999.999.999.999. AttachmentTest program (shorter times)_V2.zip (22 Downloads) 
4/2/2020 4:56 PM  
Joined: 12/3/2018 Last visit: 1/13/2021 Posts: 75 Rating: (0) 
You solve not one problem, but two of them in one package Great. I don`t understand excactly how it works just yet, but I will try to... (can you explain just a little bit?) There is really no need for MW since 999999kWh should be enough for more than 5 lifespans of the measured machine (heatpump with expected annually energy produce of around 20.000kWh) Now I just have to change readings (calculations) from one hour back to one day, because rounding (cutting) of decimals bring less error on one day then on one hour because the day number is bigger. No biggie, it basically means that you will have to wait one day for a bigger number, but as I said, I plane to read it out once/month. Or maybe you have a solution even for that as well? 
4/2/2020 5:18 PM  
Joined: 12/18/2014 Last visit: 1/15/2021 Posts: 20926 Rating: (2304)

Hahahaha .... I guessed it. As soon as the solution to the problem is delivered, a second one is called up immediately. 
4/2/2020 9:36 PM  
Joined: 12/18/2014 Last visit: 1/15/2021 Posts: 20926 Rating: (2304)

Attached is a proposal on how you can save and add up the exact energy value in W/h every hour. If you inserted in your program then must you the follows: You have to reference your calculated energy value per hour to B011 (parameter V1). The value of 32,767 is also only for the simulation. In your program must you set to 0. AttachmentCounter.zip (25 Downloads) 
4/3/2020 1:26 PM  
Joined: 12/3/2018 Last visit: 1/13/2021 Posts: 75 Rating: (0) 
Hi, I put it together and now testing it. So, if I want to avoid rounding error, I have to calculate in Wh not kWh. That means the result will be in bigger numbers. This is a little bit unclear, because we are used to kWh. Maybe I will rather stick to your first solution with kWh and daily reading, I haven`t decided yet. I will test both versions and then decide. Can you tell me what is the purpose of "Protection active" setting of some bloc (I mean in general)? P.S.: Don`t be mad at me, I have to correct you since I am an electrician: the correct unit for energy is Wh (or kWh, MWh, Ws....) not W/h This is because you calculate the energy from power with equation " Energy (Wh) = Power (W) x time (h) " See "Misuse of watts per hour" in Wikipedia:https://en.wikipedia.org/wiki/Kilowatthour 
4/3/2020 1:33 PM  
Joined: 12/18/2014 Last visit: 1/15/2021 Posts: 20926 Rating: (2304)

The Wh value can be a max. of 32, 767 Wh. But you are not forced to take my solution either. 
4/3/2020 2:14 PM  
Joined: 12/3/2018 Last visit: 1/13/2021 Posts: 75 Rating: (0) 
Maybe we don`t understand each other... It is hard to communicate over keyboard in foreign language and the topic isn`t exactly light ;) If I stay at kWh (which I would prefer) I still get a rounding error in my B003: (dividing with 1000 is there because of translating from Wh to kWh) 
Last edited by: Frayer at: 04/03/2020 14:17:17Last edited by: Frayer at: 04/03/2020 14:19:54 

Follow us on