Unexpected Nashorn Type Error

Moderator: Moderators

Unexpected Nashorn Type Error

Postby nnorwood@mitre.org » Thu Feb 16, 2017 11:56 am

Hello,
I am using the simulation toolkit to perform an activity where I balance the demand of consumers with available resource capacity. One possible way to balance the capacity and demand is to increase the capacity. In the example I have posted, I use the GUILog from the MD API to ask the user to enter new capacity values for each resource. The entered values save successfully to a Capacity InstanceSpecfication with a time stamp. The issue I am running into is that the next time an Opaque Behavior is executed I receive the following error:

"ERROR: Cannot evaluate Opaque Behavior sumDemandFromConsumers: TypeError: undefined is not an Object in nashorn:mozilla_compat.js at line number 197"

I have included two Test activities to simulate, "Predefined Test" and "User Update Test". "Predefined Test" shows how the simulation should work from start to finish, but instead of getting new capacity values from the user there is a predefined Capacity Instance. "User Update Test" takes input from the user to update an InstanceSpecifcation. This activity will fail due to the previously mentioned error.

I would appreciate any insight as to why this error is occurring and any advice on how to remedy it. I am using Cameo EA and Cameo STK 18.4.

Thank you,
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: Unexpected Nashorn Type Error

Postby nnorwood@mitre.org » Mon Feb 20, 2017 12:46 pm

I have resolved this issue. The Opaque Behavior that created the time stamp was importing "java.util.Date" instead of using the JS date. By removing this import statement, when I created a new date object
Code: Select all
var date = new Date()
the correct date object is referenced and the error no longer occurs.

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

Re: Unexpected Nashorn Type Error

Postby chanon_s » Tue Feb 21, 2017 2:32 am

Dear Nathan

Sorry for the late reply. It is great that you could resolve the issue. Please let us know if you need further assistance.

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


Return to Cameo Simulation Toolkits

Who is online

Users browsing this forum: No registered users and 0 guests