I am recreating a project from vision to perspective. One of the scripts simply copy values over from one UDT to another. They are all either double, integer, or float values with the exception of the first one. The location I want to copy from is ‘Memory’ and the one I want to copy to is ‘Cell/Current’. The vision project was done by a programmer who did a script which accomplished this but they did it by first writing values from ‘Memory’ into a dataset and then wrote the values from the dataset into ‘Cell/Current’.
I decided to accomplish this without creating a dataset to transfer the information. The code I have below does work perfectly fine:
def load_mem_to_current(cell_id):
"""Load recipe parameters from memory to cell/current location
Param:
cell_id (str): Id designation of cell
"""
recipelog = system.util.getLogger("RecipeLogger")
mempartTag = '[{}]/Cell/Recipe/Memory/0'.format(cell_id)
curpartTag = '[{}]/Cell/Recipe/Current/Cell/0'.format(cell_id)
completeTag = '[{}]/Cell/Control/Recipe Loaded'.format(cell_id)
#write memory part number to current partnumber
memPartNo = system.tag.read(mempartTag).value
system.tag.write(curpartTag,memPartNo)
index = 1
while index < 49:
memTag = '[{}]/Cell/Recipe/Memory/{}'.format(cell_id, str(index))
memValue = system.tag.read(memTag).value
curTag = '[{}]/Cell/Recipe/Current/Cell/{}'.format(cell_id, str(index))
system.tag.write(curTag, memValue)
index = index + 1
My question is is there an advantage to going the dataset method versus what I have? I only have 48 values within the UDT to transfer over and it seems to copy values over pretty quickly.