# Maintain multiple (up to 10) values of # a parameter: # # Record holding the parameter $[parm] # must FLNK -> $[parm]_SEQ # # Different values of the parameter # $[parm0]..$[parm9] are stored in # $[parm]_SEL.A .. $[parm]_SEL.J # # The actual value of the parameter is # selected based on the value of a controlling # PV $[ctrl] using a 'mapping' CALC expression # $[mapc] to convert the $[ctrl] value into # the integer range 1..10. # # The selected value of $[parm] is written # to output link $[outl] # # A) When the user writes $[parm] then # its value is deposited in the currently # selected field of $[parm]_SEL and # propagated to $[outl] # # B) When the user writes any of $[parm]_SEL.A..J # then the value is stored there. If she # writes to the currently 'active' field\ # (as selected by $[ctrl]) then # the $[parm] PV itself is updated and the # value is also propagated to $[outl] # # C) If the user changes $[ctrl] then the # corresponding value $[parm]_SEL.A..J is # propagated to $[outl] and $[parm]. # # D) At initialization, the value corresponding # to the initial setting of $[ctrl] is written # to $[outl] and $[parm] # # MACROS: # # $[parm] PV holding the parameter # $[ctrl] PV that controls the selection of # the currently active setting of # $[parm] # $[outl] PV where the currently selected # value of $[parm] shall be written-to # (if applicable) # $[prec] Precision of the $[parm]_SEL variable # (should be set to same value as $[parm].PREC) # # $[parm0]..$[parm9] initial values of $[parm] # # $[mapc] CALC expression to convert the value # of the controlling PV which is available # as 'A' to the range 1..10 (or less if # less selections are used). # E.g., to convert the value of a bo (0/1) # you would set mapc to 'A+1' (0..1 -> 1..2) # # NOTE: This sb snippet is loaded/expanded # for every parameter under control # of $[ctrl]. ALSO, the companion # snippet parmCtl.db must be loaded/expanded # but only once per controlling PV. # # This record, when scanned (as a result # of $[parm] being written and processing # its FLNK to this record] fetches $[parm] # and deposits the value into the currently # selected field of the SEL record. # # NOTE: unfortunately, the selection # mechanism of the SEQ and SEL # records differs: SEQ is 1-based, # SEL is 0-based -- now that makes # sense, doesn't it? # record(seq, "$(dev,undefined):UOFF_SEQ") { field(DESC, "Propagate Parm -> SEL") field(DOL1, "$(dev,undefined):UOFF") field(DOL2, "$(dev,undefined):UOFF") field(DOL3, "$(dev,undefined):UOFF") field(DOL4, "$(dev,undefined):UOFF") field(DOL5, "$(dev,undefined):UOFF") field(DOL6, "$(dev,undefined):UOFF") field(DOL7, "$(dev,undefined):UOFF") field(DOL8, "$(dev,undefined):UOFF") field(DOL9, "$(dev,undefined):UOFF") field(DOLA, "$(dev,undefined):UOFF") field(LNK1, "$(dev,undefined):UOFF_SEL.A PP") field(LNK2, "$(dev,undefined):UOFF_SEL.B PP") field(LNK3, "$(dev,undefined):UOFF_SEL.C PP") field(LNK4, "$(dev,undefined):UOFF_SEL.D PP") field(LNK5, "$(dev,undefined):UOFF_SEL.E PP") field(LNK6, "$(dev,undefined):UOFF_SEL.F PP") field(LNK7, "$(dev,undefined):UOFF_SEL.G PP") field(LNK8, "$(dev,undefined):UOFF_SEL.H PP") field(LNK9, "$(dev,undefined):UOFF_SEL.I PP") field(LNKA, "$(dev,undefined):UOFF_SEL.J PP") field(SELM, "Specified") field(SELL, "$(dev,undefined):UOFF_CTRL NPP NMS") } # The $[parm]_SEL record holds all possible # values of $[parm] in the 'A..J' fields. # # When processed it updates it's own VAL # to the currently selected input. Input # 'L' serves as the (1-based) selector, # i.e., L==1 selects 'A'->'VAL'. # # When the selected value changes (as a # result of SEQ depositing a new value OR # $[ctrl] changing and updating L) then # the propagator record attached to the # FLNK is processed. # record(sub, "$(dev,undefined):UOFF_SEL") { # field(INAM, "parmSelSubInit") field(SNAM, "parmSelSubProc") field(A, "0") field(B, "0") field(C, "") field(D, "") field(E, "") field(F, "") field(G, "") field(H, "") field(I, "") field(J, "") field(PREC, "4") field(FLNK, "$(dev,undefined):UOFF_PROP") } # # Finally the dfanout record # fetches the currently selected # value from SEL and propagates it # to $[outl]. It also updates # $[parm] itself so that $[parm] # always reflects the currently # selected value. # record(dfanout, "$(dev,undefined):UOFF_PROP") { field(OMSL, "closed_loop") field(DOL, "$(dev,undefined):UOFF_SEL") field(OUTA, "$(dev,undefined):U.AOFF CA") field(OUTB, "$(dev,undefined):UOFF PP") } # Drive the SEL record when the 'ctrl' PV changes # Use a CA link to monitor such changes record(calcout, "$(dev,undefined):UOFF_CTRL") { field(INPA, "$(dev,undefined):PARMSEL CP") field(CALC, "A+1") field(DOPT, "Use CALC") field(OOPT, "On Change") field(OUT, "$(dev,undefined):UOFF_SEL.L PP") } # Maintain multiple (up to 10) values of # a parameter: # # Record holding the parameter $[parm] # must FLNK -> $[parm]_SEQ # # Different values of the parameter # $[parm0]..$[parm9] are stored in # $[parm]_SEL.A .. $[parm]_SEL.J # # The actual value of the parameter is # selected based on the value of a controlling # PV $[ctrl] using a 'mapping' CALC expression # $[mapc] to convert the $[ctrl] value into # the integer range 1..10. # # The selected value of $[parm] is written # to output link $[outl] # # A) When the user writes $[parm] then # its value is deposited in the currently # selected field of $[parm]_SEL and # propagated to $[outl] # # B) When the user writes any of $[parm]_SEL.A..J # then the value is stored there. If she # writes to the currently 'active' field\ # (as selected by $[ctrl]) then # the $[parm] PV itself is updated and the # value is also propagated to $[outl] # # C) If the user changes $[ctrl] then the # corresponding value $[parm]_SEL.A..J is # propagated to $[outl] and $[parm]. # # D) At initialization, the value corresponding # to the initial setting of $[ctrl] is written # to $[outl] and $[parm] # # MACROS: # # $[parm] PV holding the parameter # $[ctrl] PV that controls the selection of # the currently active setting of # $[parm] # $[outl] PV where the currently selected # value of $[parm] shall be written-to # (if applicable) # $[prec] Precision of the $[parm]_SEL variable # (should be set to same value as $[parm].PREC) # # $[parm0]..$[parm9] initial values of $[parm] # # $[mapc] CALC expression to convert the value # of the controlling PV which is available # as 'A' to the range 1..10 (or less if # less selections are used). # E.g., to convert the value of a bo (0/1) # you would set mapc to 'A+1' (0..1 -> 1..2) # # NOTE: This sb snippet is loaded/expanded # for every parameter under control # of $[ctrl]. ALSO, the companion # snippet parmCtl.db must be loaded/expanded # but only once per controlling PV. # # This record, when scanned (as a result # of $[parm] being written and processing # its FLNK to this record] fetches $[parm] # and deposits the value into the currently # selected field of the SEL record. # # NOTE: unfortunately, the selection # mechanism of the SEQ and SEL # records differs: SEQ is 1-based, # SEL is 0-based -- now that makes # sense, doesn't it? # record(seq, "$(dev,undefined):VOFF_SEQ") { field(DESC, "Propagate Parm -> SEL") field(DOL1, "$(dev,undefined):VOFF") field(DOL2, "$(dev,undefined):VOFF") field(DOL3, "$(dev,undefined):VOFF") field(DOL4, "$(dev,undefined):VOFF") field(DOL5, "$(dev,undefined):VOFF") field(DOL6, "$(dev,undefined):VOFF") field(DOL7, "$(dev,undefined):VOFF") field(DOL8, "$(dev,undefined):VOFF") field(DOL9, "$(dev,undefined):VOFF") field(DOLA, "$(dev,undefined):VOFF") field(LNK1, "$(dev,undefined):VOFF_SEL.A PP") field(LNK2, "$(dev,undefined):VOFF_SEL.B PP") field(LNK3, "$(dev,undefined):VOFF_SEL.C PP") field(LNK4, "$(dev,undefined):VOFF_SEL.D PP") field(LNK5, "$(dev,undefined):VOFF_SEL.E PP") field(LNK6, "$(dev,undefined):VOFF_SEL.F PP") field(LNK7, "$(dev,undefined):VOFF_SEL.G PP") field(LNK8, "$(dev,undefined):VOFF_SEL.H PP") field(LNK9, "$(dev,undefined):VOFF_SEL.I PP") field(LNKA, "$(dev,undefined):VOFF_SEL.J PP") field(SELM, "Specified") field(SELL, "$(dev,undefined):VOFF_CTRL NPP NMS") } # The $[parm]_SEL record holds all possible # values of $[parm] in the 'A..J' fields. # # When processed it updates it's own VAL # to the currently selected input. Input # 'L' serves as the (1-based) selector, # i.e., L==1 selects 'A'->'VAL'. # # When the selected value changes (as a # result of SEQ depositing a new value OR # $[ctrl] changing and updating L) then # the propagator record attached to the # FLNK is processed. # record(sub, "$(dev,undefined):VOFF_SEL") { # field(INAM, "parmSelSubInit") field(SNAM, "parmSelSubProc") field(A, "0") field(B, "0") field(C, "") field(D, "") field(E, "") field(F, "") field(G, "") field(H, "") field(I, "") field(J, "") field(PREC, "4") field(FLNK, "$(dev,undefined):VOFF_PROP") } # # Finally the dfanout record # fetches the currently selected # value from SEL and propagates it # to $[outl]. It also updates # $[parm] itself so that $[parm] # always reflects the currently # selected value. # record(dfanout, "$(dev,undefined):VOFF_PROP") { field(OMSL, "closed_loop") field(DOL, "$(dev,undefined):VOFF_SEL") field(OUTA, "$(dev,undefined):V.AOFF CA") field(OUTB, "$(dev,undefined):VOFF PP") } # Drive the SEL record when the 'ctrl' PV changes # Use a CA link to monitor such changes record(calcout, "$(dev,undefined):VOFF_CTRL") { field(INPA, "$(dev,undefined):PARMSEL CP") field(CALC, "A+1") field(DOPT, "Use CALC") field(OOPT, "On Change") field(OUT, "$(dev,undefined):VOFF_SEL.L PP") } # Maintain multiple (up to 10) values of # a parameter: # # Record holding the parameter $[parm] # must FLNK -> $[parm]_SEQ # # Different values of the parameter # $[parm0]..$[parm9] are stored in # $[parm]_SEL.A .. $[parm]_SEL.J # # The actual value of the parameter is # selected based on the value of a controlling # PV $[ctrl] using a 'mapping' CALC expression # $[mapc] to convert the $[ctrl] value into # the integer range 1..10. # # The selected value of $[parm] is written # to output link $[outl] # # A) When the user writes $[parm] then # its value is deposited in the currently # selected field of $[parm]_SEL and # propagated to $[outl] # # B) When the user writes any of $[parm]_SEL.A..J # then the value is stored there. If she # writes to the currently 'active' field\ # (as selected by $[ctrl]) then # the $[parm] PV itself is updated and the # value is also propagated to $[outl] # # C) If the user changes $[ctrl] then the # corresponding value $[parm]_SEL.A..J is # propagated to $[outl] and $[parm]. # # D) At initialization, the value corresponding # to the initial setting of $[ctrl] is written # to $[outl] and $[parm] # # MACROS: # # $[parm] PV holding the parameter # $[ctrl] PV that controls the selection of # the currently active setting of # $[parm] # $[outl] PV where the currently selected # value of $[parm] shall be written-to # (if applicable) # $[prec] Precision of the $[parm]_SEL variable # (should be set to same value as $[parm].PREC) # # $[parm0]..$[parm9] initial values of $[parm] # # $[mapc] CALC expression to convert the value # of the controlling PV which is available # as 'A' to the range 1..10 (or less if # less selections are used). # E.g., to convert the value of a bo (0/1) # you would set mapc to 'A+1' (0..1 -> 1..2) # # NOTE: This sb snippet is loaded/expanded # for every parameter under control # of $[ctrl]. ALSO, the companion # snippet parmCtl.db must be loaded/expanded # but only once per controlling PV. # # This record, when scanned (as a result # of $[parm] being written and processing # its FLNK to this record] fetches $[parm] # and deposits the value into the currently # selected field of the SEL record. # # NOTE: unfortunately, the selection # mechanism of the SEQ and SEL # records differs: SEQ is 1-based, # SEL is 0-based -- now that makes # sense, doesn't it? # record(seq, "$(dev,undefined):USCL_SEQ") { field(DESC, "Propagate Parm -> SEL") field(DOL1, "$(dev,undefined):USCL") field(DOL2, "$(dev,undefined):USCL") field(DOL3, "$(dev,undefined):USCL") field(DOL4, "$(dev,undefined):USCL") field(DOL5, "$(dev,undefined):USCL") field(DOL6, "$(dev,undefined):USCL") field(DOL7, "$(dev,undefined):USCL") field(DOL8, "$(dev,undefined):USCL") field(DOL9, "$(dev,undefined):USCL") field(DOLA, "$(dev,undefined):USCL") field(LNK1, "$(dev,undefined):USCL_SEL.A PP") field(LNK2, "$(dev,undefined):USCL_SEL.B PP") field(LNK3, "$(dev,undefined):USCL_SEL.C PP") field(LNK4, "$(dev,undefined):USCL_SEL.D PP") field(LNK5, "$(dev,undefined):USCL_SEL.E PP") field(LNK6, "$(dev,undefined):USCL_SEL.F PP") field(LNK7, "$(dev,undefined):USCL_SEL.G PP") field(LNK8, "$(dev,undefined):USCL_SEL.H PP") field(LNK9, "$(dev,undefined):USCL_SEL.I PP") field(LNKA, "$(dev,undefined):USCL_SEL.J PP") field(SELM, "Specified") field(SELL, "$(dev,undefined):USCL_CTRL NPP NMS") } # The $[parm]_SEL record holds all possible # values of $[parm] in the 'A..J' fields. # # When processed it updates it's own VAL # to the currently selected input. Input # 'L' serves as the (1-based) selector, # i.e., L==1 selects 'A'->'VAL'. # # When the selected value changes (as a # result of SEQ depositing a new value OR # $[ctrl] changing and updating L) then # the propagator record attached to the # FLNK is processed. # record(sub, "$(dev,undefined):USCL_SEL") { # field(INAM, "parmSelSubInit") field(SNAM, "parmSelSubProc") field(A, "1") field(B, "1") field(C, "") field(D, "") field(E, "") field(F, "") field(G, "") field(H, "") field(I, "") field(J, "") field(PREC, "4") field(FLNK, "$(dev,undefined):USCL_PROP") } # # Finally the dfanout record # fetches the currently selected # value from SEL and propagates it # to $[outl]. It also updates # $[parm] itself so that $[parm] # always reflects the currently # selected value. # record(dfanout, "$(dev,undefined):USCL_PROP") { field(OMSL, "closed_loop") field(DOL, "$(dev,undefined):USCL_SEL") field(OUTA, "$(dev,undefined):U.ASLO CA") field(OUTB, "$(dev,undefined):USCL PP") } # Drive the SEL record when the 'ctrl' PV changes # Use a CA link to monitor such changes record(calcout, "$(dev,undefined):USCL_CTRL") { field(INPA, "$(dev,undefined):PARMSEL CP") field(CALC, "A+1") field(DOPT, "Use CALC") field(OOPT, "On Change") field(OUT, "$(dev,undefined):USCL_SEL.L PP") } # Maintain multiple (up to 10) values of # a parameter: # # Record holding the parameter $[parm] # must FLNK -> $[parm]_SEQ # # Different values of the parameter # $[parm0]..$[parm9] are stored in # $[parm]_SEL.A .. $[parm]_SEL.J # # The actual value of the parameter is # selected based on the value of a controlling # PV $[ctrl] using a 'mapping' CALC expression # $[mapc] to convert the $[ctrl] value into # the integer range 1..10. # # The selected value of $[parm] is written # to output link $[outl] # # A) When the user writes $[parm] then # its value is deposited in the currently # selected field of $[parm]_SEL and # propagated to $[outl] # # B) When the user writes any of $[parm]_SEL.A..J # then the value is stored there. If she # writes to the currently 'active' field\ # (as selected by $[ctrl]) then # the $[parm] PV itself is updated and the # value is also propagated to $[outl] # # C) If the user changes $[ctrl] then the # corresponding value $[parm]_SEL.A..J is # propagated to $[outl] and $[parm]. # # D) At initialization, the value corresponding # to the initial setting of $[ctrl] is written # to $[outl] and $[parm] # # MACROS: # # $[parm] PV holding the parameter # $[ctrl] PV that controls the selection of # the currently active setting of # $[parm] # $[outl] PV where the currently selected # value of $[parm] shall be written-to # (if applicable) # $[prec] Precision of the $[parm]_SEL variable # (should be set to same value as $[parm].PREC) # # $[parm0]..$[parm9] initial values of $[parm] # # $[mapc] CALC expression to convert the value # of the controlling PV which is available # as 'A' to the range 1..10 (or less if # less selections are used). # E.g., to convert the value of a bo (0/1) # you would set mapc to 'A+1' (0..1 -> 1..2) # # NOTE: This sb snippet is loaded/expanded # for every parameter under control # of $[ctrl]. ALSO, the companion # snippet parmCtl.db must be loaded/expanded # but only once per controlling PV. # # This record, when scanned (as a result # of $[parm] being written and processing # its FLNK to this record] fetches $[parm] # and deposits the value into the currently # selected field of the SEL record. # # NOTE: unfortunately, the selection # mechanism of the SEQ and SEL # records differs: SEQ is 1-based, # SEL is 0-based -- now that makes # sense, doesn't it? # record(seq, "$(dev,undefined):VSCL_SEQ") { field(DESC, "Propagate Parm -> SEL") field(DOL1, "$(dev,undefined):VSCL") field(DOL2, "$(dev,undefined):VSCL") field(DOL3, "$(dev,undefined):VSCL") field(DOL4, "$(dev,undefined):VSCL") field(DOL5, "$(dev,undefined):VSCL") field(DOL6, "$(dev,undefined):VSCL") field(DOL7, "$(dev,undefined):VSCL") field(DOL8, "$(dev,undefined):VSCL") field(DOL9, "$(dev,undefined):VSCL") field(DOLA, "$(dev,undefined):VSCL") field(LNK1, "$(dev,undefined):VSCL_SEL.A PP") field(LNK2, "$(dev,undefined):VSCL_SEL.B PP") field(LNK3, "$(dev,undefined):VSCL_SEL.C PP") field(LNK4, "$(dev,undefined):VSCL_SEL.D PP") field(LNK5, "$(dev,undefined):VSCL_SEL.E PP") field(LNK6, "$(dev,undefined):VSCL_SEL.F PP") field(LNK7, "$(dev,undefined):VSCL_SEL.G PP") field(LNK8, "$(dev,undefined):VSCL_SEL.H PP") field(LNK9, "$(dev,undefined):VSCL_SEL.I PP") field(LNKA, "$(dev,undefined):VSCL_SEL.J PP") field(SELM, "Specified") field(SELL, "$(dev,undefined):VSCL_CTRL NPP NMS") } # The $[parm]_SEL record holds all possible # values of $[parm] in the 'A..J' fields. # # When processed it updates it's own VAL # to the currently selected input. Input # 'L' serves as the (1-based) selector, # i.e., L==1 selects 'A'->'VAL'. # # When the selected value changes (as a # result of SEQ depositing a new value OR # $[ctrl] changing and updating L) then # the propagator record attached to the # FLNK is processed. # record(sub, "$(dev,undefined):VSCL_SEL") { # field(INAM, "parmSelSubInit") field(SNAM, "parmSelSubProc") field(A, "1") field(B, "1") field(C, "") field(D, "") field(E, "") field(F, "") field(G, "") field(H, "") field(I, "") field(J, "") field(PREC, "4") field(FLNK, "$(dev,undefined):VSCL_PROP") } # # Finally the dfanout record # fetches the currently selected # value from SEL and propagates it # to $[outl]. It also updates # $[parm] itself so that $[parm] # always reflects the currently # selected value. # record(dfanout, "$(dev,undefined):VSCL_PROP") { field(OMSL, "closed_loop") field(DOL, "$(dev,undefined):VSCL_SEL") field(OUTA, "$(dev,undefined):V.ASLO CA") field(OUTB, "$(dev,undefined):VSCL PP") } # Drive the SEL record when the 'ctrl' PV changes # Use a CA link to monitor such changes record(calcout, "$(dev,undefined):VSCL_CTRL") { field(INPA, "$(dev,undefined):PARMSEL CP") field(CALC, "A+1") field(DOPT, "Use CALC") field(OOPT, "On Change") field(OUT, "$(dev,undefined):VSCL_SEL.L PP") } # Maintain multiple (up to 10) values of # a parameter: # # Record holding the parameter $[parm] # must FLNK -> $[parm]_SEQ # # Different values of the parameter # $[parm0]..$[parm9] are stored in # $[parm]_SEL.A .. $[parm]_SEL.J # # The actual value of the parameter is # selected based on the value of a controlling # PV $[ctrl] using a 'mapping' CALC expression # $[mapc] to convert the $[ctrl] value into # the integer range 1..10. # # The selected value of $[parm] is written # to output link $[outl] # # A) When the user writes $[parm] then # its value is deposited in the currently # selected field of $[parm]_SEL and # propagated to $[outl] # # B) When the user writes any of $[parm]_SEL.A..J # then the value is stored there. If she # writes to the currently 'active' field\ # (as selected by $[ctrl]) then # the $[parm] PV itself is updated and the # value is also propagated to $[outl] # # C) If the user changes $[ctrl] then the # corresponding value $[parm]_SEL.A..J is # propagated to $[outl] and $[parm]. # # D) At initialization, the value corresponding # to the initial setting of $[ctrl] is written # to $[outl] and $[parm] # # MACROS: # # $[parm] PV holding the parameter # $[ctrl] PV that controls the selection of # the currently active setting of # $[parm] # $[outl] PV where the currently selected # value of $[parm] shall be written-to # (if applicable) # $[prec] Precision of the $[parm]_SEL variable # (should be set to same value as $[parm].PREC) # # $[parm0]..$[parm9] initial values of $[parm] # # $[mapc] CALC expression to convert the value # of the controlling PV which is available # as 'A' to the range 1..10 (or less if # less selections are used). # E.g., to convert the value of a bo (0/1) # you would set mapc to 'A+1' (0..1 -> 1..2) # # NOTE: This sb snippet is loaded/expanded # for every parameter under control # of $[ctrl]. ALSO, the companion # snippet parmCtl.db must be loaded/expanded # but only once per controlling PV. # # This record, when scanned (as a result # of $[parm] being written and processing # its FLNK to this record] fetches $[parm] # and deposits the value into the currently # selected field of the SEL record. # # NOTE: unfortunately, the selection # mechanism of the SEQ and SEL # records differs: SEQ is 1-based, # SEL is 0-based -- now that makes # sense, doesn't it? # record(seq, "$(dev,undefined):PHI_SEQ") { field(DESC, "Propagate Parm -> SEL") field(DOL1, "$(dev,undefined):PHI") field(DOL2, "$(dev,undefined):PHI") field(DOL3, "$(dev,undefined):PHI") field(DOL4, "$(dev,undefined):PHI") field(DOL5, "$(dev,undefined):PHI") field(DOL6, "$(dev,undefined):PHI") field(DOL7, "$(dev,undefined):PHI") field(DOL8, "$(dev,undefined):PHI") field(DOL9, "$(dev,undefined):PHI") field(DOLA, "$(dev,undefined):PHI") field(LNK1, "$(dev,undefined):PHI_SEL.A PP") field(LNK2, "$(dev,undefined):PHI_SEL.B PP") field(LNK3, "$(dev,undefined):PHI_SEL.C PP") field(LNK4, "$(dev,undefined):PHI_SEL.D PP") field(LNK5, "$(dev,undefined):PHI_SEL.E PP") field(LNK6, "$(dev,undefined):PHI_SEL.F PP") field(LNK7, "$(dev,undefined):PHI_SEL.G PP") field(LNK8, "$(dev,undefined):PHI_SEL.H PP") field(LNK9, "$(dev,undefined):PHI_SEL.I PP") field(LNKA, "$(dev,undefined):PHI_SEL.J PP") field(SELM, "Specified") field(SELL, "$(dev,undefined):PHI_CTRL NPP NMS") } # The $[parm]_SEL record holds all possible # values of $[parm] in the 'A..J' fields. # # When processed it updates it's own VAL # to the currently selected input. Input # 'L' serves as the (1-based) selector, # i.e., L==1 selects 'A'->'VAL'. # # When the selected value changes (as a # result of SEQ depositing a new value OR # $[ctrl] changing and updating L) then # the propagator record attached to the # FLNK is processed. # record(sub, "$(dev,undefined):PHI_SEL") { # field(INAM, "parmSelSubInit") field(SNAM, "parmSelSubProc") field(A, "0") field(B, "0") field(C, "") field(D, "") field(E, "") field(F, "") field(G, "") field(H, "") field(I, "") field(J, "") field(PREC, "1") field(FLNK, "$(dev,undefined):PHI_PROP") } # # Finally the dfanout record # fetches the currently selected # value from SEL and propagates it # to $[outl]. It also updates # $[parm] itself so that $[parm] # always reflects the currently # selected value. # record(dfanout, "$(dev,undefined):PHI_PROP") { field(OMSL, "closed_loop") field(DOL, "$(dev,undefined):PHI_SEL") field(OUTA, "$(dev,undefined):CALC.E CA") field(OUTB, "$(dev,undefined):PHI PP") } # Drive the SEL record when the 'ctrl' PV changes # Use a CA link to monitor such changes record(calcout, "$(dev,undefined):PHI_CTRL") { field(INPA, "$(dev,undefined):PARMSEL CP") field(CALC, "A+1") field(DOPT, "Use CALC") field(OOPT, "On Change") field(OUT, "$(dev,undefined):PHI_SEL.L PP") } # Maintain multiple (up to 10) values of # a parameter: # # Record holding the parameter $[parm] # must FLNK -> $[parm]_SEQ # # Different values of the parameter # $[parm0]..$[parm9] are stored in # $[parm]_SEL.A .. $[parm]_SEL.J # # The actual value of the parameter is # selected based on the value of a controlling # PV $[ctrl] using a 'mapping' CALC expression # $[mapc] to convert the $[ctrl] value into # the integer range 1..10. # # The selected value of $[parm] is written # to output link $[outl] # # A) When the user writes $[parm] then # its value is deposited in the currently # selected field of $[parm]_SEL and # propagated to $[outl] # # B) When the user writes any of $[parm]_SEL.A..J # then the value is stored there. If she # writes to the currently 'active' field\ # (as selected by $[ctrl]) then # the $[parm] PV itself is updated and the # value is also propagated to $[outl] # # C) If the user changes $[ctrl] then the # corresponding value $[parm]_SEL.A..J is # propagated to $[outl] and $[parm]. # # D) At initialization, the value corresponding # to the initial setting of $[ctrl] is written # to $[outl] and $[parm] # # MACROS: # # $[parm] PV holding the parameter # $[ctrl] PV that controls the selection of # the currently active setting of # $[parm] # $[outl] PV where the currently selected # value of $[parm] shall be written-to # (if applicable) # $[prec] Precision of the $[parm]_SEL variable # (should be set to same value as $[parm].PREC) # # $[parm0]..$[parm9] initial values of $[parm] # # $[mapc] CALC expression to convert the value # of the controlling PV which is available # as 'A' to the range 1..10 (or less if # less selections are used). # E.g., to convert the value of a bo (0/1) # you would set mapc to 'A+1' (0..1 -> 1..2) # # NOTE: This sb snippet is loaded/expanded # for every parameter under control # of $[ctrl]. ALSO, the companion # snippet parmCtl.db must be loaded/expanded # but only once per controlling PV. # # This record, when scanned (as a result # of $[parm] being written and processing # its FLNK to this record] fetches $[parm] # and deposits the value into the currently # selected field of the SEL record. # # NOTE: unfortunately, the selection # mechanism of the SEQ and SEL # records differs: SEQ is 1-based, # SEL is 0-based -- now that makes # sense, doesn't it? # record(seq, "$(dev,undefined):PSI_SEQ") { field(DESC, "Propagate Parm -> SEL") field(DOL1, "$(dev,undefined):PSI") field(DOL2, "$(dev,undefined):PSI") field(DOL3, "$(dev,undefined):PSI") field(DOL4, "$(dev,undefined):PSI") field(DOL5, "$(dev,undefined):PSI") field(DOL6, "$(dev,undefined):PSI") field(DOL7, "$(dev,undefined):PSI") field(DOL8, "$(dev,undefined):PSI") field(DOL9, "$(dev,undefined):PSI") field(DOLA, "$(dev,undefined):PSI") field(LNK1, "$(dev,undefined):PSI_SEL.A PP") field(LNK2, "$(dev,undefined):PSI_SEL.B PP") field(LNK3, "$(dev,undefined):PSI_SEL.C PP") field(LNK4, "$(dev,undefined):PSI_SEL.D PP") field(LNK5, "$(dev,undefined):PSI_SEL.E PP") field(LNK6, "$(dev,undefined):PSI_SEL.F PP") field(LNK7, "$(dev,undefined):PSI_SEL.G PP") field(LNK8, "$(dev,undefined):PSI_SEL.H PP") field(LNK9, "$(dev,undefined):PSI_SEL.I PP") field(LNKA, "$(dev,undefined):PSI_SEL.J PP") field(SELM, "Specified") field(SELL, "$(dev,undefined):PSI_CTRL NPP NMS") } # The $[parm]_SEL record holds all possible # values of $[parm] in the 'A..J' fields. # # When processed it updates it's own VAL # to the currently selected input. Input # 'L' serves as the (1-based) selector, # i.e., L==1 selects 'A'->'VAL'. # # When the selected value changes (as a # result of SEQ depositing a new value OR # $[ctrl] changing and updating L) then # the propagator record attached to the # FLNK is processed. # record(sub, "$(dev,undefined):PSI_SEL") { # field(INAM, "parmSelSubInit") field(SNAM, "parmSelSubProc") field(A, "90") field(B, "90") field(C, "") field(D, "") field(E, "") field(F, "") field(G, "") field(H, "") field(I, "") field(J, "") field(PREC, "1") field(FLNK, "$(dev,undefined):PSI_PROP") } # # Finally the dfanout record # fetches the currently selected # value from SEL and propagates it # to $[outl]. It also updates # $[parm] itself so that $[parm] # always reflects the currently # selected value. # record(dfanout, "$(dev,undefined):PSI_PROP") { field(OMSL, "closed_loop") field(DOL, "$(dev,undefined):PSI_SEL") field(OUTA, "$(dev,undefined):CALC.F CA") field(OUTB, "$(dev,undefined):PSI PP") } # Drive the SEL record when the 'ctrl' PV changes # Use a CA link to monitor such changes record(calcout, "$(dev,undefined):PSI_CTRL") { field(INPA, "$(dev,undefined):PARMSEL CP") field(CALC, "A+1") field(DOPT, "Use CALC") field(OOPT, "On Change") field(OUT, "$(dev,undefined):PSI_SEL.L PP") }