570 else: |
570 else: |
571 typeidx, varname = variable |
571 typeidx, varname = variable |
572 variable_infos = self.IECLocations[varname] |
572 variable_infos = self.IECLocations[varname] |
573 |
573 |
574 # Calculate base index for storing variable |
574 # Calculate base index for storing variable |
575 mapvariableidx = VariableStartIndex[variable_infos["pdotype"]] + \ |
575 mapvariableidx = \ |
576 VariableTypeOffset[variable_infos["sizelocation"]] * VariableIncrement + \ |
576 VariableStartIndex[variable_infos["pdotype"]] + \ |
577 variable_infos["nodeid"] |
577 VariableTypeOffset[variable_infos["sizelocation"]] * VariableIncrement + \ |
|
578 variable_infos["nodeid"] |
578 |
579 |
579 # Generate entry name |
580 # Generate entry name |
580 indexname = "%s%s%s_%d" % (VariableDirText[variable_infos["pdotype"]], |
581 indexname = "%s%s%s_%d" % (VariableDirText[variable_infos["pdotype"]], |
581 variable_infos["sizelocation"], |
582 variable_infos["sizelocation"], |
582 '_'.join(map(str, current_location)), |
583 '_'.join(map(str, current_location)), |
583 variable_infos["nodeid"]) |
584 variable_infos["nodeid"]) |
584 |
585 |
585 # Search for an entry that has an empty subindex |
586 # Search for an entry that has an empty subindex |
586 while mapvariableidx < VariableStartIndex[variable_infos["pdotype"]] + 0x2000: |
587 while mapvariableidx < VariableStartIndex[variable_infos["pdotype"]] + 0x2000: |
587 # Entry doesn't exist |
588 # Entry doesn't exist |
588 if not self.MasterNode.IsEntry(mapvariableidx): |
589 if not self.MasterNode.IsEntry(mapvariableidx): |