Hello,
I am looking for a script to replace all the transfer gates with principal events for safety mechanisms.
Does anyone have this kind of a script?
Thanks,
Kepin
Hi Kepin,
I od not have such script but the tasks to be done by the script are not that complex.
So the script should;
To locate the FTAConnection objects you can used finder ( scoped to the seltd FTA model) or the attribute of the FTAModelfinder.findByType(Metamodel.FTA.Conneciton).filter
//get the finder eihter the FTA event tree or the project scopevar myFinder = selection[0] && selection[0] instanceof Metamodel.FTA.AbstractEventTree ? Global.getFinder(selection[0]) : finder; //collect all FTAConnection objects that have the outputNode poitning to FTA TransferGatevar ftaConnections = myFinder.findByType(Metamodel.FTA.Connection).filter( function (conn){ return conn.outputNode && conn.outputNode instanceof Metamodel.FTA.TransferGate; }).asArray();// perfomr further conditiong , example filter only on those pointing to the events reprsenting safety Mechanism//ca use arrow function for array methods filter, map ,,, )ftaConnections = ftaConnections.filter( (conn)=> conn.outputNode.targetEvent.represents && conn.outputNode.targetEvent.represents instanceof Metamodel.safetyModel.SafetyMechanism );//
we dont have such a specific script, but some FTA refactoring scripts are out there in the wild. Could you explain a bit more what the script is supposed to refactor? I assume you have a transfer gate to an event which is linked to a safety mechanism and you want to replace that transfer gate by a MOE, right?
Jan