Passing Arrays in Acitivity Diagram

Moderator: Moderators

Passing Arrays in Acitivity Diagram

Postby nnorwood@mitre.org » Tue Jan 24, 2017 1:40 pm

I would like to execute an activity diagram where one opaque behavior sends another an array. I am running into an issue where I cannot access the contents of the array in the receiving opaque behavior. Is sending an array between opaque behavior actions possible with the cameo simulation toolkit? I have attached a simple test case where I try to pass an array generated in one opaque behavior to another that tries to print it out. I would appreciate any help to make this possible.

Thank you,
Nathan

I am using Cameo EA 18.4 and the Cameo Simulation Toolkit plugin 18.4
You do not have the required permissions to view the files attached to this post.
nnorwood@mitre.org
Forum Beginner
Forum Beginner
 
Posts: 37
Posts Rating:2
Joined: Tue Jun 17, 2014 11:19 am

Re: Passing Arrays in Acitivity Diagram

Postby chanon_s » Wed Jan 25, 2017 3:35 am

Dear Customer

It is not possible to send an array between actions. However, you could send a list of values, such as, reals or integers. Please see the attachment for the modified sample project.

TestPassingArrays_Modified.mdzip


Sincerely

Chanon S.
No Magic Customer Support
You do not have the required permissions to view the files attached to this post.
chanon_s
Customer Support
Customer Support
 
Posts: 91
Posts Rating:7
Joined: Thu Dec 04, 2014 2:21 am

Re: Passing Arrays in Acitivity Diagram

Postby nnorwood@mitre.org » Thu Jan 26, 2017 8:08 am

Thank you very much! However I am noticing some unintended consequences if I introduce a fork into the activity. The actions are no longer waiting for all of the input pins to execute and are just executing with null values. I have attached the model I revised with the fork. Is this the way the simulation is supposed to work when input pins have a multiplicity of many (*)? Is there some synchronization option I should be selecting?

Thank you again,
Nathan
You do not have the required permissions to view the files attached to this post.
nnorwood@mitre.org
Forum Beginner
Forum Beginner
 
Posts: 37
Posts Rating:2
Joined: Tue Jun 17, 2014 11:19 am

Re: Passing Arrays in Acitivity Diagram

Postby nnorwood@mitre.org » Fri Jan 27, 2017 7:18 am

I have found a work around, it is not ideal but I can convert an array to a string and pass the string between actions. Then parse the string back to an array in order to perform the necessary operations. Please let me know if there is a better solution.


Thank you,
Nathan
nnorwood@mitre.org
Forum Beginner
Forum Beginner
 
Posts: 37
Posts Rating:2
Joined: Tue Jun 17, 2014 11:19 am

Re: Passing Arrays in Acitivity Diagram

Postby chanon_s » Sun Jan 29, 2017 11:30 pm

Dear Customer

If you use a fork, it will simulate in different threads asynchronously (2 threads in your case: one for generateCapacityArray and the other one for generateDemandArray). Please try to change the multiplicity of all related pins to 1..* instead. Then the simulation will wait for the required values from each input pin.

Sincerely

Chanon S.
No Magic Customer Support
chanon_s
Customer Support
Customer Support
 
Posts: 91
Posts Rating:7
Joined: Thu Dec 04, 2014 2:21 am

Re: Passing Arrays in Acitivity Diagram

Postby Nerijus Jankevicius » Mon Jan 30, 2017 4:52 pm

Nathan,

* multiplicity works the same as if the lower range is 0, so action starts without receiving tokens in that input pin.
You can fix that by using 1..* multiplicities and also removing unnecessary fork.

see modified model attached.
You do not have the required permissions to view the files attached to this post.
Nerijus Jankevicius
Customer Support
Customer Support
 
Posts: 21
Posts Rating:1
Joined: Tue Mar 09, 2010 10:03 am

Re: Passing Arrays in Acitivity Diagram

Postby nnorwood@mitre.org » Tue Jan 31, 2017 6:30 am

Thanks! This will work for me! The fork was unnecessary in this test model but is necessary in the actual model I am developing. I pin pointed my synchronization problem to be caused by a fork and wanted to make sure that I could use the list passing solution when there were forks present in the model.

Thanks again,
Nathan
nnorwood@mitre.org
Forum Beginner
Forum Beginner
 
Posts: 37
Posts Rating:2
Joined: Tue Jun 17, 2014 11:19 am


Return to Cameo Simulation Toolkits

Who is online

Users browsing this forum: No registered users and 1 guest