Quick Start Guide Thank you for choosing RT-LAB as your real-time simulation platform. This Quick Start Guide will guide you through the first steps in achieving real-time and closed-loop simulation, while providing explanations to get you started. RT-LAB Quick Start Guide, by OPAL-RT TECHNOLOGIES. 2015 Install Table of Contents Connect Using your integration model with I/Os ................................16 Installing MATLAB™ and Simulink toolboxes 3 STEP 1: Create a new project based on the integration model 16 Installing RT-LAB software 3 STEP 2: Open the model in Simulink 18 Validating the installation 4 STEP 3: Build the model 20 Starting RT-LAB 4 STEP 4: Check a few things before loading the model 20 STEP 6: Load and execute the model 21 STEP 7: See external I/Os 22 Connect your real-time simulator to your network..............6 6 RT-LAB configuration 8 Annex .................................................................................................23 Create your first project..................................................................9 Local network configuration STEP 1: Create a new project based on an example model Troubleshooting .............................................................................24 9 23 11 RT-LAB is not available in MATLAB™ 24 STEP 3: Load the model 13 My simulator is not detected by RT-LAB 24 STEP 4: Execute the model 14 I need a license for my simulator 24 STEP 5: Use the console to interact with the simulation 15 STEP 6: Stop the simulation 15 Contact and support .....................................................................25 Annex STEP 2: Build the model Using model Direct Connection First project Install RT-LAB on your computer.................................................3 Resources25 Troubleshooting Support Install Install RT-LAB on your computer Connect Installing MATLAB™ and Simulink toolboxes RT-LAB provides full integration with MATLAB™ / Simulink. Please make sure this environment is available before installing RT-LAB. 2. Close all instances of MATLAB™. First project 1. Install a version of MATLAB™. You need the following toolboxes from MathWorks : • Simulink • Simulink Coder • SimPowerSystems (only for electrical simulations) • MATLAB™ Coder (not mandatory) Please visit our website for the latest MATLAB™ version compatibility third-party software at http://www.opal-rt.com/rt-lab-106-third-party-software-requirements • Stateflow (not mandatory) and http://www.opal-rt.com/software-downloads-documentation-0 Using model Installing RT-LAB software If RT-LAB is not already installed on your computer you can find the latest version on our website. The software can be downloaded directly from: http://www.opal-rt.com/software-downloads-documentation-0. Annex 1. Click on “Download Now.” • User name: client • Password: client Other option: a DVD is provided in the installation kit you received. Troubleshooting 2. Wait for the Setup Wizard to open. If the wizard fails to start automatically, browse the contents of the disk and run Setup/Setup. exe. (You will need administrator privileges.) 3. Follow the on-screen instructions to go through the installation process. 4. Please wait while RT-LAB is installed. This will only take a few minutes. 5. Once RT-LAB has been installed on your computer, click Finish to close the Wizard. Figure 1: Setup Wizard 3 Support 6. Configure the program MetaController.exe (located under <RTLAB installation folder>/common/bin) to always run with administrator privileges. Please refer to the Annex for the full procedure. Install Connect Validating the installation For validation, we recommend that you verify that all toolboxes have been installed in MATLAB™. 1. Open MATLAB™. First project 2. Type ‘’ver’’ in the command window of MATLAB™. 3. Verify that you see the following toolboxes from OPAL-RT: • ARTEMIS Blockset • RT-EVENTS Blockset If any of these toolboxes are missing, refer to the troubleshoot section towards the end of this document to install them manually. Using model Starting RT-LAB To launch the RT-LAB interface: Annex • Double-click the MetaController icon in the Windows taskbar, • Or double-click the RT-LAB shortcut on your Desktop, • Or use the Windows start menu (All Programs/OPAL-RT/RT-LABvX.Y.Z/ RT-LAB). Troubleshooting You will then be asked to select a workspace. The workspace is the directory in which RT-LAB will store all the files required for your simulations. We recommend you create a new and empty directory, as this will help you understand the exercises in this guide. Figure 2: Selecting a workspace 4 Support Click the OK button and wait for the Welcome page to appear. Install Connect First project The Welcome page provides quick access to tutorials and documentation. You can open it later from the menu Help / Welcome. For now, click Go to the workbench to open the main RT-LAB window: Using model Annex Figure 3: Welcome Page Troubleshooting Figure 4: RT-LAB workbench 5 Support RT-LAB is now ready to create and run real-time simulations. Install Connect your real-time simulator to your network Connect It is now time to unpack your real-time simulator (also called “target” in this document). The simulator communicates with the host computer via TCP/IP. The simulator can be connected either directly to your host computer (direct connection) or via your local area network (local network). We recommend using a direct connection to facilitate configuration. First project Using model Figure 5 - Simulator and host communication Annex Direct Connection First, locate the IP address of your simulator. The target has a fixed IP address. You can find the IP address in two different places: Troubleshooting • On a sticker attached to your simulator, or, • In the “SystemDescription [Customer Name]_[Project Number].pdf” located on your DVD. You will find the IP address within the “Simulator General Overview” section. Use the Ethernet cable found in the box to connect the simulator from its Ethernet port to your computer’s LAN port. In order to establish communication, you must now modify the IP address of your host computer so that it is in the same sub-network as the simulator. Support 6 Install Connect 1. Click the network icon in your Windows icon tray, and then click on “Open Network and Sharing Center” [Fig. 6]. 2. Click “Local Area Connection” [Fig. 7]. First project Figure 7 - Local Area Connection 3. Click the Properties button. 4. Choose the connection “Internet Protocol Version 4 (TCP/IPv4)”, and then click “Properties” [Fig. 8]. Using model Figure 6 - Open Network and Sharing center Troubleshooting Figure 9 - Windows IP configuration 7 Support Figure 8 - Windows IP properties Annex 5. Choose “Use the following IP address” and enter the correct IP address and subnet mask. Usually, the first three numbers of the IP address should be the same as your simulator. The last number should be between 1 and 255 and should be different from your simulator. The subnet mask will be “255.255.255.0” [Fig. 9]. Install Connect RT-LAB configuration In the RT-LAB’s Project Explorer, double-click this item to discover available simulators on your network. First project After a short time, the following window should appear and show your simulator. Edit the name of your simulator as you wish, then click Finish. Figure 10: Discovering targets Using model Note: if your simulator is not automatically detected, please refer to the Troubleshooting section: My simulator is not detected by RT-LAB. Annex Troubleshooting Your simulator is now available in the RT-LAB interface: Figure 11: Detected targets Figure 12: Simulator is ready 8 Support Note: if your simulator is not automatically detected, please refer to the Troubleshooting section “My simulator is not detected by RT-LAB.” Install Create your first project Connect STEP 1: Create a new project based on an example model In the RT-LAB’s Project Explorer, double-click this item to create a new project. Alternatively, you can use the following menu: File / New / RT-LAB Project. First project The following window appears: Figure 13: Creating a new project Using model Follow the next steps to configure this model and run it in real-time. Toolbar Annex 1. Name your project (e.g. “My first Project”) then click Next. Troubleshooting Figure 14: Naming the new project Support 9 Install Connect 2. Browse the examples to open the Basic folder and select “rtdemo1.” 3. Click Finish. First project Using model Annex Troubleshooting Figure 15: RTDemo1 example Your project is now available in the Project Explorer. It contains a simple model named “rtdemo1.” This model simulates a mass-springdamper mechanical system with its PID controller. Support 10 Install Connect STEP 2: Build the model The build process allows RT-LAB to transform the Simulink model into a full real-time simulation. This process must be done each time the Simulink model is modified. First project 1. In the Project Explorer window, expand the project you just created to find the “rtdemo1” model. 2. Drag the model onto your target. This will automatically configure your model to run on this particular target. 3. Right-click on the model, then select Simulation / Build configurations… Using model 4. Select the Matlab version you want to use. Figure 16: Assigning the model to the target Annex Troubleshooting 11 Support Figure 17: Building the model Install Connect This opens the following window: First project 5. Verify that your target is selected as the “Development Node.” The “Development Node” is the target that RT-LAB will use to perform the build. 6. Click “OK” then wait for the build process to complete. You can view the progress of the build in the Compilation View at the bottom of the RT-LAB interface. Using model Annex Troubleshooting Figure 18: Build configuration Support 12 Install Connect STEP 3: Load the model The load process prepares the real-time target to perform the simulation. First project 1. For easier interaction with your simulation, make sure that the Handle console automatically option is enabled. To do so, double-click on the “rtdemo1” model to open its editor, then go the Simulation tools tab: Using model Annex Troubleshooting Figure 19: Handle console option 2. Right click the project and select Simulation / Load. Or simply use the Load toolbar item: in RT-LAB. Figure 20: The Simulink console 13 Support 3. Wait while rtdemo1 is loading. Shortly, a new window appears (rtdemo1 user interface). Install Connect STEP 4: Execute the model Executing the model starts the real-time simulation on the target. First project 1. Right click the project and select Simulation / Execute. Or simply use the Execute toolbar item: Using model Annex Troubleshooting Figure 21: The console is running Support 14 Install Connect STEP 5: Use the console to interact with the simulation First project The user console is now receiving and sending data to the simulation and you can observe the changes on-line. In the console, you can double click on the adjust reference block to control the set point of the mass-spring-damper system and on the scope blocks to observe signals received from the simulator. Using model Annex Figure 22: Observing the simulation Troubleshooting STEP 6: Stop the simulation Stopping the simulation releases the target and allows for another simulation to be performed. 1. Right click the project and select Simulation / Reset. Or simply use the Reset toolbar item: . 2. Verify that the console is automatically closed. 15 Support You are now ready to test your integration model. Install Using your integration model with I/Os Connect Now it’s time to use your integration model. This model has been designed to interact with the hardware included in your simulator. Each system is delivered with a special model that uses all I/Os available on your simulator. STEP 1: Create a new project based on the integration model First project Just like with your first project, double-click Create a project, then name it and click Finish. Make sure your project is now visible in the Project Explorer. Expand it then right click on Models and select Import: Using model Annex Troubleshooting Figure 23: Importing your model (1) Support 16 Install Connect In the next window, select RT-LAB / Existing RT-LAB model: First project Using model Browse and select your existing model on your computer or on the DVD provided. You are looking for the model under /Test_Models/CPU. Select the Simulink model file (.mdl). If you find two “.mdl” files, select the one with the shortest name. Once selected, click Finish. Annex Now you can see your model in the Project Explorer window: Troubleshooting Figure 24: Importing your model (2) 17 Support Figure 25: Model has been imported Install Connect STEP 2: Open the model in Simulink To open your model in Simulink, right click on your model -> Edit With -> choose your MATLAB™ version. MATLAB™ will open with your model. First project In the root layer of your Simulink model, you will find two subsystems: SM_[name] and SC_[name]. Using model SM_ [name] stands for subsystem master. This is where all the realtime simulation will occur. This is the only subsystem that will be run on the simulator and which contains I/Os. Annex SC_[name] stands for subsystem console. This will be an asynchronous subsystem that will run on your host computer and will act as a user interface. No critical mathematical logic should be included in this subsystem. The subsystem console (SC_ [name]) will essentially act as the graphical user interface (GUI). Troubleshooting Figure 26 - Editing model Support 18 Install Connect In the SM_[name] subsystem, you will find a block of our library that controls I/Os. Depending on your system, you will see the following blocks: Analog input (Ain) and output blocks (Aout), Static digital input (Din) and output blocks (Dout), PWM input (PWMin) and output blocks (PWMout), and, Event detector (TSDin) and Event generator blocks (TSDout). First project • • • • Each of the I/O configurations of your simulator will be described in “SystemDescription_[Customer Name]_[Project Number].pdf”. The I/Os model will read and simulate all of your system’s I/Os. Using model Annex Troubleshooting 19 Support Figure 27 - Subsystem topology Install Connect STEP 3: Build the model 1. Just like with the “rtdemo1” model, drag the integration model onto your target to preconfigure it. and wait a few seconds while the model is First project 2. As you have already configured the build process, simply click the Build toolbar item compiled. STEP 4: Check a few things before loading the model Using model Since this model uses I/Os, some additional steps are required: 1. Double-click the model to open its editor and go to the Execution tab. Change the real-time simulation mode to “Hardware synchronized.” Annex Troubleshooting Figure 28: Hardware synchronization Figure 29: XHP mode 20 Support 2. Then, go to the Assignation tab and make sure that the XHP (Extra High Performance) box is checked (ON): Install Connect STEP 6: Load and execute the model 1. Click the Load toolbar item and wait for the load process to be completed. First project 2. Click on the Execute toolbar item . A new console window appears. Your I/Os are up and running! You can now change constant blocks to control analog and digital output signals and observe analog and digital input signals using the various scope blocks: Using model Annex Troubleshooting 21 Support Figure 30: Integration model running Install Connect STEP 7: See external I/Os To see external signals, you can use an oscilloscope to probe analog and digital output of the simulator. The integration model is already simulating all output signals with either a square or a sine wave signal. Note that the digital output card needs to be powered up with an external source between 5v and 32v on the Vuser and have a ground in Vrtn pins. See the System Description documents to locate those pins. First project From your “SystemDescription_[Customer Name]_[Project Number].pdf,” in section B – “Mapping I/O Blocks to signal conditioning,” you will find all the I/O configurations of your simulator. The most important thing is that you will find the pin assignments of each I/O channel. Figure 31 - Loopback boards Using model For quick testing, you can also use output signals to simulate inputs. We call this method “loopback testing.” The system comes with some loopback boards and cables that can be used to create a loopback configuration. Figure 32 - Loopback cables Annex Troubleshooting Figure 33 - Loopback Congratulations, you made it through the Quick Start Guide! 22 Support If you want to learn more about RT-LAB and real-time simulations, the full documentation is available from the menu Help / Content of RT-LAB. Install Annex Connect Local network configuration If you want to use your simulator in a corporate network environment, please follow the steps below. Otherwise, go to the next section. First project 1. Ask your IT department if you can add a fixed IP address component on the network where your computer will be able to communicate. Using model 2. They will most likely give you a range of IP addresses that the simulator can use. 3. The IP addresses of the simulator will need to be changed to the address given by your IT department. To do so, please follow these steps: Annex Figure 34 - Change IP address • In RT-LAB, double click the target to open the configuration panel. In the overview tab, you will see the actual IP address. • Change the IP address to the one from your IT department. • The system will ask you if you would like to change the IP address. Click yes. Troubleshooting 4. Disconnect the simulator from your computer. 5. Connect both the simulator and your computer to the network. 6. Return to the original configuration of your network for your computer. 7. You will see the simulator connected in RT-LAB. Support 23 Install Troubleshooting Connect RT-LAB is not available in MATLAB™ If any of the OPAL-RT toolboxes have not been installed in your instance of MATLAB™, you can add them manually. Run the following “m” script in your MATLAB™ to install them. ARTEMIS Blockset : C:\OPAL-RT\ARTEMIS\[ARTEMIS version]\art_m\setup_artemis.m RT-EVENTS Blockset : C:\OPAL-RT\RT-EVENTS\[RT-EVENTS version]\rte_m\setup_rtevents.m RT-LAB: C:\OPAL-RT\RT-LAB\[RT-Lab version]\simulink\m\setup_rtlab.m RT-XSG: C:\OPAL-RT\RT-XSG\[RT-XSG version]\Simulink\xsg_Rxx\m\setxsgpath.m First project • • • • Using model My simulator is not detected by RT-LAB 1. Create a target node in RT-LAB: in the Project Explorer, right-click on Targets then select New / New Target. 2. Enter a name and the specific IP address for the target. Annex 3. Now click Ping to ensure that the target is available. If not, please contact your network administrator or follow the instructions on this page: http://www.opal-rt.com/kb-article/how-change-ip-address-or-ip-mask-redhat-target-through-telnet. Otherwise, simply click Finish and your target will appear in the Project Explorer. Troubleshooting I need a license for my simulator If your simulator needs a license, double-click on it in the Project Explorer to open its editor, then go to the License tab and follow the instructions. For more details on the license system, please visit: http://www.opal-rt.com/kb-article/rt-lab-105x-license-activation-request-andinstallation Support 24 Install Contact and support Connect If you have any questions, please refer to our web page “Software Downloads & Documentation” or contact the Support team using the “Support Request” web page: http://www.opal-rt.com/support/support-request. First project Be sure to check out the Troubleshooting page of this Quick Start Guide. It is a good reference for helping you understand the source of any issues you might have. If you don’t find an answer, please contact us and we will answer your questions and help you with the getting started process. Resources Download latest version Return Merchandise Authorization (RMA) Technical Support www.opal-rt.com/hardware-overview Using model Hardware Information www.opal-rt.com/software-downloads-documentation-0 www.opal-rt.com/support/return-merchandise-authorization-rma-request www.opal-rt.com/technical-support www.opal-rt.com/support/knowledge-base Download Linux http://ftp.opal-rt.com/Redhat/ Login: client Password: opal102 Annex Knowledge Base Troubleshooting Support 25 Quick Start Guide OPAL-RT is the world leader in the development of PC/FPGA Based Real-Time Digital Simulator, Hardware-In-the-Loop (HIL) testing equipment and Rapid Control Prototyping (RCP) systems to design, test and optimize control and protection systems used in power grids, power electronics, motor drives, automotive industry, trains, aircrafts and various industries, as well as R&D centers and universities. Tel.: +1 514-935-2323 | www.opal-rt.com