Discuss and solve problems in energy management and automation. Join conversations and share insights on products and solutions. Co-innovate and collaborate with a global network of peers.Register Now
I have a situation where my program is storing real variables with the starting word is an odd %mw for example %mw1553. My version of the program from a week ago the same real in the same structure was at %mw1554. There is not change to the structure, no new variables added or removed. I was under the impression that all real data types need to start at even address. Can anyone help me find what setting I may have changed or what may have happened here. We are running unity 13.1, and ran an update recently. All I can recall settings wise that has been changed is increasing memory size from 5000 to 7000 and "allowin dynamic arrays". This is an M580 2040
The reason was due to unity shuffling memory addresses when it is in simulation mode
yes I know its not a new feature, that is the problem. In our original developed program we put a ddt at address %mw1000 for example. the first word is at %mw1000, the second thing in there is a real and is placed automatically at %mw1002. If you put your plc in simulation mode it will put the word at %mw1000 and the real at %mw1001
For testing a program in simulation mode the plc re positions reals that are in DDTs to be able to start on odd addresses without error. I see this as a huge flaw with the simulator mode, it should act identically to regular operation in terms of memory allocation.
Ok, now I understand what you are facing.
And I try this also on unity 8.0 and control expert 14.1 and you are absolutely right. 😂
Hi @Omaelk can you mention/forward to M580 Product manager / R&D team. about this issue. Thanks
The problem comes from the 32 bits alignment in the M580 platforms. If you map a structure on %MW, due to the 32 bits alignment some holes can be created to align the 32 bits variable on even addresses. (DWORD, REAL...) this is not the case when you use the simulator which is based on 16bits alignment. this is due to the legacy platforms which are all 16 bits, when the simulator was developed. This is explained in the online help in the topic: DDT: Mapping Rules.
I just forgot something, There is a warning message that can be triggered in case of mapping compatibility. this message is displayed if Control Expert needs to align the 32 bits variable: