[go: up one dir, main page]

Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Vorto » Definition of Arrays in Datatype / Function Block Models
icon5.gif  Definition of Arrays in Datatype / Function Block Models [message #1705964] Thu, 20 August 2015 13:12 Go to next message
Marco Wagner is currently offline Marco WagnerFriend
Messages: 5
Registered: August 2015
Junior Member
Hi!

I am currently exploring Vorto by building up my first simple models.
One thing that I didn't figure out so far is how to define arrays within Datatype or Function Block Models.

For example, I have created the following Datatype Model:

namespace com.mycompany.type
version 1.0.0
entity ErrorLog
{
	mandatory info as string
	mandatory error_event_output as string
}


Right now, the attribute "error_event_output" is a simple string. However, what I actually need is an array of strings that hold multiple messages.

Is there a way to define such an array in Vorto?

Thanks,
Marco
Re: Definition of Arrays in Datatype / Function Block Models [message #1706003 is a reply to message #1705964] Fri, 21 August 2015 00:09 Go to previous messageGo to next message
Alexander Edelmann is currently offline Alexander EdelmannFriend
Messages: 39
Registered: January 2015
Member
Hi Marco,

yes there is a way, with the keyword 'multiple', for example in your case:

namespace com.mycompany.type
version 1.0.0
entity ErrorLog
{
mandatory info as string
mandatory multiple error_event_output as string
}

- Alex
Re: Definition of Arrays in Datatype / Function Block Models [message #1706012 is a reply to message #1706003] Fri, 21 August 2015 05:52 Go to previous messageGo to next message
Marco Wagner is currently offline Marco WagnerFriend
Messages: 5
Registered: August 2015
Junior Member
Hi Alex!

Thanks for the fast response. Works fine!

One additional question: Is it possible to define additional attributes of the array such as size or dimension?

Thanks,
Marco
Re: Definition of Arrays in Datatype / Function Block Models [message #1706013 is a reply to message #1706012] Fri, 21 August 2015 06:05 Go to previous messageGo to next message
Olaf Weinmann is currently offline Olaf WeinmannFriend
Messages: 29
Registered: May 2015
Junior Member
Hi Marco,

currently there is no additional keyword available to specify size or dimension. The keyword "multiple" does not even distinguish between arrays and lists. This is because we want to keep it simple to model items with multiplicity. However it is possible to use the mapping concept to map an attribute to additional information, e.g. implementation : array, size : 10. The following example illustrates this:
...
entitymapping myMapping{
from ErrorLog.error_event_output to array with { size : "10" }
...
}

Is that a solution for you? Do you have additional requirements or comments?
Re: Definition of Arrays in Datatype / Function Block Models [message #1706015 is a reply to message #1706013] Fri, 21 August 2015 06:42 Go to previous messageGo to next message
Marco Wagner is currently offline Marco WagnerFriend
Messages: 5
Registered: August 2015
Junior Member
Hi Olaf,

well it helps me right now.
However, if I got the concept of mappings in Vorto right (please correct me if I am wrong), mappings are connected to an Information Model. In this case I want to add the additional information directly to the Datatype since I may want to use it in several different Function Blocks and Information Models.

Wouldn't it be possible to assign this information directly to the Datatype for example like this:
entity ErrorLog
{
	mandatory info as string
	mandatory multiple error_event_output as string <SIZE 10, DIM 2>
}


Thanks,
Marco
Re: Definition of Arrays in Datatype / Function Block Models [message #1706384 is a reply to message #1706015] Wed, 26 August 2015 13:04 Go to previous messageGo to next message
Olaf Weinmann is currently offline Olaf WeinmannFriend
Messages: 29
Registered: May 2015
Junior Member
Hi Marco,

No, mappings are not connected to an Information Model. They can also be connected to a datatype or a Functionblock. But usually a mapping is related to a specific use-case - so the reusability might be limited for the situation that you're describing. I agree that it make sense to allow the specification of size and dimension for items with multiplicity. Does your use-case also require that it can be specified whether a list or an array should be used? Can you give me a few more details regarding that question? Currently we do not allow such specifications within the generic Functionblocks since thy shall be technology agnostic.

Cheers,

Olaf
Re: Definition of Arrays in Datatype / Function Block Models [message #1706389 is a reply to message #1706384] Wed, 26 August 2015 14:04 Go to previous messageGo to next message
Marco Wagner is currently offline Marco WagnerFriend
Messages: 5
Registered: August 2015
Junior Member
Hi Olaf,

thanks for your reply.
Regarding my use case, I am currently looking at using Vorto for describing Gateway devices. This means that I am trying to describe functionality that is actually mapped directly into a network packet on the gateway.

For example:
I have a functionality behind a gateway that calculates a specific value on the basis of some input values. The input values are in the form of a one dimensional array of type byte with 10 elements.
The functionality that I try to describe with Vorto is located on the gateway. As soon as it is requested from external it creates a network message that is sent to the actual provider of the function which answers this request. The gateway then forwards the response to the initial requester.

In order to describe this in Vorto I would try it in the following way:

Datatype:
namespace com.mycompany.type
version 1.0.0
entity RequestDataExample
{
	mandatory multiple data_array as byte <SIZE 10, DIM 1>
}


FunctionBlock:
namespace com.mycompany.fb
version 1.0.0
using com.mycompany.type.RequestDataExample ; 1.0.0
functionblock ExampleFBlock {
	displayname "ExampleFBlock"
	description "Function block model for ExampleFBlock"
	category demo
...
	operations {
	//Please enter functionblock operations.
		calculateValue(data as RequestDataExample) returns byte
	}

}


InformationModel:
namespace com.mycompany
version 1.0.0
using com.mycompany.fb.ExampleFBlock ; 1.0.0
infomodel ExampleInfoModel {
	displayname "ExampleInfoModel"
	description "Information model for ExampleInfoModel"
	category demo
	functionblocks {
		examplefblock as ExampleFBlock
	}
}


How would the approach using mappings look like?

Thanks,
Marco
Re: Definition of Arrays in Datatype / Function Block Models [message #1706651 is a reply to message #1706389] Fri, 28 August 2015 12:29 Go to previous messageGo to next message
Olaf Weinmann is currently offline Olaf WeinmannFriend
Messages: 29
Registered: May 2015
Junior Member
Hi Marco,

It would look pretty much the same - the only difference would be that you have an additional mapping file for your entity containing contents like:
...
entitymapping myMapping{
from RequestDataExample.data_array to ARRAY with { SIZE : "10", DIM : "1" }
...
}

and your entity would look like follows:
namespace com.mycompany.type
version 1.0.0
entity RequestDataExample
{
	mandatory multiple data_array as byte
}

But as I mentioned before I agree that we should extend the grammar a bit and allow to specify such constraints in an easier way. Do you have additional requirements for Vorto?

Cheers,

Olaf
Re: Definition of Arrays in Datatype / Function Block Models [message #1707084 is a reply to message #1706651] Wed, 02 September 2015 07:37 Go to previous message
Marco Wagner is currently offline Marco WagnerFriend
Messages: 5
Registered: August 2015
Junior Member
Hi Olaf,

thanks for the reply.
I really appreciate that you consider extending the grammar. I believe that would help a lot in defining Arrays in a concise and well readable way.

Right now I have no further requirements. I'll let you know if I stumble upon another issue.

Thanks,
Marco
Previous Topic:Vorto documentation
Next Topic:Ideas for transfer process of Vorto specifications along the value chain
Goto Forum:
  


Current Time: Thu Dec 12 16:41:22 GMT 2024

Powered by FUDForum. Page generated in 0.03302 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top