Canaan Avionics Canvas


Canvas is a muliti-protocol application that provides display of data with an Inter-Connect Definition (ICD) that decodes the payloads. Canvas displays the real-time data in Engineering Units defined by the ICD, and provides scripting interfaces (such as Python) that enable maipulation and recording of the interfaces. Canvas is perfect for things like Acceptance Test Procedures (ATP) and for simulators.

Canvas works with several protocols:

  • ARINC 429, tools such as the U2004 ARINC 429 Server, Matt's Business Card, and even some 3rd Party hardware
  • Honeywell Avionics Standard Comunications Bus (ASCB) {versions A, B and C}

    Note: Canaan Avionics has an ASCB version of the U2004 coming soon

  • Discrete In/Out and Analog Signals
  • Commercial Standard Digital Bus

Canaan Avionics offers a Dll that enables any 3rd-party interfaces to be added.



Programming ARINC 429 with Python Example

In this example, the U1507 Air Data Computer will transmit air temperature in degrees Celsius into the U2004, then the U2004 will re-transmit that word in degrees Kelvin (using python to create a new label and to change the units).

Included in the following section is a demonstration of a potential use case for Canvas along with a few Canaan Avionics products. The components seen in the below from left to right is the U1507 Air Data Computer that is transmitting ARINC 429 into the U2004. The U2004 is receiving the Air Data on port RX0. The U2004 is connected to Canvas via USB (TCP/IP connection options are available) Finally, to the right the U2004, there is a ARINC 429 Data Reader (Matt's Business Card) that is also connected to the same PC via USB. The u2004 is sending data to the business card via TX0.

Once the hardware is setup, the PC that the U2004 and card are connected to launches and runs Canvas. Next, both the U2004 and business card are added manually as devices. Following that, the business card must have a custom ICD loaded onto it titled "KelvinTemp.icd". From there, the "web_example.py" script is run: (Note that both the custom ICD and the script can be downloaded from this page. The other files used in this example may also be downloaded from the Canaan Avionics website.)

           
        import time
        import sys
        import clr
        import math

        # Assumes the first bit is parity, then 2 ssm, 19 for data, 2 for sdi, and 8 for label
        def ConstructA429Word(SSM: int, Data: int, SDI: int, Label: int):
            word = 0x000000FF & Label
            word += 0x00000300 & (SDI << 8)
            word += 0x1FFFFC00 & (Data << 10)
            word += 0x60000000 & (SSM << 29)

            parity = 0
            wordCop = word
            while wordCop:
                parity ^= wordCop & 1
                wordCop >>= 1

            word += 0x80000000 & (parity << 31)
            return word

        # Takes a double and converts it to a data field to be used in BNR word construction
        def FloatToDataBNR(f: float, minResolution: float, numDataBits: int, isSigned: bool):
            assert f >= 0 or isSigned
            sinBit = 0
            if isSigned:
                numDataBits -= 1
                if f < 0:
                    sinBit = (1 << numDataBits)
                    f += minResolution*(2**(numDataBits))
    
            posBits = round(f*(2**(math.log(1/minResolution, 2))))

            return sinBit + posBits

        ###############################ENTRY############################

        # sys.path.append() - path to the U2004 Dll
        clr.AddReference("U2004_11_Dll_Library")
        from U2004_11_Dll_Library import U2004

        # Create an instance of the U2004
        u2004 = U2004()
        u2004.CanvasConnect("127.0.0.1", 11076)
        u2004.Initialize() 

        # load icd onto rx0 and start ports
        u2004.LoadIcdFromPath(r"[absolute path on the host pc]\Canaan_GAMA.icd", "RX0", "Canaan Air Data Computer")
            
        # Start RX0
        u2004.PortHs(U2004.A429Port.RX0)
        u2004.PortStart(U2004.A429Port.RX0)

        # Start TX0
        u2004.PortLs(U2004.A429Port.TX0)
        u2004.PortStart(U2004.A429Port.TX0)

        # super loop
        while True:
                
            # get a floating point value of the static air temperature from the ARINC 429 coming from the U1507 Air Data Computer
            tempC = u2004.GetWkn("STATIC_AIR_TEMPERATURE")

            # convert the temp in celcius to kelvin
            tempK = tempC + 273.15

            # create a 19-but kelvin data field 
            # note this can be done in Canvas too by loading an *.icd and by calling SetWkn()]
            tempKData = FloatToDataBNR(tempK, .0625, 19, False)

            # construct a new 32-bit ARINC 429 Data Word
            newWord = ConstructA429Word(0, tempKData, 0, 0o001)

            # transmit this word as an unscheduled word on TX0 using TxWord()
            u2004.TxWord(U2004.A429Port.TX0, newWord)
                
            # loop for about a 10Hz operation
            time.sleep(.1)            
        

After declaring some helper functons, we use the clr utility to import the u2004 DLL, allowing us to make c# function calls from Python. Canvas brokers the connection between the script and all the hardware used. An Interconnect Definition (ICD) enables the system to display ARINC 429 in Engineering Units, and for out script to work in Engineering Units. The script programmatically loads an ICD onto the RX0 port of the U2004 which decodes all of the Air Data words rfom the ADC. Without this ICD, Canvas would have no way of knowing what the data coming from the air data computer is meant to represent or how it's formatted, and it will just display the binary data. The ICD is just an XML file format, and custom ICD’s are easily created with a text editor.

A super loop will keep the program alive after it is run. 10 times per second the script will survey all ports on the U004 for a corresponding double that matches the Well Known Name "STATIC_AIR_TEMPERATURE" (This WKN was established by the ICD loaded previously.) Next, the temperature read-in is converted to Kelvin and formatted into a BNR bit-field. This bit field is then further packaged into a 32-bit A429 word to be sent back to Canvas. The specifics of how this word is constructed is explained in the A429 specification and the "KelvinTemp.icd" file.