Jython to Matlab Code Conversion

Moderator: Moderators

Jython to Matlab Code Conversion

Postby jarrod.brandt@aero.org » Tue Aug 17, 2021 11:06 am

Hello All,

I'm trying to find the correct syntax to use when navigating objects via matlab code. I have a structure of linked opaqueActions with jython code in their bodies, an example of which is below:

from com.nomagic.uml2.ext.jmi.helpers import StereotypesHelper

slf = ALH.getCaller()
ips = slf.getInputValue()
ip1 = ips[0]

flws = ip1.getIncoming()
flw1 = flws[0]

flwnum = len(flws)

op = flw1.getSource()
opnm = op.getName()
paction = op.get_opaqueActionOfOutputValue()
ster = StereotypesHelper.getAppliedStereotypeByString(paction, "Enterprise Risk")

sum_risk = 0
scores = []
for n in range(0, flwnum):

op =flws[n].getSource()
paction = op.get_opaqueActionOfOutputValue()
risk_score = StereotypesHelper.getStereotypePropertyFirst(paction, "Enterprise Risk", "Risk Score")
sum_risk = sum_risk + risk_score

max_score = max(scores)
avg_score = sum_risk/len(scores)

currname = slf.getName()
StereotypesHelper.setStereotypePropertyValue(slf, ster, "Risk Score", avg_score)

My issue is that I used StereotypesHelper to navigate relationships and elements via jython, but I have no idea how to do so via Matlab. For context, I am switching to matlab in order to accomodate the use of probability density functions and more complex statistical math. If anyone has any experience with this, or could point me to a relevant resource, I'd really appreciate it!
Forum Newbie
Forum Newbie
Posts: 4
Posts Rating:0
Joined: Tue Nov 24, 2020 4:32 pm

Return to Cameo Simulation Toolkits

Who is online

Users browsing this forum: No registered users and 0 guests