I wish to do a project about CAN bus message testing, but without a real vehicle. Is there any way to simulate a virtual CAN bus network?
There are really two ways of achieving this.
Wire up all of the required Nodes on the bench, for example this can be the Engine ECU, Instrument cluster, BCM, indicator stalk, rear convenience module etc etc.
Monitor the CAN data on the vehicle in question so you know what data is required and then transmit this from your own device such as a PC, CAN bus development board etc etc. I prefer to use a USB-CAN transceiver and a PC that way I can write custom scripts and software to monitor the traffic and transmit at certain times under certain conditions. The benefit with this method is you can have gauges and graphs on screen.
It really depends what you want to achieve and why.
Number one has the benefit of being 'real world' hardware, it is exactly as it would be in the vehicle. The problem however is that there would be hundreds of errors unless you have every last electrical device hooked up as certain ECUs would be looking for sensors, actuators even light bulbs etc that were not present.
Number two has the benefit of saving space and eliminates the problem of missing hardware. You simply transit all of the CAN IDs and data that would be present on the vehicle. The problem with this is that there can be timing issues with security and safety systems. With 95% of the data transmitted it doesn't really matter about when exactly the data is transmitted it just needs to see it within a certain amount of time. But some data acts as a call and response system, e.g. Node 1 sends 'xxxxxxx', Node 2 will only then send 'xxxxxx1' then Node 1 continues to send the rest of the data. Or a specific Node will have to transmit first in order to wake up the rest. Although after monitoring the live data enough it is not that hard to work the timing out.
I usually have the Engine ECU hooked up on a bench rig with all of the required sensors and actuators, I then hook this up to my PC using a USB-CAN device.
Just remember the automotive CAN bus isn't really that complicated at all, each node simply transmits a number of IDs with up to 8 bytes of data. ECUs/Nodes don't 'talk' to each other, they're dumb, they simply monitor the bus for the data and make changes based on this data. Simulate this data exactly and there will be no issues.
I would avoid DIY and open source CAN bus devices such as Arduino as they are usually not fast enough to transmit and process up-to 100 IDs. I would invest in a decent CAN bus analyser such as Kvaser.
I have personally made my own CAN bus analyser with a 72Mhz processor, which I would say is the minimum required to simulate a complete network. It all depends on your electronics and software knowledge, building your own analyser and custom PCB is not that hard with beginner electronics knowledge.
It's a worthy endeavor, but I suspect any solution that you could buy would be far more expensive than salvaging the important computers from a wrecker [junkyard] and creating your own virtual "test vehicle".
Even just an ECU and "body module" (in GM terms, BCM/BCU) might be enough to simulate an entire vehicle for your purposes.
Or perhaps purchase a wrecked vehicle, no need for aesthetics or even an engine. You just need the wiring harness and computers intact.