1. Department of Computer Science and Engineering
SHRI PILLAPPA COLLEGE OF ENGINEERING
PROJECT
ON
“CANSim Tool to diagnose CAN Devices “
Guided & Coordinated by :
Mr. Prof. Ranjan.
B.E, M.Tech, Asst. Prof
Presented by:
Abhishek Singh (1PL12CS003)
Amit Kumar Singh (1PL12CS004)
Prashant Sharma (1PL12CS027)
3. INTRODUCTION
The role of CANSim tool is to diagnose the program which is dumped in the CAN Hardware
device. All CAN devices are Electronically Controlled i.e. they interact using electrical signals.
This would reduce the cost of testing and Verification of the Hardware Devices to be installed in
Automobiles.
The need for Developing a tool for CAN Device diagnosis. Since every device to be installed
on an Automobile cannot be crash tested directly we make use of an Application to do so without
the use of Automobile.
4. EXISTING SYSTEM
The existing system for CAN Hardware diagnosis is CANALYZER Pro by
Vector International Pvt Ltd.
This is a perfect tool for diagnosing the CAN Hardware devices but it also has
following limitations :
1) Cost is too high for Each Copy of the tool.
2) The Source Code of the tool is Restricted from users.(Can’t modify)
3) The features available in it are not 100% satisfying for the organization.
5. PROPOSED SYSTEM
A Software tool which would provide the following Requirements :
Open source tool.
Cost Considerations.
Ease of use for the user.
Application Name : CANSim
Project Type : Windows Form Application
Programming Language Used : C#
Programming Environment : .NET
Additional Tools used : Vector-Hardware by Mathworks Matlabs Pvt Ltd
Additional Libraries Imported : SourceGrid.dll
6. DESIGN
CANSim 1
GUI Thread
Background
Worker Thread
CANSim 2
GUI Thread
Background
Worker Thread
The tool works in two modes :
CANSim 1
When associated with another
application. This tool will work as
a part of that tool with a different
GUI.
CANSim 2
In this mode the tool runs as a
standalone application. This tool
works with a UI different to CAN
Sim 1/
7.
8. IMPLEMENTATION
The key features/requirements specified by the organization are as follows :
1. Sending only selected Signals Sequentially
2. Shortcut Key assignment
3. Configuration Status
4. Clear all Contents
5. Cloning Feature
6. Send Signal Function
9. Step 1 : Check the “Item” Column to know which rows are selected by the user
(Item is a Column with Checkbox)
go to Step 2
Step 2 : Get the index values of the rows Checked/ Selected by the user
go to Step 3
Step 3 : Get the time Interval “t” from the user
go to Step 4
Step 4 : Select 1st signal to be transmitted (using the index values stored in an array)
Send the signal
Start the timer
go to Step 5
Step 5 : Select next signal to be transmitted
After time “t”
Send Signal
go to Step 6
Step 6 : If (the last signal sent is the last one in the sequence)
Stop the timer.
else
go to Step 5
1.Sending only selected Signals Sequentially
Functions Used
Void button9_Click(object sender, EventArgs e)
Void send()
int check()
10. Step 1 : Identify the key pressed by the user via PreviewKeyDown Event.
If(identified)
go to Step 2
else
Display “Invalid Key “ in MessageBox
Step 2 : Check whether any signal is assigned for the key pressed by the user.
If (assigned)
go to Step 3
else
Do nothing
Step 3 : Check whether two or more signals are assigned with same Alphabetical / Numerical Shortcut.
If(assigned)
Display “Possibly assigned same shortcut for another signal” in MessageBox.
else
go to Step 4
Step 4 : Check whether the data is valid or not , on the signal to be sent.
If (valid)
Send the Signal
else
Display Error Message in MessageBox.
2. Shortcut Key assignment
Functions Used
Int sc();
Byte Converter();
Void Grid_Signal_PreviewKeyDown(
11. Step 1 : Open Savefile Dialog and allow the user to enter the filename.
If (filename is valid)
go to step 2
else
abort
Step 2 : static extern long WritePrivateProfileString(string Section, string Key, string Value, string FilePath);
/* static extern long GetPrivateProfileString(string Section, string Key, string Value, string FilePath);
for Load */
Step 3 : Using the function in Step 2
Write the values in the filename.ini row by row in the following format.
[SECTION 1]
key1=value1
key2=value2
key3=value3
.
.
[SECTION 2]
key1=value1
key2=value2
.
.
3. Configuration Status (Save / Load )
Functions Used
Void savecfg();
Void loadcfg();
Void WritePrivateProfileString();
Void GetPrivateProfileString();
12. Step 1 : Select first row
go to step 2
Step 2 : Set the values of the following columns to their default/minimum values
MsgID - “”
Len - “”
[B1-B8] - “”
Interval - “10”
Start - false(bool)
Channel - “Ch1”
Key - “”
If ( current_row -> Last_Row)
stop
else
select next row
goto Step2
4. Clear All Contents
Functions Used
Void button8_Click(object sender, EventArgs e)
13. Step 1 : Check for availability of empty row below the current position.
if (found)
Check whether the data in current position is valid or not.
if (valid)
write data in current position in the Empty row available.
else
Display Error Message
else
go to Step 2
Step 2 : Check for availability of empty row above the current position. (Starting from the top)
if (found)
Check whether the data in current position is valid or not.
if (valid)
write data in current position in the Empty row available.
else
Display Error Message
else
go to Step 3
Step 3 : Display “All rows are filled” in MessageBox .
5. Cloning Feature
Functions Used
Bool Checkbelow();
Bool Checkabove();
Void Write();
14. Step 1 : Check Whether the data to be transmitted is valid or not.
(Make necessary corrections if required)
Step 2 : Make data conversion (i.e. from decimal to Hex)
Step 3 : Choose Appropriate channel as configured by user
Step 4 : Create Send Event via “XLClass.xl_event_collection” Class
Send information in sequence.
6. Send Signal
Functions Used
Void signal_Click(object sender, EventArgs e)
15. CONCLUSION
Since CANSim is an Open Source product .It can be modified or
enhanced as required.
The Cost for Buying the Existing tool is saved.
Can be used without the hardware for Testing by making use of
Virtual Channels