Jump to content

How can I reduce step number of the program which is developed with gx iec software?


Recommended Posts

Posted
Hello, I am a new member at the forum. There is a problem interested with gx iec.The problem is that I developed a function block.Normally, step number of function block is seeming 80.I downloaded software to plc from gx iec,after that I uploaded to plc using normal gx software.In this,step numbers of function block is seeming 405.How can I reduce step numbers of function block?

Posted (edited)
hi kaare_t,thanks for reply.I attached the fb in library format.If you would use gx iec,you can review the fb.I wonder your reply thank you very much again.FAN_CONTROL_FB.zip Edited by Mitsumi
Posted
Hi, Your FB uses 315 steps. Note that you cannot determine the number of steps based on the number of networks. Currently, inside the FB, you have 50 networks. That is not the same as step numbers. The actual step numbers can be found when you compile the program in GX IEC, look at the bottom where it says 315 steps (see attached picture). Does this clearify your question? I've also taken a small look in your code, and I don't think that you will be able to compact the FB any more, so you'll have to use it like it is.... But you're running a Q-CPU so you'll have plenty of space...!!???
Posted
Sorry, it uses 315 steps after I have compiled.I will use Q25PRH cpu.It supports 250 k steps and There are 800 fans in the our project.I must reduce step numbers of fb.In addition,there is an another my question that Do you know how many pou (as a program) supports gx iec?We are thinking to do subprograms to use task function. Thank you very much.
Posted
When you use timers or other functions that requires values to be retained over several scan-cycles in the PLC you cannot do this routine as a sub-routine, since FAN2 will overwrite FAN1, FAN3 will overwrite FAN2 and so on.... The FB/Sub-Routine must "remember" timer values etc over several scans, so you must allocate one FB for each instance. I think you will have to go with two CPU's....
Posted (edited)
I will use different instance name for each fb. for example at the first program FAN1, for second fan "FAN2" etc.Actually,We will already use two cpu's because it will be the reduntant system. But there are different equipments and fan blocks will use memory predominantly.Interested with pou's How can i use different pou's as a program? Also, Is there any limit interested with pou numbers in gx iec? thank you very much. Edited by Mitsumi
Posted
Not sure if there are limitations on the number of POU's, I'm pretty sure that it isn't but I won't guarantee it. Regarding different POU's, if you define Global Variables you can access them across different POU's, however local variables are inside specific POU only. POU's are executed in the order that you specify in Task_Pool. I don't think that you will have space for 800 FBs in your CPU. Remember that the first FB takes 315 steps, and every additional FB will occupy a little less than 315 so the total will be a bit less than 315*800 = 252k steps. However if you are able to download the FBs to the CPU you won't have space for other tasks....
Posted (edited)
By "normal GX" you demonstrated your intuitive feeling that GX IEC is not normal. Fully agree, and recommend you to use GX, as you have both in your possession. Edited by Sergei Troizky
Posted
I've never personally used GX IEC Developer, but in GX Works2, I know there are a couple of check boxes when creating a function block, and one of them determines if the code will be a subroutine or will be inserted into the program each time its used. It's called Use Macrocode in GX Works2. I know you can't use GX Works2 with the redundant CPU. I know also if your program is too large, you could consider Q50UDEH or Q100UDEH processors. 500k or 1000k steps of program. But they are not redundant.
Posted
You are right, we have the same option in GX IEC Developer. But this is where the problem occurs with his code, he is using timers and a subroutine won't do the trick since the subroutine is called from 800 places in the program, no2 will overwrite no1, no3 will overwrite no2 and so on....So you are correct, this option is extremely important to know about. It is default left off in GX IEC, so many people have problems when creating FBs, since they don't behave like expected... In addition, just to explain, macrocode basically inserts the selected FB/FUN directly into the code between the networks where the FB/FUN is located, just as regular code. So if you were to upload the program as IL, you won't see any calls to subroutines, you will only see regular code even where the FB/FUN is inserted, and you will see the same code repeat itself over and over again if you use the FB/FUN several times...
Posted
Mitsumi, Your program can be extremely short. To do this: 1. Use the DUT to describe input and output variables of the function block. 2. Represent variables in the GVL in form of Array of DUT. 3. Run the functional block in the loop with the necessary number of repetitions, where the variables at each pass will be pulled out of the array by index. In addition, the functional block, which you wrote, itself can be optimized to reduce the number of steps that are generated when it is compiled. It's possible to provide.
Posted
Hi Inntele; I am not an expert about iec.Could you do at above conditions in gx iec as an example? I have added code (library file) third post. Thank you very much.
Posted (edited)
Until you work on the task, please continue to do it yourself. Nevertheless, to help you, I am publishing the sample, which showing those key points to a program design, about which I mentioned in the previous post: OBJECT_TEMP_CONTROL.zip Edited by Inntele
Posted
Please, but I don't know what I can help you else In contrast to your FB, the sample program, I've published, is supplied with detailed comments, which allow to understand what task is need to implement and by what actions and steps the task was performed. The file of sample has been updated.
Posted
@Inntele: I've reviewed the program, and your loop through all the heaters (in POU "Object_Temp_Control"). This would of course work, except when using timers inside the FB's (FB_Heater) since the timer will be resetted everytime you do a loop, hence the timer output will never turn on.... Except for this everything would work. Also, the topic starter has never specified time requirements, but if time is not at an issue I would re-write the FOR-NEXT loop to do a scan based indexing so that instead of iterating 1000 times, you will distribute the loop over 1000 scans. This would lighten the scan load, hence each scan would go quicker and not "hang" the rest of the application. This is of course only my personal opinion, AND if the requirements of quick FB updating is NOT time critical. Except for the points above Inntele has made a pretty extensive work on the FBs of the topic starter, great work!
Posted
@Mitsumi: You should really consider to decrease the number of steps in your FB. Remember that if you reduce the FB with e.g. 10steps, the whole program will take 8000 steps less (10 * 800).... So I would rewrite the whole FB from scratch, and try to make the FB as efficient as possible, 2 steps here and 3 steps there will make huge improvements of the total of 800 FBs. Also, as Inntele has shown you it's possible to loop through all the 800 FB's. Do you really need to use timers inside the FB? Could you do without? Basically Inntele's example shows you how to iterate through the 800 FBs, instead of inserting 800 FBs (what a huge job, and not very efficient) into the program.
Posted
Dear Kaare, Thanks that you appreciated my example And, let me add one small remark else... The sample, posted by me, shows the general principle of the implementation of similar tasks. At the same time, to run the function block in the FOR-NEXT loop is just one of the variants of such implementation, allowing reduce the lenght of program code extremely. Somebody, who does not like FOR-NEXT loop: 1) can easily delete all PRG-networks, except of network, containing the FB_Temp_Control; 2) uncheck a box "Use a macrocode" into a properties window of this block; and then 3) insert 1000 same FBs into his program (as single local variable of this PRG), equipped each with the numerical number of zone. Even in this case, whole program will take simply 8400 steps, but appears a monitoring possibility for FBs.
Posted (edited)
Dear Kaare, Why do you sure that the timer value will be resetted? The timer is only a special memory cell, the value in it I rewrite every time before it performs, and if its coil is active it shouldn't be resetted... I've checked the truth of your conclusion, and it's erroneous. All timers works properly. If you doubt in my words, please make checking again. Edited by Inntele
Posted
Maybe I've misunderstood the topic starter: I thought he needed the timer for each of the FB's so that they could work independantly. If this is not the case then your solution will work. However if he needs a timer that monitors each FB then he will have to do it differently.... Agree?
Posted (edited)
Of course, you are understanding the task correctly. And that's exactly what I was trying to implement, but with single timer only, because all is need from a timer - this are the correct calculation of time and on-time setting of its flag . To provide this, the current timer value is being overwritten to the previous value, stored in the cell, assigned for each heater, and so on. But in fact, you were right, something in the program does not operate properly because faulty flags for 2kW heater is being set as unfounded , when the time delay from the start has not expired. Where is buried exactly this issue I have not identified yet. But when there will be free time, I will find the cause of problem and lay out the result in this thread. Edited by Inntele

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...