Hello,
I would like to write a JavaScript which calculates the PMHF value. Since I have different Safety Goals I use the "Individual Metrics" in the FMEDA. Now my question is how can I access these individual metrics in JavaScript?
Hello Martin,
just to confirm: you want to access the information in this table?
I think this part is not scriptable yet, but I need to confirm.
Happy Scripting
Jan
Well, fortunately I was wring in my first statement. You can indeed access the values.
Here is the rule:
Here a small example:
var dc = finder.findByType(Metamodel.dc.DCWorksheet).first(); var goals = dc.safetyGoal.toArray(); // actually "multiple safety goals" goals.forEach(function (goal) { console.log("Goal: {0}", goal.identifier); console.log(" Goal spfMetric: {0}", dc.getSpfMetric(goal)); });
the solution you gave me 2 years ago worked all the time.
But now I migrated to Medini version 2022 R1 and I can't access the individual metrics any more.
I always get the error:
Can you help me again please?
Martin, that problem indeed crept in with 2022 R1 but has been fixed meanwhile with 2022 R1.1 (a service pack).
Please update and the script should work again.
Regards
please note: We will also provide an update to the PMHF calculation script that takes into account the topic mentioned by Jan and will also now calculate the PMHF for the usage of variants and/or multiple safety goals. The script is currently under internal review.
Eckhardt
PS: In case you have an urgent need, I can provide you with a preview version (without any warranty of course)
Hi all,
i'd like to calculate an overall SPFM and LFM by accessing the individual SPFMs and LFMs of multiple DC-Worksheets.
Is there also a possibility to access the individual metrics for multiple variants and safety goals?
Regards,
Lukas
Lukas,
there is support for that using Java Script (and OCL maybe). The worksheet (DCWorksheet) typically has operations like:
BigDecimal getSpfMetric() // non-variant-non goalBigDecimal getSpfMetric(safetyGoal)BigDecimal getSpfMetric(safetyGoal, variant);// same for Lmpf, and other metrics
You may pass null/undefined for goal or variant in the last signature.
Note that in 25.2 the diagnostics view also shows operations (optionally):
Hello Jan,
I am looking for the same view 'operations' in Element Attributes diagnostics view at DCComponentEntry and DCFailureModeEntry level respectively.
Could you please share a snapshot of the operations at these levels.
I want to access the following information which are safety-goal-dependent and variant-dependent at both levels: component entry and failure mode entry
DCFailureModeEntry level:
- SafeFailureFraction
- SafeFaultsFailureRate
- spfCoverage
- lmpfCoverage
(For the first one, I have for instance tried out DCFM[j].getSafeFailureFraction(SourcefmedaSheet.safetyGoal[selectedSG], SourcefmedaSheet.variants[selectedV])) but it failed.
DCComponentEntry Level:
- permanent SafeFaultsFailureRate
- transient SafeFaultsFailureRate
- TotalSafetyRelatedFailureRate
- TotalSafetyRelatedTransientFailureRate
Context: I am developing a script to calculate for each sub-part the following data and concatenate them to have these data (as per ISO 26262-10:2018, Clause 8.1.8 / Figure 10) at any abstraction level:
Total number of permanent safety-related faults ( lFM,SRp )
Total number of transient safety-related faults ( lFM,SRt )
Permanent PVSG-faults ( l FM,PVSGp )
Transient PVSG-faults ( l FM,PVSGt)
Permanent single point faults and residual faults ( lFM,SPFp + l FM,RFp )
Transient single point faults and residual faults ( lFM,SPFt + l FM,RFt )
Permanent safe faults (l FM,SFp)
Transient safe faults (l FM,SFt)
Permanent MPF-primary-related faults ( lFM,MPF, primary )
Permanent MPF-secondary-related faults ( lFM,MPF, secondary )
Permanent MPF-primary detected/perceived faults (lFM,MPF, primary, det)
Permanent MPF-secondary detected/perceived faults (l FM,MPF,secondary, det )
Permanent MPF-primary latent faults (lFM,MPF,primary l)
Permanent MPF-secondary latent faults (lFM,MPF,primary l)
If Medini has already some functions getXXX to get these values, please also share.
Thank you and regards,
Romain
Hi Romain ,
Two points from my side:
--DCFailureMode as a modelBrowser selection objectself.oclAsType(ecore::EObject).eClass().eAllOperationsResults:mediniGetMetaObject() : EObjectmediniHaveSameType(EObject) : EBooleanmediniGetProxyObject(EString) : MediniObjectmediniGetContainer() : MediniObjectmediniGetOpposites(EString) : EEList<?>mediniGetTracedElements(EJavaObject) : EEList<EObject>mediniGetTracedElements(EJavaObject, EString) : EEList<EObject>mediniSetTags(EString)getEAnnotation(EString) : EAnnotationgetAppliedStereoType() : EClassgetDerivedProfileProperty(EStructuralFeature) : DerivedProfilePropertygetProfilePropertyValue(EString) : EEList<EJavaObject>getAnnotationValue(EString, EString) : EStringfailureRateEquals(EDoubleObject, EDoubleObject) : EBooleantoDouble(EBigDecimal) : EDoublegetSpfFailureRate(EObject) : EBigDecimalgetLmpfFailureRate(EObject) : EBigDecimalgetRemainingFailureRate(EObject) : EBigDecimalgetSpfFailureRate(EObject, Variant) : EBigDecimalgetLmpfFailureRate(EObject, Variant) : EBigDecimalgetRemainingFailureRate(EObject, Variant) : EBigDecimalgetSpfFailureRate(DCMetricsParameters) : EBigDecimalgetLmpfFailureRate(DCMetricsParameters) : EBigDecimalgetRemainingFailureRate(DCMetricsParameters) : EBigDecimal
let goals:OrderedSet(ecore::EObject)=dc::DCWorksheet.allInstances().safetyGoal->asOrderedSet(), variants:OrderedSet(fmea::Variant)= dc::DCWorksheet.allInstances().variants->asOrderedSet()in--get DCFM Remainig failureRate for all available worksheet goals, first variant--individual metrics enabled!Sequence{1..goals->size()} ->collect(id:Integer| self.getRemainingFailureRate(goals->asOrderedSet()->at(id),variants->at(1)) ) -- append also case if the individual metrics are off ->including(self.getRemainingFailureRate(null,null))
So here are just some screen captures:
Marian
Hello Marian,
Thank you for your detailed answer. As you have noticed I am looking for ways to extract following values: SafeFailureFraction, spfCoverage and lmpfCoverage for a specific variant and safety goal in JS rather than in OCL. If I can get such info, I should be able to calculate any other relevant values. The reason I use JS is that it is coupled with other JS scripts and related dashboards out of it. I could not identify such getXYZ neither in the help section nor in the forum but I may have missed it. Even with tryouts it didn't work, e.g. DCFM[j].getSafeFailureFraction(SourcefmedaSheet.safetyGoal[selectedSG], SourcefmedaSheet.variants[selectedV])) while obviously all other available .getXYZ work.
The ones that are available and listed in this forum post are not sufficient for me as I want to extract all values from ISO 26262-10:2018, Clause 8.1.8 / Figure 10 to compare such values for multiple elements across multiple projects. I want to stress my study on how much coverage we have on MPF-primary-related faults (KFMC,MPF, primary on lFM,MPF, primary) and on MPF-secondary-related faults (KFMC,MPF, secondary on lFM,MPF, secondary) for each architectural element. The global values of LFp, LFt and LFM are not sufficient for my study. As you know, we might get a very high value of LFM but with a very poor coverage of latent faults, e.g. depending on how much PVSG-related faults are predominant.
I will certainly look into 'applicableFor' that I have not used so far.
Thanks again for the detailed hints!
hello Marian,
Indeed, for the safeFaultFraction, DCFM[j].getRemainingFailureRate(SourcefmedaSheet.safetyGoal[selectedSG], SourcefmedaSheet.variants[selectedV]) should do the trick.
For the rest, I'll post it here if I get some progress.
Thank you,
my script seems to work fine.
I want to share how I solved this issue.
Nice, it took a long way Romain, thanks for sharing.