OPC-UA server with multiple nodes using eclipse milo - opc-ua

I am building a OPC-UA server using eclipse milo. What are the different ways to provide multiple nodes for a subscription service? Can I define a custom data object having properties of basic data types, for this? How?
I want to have a service which serves data of different data types (Integer, Double, Boolean etc.) as it's output. Each of the values should be named different not single name like array output with single name for all of the values. For this purpose is there a way to define a custom data object class with attributes of different types? Is this possible in OPC to have a custom data object type as output of a service?

Conceptually, adding Nodes with each of the different DataTypes you're asking about is no different than creating a folder node and adding nodes to that.
The ExampleNamespace in the milo-examples project shows you how to do that.
If you truly want to use an instance of a custom ObjectType rather than an instance of FolderType then there's a bit of bookkeeping work you'll need to do.
Create an instance of ObjectTypeNode to describe your new type.
For each property/member it will have, create a new VariableNode with that configured with the DataType you want, then add a HasComponent or HasProperty reference from your ObjectTypeNode to this VariableNode. (These Nodes are what the spec calls InstanceDeclarations)
Add your ObjectTypeNode to the address space as a subtype of BaseObjectTypeNode.
Then, when you created your original ObjectNode, you'd specify the type definition as being your newly created ObjectTypeNode rather than, say, a FolderType.
You can get a better idea about how all this works in Part 3 and 5 of the spec or by using a client like UaExpert to inspect some of the pre-existing ObjectTypes in the server, such as ServerType.
Edit: There's now an example of how to do this here. If this seems a bit bulky... you're right. Typically ObjectTypes and VariableTypes are designed in a modelling tool and imported via a NodeSet XML file, but that's outside the scope of things right now...

Related

How to use multiple concepts per text gen component in Jetbrains MPS 2017.1?

I created a simple DSL in JetBrains MPS for an automation task at hand. The DSL allows defining information objects which in turn shall be used for code generation. I am able to generate my models - but I am struggling to find a way to assign an additional text gen component to the same language concept, i.e. what I am trying to achieve is:
information object to db model (python)
information object to db access layer methods (python)
information object to protobuf message
...
I feel that I got a wrong understanding on how to use this. Any ideas on how to achieve different outputs for the same language concept?
MPS will only allow you to have single textgen definition per concept.
The MPS way to do what you want to do is to do this before textgen with a model to model transformation.
Define additional concept for your three objects you want to create. Their content is basically the same as in the root concept that you already have. Theses concept will only be used to define your textgen. So next define the textgen for theses concepts.
Now you still need to create instances of these because of course you don't want the user to specify theses information multiple times. To do this you need to define a generator. Generators are used for model to model transformations in MPS.
By default your language should already have a generator. In the generator is a mapping configuration main. In there you create a root mapping for each of the of the three new concepts you created. Each of this rules has as the input concept the one that the user specifies and as a template one of the new concepts. You can create a new template by pressing alt + enter in the editor and choose the concept you want to create. Make sure you set keep input root to true instead of default.
Inside the template you specify a COPY_SRC to copy all of the contents from the input to the output.
What then happens during generation is that MPS will create three new concepts out of the one that the user created in the original model and after the executes the textgen for all of them. This also allows you to create different files for each root.
I think the DEMO 1 project shows some of the things you will need for this.
You may want to consider the plaintextgen plugin: https://plugins.jetbrains.com/plugin/8444-com-dslfoundry-plaintextgen

How to "flow" tagged values in Enterprise Architect from one instance to another

My questions is about bringing a concept to reality through technical availability of EA.
I am looking for a way to connect instances at an object diagram through which I can transfer tagged values. Let me explain the background of the project.
Purpose is to first have Stereotypes for specific roles in the system, such as "Calculation", "Transmission", "Decision", "Qualification", "Abstraction" etc.
Each of these stereotypes have specific tagged values suitable for their purpose.
Then I am creating instances from these stereotypes, eg. "MotorTorque:Calculation" and "LimitedTorque:Abstraction"
Each of these instances have a common tagged value, "criticality", boolean and I want this tagged value to progress from "MotorTorque:Calculation" to "LimitedTorque:Abstraction" through an output port > some sort of flow > input port kind of way.
Questions are:
1- Is this approach technically achievable in EA? If so what would be the correct way to do it?
2- The purpose is to have this "connection" readable in XMI export of the diagram which I will be using as an input for another purpose.
I have created an MDG Technology for my project with stereotypes and tagged values, however, I am having difficulty achieving this "connection", this "flow" of values.
Thank you for your time.
What you are asking for is not directly achievable. However, many ways lead to Rome.
One way would be to <<trace>> connect those objects to a Status class (or what ever you like to name it) and have this carry the "shared TV".
Another way is (by far more complex) to use an add-in. You would anyway need ways to create groups which share the TV. From your current explanation I can't see what that might be. Maybe the instantiating class of those instances? If so, you make a script that propagates a TV setting from ist current to all other linked instances. I'm not sure if the add-in events fire when a TV is changes (I do have some doubts here). If needed I could look that up.
What you propose is partially feasible.
There is a tagged value inheritance chain in EA, in which tagged values are inherited down the generalization chain, and from a classifier to its instances. In the GUI, inherited tagged values are shown separately from the instance's own ones, and in the API they are accessed using the Element.TaggedValuesEx property. Inherited tagged values can also be overridden.
Since the correct way to create a port (or part/property) is to make it an instance of a component, a port will inherit any tagged values from that component. So if your Calculation stereotype applies to component, ports which are instances of Calculation components will inherit the MotorTorque tagged value.
However, there is no way to "flow" tagged values from one port to another. If you want such a function, you'll have to implement it yourself with an Add-In.
Regarding XMI, first you must understand that an XMI export is based on a package, not a diagram. The XMI format itself is extensible, which means that different tool vendors create their own extensions which are typically not publicly documented. Crucially, diagram layouts are part of these non-standardized extensions. In EA's case, the image data is some sort of UU-encoded bitmap which you won't be able to extract any useful information from.
Elements' tagged values are included in an XMI export, but again, the EA extensions are not publicly documented. In other words, you can import EA:s XMI format in another program, but you will need to reverse-engineer the format. Not impossible, but it's probably better to either write your own specialized export function, or export via CSV. Note, however, that CSV export cannot be automated -- there's no call for it in the API.

OPC UA and data representation

Hi I am investigating OPC UA for my organization. I am trying to work out an example for a presentation based on an information or data example.
I have one for a on demand read operation and one for a continuous monitor. What I don't quite understand since I am just learning and haven't picked a vendor yet (lean towards United Auto) is how is the data represented?
For example if I have a data struct or object called machineInfo with 13 attributes (data) how would I create that on the server side and show how its done?
How would it fit in the BaseNode, Variable hierarchy? Or am I way off?
I can show high level or just code.
Thanks
MachineInfo would be an Object node (NodeClass of Object), with HasComponent references to each of the 13 attributes, which themselves would be Variable nodes (NodeClass of Variable).
As far as type definitions go, you could start out with just using the BaseObjectType and BaseDataVariableTypes, but if you're going to be using a client capable of taking advantage of more complex types you could create a custom ObjectType for the object. The variable components could be further exposed as AnalogItemType or DiscreteItemType, if applicable...
What programming language/SDK are you leaning towards?

How many IDL files are needed when there are multiple components in a distributed system?

This is the scenario.
There are three components, A, B and C.
Component A can access methods of component B.
Component B can access methods of component A and component C.
Component C can access methods of component B.
To implement this scenario how many interface description language (IDL) files are needed? How many stubs and skeletons do we require?
I was thinking four IDL files. But can we have multiple stubs and skeletons?
Depending on the size of your services/components (number of methods), I would rather try to split them into logical units rather than based on the number of computers you want to connect.
For example, it can make sense to have two different services implemented by the same server: One for internal purposes and one that is to be published. Or a service is split into two parts, because these two parts do not really belong together logically, although they are for some reason implemented by the same component. All of these services may or may not share the same IDL file.
Last not least, if you still want to minimize the amount of files, keep in mind that declaring, publishing and knowing about a certain service interface does not imply, that a given component must implement the service, must be able to reach the service, wants to use the service, or is allowed to call it.

In salesforce.com can you have multivalued attributes?

I am developing a Novell Identity Manager driver for Salesforce.com, and am trying to understand the Salesforce.com platform better.
I have had really good success to date. I can read pretty much arbitrary object classes out of SFDC, and create eDirectory objects for them, and what not. This is all done and working nicely. (Publisher Channel). Once I got Query events mapped out, most everything started working in the Publisher Channel.
I am now working on sending events back to SFDC (Subscriber channel) when changes occur in eDirectory.
I am using the upsert() function in the SOAP API, and with Novell Identity Manager, you basically build the SOAP doc, and can see the results as you build it. (You can do it in XSLT or you can use the various allowed tokens to build the document in DirXML Script. I am using DirXML Script which has been working well so far.).
The upshot of that comment is that I can build the SOAP document, see it, to be sure I get it right. Which is usually different than the Java/C++ approach that the sample code usually provides. Much more visual this way.
There are several things about upsert() that I do not entirely understand. I know how to blank a value, should I get that sort of event. Inside the <urn:sObjects> node, add a node like (assuming you get your namespaces declared already):
<urn1:fieldsToNull>FieldName</urn1:fieldsToNull>
I know how to add a value (AttrValue) to the attribute (FieldName), add a node like:
<FieldName>AttrValue</FieldName>
All this works and is pretty straight forward.
The question I have is, can a value in SFDC be multi-valued? In eDirectory, a multi valued attribute being changed, can happen two ways:
All values can be removed, and the new set re-added.
The single value removed can be sent as that sort of event (remove-value) or many values can be removed in one operation.
Looking at SFDC, I only ever see Multi-picklist attributes that seem to be stored in a single entry : or ; delimited. Is there another kind of multi valued attribute managed differently in SFDC? And if so, how would one manipulate it via the SOAP API?
I still have to decide if I want to map those multi-picklists to a single string, or a multi valued attribute of strings. First way is easier, second way is more useful... Hmmm... Choices...
Some references:
I have been using the page Sample SOAP messages to understand what the docs should look like.
Apex Explorer is a kicking tool for browsing the database and testing queries. Much like DBVisualizer does for JDBC connected databases. This would have been so much harder without it!
SoapUi is also required, and a lovely tool!
As far as I know there's no multi-value field other than multi-select picklists (and they map to semicolon-separated string). Generally platform encourages you to create a proper relationship with another (possibly new, custom) table if you're in need of having multiple values associated to your data.
Only other "unusual" thing I can think of is how the OwnerId field on certain objects (Case, Lead, maybe something else) can be used to point to User or Queue record. Looks weird when you are used to foreign key relationships from traditional databases. But this is not identical with what you're asking as there will be only one value at a time.
Of course you might be surpised sometimes with values you'll see in the database depending on the viewing user's locale (stuff like System Administrator profile becoming Systeembeheerder in Dutch). But this will be still a single value, translated on the fly just before the query results are sent back to you.
When I had to perform SOAP integration with SFDC, I've always used WSDL files and most of the time was fine with Java code generated out of them with Apache Axis. Hand-crafting the SOAP message yourself seems... wow, hardcore a bit. Are you sure you prefer visualisation of XML over the creation of classes, exceptions and all this stuff ready for use with one of several out-of-the-box integration methods? If they'll ever change the WSDL I need just to regenerate the classes from it; whereas changes to your SOAP message creation library might be painful...