{"id":831,"date":"2022-09-27T16:43:53","date_gmt":"2022-09-27T08:43:53","guid":{"rendered":"https:\/\/www.tosunai.com\/?p=831"},"modified":"2023-04-20T15:34:57","modified_gmt":"2023-04-20T07:34:57","slug":"tsmaster-hil-simulation-05","status":"publish","type":"post","link":"https:\/\/www.tosunai.com\/en\/tsmaster-hil-simulation-05\/","title":{"rendered":"TSMaster HIL Real-Time Simulation Series 5 - Implementation of ECU HIL Simulation"},"content":{"rendered":"
This article introduces the fifth chapter in the TSMaster Building Vehicle Controllers from Scratch HIL Real-Time Simulation series, which continues with the implementation of real-time HIL for controllers.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t ABS algorithm simulation and vehicle model operation, their function is not simply to draw curves and collect operation data, but has a deeper purpose, which is to link with the external world, exposing the input and output data completely in the real world, to achieve the real purpose of HIL - hardware in the loop.<\/span><\/p> \u00a0<\/p> The process of interacting with the outside world can be very simple, just design a dbc file specifically for this purpose, load it into TSMaster, and map the contents of the system variables to the bus.<\/span><\/p> \u00a0<\/p> Here I have prepared a simple dbc file which contains four wheel speeds, and four wheel cylinder pressure signals. Let's drag it into tsmaster.<\/span><\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t \u00a0<\/span><\/p> Turn on the RBS again and let the remaining bus emulation take over the sending of these signals.<\/span><\/p> \u00a0<\/span><\/p> Then we opened the hardware channel selector and selected the CAN channel as a bus tool of the same star - TC1005 as a demo. Channel 1 and channel 2 of TC1005 were connected to each other to ensure that the outgoing messages could be answered correctly.<\/span><\/p> \u00a0<\/span><\/p> We start the RBS, open the Trace window, and we can see that the signals we need are being sent on the bus at a predetermined frequency, but of course these signals are initially at 0 because they are not updated, and the next step is<\/span>Do signal binding to pass the values in the system variables to these signals.<\/span><\/p> \u00a0<\/span><\/p> First stop the simulation and go back to our algorithm applet and add pre-send functions that take over the process of sending wheel speed and pressure messages. This means that whenever a message is about to be sent, the system calls these pre-send functions and we simply update the signals we need within these functions.<\/span><\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t We try to assign values. Finally, we add the CAN signals to be observed in the graph window, including velocity and pressure signals, etc.<\/span><\/p> At this point, we have completed all the required pre-sending functions for the signals and it is time to start the entire simulation process, again in the same way, by connecting to the TSMaster application and clicking on the start button of the automation module. You can see that the vehicle is running.<\/span><\/p> \u00a0<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t As the program runs, we can observe the active wheel speed and pressure signals on the bus in real time, and these signals are finally interacting with the real world.<\/span><\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t With the previous foundation, we can say that at this point we have really stepped into the door of HIL real-time simulation. Using this set of processes, we can realize HIL simulation of various vehicle controllers with no change.<\/span><\/p> \u00a0<\/p> As a simple example, if we need to perform HIL simulation of the developed ibooster, which is a real ECU, we need to import all the dbc files of the network of the ibooster and simulate all the signals needed for it with our RBS.<\/span><\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t And to emulate the signal, the easiest way is to select the ibooster node we need on the RBS emulation interface, right-click and automatically generate the HIL configuration with one click, this step will automatically activate the other nodes and messages that the ibooster depends on.<\/span><\/p> \u00a0<\/p> Next, come to the applet and construct the various bus signals needed for this node by using the pre-send function.<\/span><\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t Next are some hardware signals, such as encounter pedal signals, which can be implemented through the cylinder automation interface or a custom API.<\/span><\/p> Also, if IO or on\/off signals are encountered, they are implemented through our IO and relay board APIs.<\/span><\/p> \u00a0<\/p> If special sensor signals such as wheel speed are encountered, this is achieved through our wheel speed simulation board API.<\/span><\/p> \u00a0<\/p> If the control of the supply voltage is encountered, it can be achieved by using a programmable power supply with an API.<\/span><\/p> \u00a0<\/span><\/p> Finally, we can open the automation module and write a series of use cases to test our product in every possible way.<\/span><\/p> \u00a0<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t Of course, there is an important prerequisite behind all this, and that is that everything outside the software must be prepared, i.e. the ECU mechanical and hydraulic loads must be prepared in advance.<\/span><\/p>\n As long as the above are in place, then unattended fully automated parameter traversal and testing can be designed and eventually executed, and at the end of the test, the test report can be automatically generated with a single click using pre-configured information.<\/span><\/p>\n The final implementation content is too detailed and implemented in different ways. We have reason to believe that based on this whole set of simulation architecture of TSMaster, the partners can also use their own ingenuity to design various kinds of HIL real-time simulation systems.<\/span><\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>","protected":false},"excerpt":{"rendered":" This article introduces the fifth chapter of TSMaster's series on building vehicle controller HIL real-time simulation from scratch, and continues with the implementation of controller real-time HIL. I. [...]<\/p>","protected":false},"author":4,"featured_media":2727,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"0","ocean_second_sidebar":"0","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"0","ocean_custom_header_template":"0","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"0","ocean_menu_typo_font_family":"0","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"on","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"0","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"off","ocean_gallery_id":[],"footnotes":""},"categories":[36],"tags":[81,84,65],"class_list":["post-831","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hil-rt-simulation","tag-doip","tag-ecu","tag-tsmaster","entry","has-media","owp-thumbs-layout-horizontal","owp-btn-normal","owp-tabs-layout-horizontal","has-no-thumbnails","has-product-nav"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tosunai.com\/en\/wp-json\/wp\/v2\/posts\/831","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tosunai.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tosunai.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tosunai.com\/en\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tosunai.com\/en\/wp-json\/wp\/v2\/comments?post=831"}],"version-history":[{"count":0,"href":"https:\/\/www.tosunai.com\/en\/wp-json\/wp\/v2\/posts\/831\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.tosunai.com\/en\/wp-json\/wp\/v2\/media\/2727"}],"wp:attachment":[{"href":"https:\/\/www.tosunai.com\/en\/wp-json\/wp\/v2\/media?parent=831"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tosunai.com\/en\/wp-json\/wp\/v2\/categories?post=831"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tosunai.com\/en\/wp-json\/wp\/v2\/tags?post=831"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}
I. HIL hardware in the loop<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\tII. Implementation of HIL simulation of vehicle controller<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
<\/p>\n
<\/p>\n