Changing Operands

Changing Operands

When loading a template it might happen that the frequency numbering has changed and therefore the Operand has to be updated.

the function to achieve this is

EVSel$SetOperand(1,EVNewVar)

, where EVSel is the EV Variable for which the Operand needs to be changed and EVNewVar is the new Operand. Based on this an easy loop can be used to check the frequency of the input variable and attach it to the correct Variable.

In this case the starting variables are called Sv [Frequency] kHz (e.g. Sv 38 kHz) and they should be connected to the corresponding TVG [Frequency] (e.g. TVG 38):

#Attach right frequencies
for (f in c(18,38,120,200)){
#Find the starting Variable
EVVar <-EVFile[["Variables"]]$FindByName(paste("Sv ",f," kHz",sep=""))
#Get the frequency
freq  <- round(as.numeric(as.character(EVVar[["Properties"]][["Calibration"]]$Get("Frequency",0))),0)
#Find the connecting variable
EVSel  <-EVFile[["Variables"]]$FindByName(paste("TVG ",freq,sep=""))
#Change the operand
EVSel$SetOperand(1,EVVar)
}