etherlab/entries_list.ysl2
author |
Andrey Skvortsov <andrej.skvortzov@gmail.com> |
|
Tue, 05 Mar 2019 11:19:36 +0300 |
changeset 2519 |
27955f010b23 |
parent 2165 |
02a2b5dee5e3
|
child 2641 |
c9deff128c37 |
permissions |
-rw-r--r-- |
Fix crash if LD input contact isn't connected
Traceback (most recent call last):
File "/home/developer/WorkData/PLC/beremiz/beremiz/BeremizIDE.py", line 339, in OnMethod
obj.CTR.CallMethod('_'+meth)
File "/home/developer/WorkData/PLC/beremiz/beremiz/ProjectController.py", line 1996, in CallMethod
getattr(self, method)()
File "/home/developer/WorkData/PLC/beremiz/beremiz/ProjectController.py", line 1134, in _Build
IECGenRes = self._Generate_SoftPLC()
File "/home/developer/WorkData/PLC/beremiz/beremiz/ProjectController.py", line 746, in _Generate_SoftPLC
if self._Generate_PLC_ST():
File "/home/developer/WorkData/PLC/beremiz/beremiz/ProjectController.py", line 763, in _Generate_PLC_ST
self._getIECgeneratedcodepath())
File "/home/developer/WorkData/PLC/beremiz/beremiz/PLCControler.py", line 456, in GenerateProgram
self.ProgramChunks = GenerateCurrentProgram(self, self.Project, errors, warnings)
File "/home/developer/WorkData/PLC/beremiz/beremiz/PLCGenerator.py", line 1762, in GenerateCurrentProgram
generator.GenerateProgram()
File "/home/developer/WorkData/PLC/beremiz/beremiz/PLCGenerator.py", line 478, in GenerateProgram
self.GeneratePouProgram(pou_name)
File "/home/developer/WorkData/PLC/beremiz/beremiz/PLCGenerator.py", line 260, in GeneratePouProgram
program = pou_program.GenerateProgram(pou)
File "/home/developer/WorkData/PLC/beremiz/beremiz/PLCGenerator.py", line 1718, in GenerateProgram
self.ComputeProgram(pou)
File "/home/developer/WorkData/PLC/beremiz/beremiz/PLCGenerator.py", line 1028, in ComputeProgram
self.GenerateBlock(instance, block_infos, body, None)
File "/home/developer/WorkData/PLC/beremiz/beremiz/PLCGenerator.py", line 1144, in GenerateBlock
expression = self.ComputeExpression(body, connections, executionOrderId > 0)
File "/home/developer/WorkData/PLC/beremiz/beremiz/PLCGenerator.py", line 1373, in ComputeExpression
paths = self.GeneratePaths(connections, body, order, to_inout)
File "/home/developer/WorkData/PLC/beremiz/beremiz/PLCGenerator.py", line 1344, in GeneratePaths
elif isinstance(result[0], list):
IndexError: list index out of range
Close #70
/*
Stylesheet used to list EtherCat dictionnary entries.
Copyright (C) 2011-2014: Laurent BESSARD
Distributed under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
See COPYING file for copyrights details.
*/
include yslt.yml2
estylesheet xmlns:ns="entries_list_ns"
extension-element-prefixes="ns"
exclude-result-prefixes="ns" {
param "min_index";
param "max_index";
template "text()";
template "Device" {
apply "Profile/Dictionary/Objects/Object";
foreach "RxPdo" {
call "pdo_entries" with "direction", "'Receive'";
}
foreach "TxPdo" {
call "pdo_entries" with "direction", "'Transmit'";
}
}
template "Object" {
variable "index" > «ns:HexDecValue(Index/text())»
variable "entry_name" > «ns:EntryName(Name)»
choose {
when "$index >= $min_index and $index <= $max_index" {
variable "datatype_name" > «Type/text()»
choose {
when "ancestor::Dictionary/child::DataTypes/DataType[Name/text()=$datatype_name][SubItem]" {
apply "ancestor::Dictionary/child::DataTypes/DataType[Name/text()=$datatype_name][SubItem]" {
with "index" > «$index»
with "entry_name" > «$entry_name»
}
}
otherwise {
variable "subindex" > 0
variable "entry" {
> «ns:AddEntry($index, $subindex, $entry_name, $datatype_name, BitSize/text(), Flags/Access/text(), Flags/PdoMapping/text())»
}
}
}
}
}
}
template "DataType" {
param "index";
param "entry_name";
foreach "SubItem" {
variable "subindex" > «ns:HexDecValue(SubIdx/text())»
variable "subentry_name" > «$entry_name» - «ns:EntryName(DisplayName, Name/text())»
variable "entry" {
> «ns:AddEntry($index, $subindex, $subentry_name, Type/text(), BitSize/text(), Flags/Access/text(), Flags/PdoMapping/text())»
}
}
}
function "pdo_entries" {
param "direction";
variable "pdo_index" > «ns:HexDecValue(Index/text())»
variable "pdo_name" > «ns:EntryName(Name)»
foreach "Entry" {
variable "index" > «ns:HexDecValue(Index/text())»
choose {
when "$index >= $min_index and $index <= $max_index" {
variable "subindex" > «ns:HexDecValue(SubIndex/text())»
variable "subentry_name" > «ns:EntryName(Name)»
variable "access" {
choose {
when "$direction='Transmit'" > ro
otherwise > wo
}
}
variable "pdo_mapping" {
choose {
when "$direction='Transmit'" > T
otherwise > R
}
}
variable "entry" {
> «ns:AddEntry($index, $subindex, $subentry_name, DataType/text(), BitLen/text(), $access, $pdo_mapping, $pdo_index, $pdo_name, $direction)»
}
}
}
}
}
}