Logic Equation Control Qualifiers
To access these questions, in the RCP> prompt, type: Control Logic.
The questions are a series of logic equations for qualifying RCP8 control functions. You can modify control bits according to a logical combination of control bits, status bits, and internal local variables. Using these questions, you can program RCP8 to perform custom safeguards and implement feedback specific to each site.
Each equation consists of a control variable on
the left that is assigned to a logical combination of variables on the right. The syntax
is that of an ordinary C language statement using the operators & for AND, | for
OR, and ! for NOT.
You may include parentheses as needed. Type new equations and sub-commands following the
--> prompt printed below the current equation.
For example:
EQ00: v0 = airflow | wavegp | magcur
EQ01: cservo = cservo & !v0
EQ02: relay = relay | c10
EQ03: ctrpower = true
-->
In the above example, EQ00
assigns the internal local variable V0 to the logical
OR of the "airflow", "waveguide pressure" and "magnetron current" status bits.
- V0 is
TRUEwhen any of those status lines are true. - EQ01 uses a
TRUEsense of V0 to force the servo power control lineFALSE. Servo power is only on if it is requested to be on, and if none of the 3 control lines are asserted. - EQ02 allows the external local/remote relay to be forced on by
the auxiliary control line
c10. - EQ03 forces
T/R powerto be on all the time, regardless of any other conditions.
The rules for constructing equations are as follows:
- The right side of the equation must consist of a logical combination of any of the above control variables, plus any of the status variables such as: spw0, spw1, sradiate, sservo, strpower, sreset, siris0, siris1, siris2, local, standby, ilock, magcur, airflow, wavegp, elimlo, elimhi, ngen_on, sgen_on, sgen_cw, sgen_flt, local_tr, shutdown, s[0:319]. The numbered status variables refer to the optional auxiliary status input lines.
- The left side of the equation must consist of one of the control variables: cpw0, cpw1, cradiate, cservo, ctrpower, creset, ciris0, ciris1, ciris2, ngen_on, sgen_on, sgen_cw, relay, shut1, shut2, v[0:15], c[0:79]. Control variables that have status counterparts are prefixed with the letter c. Thus, cradiate is the request to radiate, whereas sradiate is the detected radiate status. The numbered local variables V[0:15] can be used as temporary storage for sub-expressions, and the numbered control lines C[0:63] refer to the optional auxiliary control outputs.
- You can also write logic equations in which status variables appear on the left–hand side. The meaning given to such assignments is that the working value of the status variable is modified from its default "requested" value, that is, the value assigned from whatever hardware line or external condition is normally attached to the status bit. In this sense, the modification of a status variable is identical to the modification of a control variable. In both cases, when the variable appears on the right–hand side, it refers to its default requested value.
- The symbols
TRUEandFALSEmay be used on the right side of an equation to indicate always and never. -
The maximum number of variables on the right side of an equation is 4. If you must combine more than 4 four variables in an expression, you must use multiple equations using local variables to combine the bits together. For example, to force servo power off when any of the first 8 auxiliary status lines is high:
EQ00 : V0 = S0 | S1 | S2 | S3 EQ01 : V1 = S4 | S5 | S6 | S7 EQ02 : Cservo = Cservo & !(V0 | V1) - Control variables that appear on the right
side of an equation refer to the requested control state and those appearing on the
left-hand-side reflect the final qualified state. For example, the equation
cservo = cservo & !v0 causes the requested servo
state to be AND'ed with the negation of local variable V0, and the result is the actual servo state. This useful convention
allows you to use control variables on the right without ambiguity. For example, the
pair of equations:
EQ00:cpw0 = cpw1 andEQ01:cpw1 = cpw0, swaps the 2 pulse width control bits. - Order of evaluation of each equation is from right-to-left. There is no evaluation precedence among the &, |, and ! operators. Thus, !V0 & V1 means !(V0 & V1), rather than (!V0) & V1. You must use parentheses as needed to express your equations.
- Order of evaluation of the set of equations is
from
EQ00toEQ79. The order is important only when local variables are assigned in earlier equations so that they can be used in later equations. - The error message that is printed when an ambiguous variable name is typed into a logic equation includes a list of all of the possible matches. This can help you identify how to type the variable uniquely.
- The logic equation editor prints a warning upon exit if multiple assignments are being made to the same variable. For normal status and control variables this almost certainly indicates an error, since only the final assignment has any lasting effect. For local variables, however, multiple sequential assignments are meaningful since an assignment on one line may be referenced on a subsequent line. For now, the warning is printed even for local variables since there is still a chance that is not what you had intended to do. To eliminate spurious local variable warnings, choose a unique set of numbered variables to use (that is, by not reusing them within the overall set of equations).
Comments and disabled equations are available:
- It is possible to add a line of comment text to each logic equation. Use the # command, followed by the text (which may be up to 74 characters in length). If no non–blank text is found, then the comment is removed. Whenever an equation includes a comment, the comment text is displayed in the line preceding the equation during the editing process.
- It is possible to enable and disable control logic equations while keeping the content of the equation intact. Use the / command within the equation editor to toggle whether the current equation is effectively "commented out". The text for disabled equations is still be shown in the editor, but is prefixed with the # character. This feature is useful when you want to temporarily disable some trusted and debugged equations without the risk of retyping them incorrectly later.
When using variables, note the following:
- A side effect of making assignments to local variables is that these bits are also reported to the host computer in the RCP8 Internal BITE packet. This opens many possibilities for designing customized status bits that could be monitored and reported by IRIS BITEX utility.
- The variables shut1 and shut2 cause a
user-induced shutdown if they are set to
TRUE. You may now write logic equations that force a shutdown of RCP8 when certain conditions are present. The 2 types of shutdowns are provided in case there is a need to distinguish among different causes. Along with this, the status variable shutdown is setTRUEif RCP8 is shutdown. For example, adding the equation CSERVO = CSERVO & !SHUTDOWN forces the servo power off when RCP8 is shutdown. - The 4 status variables usr0, usr1, usr2, and usr3 correspond to the 4 input lines at pins from 1 to 4 of header H9 on the RCP8 main board. These are general purpose TTL inputs that you may assign to any purpose you wish. For example, to include an additional status bit in RCP8's Internal BITE packet, include an equation such as v13 = usr0. Since the local variables states appear in the BITE packet, the usr0 line shows in bit #6 of byte #12 as a result of this assignment.
- The status variable unsafe is
TRUEif RCP8 is in the temporary unsafe mode following a reset command. The status variables ovel_az and ovel_el areTRUEwhen the velocity on the corresponding axis exceeds the maximum value setup from the velocity command. - The 8 control variables csgen0 through csgen7 represent bits 0 through 7 of the signal generator level that is being requested by the host computer. Having access to these bits makes it possible to remap the level bits in cases where the signal generator is not controlled via the default HPIB interface.
-
The 2 control variables trig_normal and trig_blank can be used to override the protected sector trigger blanking that is defined in the Site Custom menu. These new variables operate as follows (See also Logic Equation Examples):
- When trig_blank is
FALSEand trig_normal isFALSE, the trigger is blanked when the antenna is within one of the designated sectors. This is the normal operating mode. You can disable all 8 of the sectors if you don't want to use the trigger blanking feature at all. - When trig_blank is
FALSEand trig_normal isTRUE, the trigger is always generated, no matter where the antenna is. - When trig_blank is
TRUE, the trigger is always blanked, no matter where the antenna is. The assignment to trig_normal is ignored in this case.
- When trig_blank is
When a new equation is entered, RCP8 immediately parses the input text and converts the right-hand-side into an internal representation that can be evaluated efficiently at run time. The original line of text is discarded. When the equation is re–displayed, RCP8 must recreate a printed line of text from this internal compiled representation. As a result, the equation that is echoed back does not always look the same as the equation that was originally typed. It is logically equivalent, but the exact syntax may be different. For example:
--> v0 = v1 & v2 & !v3
EQ00: v0 = v1 & v2 & !v3
Here, the output representation happens to be identical to the original input.
--> v0 = v1 & (v2 | v3)
EQ00: v0 = (v1 & v2) | (v1 & v3)
In this case, the equation is printed as an
expanded version of the original. Note that the Boolean operators &
and "|" both distribute symmetrically over each other, so that logical
expressions can be factored and expanded over either operator.
--> v0 = (v1 & v2) | (v1 & !v2)
EQ00: v0 = v1
Here, what appears to be a function of two variables is really only dependent on one.
--> v0 = (!v1) & (!v2)
EQ00: v0 = !(v1 | v2)
In this case, the DeMorgan equivalent of the
AND of 2 negations is printed as the negation of 2
OR's. This type of transformation is common, since RCP8 attempts to
minimize the number of ! operators in its synthesized
expressions.
The following list of sub-commands is printed at the beginning of the equation list.
Subcommands
Del – Delete text of current equation
Ins – Insert free slot before current equation
Pack – Pack equations to consolidate free slots
! – Negate logic sense of equation
?<v> – Additional help
- Del
- Deletes the text of the current equation so that the line is blank
- Ins
- Inserts a blank equation at the current location by shifting the current equation plus all subsequent equations ahead by one
- Pack
- Removes blank equations and shifts all equations into the lower numbered slots
- !
-
Replaces the current equation with its logical negation. For example:
EQ00: v0 = v1 & v2 --> ! EQ00: v0 = !(v1 & v2) EQ00: v0 = v1 & !v2 --> ! EQ00: v0 = (!v1) | v2Note that DeMorgan's theorem was used to reprint the second of these 2 examples, because doing so removes an extra ! from the equation. Perhaps the simplest equation to negate is:
EQ00: cservo = true --> ! EQ00: cservo = falseHere, the output variable is forced
TRUE/FALSEeach time the ! sub-command is used. This can be helpful when testing individual control lines forON/OFFresponses.
Before the equation list appears (in response to the Control Logic command), the following initial question is asked:
Enable logic override of control lines: NO New Value:
This question allows the entire set of equations
to easily be switched ON/OFF, without having to change
any of the equations themselves. Answering NO leaves the control
functions unmodified (direct control from the host computer). YES
applies all of the logical constraints.
The logic equation editor is a live menu. This means that each equation becomes active as soon as it is typed in. You can test individual control lines, and edit the set of equations until you obtain the desired effects.
The !
sub-command is shortcut for quick ON/OFF toggles to
test any control line.