Today we introduce a new feature of TSMaster - the CANoe Automation Module. The function of this module is to automate CANoe by stimulating the system variables inside CANoe and responding to variable change events with the CAPL script running in CANoe.
一、Open CANoe Automation Module
Open CANoe Automation module
Click on the icon of the CANoe Automation Module to open the window.
If CANoe is not installed or if CANoe's automation server is not registered, TSMaster will print an error message. The user can register himself according to the error message.
二、 the sample configuration
After CANoe has finished booting, we can open a sample configuration with system variables at will. We can look for the various examples in the programming section.
For example, the COM Automation via Python example configuration. When you open it, you will find a Simulation Setup, where we can browse the logic of each simulation node.
We can see that this is a simulation of the operation of the lights of a car, we can go to Analysis and see that it has panels, various buttons, traces and graphics. the first script is the control of the engine; the second is the control of the lights. We can see that there is such a system variable change event inside the light control, which is the switch of the double flashing lights. This control code is to achieve the flashing function of the double flashing lights by stimulating the system variable of the double flashing lights-HazardLightsSwitch.
三、to achieve CANoe double flashing light flashing
CANoe double flashing lights are achieved
Back in TSMaster, click Refresh System Variables List and expand it to see all system variables in the current state of CANoe.
One of them is Lights, and under this Namespace there is a HazardLightsSwitch, which is the variable we want to control.
> First we start the CANoe emulation. Click on the Start Emulation button of TSMaster and the CANoe emulation will start normally. It is important to note that all operations of the interface you just saw can be done automatically with TSMaster's script.
> We try to modify the system variable of the double blinker of CANoe in the interface, you can double click or press enter, after that a modify dialog box will pop up, enter 1 and press enter, then go to CANoe, we can find that the double blinker of this car in CANoe has started to blink.
> We go back to TSMaster, change this variable to 0 and press enter, you can see that the double flashing light goes off. This is the core functionality currently supported by the CANoe automation module. It is able to automate through system variables, and this module will add new control functions later, so stay tuned...
四、in the TSMaster control flicker
Control double flash in TSMaster
> We click on Stop to stop the simulation, then open an Automation Module interface, press Enter and add an action, which we set to an API function call, where we need to use the many APIs that come with the CANoe Automation Module. we select the applet library function, here is a list of the 24 API functions inside the CANoe Automation Module.
> First of all, the first function is to connect CANoe, double click on it to add it in, the second step after connecting CANoe, we can copy this code Ctrl c plus Ctrl v. Then the second step is to start the simulation, start the simulation is naturally canoe_start enter, so that the canoe_start API is selected.
> After starting the emulation, we may need to wait a second, press enter, and then double-click on the new action, which we can choose to still be an API call, but at this point is our internal system function.
> Then we select wait, the time displayed is 1000 milliseconds, the message is wait some time, after 1 second we want to trigger a change in the variable of the double flashing light. Again enter, then check our new action, it changes to API function call library function, function name needs to be filtered by set.
> Here are some functions to set the system variables, suppose after we set them, we may need to wait for 5 seconds to observe. Then we change the wait parameter time to 5000, then we need to set the variable to 0 to stop the double blinker. Then we may need to stop for another 3 seconds to observe, then we copy the wait function again and change it to 3000, then we stop the emulation and stop the disconnection of CANoe.
> We went ahead and copied and pasted it and changed it to disconnect, which completed the design of a flowchart. Then, by means of the flowchart, we have completed the design of the control logic. At the same time, this flowchart is an executable program that can be executed by pressing F9. Switching to CANoe, we can see the double flashing lights flashing, and after 5 seconds, the double flashing lights are off. Finally the whole process is finished and the simulation is stopped.
Here we believe that there will be a lot of user demand for the CANoe automation module of TSMaster. The existing logic can still be run in CANoe, which is equivalent to the fact that the two software can be co-simulated. On the one hand, many unique functions that only CANoe CAPL scripts can execute are realized; on the other hand, the efficiency of development debugging and testing can be improved.
The above is our TSMaster's CANoe automation module function demonstrated for you in this chapter, more detailed operation steps can be watched at the B station Oh!