TIA Portal storing a value for previous cycles

thewalkerist

Member
Join Date
May 2021
Location
Izmir
Posts
178
Hello,

I was messing around with my HMI and i decided to save some values from the previous cycles so i can see how much efficiently i was working. I started thinking and came up with something like this.

As a beginner-level person on plcs and programming i am kinda weirded out by this. Dont get me wrong, it is working as intended. I have 5 values that are stored. 5th number is oldest cycle result and the 1st one is the newest one. I can add more if i want to easily and its working fine as it is. But i cant stop myself from thinking if there is another way to achieve the same result with something more efficient or better. I mean if i wanted to store 20 values then what would i do? just put 20 more move blocks and have something like a 4 storey building?

What would you do if you needed to store values like this?

Screenshot (877).png
 
Use a word shift function, Not done S7 for a number of years but I bet there is one.
Attached is a Mitsubishi program, this was a test for a conveyor that tracked parts & diverted them based on a number in the word shift register, basically, when a bar code was read a pulse was generated & the bar cade stored in the head of the shift register array, the data was shifted down on that pulse, when the register i.e. perhaps array[50] for example compared with a known number it diverted, not what you are doing but the storing of values in an array is the same so in this case it would only require a oneshot when you wanted to store & shift the values, the one here is 100 words long but it can be what you want i.e. say DB100 words 0-99.
Edit: found this on YT
https://www.bing.com/videos/search?...qpvt=Siemens+S7+word+shift+register&FORM=VDRE
 
Last edited:
Hey i wondered if that shift left- right stuff would work for this but didnt know how, Thanks for that. Its time to learn :D

I was just doing it to learn more, so i dont think that i would go for something like yours anytime soon but thanks for that sample project. I cant wait to dissect it after i learn more about Shifts and rotates
 
Stop using M tags, use DBs with arrays, structs etc.

I was using it for experiments. Though i gotta be honest i am still using M tags on very important things, i will try to fix that aspect of myself. But ever since i learned about DBs, i cant stop using them :D. Now i saved both my Preset Names AND my values all thats left to do is put em on my screen

Screenshot (879).png
 
all thats left to do is put em on my screen

Whoops forgot to mention a small problem on that note. Well in my basic panel i cant even get a simple table so that i can put my stuff in so i had to get creative.

Dont ask me how i did it, it was the most painful experience of my life, I used the colors of the table from my old recipe view. And i used I/O fields to make it and then grouped them into one and then there you go, a perfect table view. (y) Dont laugh please and please dont tell me there is a way to do tables on ktp400 basic because if there is a way and i didnt see then im gonna cry

Screenshot (882).png
 
FIFO huh? never heard that. Is it normal that i dont have it?

Most PLCs follow the precept "some assembly required." Some have useful pre-built functionality (like FIFOs and LIFOs), some do not. The definition of what is "useful" will vary from vendor to vendor, of course. Major vendors provide sample libraries to compensate for what they did not put into the base package, probably to cut down on service calls.

Here is another approach (see attached image): a FIFO-like FB that uses a circular buffer: "circular" means you maintain an index to the next location to add the new value, and you don't have to shift the data values through the array. I.e. in a normal FIFO, the values' locations shift in the array, and the indices (indexes) are static, so e.g. index 0 is always the oldest value and N is the newest value. In a circular buffer, the values' location in the array are static, and the indices are dynamic.

Note: this does not implement strict FIFO, because it assumes the buffer is always full. Normally a FIFO starts out empty, then adds items until it is full, at which point you have to pop (dequeue) the oldest element off the buffer before you can push (enqueue) a new element onto the buffer. But in this thread it does do the same thing as OP's branches of multiple MOVes.

xxx.png
 
FIFO huh? never heard that. Is it normal that i dont have it?


It's a library that isn't included by default. There are a ton of libraries on the support site for various purposes; this one is "general" functions. You need to go download it. Why? No idea, seems like it should be included, but I'm sure it's been created/maintained by different people.



https://support.industry.siemens.com/cs/us/en/view/109479728
 
It's a library that isn't included by default. There are a ton of libraries on the support site for various purposes; this one is "general" functions. You need to go download it. Why? No idea, seems like it should be included, but I'm sure it's been created/maintained by different people.



https://support.industry.siemens.com/cs/us/en/view/109479728

wow i didnt know that we can download new stuff. Thats amazing
 
Here is another approach (see attached image): a FIFO-like FB that uses a circular buffer: "circular" means you maintain an index to the next location to add the new value, and you don't have to shift the data values through the array. I.e. in a normal FIFO, the values' locations shift in the array, and the indices (indexes) are static, so e.g. index 0 is always the oldest value and N is the newest value. In a circular buffer, the values' location in the array are static, and the indices are dynamic.

To my dismay i dont have that aswell :D. I dont know if its is a part of that LGF stuff or not, maybe thats why i dont have it. Im gonna download these LGF's immediately. Im missing quite a lot of fun stuff.

Hey since i have you guys and i know this has nothing to do with my original post's topic, but as i previously stated at my post, im having quite difficulties with my current basic panel(ya know, cant create anything and its too small). I wanted to buy a new hmi but siemens' HMIs always seems so annoying to me. I dont know most of the screen is junk stuff, only small margin of it is useable. I was looking at other brands and i dont know, mitsubishi, schneider, allen bradley these all seem to have kind of better looking HMI's. Is it possible for me to buy one of these HMI's and use that instead of my current HMI? Does TIA portal support that kind of thing?
 
To my dismay i dont have that aswell :D. I dont know if its is a part of that LGF stuff or not, maybe thats why i dont have it. Im gonna download these LGF's immediately. Im missing quite a lot of fun stuff.


That FIFO-ish code I wrote myself this morning; it is not in any library.
 

Similar Topics

hi, i made a program of controlling temperature of 20 tanks using PID control. now i want to store the data of the present temperature of the...
Replies
4
Views
2,881
Hi All, Someone at work has put a PLC system on my desk, that's just been taken off an idle production line. He said "It's an S7 PLC. We don't...
Replies
10
Views
252
Hi guys , I'm new with Allen Bradley, but I have experience with Tia portal (s7 1200 ,s7 1500) I want to convert my project from Tia portal to...
Replies
2
Views
208
Hi, I have had problem with upgrading some projects from v16 to v18. I tried it on 3 diffrent computers. I want to post this so that anyone that...
Replies
3
Views
173
Hello gentlemen, Im working on a small project on TIA Portal, about establishing a Modbus TCP connection between my ET200SP plc and a socomec...
Replies
12
Views
310
Back
Top Bottom