11:17, EET
December 20, 2016
Hi,
I currently created a information model, where companion standards di, adi, plc are used. Then two xml models of my own are loaded.
When I try codegeneration I get errors in the generated classed (no errors while generation). I came to this point, by placing everything (except the “main” model, that is aggregating the others) in the codegen/lib folder. Together with the .package files (I put everyhting into my own package structure). E.g. I have the problem, that from Pcl CtrlFunctionBlockTypeNode cannot be resolved and also in the generated classes of adi, di are errors, because types are missing.
I added all xml files (also the companion standards) to the codegen.properties targets.
How is this done correctly?
Thanks,
lg Manu
14:33, EET
April 3, 2012
Hi,
Do not try to generate more than one namespace per java package (I assume this by “(I put everyhting into my own package structure)” ), otherwise the generated Ids/Serializers/InformationModel classes will overwrite themselves as one is created for each namespace.
The SDK includes,
The Standard namespace, http://opcfoundation.org/UA/, which maps to com.prosysopc.ua.types.opcua
Do not edit the Opc.Ua.NodeSet2.package.clj, as for the SDK to work it must point to com.prosysopc.ua.types.opcua.
It also includes the following companion specification models + generated code
The Device Information model, http://opcfoundation.org/UA/DI/, which by default has .package of com.prosysopc.ua.types.di
The Analog Device Information model, http://opcfoundation.org/UA/ADI/, which by default has .package of com.prosysopc.ua.types.adi
PlcOpen model, http://PLCopen.org/OpcUa/IEC61131-3/, which by default has .package of com.prosysopc.ua.types.plc
You should also not edit these .package files, as they are already generated to the SDK and can just be loaded (see SampleConsoleServer.loadInformationModel()). However the SDK does not implement the methods (yet) in these types (they are more for the client side usage at the moment), so if you need these on the server side, you might need to generate them.
So unless you are trying to generate them, they should not be put in the codegen.properties targets
Could you try generating one model/xml at a time? Could you list some of the errors?
Future SDK 2.3 will include a new/rewrite of the codegen, which allows us to react a bit better to codegen related issues (still even it can generate only one namespace per java package for now).
– Bjarne
14:23, EET
December 20, 2016
Hi,
thanks for your reply! Your tips seem to have resolved most of the codegeneration issues. It is now generated without errors.
But now i have problems when loading the information model. I do it with following code:
getServer().registerModel(com.prosysopc.ua.types.di.server.InformationModel.MODEL);
getServer().registerModel(com.prosysopc.ua.types.adi.server.InformationModel.MODEL);
getServer().registerModel(com.prosysopc.ua.types.plc.server.InformationModel.MODEL);
getServer().registerModel(com.kuka.basys.opcua.server.informationmodel.mxautomation.server.InformationModel.MODEL);
getServer().registerModel(com.kuka.basys.opcua.server.informationmodel.mxautomationplc.server.InformationModel.MODEL);
getServer().registerModel(com.kuka.basys.opcua.server.informationmodel.server.InformationModel.MODEL);
try {
getServer().getAddressSpace().loadModel(UaServer.class.getResource(“Opc.Ua.Di.NodeSet2.xml”).toURI());
getServer().getAddressSpace().loadModel(UaServer.class.getResource(“Opc.Ua.Adi.NodeSet2.xml”).toURI());
getServer().getAddressSpace().loadModel(UaServer.class.getResource(“Opc.Ua.Plc.NodeSet2.xml”).toURI());
getServer().getAddressSpace().loadModel(getClass().getClassLoader().getResource(“mxautomation.xml”).toURI());
getServer().getAddressSpace().loadModel(getClass().getClassLoader().getResource(“mxautomationplc.xml”).toURI());
getServer().getAddressSpace().loadModel(getClass().getClassLoader().getResource(“lbr.xml”).toURI());
} catch (Exception e) {
throw new RuntimeException(e);
}
But when loading mxautomation I get following error:
WARN createModel: Error in ModelParser2.startElement: localName=Models
java.lang.IllegalArgumentException: No enum constant com.prosysopc.ua.ModelParserBase.b.Models
at java.lang.Enum.valueOf(Unknown Source)
at com.prosysopc.ua.ModelParserBase$b.valueOf(Unknown Source)
at com.prosysopc.ua.ModelParserBase.startElement(Unknown Source)
at com.prosysopc.ua.ModelParserBase$a.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.prosysopc.ua.ModelParserBase.parseFile(Unknown Source)
at com.prosysopc.ua.ModelParserBase.parseFile(Unknown Source)
at com.prosysopc.ua.ModelParserBase.parseFile(Unknown Source)
at com.prosysopc.ua.server.NodeManagerTable.loadModel(Unknown Source)
at com.prosysopc.ua.server.NodeManagerTable.loadModel(Unknown Source)
…
01/17/2017 13:17:30.996 WARN createModel: Error in ModelParser2.startElement: localName=RequiredModel
java.lang.IllegalArgumentException: No enum constant com.prosysopc.ua.ModelParserBase.b.RequiredModel
at java.lang.Enum.valueOf(Unknown Source)
at com.prosysopc.ua.ModelParserBase$b.valueOf(Unknown Source)
at com.prosysopc.ua.ModelParserBase.startElement(Unknown Source)
at com.prosysopc.ua.ModelParserBase$a.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.prosysopc.ua.ModelParserBase.parseFile(Unknown Source)
at com.prosysopc.ua.ModelParserBase.parseFile(Unknown Source)
at com.prosysopc.ua.ModelParserBase.parseFile(Unknown Source)
at com.prosysopc.ua.server.NodeManagerTable.loadModel(Unknown Source)
at com.prosysopc.ua.server.NodeManagerTable.loadModel(Unknown Source)
…
01/17/2017 13:17:30.997 INFO Unknown element in XML: RequiredModel
2611 [main] INFO com.prosysopc.ua.ModelParserBase – Unknown element in XML: RequiredModel
01/17/2017 13:17:30.997 WARN createModel: Error in ModelParser2.startElement: localName=RequiredModel
java.lang.IllegalArgumentException: No enum constant com.prosysopc.ua.ModelParserBase.b.RequiredModel
at java.lang.Enum.valueOf(Unknown Source)
at com.prosysopc.ua.ModelParserBase$b.valueOf(Unknown Source)
at com.prosysopc.ua.ModelParserBase.startElement(Unknown Source)
at com.prosysopc.ua.ModelParserBase$a.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.prosysopc.ua.ModelParserBase.parseFile(Unknown Source)
at com.prosysopc.ua.ModelParserBase.parseFile(Unknown Source)
at com.prosysopc.ua.ModelParserBase.parseFile(Unknown Source)
at com.prosysopc.ua.server.NodeManagerTable.loadModel(Unknown Source)
at com.prosysopc.ua.server.NodeManagerTable.loadModel(Unknown Source)
…
14:41, EET
December 20, 2016
Ok, i solved the problem. In this xml file from UaModeler was a section:
<Model ModelUri="http://kuka.com/mxAutomation" PublicationDate="2017-01-12T15:25:34Z" Version="1.0.0">
<RequiredModel ModelUri="http://opcfoundation.org/UA/" PublicationDate="2016-04-15T00:00:00Z" Version="1.03"/>
<RequiredModel ModelUri="http://opcfoundation.org/UA/DI….." PublicationDate="2013-12-02T00:00:00Z" Version="1.01"/>
<RequiredModel ModelUri="http://PLCopen.org/OpcUa/IEC61….." PublicationDate="2010-03-24T00:00:00Z" Version="1.00"/>
</Model>
</Models>
I removed this, and it works. But I think the xml parser should be able to deal with that!
15:01, EET
April 3, 2012
If your models have the Models -tag then it would indicate that the NodeSet model in question has been made for the UA Specification version 1.03 while the current 2.2.x releases of the SDK support specification version 1.02 (the Models block/tag was added in the xml schema in spec version 1.03). Also the informationmodels inside the SDK are the 1.02 versions of the information models. Assuming you have not used any 1.03 feature/datatypes in your models they should still work, otherwise you need to wait for 2.3
SDK 2.3.x will support 1.03 and bundles also 1.03 versions of the models for the standard/companion namespaces
– Bjarne
P.S. I actually encountered the same issue about one hour ago while developing for 2.3
Most Users Ever Online: 1919
Currently Online:
64 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Heikki Tahvanainen: 402
hbrackel: 144
rocket science: 88
pramanj: 86
Francesco Zambon: 83
Ibrahim: 78
Sabari: 62
kapsl: 57
gjevremovic: 49
Xavier: 43
Member Stats:
Guest Posters: 0
Members: 737
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1524
Posts: 6450
Newest Members:
fannielima, kristiewinkle8, rust, christamcdowall, redaahern07571, nigelbdhmp, travistimmons, AnnelCib, dalenegettinger, howardkennerleyModerators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1026, Jimmy Ni: 26, Matti Siponen: 346, Lusetti: 0
Administrators: admin: 1