TL;DR: What is the best way to Export Ladder Logic in Tia 14?
Recently my company has started using Tia Portal v14. The update was due and we have begun to do some work with the S7 1500 series of CPUs. It has come to the attention of those in my team that there is not a simple way to export LAD logic (FBs, FCs, OBs) from Tia 14. Since we are working on separate PCs its very inconvenient not to be able to send the individual blocks to one another when an update is put out. It is even more inconvenient for the people debugging the machines that are using the CPUs. We have come up with a few ways around this, but I wanted to hear the opinion of people on SO regarding the best ay to export LAD logic.
Things we are doing or have tried:
Zipping entire project so that it can be sent to a new pc and have the file copied over (Working solution, but seems rather clunky and inconvenient as compared to sending a single file and importing it).
Conversion of the Ladder Logic to a language or view that has "Generate Source from Blocks" enabled (SCL, STL, etc.) (Comes with its own host of issues, such as issues converting back to LAD, unfamiliarity with Text based languages, etc).
Looking into a solution where the LAD file is converted to XML using a piece of Third party software, and then imported back in through the program on the other end (Not me who is looking into it, so I cant give a lot of details. One of the guys on my team believes this to be possible and is looking into it).
Calling attention to any oversights or offering suggestions is appreciated.
Your third option you listed may be the best way to do this. You can use the Openness
API that is a .net dll. You can quite easily export a plc block (in xml
) then import the function block into another project. you don't even have to look at the xml
to do this.
Here is an example code of how to do so
//Import blocks
private static void ImportBlocks(PlcSoftware plcSoftware)
{
PlcBlockGroup blockGroup = plcSoftware.BlockGroup;
IList<PlcBlock> blocks = blockGroup.Blocks.Import(new
FileInfo(@"D:\Blocks\myBlock.xml"), ImportOptions.Override);
}
private static void ExportBlock(PlcSoftware plcSoftware)
{
PlcBlock plcBlock = plcSoftware.BlockGroup.Blocks.Find("MyBlock");
plcBlock.Export(new FileInfo(string.Format(@”D:\Samples\{0}.xml”,
plcBlock.Name)),
ExportOptions.WithDefaults);
}
Check out this link for an example project. Openness