CANtrace Python Script for Custom Signal Conversion
TK Engineering executed a project for a customer that utilized CANtrace’s Python scripting to decode float signals from channel multiplexed CAN messages. This meant that the signals were converted to fixed point and transmitted without multiplexing on a virtual CAN channel, allowing the data to be plotted and logged like standard CAN signals. Python code was also used to log CAN channel data in multiple CSV files for spreadsheet analysis.
Custom Python Scripting for Float-to-Fixed Point Conversion and Custom Log File Generation
The project aimed to improve CAN data analysis, with a focus on improving the precision and readability of specific signals. Custom Python scripts were developed to enable conversion of float signals to fixed point representations and facilitate data logging in custom log files.
At the request of our customer, the team extended the functionality of CANtrace’s Python scripting functions to handle the conversion of float signals to fixed point and generate customized log files in CSV format. One of our main challenges was to decode float signals from a channel multiplexed CAN message, convert them to fixed point and transmit the refined data on another virtual CAN channel. The Python script was also tailored to save CAN data, including converted fixed point signals, in CSV files for further analysis. Our team worked closely with the customer and utilized the platform’s robust Python scripting support to extend existing scripts for float-to-fixpoint conversion and custom log file generation
Python Script Optimization, CSV File Generation
Python script enhancement: We developed Python code within CANtrace to decode float signals from channel multiplexed CAN messages. An advanced algorithm was implemented to convert these float signals to fixed points, ensuring precision and accuracy in the process. In addition, a logical framework was created to transmit the converted fixed point signals on a designated virtual CAN channel, facilitating non-multiplexed data transmission. Generation of CSV files and further analysis: Our Python script was extended to save the CAN data, including the newly converted fixed point signals, to CSV files. These files are carefully structured for easy access and are designed to streamline post-processing analysis. This improvement gives our customers significantly better opportunities to analyze special CAN messages in spreadsheets.
User-friendly configuration
To ensure a seamless integration process, clear instructions were provided on how to associate the right database with the relevant CAN channel within CANtrace. We also implemented a user-friendly configuration process for signals in both the graph and data tabs. This allows users to easily visualize and analyze the fixed point signals, improving the overall user experience.
Seamlessly Converting Floats to Fixed Points and Enhancing CAN BUS Analysis
The extended Python script in CANtrace met the customer’s needs by seamlessly converting floats to fixed points. Customized CSV log files improved data analysis and increased the accuracy of signal interpretation for efficient CAN BUS analysis. CANtrace’s flexibility and Python scripting capabilities allowed us to tailor the solution to the customer’s specific requirements and deliver an advanced script for converting floats to fixpoints and generating CSV files. The Python scripting in CANtrace can be used to decode non-standard data, to make advanced data filters, to create custom log files for interfacing with proprietary systems, to simulate CAN nodes and to combine existing data on the CAN bus into new aggregate signals, in real-time, for quick data analysis.