How to Set an Initvalue for the ISignal (Numerical Value Specification)

Scripting example how to set an initvalue for the ISignal (Numerical value Specification) 

//create numerical value specification  

MINumericalValueSpecification numericalValueSpec = mdfAccess.createMDFObject(MINumericalValueSpecification) 

//add the value of zero, for that create a MixedtextItem and create a numerical variation point 

MINumericalValueVariationPoint newVariationPoint = mdfAccess.createMDFObject(MINumericalValueVariationPoint) MIMixedTextItem texITem = mdfAccess.createMDFObject(MIMixedTextItem.class) texITem.setValue("0") //set the variation point into the numerical Value specification 

numericalValueSpec.setValue(newVariationPoint) newVariationPoint.getFormulaExpressionChildren().add(texITem) 

//set the numerical value specification in ISignal myISignal.setInitValue(numericalValueSpec) 


For the mentioned examples you need additional imports like com.vector.cfg.model.mdf.ar4x.systemtemplate.fibex.fibexcore.corecommunication
for the MIISignal.

Article ID: 1526
Last updated: 2019-12-19
Revision: 5
MICROSAR and DaVinci -> Scripting -> Groovy Script Examples -> How to Set an Initvalue for the ISignal (Numerical Value Specification)