Hi,
So I have H/W Model created by importing data from CSV and everything is updated accordingly but now I would like to add some Transient Fault.
I am able to change the type to Transient and of course, it will disable the failure Rate Distribution by default when it's Transient. Then I tried to update the failure rate and I checked the value by printing it, it looks fine.
But once the script execution finished, it only changed the type but not failure rate fraction. It's 0, not taking the percentage value as how I assigned it.
However, if I do it in a separate script, it works fine.
May I know what did I do wrong? Kindly help.
Thank you.
Here's the snippet of the script:
(p/s: c is children[i] of SysMLPart)
--------------------------------------------------------------------------------------------------
var failureModes = c.user_failure_mode;
var fm= findOrCreateFailureMode(part, failureModes);
fm.description = c.user_failure_mode;
if(c.user_failure_mode.indexOf("transient failure") !== -1){
fm.failureType = Metamodel.safetyModel.FailureType.TRANSIENT.instance;
fm.failureRate = java.math.BigDecimal(c.percentage);
console.log("fm.failureRate: {0} ", fm.failureRate);
}
console.log("FM: {0} ", fm);
--------------------------------------------------------------------------------------------------
And this is the separate script:
(p/s: Ignore how this is taken from the safe failure 1st element. This is only for test to prove it works in a separate script)
--------------------------------------------------------------------------------------------------
var children= scope.findByType(Metamodel.safetyModel.FailureMode , false).filter(isTransient).asArray();
for (var i = 0; i < children.length; i++) {
children[i].failureRate = java.math.BigDecimal(children[i].safe_failure[0]);
};
--------------------------------------------------------------------------------------------------
Thank you.