• Not Answered

Any way to force Analog Inputs for RX3i?

I would like to simulate an analog input signal for simulation purposes.

I see I can easily do this for DIs, DOs, and AOs, but cannot see how to do it for AIs.

Is this possible?

Thanks!

5 Replies

  • While there is no direct way to Force an Analog Input signal in PAC Machine Edition, I suggest creating a Force_AI Block that can be called in Rung 1 of the _MAIN block.
    That Force_AI block, when enabled, can Move an Analog Value (I.e. a Symbolic Variable named Forced_AI102_Value with Data Type REAL) to the %AI Mapped Variable (I.e. %AI102).
    You can then modify the Forced_AI102_Value Variable’s value in the Data Watch, for example.
  • In reply to MichaelRichards:

    Hi there,

    Thanks for the reply!
    I'm sorry if I'm misinterpreting your answer, but it seems [to me] like you're saying that an operator cannot Force the AI directly, but you can do it programmatically?


    In other words, direct the Force_AI block to write to the %AI memory?

    If so, is this simply a function of write speed?
    Forcing via PAC ME does actually work, but it's just overwritten immediately, whereas the program can rapidly execute the overwrite?

  • In reply to Matthew Love:

    As you note, an operator may Write to the Analog Input Variable directly from PAC Machine Edition.

    For example, right-click on the Variable in the LD Editor, select the Write Value menu item, and enter a Value.

    This write will occur during the Communications Window portion of the Controller Scan, and immediately be overwritten by the Input Scan at the top of the Controller Scan.

    The Controller Scan has four Steps:

    1. Input Scan: Controller reads discrete and analog information from its I/O modules. CPU places this information into Controller memory.
    2. _MAIN Logic Execution: Controller executes _MAIN Block and any Blocks that _MAIN Block CALLs. _MAIN Block is called once per Controller Scan.
    3. Output Scan: Controller writes discrete and analog information to its I/O modules.
    4. Communications Windows: Controller exchanges information with any of its communication modules, such as Ethernet Modules, for communications with external devices, such as HMIs -and- PAC Machine Edition.
    5. Jump to Step 1.

    So, for a Force of an Analog Input to be effective, it has to come after the Input Scan step… Placing Logic to do this at the very beginning of the _MAIN block ensures all of the Logic will act on the forced value.

  • In reply to MichaelRichards:

    Okay, got it. Makes sense.

    I have implemented this with a MOVE REAL ladder instruction.
    The next question would be how to apply this to variable/multiple/all input registers?
    Is there a way to programmatically change the recipient address field?

    Such as: put Q data in address %AI00[XX]
    With XX being determined elsewhere.
  • In reply to Matthew Love:

    You can use Indirect Addressing or Variable Indexing of Arrays to programmatically change the Analog Input address.

    For Indirect Addressing (@), the Value of the Variable is taken as the Memory Location to access.

    For example, an example in ST Logic:

    if Enable_AI_Force then
    AI00001_INT := Index;' AI0001 is mapped to %AI00001
    @AI00001 := AI_Force_Data_Value;' Write data value to %AI indicated in Index
    end_if;

    Or, if you create an AI_Data Array Mapped to start at %AI0001,

    if Enable_AI_Force then
    AI_Data[Index] := AI_Force_Data_Value;' Write data value to %AI indicated in Index [Index is 0 based...]
    end_if;

    So, there are a couple of ways to approach this.