# 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):UPHAS_SEQ") { field(DESC, "Propagate Parm -> SEL") field(DOL1, "$(dev,undefined):UPHAS") field(DOL2, "$(dev,undefined):UPHAS") field(DOL3, "$(dev,undefined):UPHAS") field(DOL4, "$(dev,undefined):UPHAS") field(DOL5, "$(dev,undefined):UPHAS") field(DOL6, "$(dev,undefined):UPHAS") field(DOL7, "$(dev,undefined):UPHAS") field(DOL8, "$(dev,undefined):UPHAS") field(DOL9, "$(dev,undefined):UPHAS") field(DOLA, "$(dev,undefined):UPHAS") field(LNK1, "$(dev,undefined):UPHAS_SEL.A PP") field(LNK2, "$(dev,undefined):UPHAS_SEL.B PP") field(LNK3, "$(dev,undefined):UPHAS_SEL.C PP") field(LNK4, "$(dev,undefined):UPHAS_SEL.D PP") field(LNK5, "$(dev,undefined):UPHAS_SEL.E PP") field(LNK6, "$(dev,undefined):UPHAS_SEL.F PP") field(LNK7, "$(dev,undefined):UPHAS_SEL.G PP") field(LNK8, "$(dev,undefined):UPHAS_SEL.H PP") field(LNK9, "$(dev,undefined):UPHAS_SEL.I PP") field(LNKA, "$(dev,undefined):UPHAS_SEL.J PP") field(SELM, "Specified") field(SELL, "$(dev,undefined):UPHAS_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):UPHAS_SEL") { # field(INAM, "parmSelSubInit") field(SNAM, "parmSelSubProc") field(A, "1000") field(B, "1000") field(C, "") field(D, "") field(E, "") field(F, "") field(G, "") field(H, "") field(I, "") field(J, "") field(PREC, "1") field(FLNK, "$(dev,undefined):UPHAS_PROP") info(autosaveFields, "A B C D E F G H I J") } # # 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):UPHAS_PROP") { field(OMSL, "closed_loop") field(DOL, "$(dev,undefined):UPHAS_SEL") field(OUTA, "$(dev,undefined):UPHAS_OUT PP NMS") field(OUTB, "$(dev,undefined):UPHAS PP") } # Drive the SEL record when the 'ctrl' PV changes # Use a CA link to monitor such changes record(calcout, "$(dev,undefined):UPHAS_CTRL") { field(INPA, "$(dev,undefined):PARMSEL CP") field(CALC, "A+1") field(DOPT, "Use CALC") field(OOPT, "On Change") field(OUT, "$(dev,undefined):UPHAS_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):VPHAS_SEQ") { field(DESC, "Propagate Parm -> SEL") field(DOL1, "$(dev,undefined):VPHAS") field(DOL2, "$(dev,undefined):VPHAS") field(DOL3, "$(dev,undefined):VPHAS") field(DOL4, "$(dev,undefined):VPHAS") field(DOL5, "$(dev,undefined):VPHAS") field(DOL6, "$(dev,undefined):VPHAS") field(DOL7, "$(dev,undefined):VPHAS") field(DOL8, "$(dev,undefined):VPHAS") field(DOL9, "$(dev,undefined):VPHAS") field(DOLA, "$(dev,undefined):VPHAS") field(LNK1, "$(dev,undefined):VPHAS_SEL.A PP") field(LNK2, "$(dev,undefined):VPHAS_SEL.B PP") field(LNK3, "$(dev,undefined):VPHAS_SEL.C PP") field(LNK4, "$(dev,undefined):VPHAS_SEL.D PP") field(LNK5, "$(dev,undefined):VPHAS_SEL.E PP") field(LNK6, "$(dev,undefined):VPHAS_SEL.F PP") field(LNK7, "$(dev,undefined):VPHAS_SEL.G PP") field(LNK8, "$(dev,undefined):VPHAS_SEL.H PP") field(LNK9, "$(dev,undefined):VPHAS_SEL.I PP") field(LNKA, "$(dev,undefined):VPHAS_SEL.J PP") field(SELM, "Specified") field(SELL, "$(dev,undefined):VPHAS_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):VPHAS_SEL") { # field(INAM, "parmSelSubInit") field(SNAM, "parmSelSubProc") field(A, "1000") field(B, "1000") field(C, "") field(D, "") field(E, "") field(F, "") field(G, "") field(H, "") field(I, "") field(J, "") field(PREC, "1") field(FLNK, "$(dev,undefined):VPHAS_PROP") info(autosaveFields, "A B C D E F G H I J") } # # 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):VPHAS_PROP") { field(OMSL, "closed_loop") field(DOL, "$(dev,undefined):VPHAS_SEL") field(OUTA, "$(dev,undefined):VPHAS_OUT PP NMS") field(OUTB, "$(dev,undefined):VPHAS PP") } # Drive the SEL record when the 'ctrl' PV changes # Use a CA link to monitor such changes record(calcout, "$(dev,undefined):VPHAS_CTRL") { field(INPA, "$(dev,undefined):PARMSEL CP") field(CALC, "A+1") field(DOPT, "Use CALC") field(OOPT, "On Change") field(OUT, "$(dev,undefined):VPHAS_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):QSCL_SEQ") { field(DESC, "Propagate Parm -> SEL") field(DOL1, "$(dev,undefined):QSCL") field(DOL2, "$(dev,undefined):QSCL") field(DOL3, "$(dev,undefined):QSCL") field(DOL4, "$(dev,undefined):QSCL") field(DOL5, "$(dev,undefined):QSCL") field(DOL6, "$(dev,undefined):QSCL") field(DOL7, "$(dev,undefined):QSCL") field(DOL8, "$(dev,undefined):QSCL") field(DOL9, "$(dev,undefined):QSCL") field(DOLA, "$(dev,undefined):QSCL") field(LNK1, "$(dev,undefined):QSCL_SEL.A PP") field(LNK2, "$(dev,undefined):QSCL_SEL.B PP") field(LNK3, "$(dev,undefined):QSCL_SEL.C PP") field(LNK4, "$(dev,undefined):QSCL_SEL.D PP") field(LNK5, "$(dev,undefined):QSCL_SEL.E PP") field(LNK6, "$(dev,undefined):QSCL_SEL.F PP") field(LNK7, "$(dev,undefined):QSCL_SEL.G PP") field(LNK8, "$(dev,undefined):QSCL_SEL.H PP") field(LNK9, "$(dev,undefined):QSCL_SEL.I PP") field(LNKA, "$(dev,undefined):QSCL_SEL.J PP") field(SELM, "Specified") field(SELL, "$(dev,undefined):QSCL_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):QSCL_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, "3") field(FLNK, "$(dev,undefined):QSCL_PROP") info(autosaveFields, "A B C D E F G H I J") } # # 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):QSCL_PROP") { field(OMSL, "closed_loop") field(DOL, "$(dev,undefined):QSCL_SEL") field(OUTA, "$(dev,undefined):TMIT.ASLO CA") field(OUTB, "$(dev,undefined):QSCL PP") } # Drive the SEL record when the 'ctrl' PV changes # Use a CA link to monitor such changes record(calcout, "$(dev,undefined):QSCL_CTRL") { field(INPA, "$(dev,undefined):PARMSEL CP") field(CALC, "A+1") field(DOPT, "Use CALC") field(OOPT, "On Change") field(OUT, "$(dev,undefined):QSCL_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):URSCL_SEQ") { field(DESC, "Propagate Parm -> SEL") field(DOL1, "$(dev,undefined):URSCL") field(DOL2, "$(dev,undefined):URSCL") field(DOL3, "$(dev,undefined):URSCL") field(DOL4, "$(dev,undefined):URSCL") field(DOL5, "$(dev,undefined):URSCL") field(DOL6, "$(dev,undefined):URSCL") field(DOL7, "$(dev,undefined):URSCL") field(DOL8, "$(dev,undefined):URSCL") field(DOL9, "$(dev,undefined):URSCL") field(DOLA, "$(dev,undefined):URSCL") field(LNK1, "$(dev,undefined):URSCL_SEL.A PP") field(LNK2, "$(dev,undefined):URSCL_SEL.B PP") field(LNK3, "$(dev,undefined):URSCL_SEL.C PP") field(LNK4, "$(dev,undefined):URSCL_SEL.D PP") field(LNK5, "$(dev,undefined):URSCL_SEL.E PP") field(LNK6, "$(dev,undefined):URSCL_SEL.F PP") field(LNK7, "$(dev,undefined):URSCL_SEL.G PP") field(LNK8, "$(dev,undefined):URSCL_SEL.H PP") field(LNK9, "$(dev,undefined):URSCL_SEL.I PP") field(LNKA, "$(dev,undefined):URSCL_SEL.J PP") field(SELM, "Specified") field(SELL, "$(dev,undefined):URSCL_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):URSCL_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):URSCL_PROP") info(autosaveFields, "A B C D E F G H I J") } # # 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):URSCL_PROP") { field(OMSL, "closed_loop") field(DOL, "$(dev,undefined):URSCL_SEL") field(OUTA, "$(dev,undefined):URMS.ASLO CA") field(OUTB, "$(dev,undefined):URSCL PP") } # Drive the SEL record when the 'ctrl' PV changes # Use a CA link to monitor such changes record(calcout, "$(dev,undefined):URSCL_CTRL") { field(INPA, "$(dev,undefined):PARMSEL CP") field(CALC, "A+1") field(DOPT, "Use CALC") field(OOPT, "On Change") field(OUT, "$(dev,undefined):URSCL_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):VRSCL_SEQ") { field(DESC, "Propagate Parm -> SEL") field(DOL1, "$(dev,undefined):VRSCL") field(DOL2, "$(dev,undefined):VRSCL") field(DOL3, "$(dev,undefined):VRSCL") field(DOL4, "$(dev,undefined):VRSCL") field(DOL5, "$(dev,undefined):VRSCL") field(DOL6, "$(dev,undefined):VRSCL") field(DOL7, "$(dev,undefined):VRSCL") field(DOL8, "$(dev,undefined):VRSCL") field(DOL9, "$(dev,undefined):VRSCL") field(DOLA, "$(dev,undefined):VRSCL") field(LNK1, "$(dev,undefined):VRSCL_SEL.A PP") field(LNK2, "$(dev,undefined):VRSCL_SEL.B PP") field(LNK3, "$(dev,undefined):VRSCL_SEL.C PP") field(LNK4, "$(dev,undefined):VRSCL_SEL.D PP") field(LNK5, "$(dev,undefined):VRSCL_SEL.E PP") field(LNK6, "$(dev,undefined):VRSCL_SEL.F PP") field(LNK7, "$(dev,undefined):VRSCL_SEL.G PP") field(LNK8, "$(dev,undefined):VRSCL_SEL.H PP") field(LNK9, "$(dev,undefined):VRSCL_SEL.I PP") field(LNKA, "$(dev,undefined):VRSCL_SEL.J PP") field(SELM, "Specified") field(SELL, "$(dev,undefined):VRSCL_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):VRSCL_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):VRSCL_PROP") info(autosaveFields, "A B C D E F G H I J") } # # 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):VRSCL_PROP") { field(OMSL, "closed_loop") field(DOL, "$(dev,undefined):VRSCL_SEL") field(OUTA, "$(dev,undefined):VRMS.ASLO CA") field(OUTB, "$(dev,undefined):VRSCL PP") } # Drive the SEL record when the 'ctrl' PV changes # Use a CA link to monitor such changes record(calcout, "$(dev,undefined):VRSCL_CTRL") { field(INPA, "$(dev,undefined):PARMSEL CP") field(CALC, "A+1") field(DOPT, "Use CALC") field(OOPT, "On Change") field(OUT, "$(dev,undefined):VRSCL_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):QRSCL_SEQ") { field(DESC, "Propagate Parm -> SEL") field(DOL1, "$(dev,undefined):QRSCL") field(DOL2, "$(dev,undefined):QRSCL") field(DOL3, "$(dev,undefined):QRSCL") field(DOL4, "$(dev,undefined):QRSCL") field(DOL5, "$(dev,undefined):QRSCL") field(DOL6, "$(dev,undefined):QRSCL") field(DOL7, "$(dev,undefined):QRSCL") field(DOL8, "$(dev,undefined):QRSCL") field(DOL9, "$(dev,undefined):QRSCL") field(DOLA, "$(dev,undefined):QRSCL") field(LNK1, "$(dev,undefined):QRSCL_SEL.A PP") field(LNK2, "$(dev,undefined):QRSCL_SEL.B PP") field(LNK3, "$(dev,undefined):QRSCL_SEL.C PP") field(LNK4, "$(dev,undefined):QRSCL_SEL.D PP") field(LNK5, "$(dev,undefined):QRSCL_SEL.E PP") field(LNK6, "$(dev,undefined):QRSCL_SEL.F PP") field(LNK7, "$(dev,undefined):QRSCL_SEL.G PP") field(LNK8, "$(dev,undefined):QRSCL_SEL.H PP") field(LNK9, "$(dev,undefined):QRSCL_SEL.I PP") field(LNKA, "$(dev,undefined):QRSCL_SEL.J PP") field(SELM, "Specified") field(SELL, "$(dev,undefined):QRSCL_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):QRSCL_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, "3") field(FLNK, "$(dev,undefined):QRSCL_PROP") info(autosaveFields, "A B C D E F G H I J") } # # 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):QRSCL_PROP") { field(OMSL, "closed_loop") field(DOL, "$(dev,undefined):QRSCL_SEL") field(OUTA, "$(dev,undefined):RRMS.ASLO CA") field(OUTB, "$(dev,undefined):QRSCL PP") } # Drive the SEL record when the 'ctrl' PV changes # Use a CA link to monitor such changes record(calcout, "$(dev,undefined):QRSCL_CTRL") { field(INPA, "$(dev,undefined):PARMSEL CP") field(CALC, "A+1") field(DOPT, "Use CALC") field(OOPT, "On Change") field(OUT, "$(dev,undefined):QRSCL_SEL.L PP") }