该内容不适用于您选择的语言

该内容将以另一种语言显示出来。 您可使用浏览器的翻译功能查看内容。

Preparing a NI Linux Real-Time PXIe Controller for Usage With IPG CarMaker

Updated Jan 4, 2023

Environment

Hardware

  • PXI Controller

Software

  • VeriStand
  • LabVIEW Real-Time Module

Operating System

  • LabVIEW Real-Time (NI Linux Real-Time)

Other

  • IPG CarMaker/HiL version 9.0 or higher

NI Real-Time Controller can be used as a Real-Time target for Hardware-in-the-loop simulation with IPGs simulation environment CarMaker. Files which are used on the NI Linux Real-Time target as well as by parts of the CarMaker application, which are running on a Windows-host e.g. IPGMovie, are shared over the Network File System (NFS) protocol. This guide explains how to setup the NFS protocol on the NI Linux Real-Time controller. We choose a way that the shared content is also available even after the reboot of the NI Linux Real-Time target. If a PXIe Controller with a Phar Lap Operating System is used, this guide does not apply, as it uses a different file sharing mechanism.

Steps

Prerequisites

  • Installation of CarMaker/HIL version 9.0 or higher
  • Installation of compatible version of VeriStand or LabVIEW. A compatibility table can be found in the customer area of IPG under the Supplementing CarMaker section
  • Installed VeriStand support (for the usage with VeriStand) or LabVIEW Real-Time Engine (for the usage with LabVIEW) on the NI Linux Real-Time target
 

Setup on Windows host machine

  1. Open Realtime System Setup as administrator and check the following points, to ensure the file sharing service is set up correctly:
  • The NFS Server is installed and running
  • The Net Interface specifies the Network Interface on your host PC, which you use to communicate to the NI Linux Real-Time target 
  • The Shared Directories look like in the picture below
Figure 1: Realtime System Setup
 
  1. Add your Realtime System to the List of RT Systems by clicking on the + Button. Choose a meaningful Host name and provide the IP and MAC Address of your NI Linux Real-Time target. Leave the OS/CPU Type unchanged. Afterwards save these settings with clicking on Apply. Adding your Real Time target to this list is required, because with this entry the access rights to the NFS server are managed. Access to the over NFS shared files will be denied, if the real time target is not part of this list.
  2. Open a text editor (e.g. Notepad++) and create a new file, which looks like the following. Replace the Host.IP.address in the script with your Host IP address in dot notation. Save the file without any file extension. Check if the file was saved with Unix End-of-Line (EOL) characters. In Notepad++ this option can be found under Edit>>EOL Conversion>>Unix (LF). You can find this script also in the attachment section below.
#!/bin/bash

NAME="MountSharedDrive Startup Script"

do_start() {
sleep 20
mount -t nfs Host.IP.address:/opt/ipg  /opt/ipg -o  auto,intr,nolock
mount -t nfs Host.IP.address:/CM_Projects /c/CM_Projects  -o  auto,intr,nolock
}

do_stop() {
umount /opt/ipg
umount /c/CM_Projects
}

case "$1" in
start)
   echo "Starting $NAME"
   do_start
   ;;
stop)
   echo "Stopping $NAME"
   do_stop
   ;;
restart)
   echo "Restarting $NAME"
   do_stop
   do_start
   ;;
*)
   echo "Usage: $0 {start|stop|restart}"
   exit 1
   ;;
esac

exit 0
  1. Copy this file to NI Linux RT Target into the folder /etc/init.d using one of the Tools Available for File Transfer/Access on NI Linux Real-Time Targets.
 

Setup on NI Linux Real-Time Target

  1. Access the Shell on NI Linux Real-Time Device and Login.
  2. Run a package manager update: opkg update
  3. Install NFS and libusb: opkg install nfs-utils libusb-0.1-4
  4. Create mount points: mkdir -p /opt/ipg /c/CM_Project
  5. Test your script with the following command. Replace <name of your script> with the name of your script: /etc/init.d/<name of your script> start
  6. If you cannot execute the script, use the following command to change the execution mode. chmod +x /etc/init.d/<name of your script> Repeat step 5
  7. Confirm mount is done:
    1. cd /opt/ipg
    2. ls
    3. all folders and files from the IPG installation on the Windows host PC must be visible
    4. cd
    5. cd /c/CM_Projects
    6. all folders and files from the CM_Projects folder on the Windows host PC must be visible
  8. (Optional) Test unmounting your shared folders: /etc/init.d/<name of your script> stop
  9. Enter the following command in the shell to automatically mount the shared folder during the boot up: /usr/sbin/update-rc.d -f <name of your script> defaults 99 10
  10. Reboot. Wait for 30 seconds, then check if folder content is visible (see step 7). The script contains a sleep command before mounting, since the network needs some time to initialize and therefore the NFS folders are not available at the start of the boot process.
  11. (Optional) If you want to remove the automatic mount during the boot, run the following command: /usr/sbin/update-rc.d -f <name of your script> remove
  12. Copy the following files from /opt/ipg/carmaker/win64-X.X/lib-nilrt (Replace X.X. with your version of IPG CarMaker) to /usr/lib
    • CM_lvrt.so:
      • cp /opt/ipg/carmaker/win64-X.X/lib-nilrt/CM_lvrt.so /usr/lib
    • libMIOdrv.so
      • cp /opt/ipg/carmaker/win64-X.X/lib-nilrt/libMIOdrv.so /usr/li
  13. Change access permissions:
    1. cd
    2. cd /opt/ipg/carmaker/win64-X.X
    3. chmod +x *
  14. Check if CarMaker.nilrt.so and apobrokerd are configured correctly
    1. cd bin-nilrt
    2. ls
      1. if CarMaker.nilrt.so and apobrokerd are displayed in green, everything is configured correctly
      2. if they are not displayed in green, enter the following:
        1. chmod 777 -R CarMaker.nilrt.so
        2. chmod 777 -R apobrokerd
        3. ls

Results

With this procedure the content of the IPG shared directories are always available on the NI Linux-Real Time target, which is necessary to successfully run CarMaker/HiL on the target. With successful mount the shell output could look like that.

Figure 2: Shell output after successful mount after boot


Note that the content of the /opt/ipg folder is a representation of the C:\IPG folder on the Windows Host PC and should look similiar.
The /c/CM_Projects  folder is a representation of the C:\CM_Projects folder on the Host PC and does contain all your CarMaker Projects.

Next Steps

For the Use with LabVIEW

  • Refer to the section 1.9.3 Using CarMaker with NI LabVIEW in CarMakers Programmers Guide (CarMaker >> Help >> Programmers Guide)
 

For the Use with VeriStand

  • Refer to the scetion 1.9.4 Using CarMaker with NI VeriStand in CarMakers Programmers Guide (CarMaker >> Help >> Programmers Guide)

Attachments

Was this information helpful?

Yes

No