S7-312 out of memory question??

Johnny T

Member
Join Date
Jul 2003
Location
Fife, Scotland
Posts
642
Hi

I'm doing a job that uses a S7-312 PLC. When trying to download the program I got the error saying that it was 'out of memory'. I tried compressing and that worked at first but then the downloading failed (ie. the memory was chock full).

So... I changed the 64Kb Micro Memory Card for a 512Kb Micro Memory Card and now I find that I have exactly the same problem???

Is there something I'm missing here?

Do I have to somehow tell the 312 to start using the MMC when its memory is full??

Any advice, as always, appreciated.

Cheers

JT :)
 
I am not certain that this is the solution, but try to go online and delete all the blocks. Then download only the blocks that are relevant.

Is there something about that you can overwrite but not delete blocks on the MMC card ? To delete them you need an MMC "prommer" ?

For your info: The MMC is the "load memory" whereas the RAM on the CPU is the work memory.
I think you can investigate if it is the MMC or the CPU RAM that is full, by checking the CPU "Module Information" and then "Memory" tab.
There should be separate info about load memory and work memory.
 
Jesper

I've looked in the module diagnostics and the RAM memory is only 2% full but the "Work Memory" is 90% full.

I thought it might be because I was trying to download the whole project in one go (I was thinking that maybe the work memory was acting as a buffer and was overflowing before it could write to the MMC) but I still get the same problems if I try and download the blocks one by one.

If I go online I only see the SFC's in the PLC (and the blocks that I've managed to download).

Any other ideas mate?

If it helps.. when I try and download the entire project I get the following error:
"Possible working memory bottleneck. Required/free/total working memory 33472/16384/16384"

???

Cheers

JT
 
The 312 only has 16kB work memory.
Check the size of the blocks you are trying to download.
The "required" memory says 33472 bytes, and the "free" is 16834 bytes.
It looks like at least one of your blocks (or is it the sum of them ?) is too large.
 
Jesper

The biggest block is 7100 size in work memory.

Does the 16Kb work memory mean that the 312PLC can't run any program bigger than 16Kb??

I thought that, as long as your MMC was big enough, it wouldn't matter??

Cheers

JT
 
Johnny T said:
Does the 16Kb work memory mean that the 312PLC can't run any program bigger than 16Kb??
That is correct.

Johnny T said:
I thought that, as long as your MMC was big enough, it wouldn't matter??
No, the MMC is sort of a "backup battery and EPROM in one". The program has to run in the CPU RAM memory (load memory).
 
So, there is no point having a MMC bigger than your RAM (ie 16Kb in my case). Because if you load anything on the MMC it isn't going to fit into the RAM in the event of power failure etc...

Siemens stuff is very badly designed. You would have thought that the processor would be able to run whatever was on the MMC. So the MMC would act like extra RAM...

So.. that's £140 on that MMC down the pan then because the PLC isn't going to be able to run the program full stop.

Many thanks for your help Jesper, thanks for clearing that up, you have saved me a few hours of struggling.

Cheers

JT :)
 
Because if you load anything on the MMC it isn't going to fit into the RAM in the event of power failure etc
Actually, it is relatively normal that the load memory usage is a little bit greater than the work memory usage. The CPU only loads the blocks that are called in the program. So dormant blocks may stay on the MMC and not be loaded into the work memory.

Siemens stuff is very badly designed.
I think that the design is very well thought out. Problem is the documentation that is weak or overcomplicated - leading to misunderstandings.
 
Hello Johnny;

It is a good practice to keep abreast of the memory requirements of a program you are developping on a Siemens PLC (especially if you are working with the smallest and cheapest of the breed). If you right-click on the Blocks folder you will find memory usage information on the blocks (work and load memory).
Now, is there any way you can reorganize your blocks to optimize your memory usage? Using FBs with different instance DBs requires less memory than calling thhe equivalent FC many times, for example. You seem to have one particularly large function; any way you can segment the logic into different blocks that you can then call in sequence (so they are not all in work memory in the same time)?
Hope this helps,
Danmiel Chartier
 
Daniel

I've gone to the properties of the blocks and found this:
 
User program memory

Size in load memory 49584 bytes
Size in work memory Code 26532 bytes
Data 6940 bytes
Total 33472 bytes



Does this mean that there is no way to fit this program in a 312 with a 512Kb MMC fitted?

Most of my blocks are FB's with instance DB's attached. There is one FB that is 7218 in size. I could conceivably split this into other FB's but would that help??

Many thanks

JT
 
You have too small a CPU for the application you are trying to make.
The latest version 314 (6ES7 314-1AF10-0AB0) with 48kB is the smallest one that can fit your current program (note: older 314 types only have 24kB).
How big is your project ? How many io ?

The only thing that can help to squeze the program into a 312 is to cut down on code and data so much that the work memory sum comes below 16kB.
 
Jesper

There's very little I/O.. about 12 inputs and 12 outputs.

I'll have a look at the code and see if there's anyway of amalgamating bits of it or reusing bits of it to try and cut down on the size of it.

It's actually not finished yet so it will get a little larger than it is.

What figure should I be looking at for the PLC I need.. is it the "Total work memory" or the "Size in Load memory" ??

Thanks

JT :)
 
With only 12/12 io, it should be possible to squeze it into the 312.
What is it that the program is supposed to do ?
Are you doing a lot of calculations ?
The question is how you have made your program.
What is it that eats all that memory ?

In the end the critical value is the size in work memory.
But be warned !
The size reported by STEP7 when you investigate the properties for the blocks is not the real sum that eventually will be required on the CPU.
In addition to the blocks there is system memory and communication connections that also eat memory.
Try to download some blocks to the 312 you have, and then compare the sum of the blocks reported by STEP7, and the amount of used work memory reported online with "Module Information". This will give you a rough idea on how much memory you must set aside to "extras".
 
Jesper

Many thanks for the info.

The program is basically controlling 16 servo motors via a CP341 card. The data that controls the 16 motors (ie. the position they all have to be in) is held in a datablock. There are 32 possible configurations however so that means 32 datablocks.

There's then FB's that read the relevant datablock (depending on prog chosen by the operator) and write the info to the motors.

That is why there's very little i/o but a lot of memory used for the program.

Cheers

JT :)
 
Ahaaa... the truth is revealed.
16 servo motors. Does sound a little much for the poor 312.
With a CP341 you must count on that the communication connections will use some of the work memory by itself.
 

Similar Topics

Hello my fellow plc masters. I have come to ask you again :D Lets start the story. A few days ago i've made a post here about a s7-300 plc and...
Replies
19
Views
4,562
Hi! Greetings, I've been trying to use the PLC M221 to control and read the variables from the VSD ATV312 through Modbus RTU, which is something...
Replies
2
Views
1,601
Dear all, My CPU312 is in RUN state, RUN and DC5V LED's are green. Still there is no input or output. CP341 (RS422/485) is also installed in a...
Replies
2
Views
1,048
As you know, Schneider is phasing out the 312. We have had problems w/ the 320 following the decel ramp. Anyone else? Also, we have had to adjust...
Replies
3
Views
1,515
Hello everyone. I'm trying to communicate a Controllogix L36ERM with a 1769-SM2 Modbus module to a Schneider-electric Altivar 312 Modbus motor...
Replies
7
Views
2,477
Back
Top Bottom