20sim4creferencemanual

Upload: tijdelijkaccount

Post on 08-Apr-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/7/2019 20sim4CReferenceManual

    1/53

    20-sim 4C

    20-sim 4C 1.1 Reference Manual

    Windows Vista / XP / 2000

  • 8/7/2019 20sim4CReferenceManual

    2/53

    20-sim 4C 1.1 Reference Manual

    2008, Controllab P roducts B.V.

    Authors: Ir . C. Kleijn, Ir. P.M. Visser

    Disclaimer

    This manual describes the prototyping environment 20-sim 4C.

    Controllab Products B.V. makes every effort to insure this information is accurate and reliable.

    Controllab Products B.V. will not accept any responsibility for damage that may arise from using this

    manual or information, either correct or incorrect, contained in this manual.

    Information in this document is subject to change without notice. No part of this document may be

    reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose,without the express written permission of Controllab Products B.V.

    Windows is a registered trademark of the Microsoft Corporation, USA.

    Reference

    Kleijn C., Visser P.M.

    20-sim 4C 1.1 Reference Manual

    Enschede, Controllab Products B.V., 2008

    ISBN 978-90-79499-02-1

    Information

    Controllab Products B.V.

    Address: Drienerlolaan 5 HO-8266

    7522 NB Enschede

    the Netherlands

    Phone: +31-53-4893096

    Fax: +31-53-4892223

    Internet: www.20sim.com

    www.controllab.nlE-mail: [email protected]

  • 8/7/2019 20sim4CReferenceManual

    3/53

    Table Of Contents

    Table of Contents

    1 Installing 11.1 Introduction 11.2Connecting the Target 11.3 Installing 20-sim 21.4 Installing 20-sim 4C 31.5Running a Test Model 42 Working w ith 20-sim 4C 132.1 Introduction 132.2Working Order 142.3Configure 152.4Connect 172.5Compile 192.6Command 202.7Command Browse 212.8Monitoring and Logging 232.9Run with Monitoring 232.10Run with Logging 242.11Select variables for logging and monitoring 262.12Change Parameters 283 Advanced Options 293.1 Loading Models 293.2Multiple Targets 294 Targets 314.1 Introduction 314.2PC104 Mechatronic Demonstrator 324.3PC/PC104 (NO I/O) 334.4PC/PC104 with Sensoray 526 344.5ARM 7260 354.6ARM 7300 Torsion Bar Setup 36

    i

  • 8/7/2019 20sim4CReferenceManual

    4/53

    Table Of Contents

    ii

    4.7ARM 7300 374.8ARM 7300 with TS-9700 385 Operating Systems 395.1 Introduction 395.2Targetdaemon 395.3RTAI Linux 396 Troubleshooting 416.1 Introduction 416.2Software 416.3Errors 43Index 47

  • 8/7/2019 20sim4CReferenceManual

    5/53

    1. Installing

    1Installing1.1 Introduction20-sim 4C is a prototyping environment that allows you to connect 20-sim models to physical

    systems. To install 20-sim 4C and test its proper working we have to check that both 20-sim 4C and

    20-sim are installed and a target is connected. Then we will load a test model in 20-sim and see if we

    can get it running on the target.

    Requi r em ent s

    Runs on Windows XP and Windows Vista. Only in combination with 20-sim 4.0 Professional. A valid 20-sim license with the 4C toolbox

    extension is required.

    20-sim 4.0 Professional has to be installed on the same computer.I ns t a l la t ion

    1. Install 20-sim 4C and make sure it is working properly.2. Install 20-sim and make sure it is working properly.3. Connect a target and make sure it is powered on.4. Run a test model.1.2 Connecting the Target20-sim 4C uses an ethernet connection to communicate with a target. This connection can be

    established by a cross cable that is connected between your PC and the target directly or by a

    network connection. Using a cross-cable to connect the host PC to the target is the recommended

    approach if you start 20-sim 4C for the first time.

    Plug in the cross cable or network cable.

    1

  • 8/7/2019 20sim4CReferenceManual

    6/53

    1. Installing

    Cro ss Cabl e

    1. Plug in the cross cable in the connector of your target.2. The other end of the cross cable must be plugged in into your PC computer.Netw ork Cable

    1. Plug in the network cable in the connector of your target.2. The other end of the network cable must be plugged in into a switch or hub of the

    network.

    Use a 'normal' network cable to connect your target via a switch or hub to your network. Make sure

    your network is configured in the 192.168.1.x range and that your PC computer has a proper

    connection to the network.

    1.3 Installing 20-sim1. Install 20-sim 4.0 Professional or a higher version.2. Make sure that you have a 20-sim license that allows you to run 20-sim 4C. Contact your

    local distributor how to get such a license.

    3. From the Window s Start menu open 20-sim.4. In the 20-sim Editor from the Tools menu click the Options command.5. In the window that pops up, click the Code Generation tab.

    In 20-sim you can enter the ini-file that is used for C-code generation.

    6. Change the ini-file for C-code Generation to:C: \ Prog ram Fi les\ 20 -s im 4C 1.1\ ta rget \ com m on\ 20 SI M\ t arg ets . in i

    2

  • 8/7/2019 20sim4CReferenceManual

    7/53

    1. Installing

    Note: depending on the location of 20-sim 4C, the path may be different. Enter you own path here.

    The file targets.ini shows where 20-sim 4C is located. If you are generating C-code from 20-sim, the

    code will be automatically transferred to 20-sim 4C.

    1.4 Installing 20-sim 4C1. Install 20-sim 4C on the same computer as 20-sim 4.0 Professional.2. Make sure that you have a 20-sim license that allows you to run 20-sim 4C. Contact your local

    distributor how to get such a license.

    3. From the Windows Start menu open 20-sim 4C.20-sim 4C should open and look like the figure below.

    20-sim 4C.

    4. From the File menu choose Open Project. Load the model:C:\Program Files\20-sim 4C 1.1\examples\20-sim 4C\Test.txp.

    3

  • 8/7/2019 20sim4CReferenceManual

    8/53

    1. Installing

    20-sim 4C should look like:

    20-sim 4C with a test model loaded.

    If you cannot open 20-sim 4C, please check the troubleshooting section.

    1.5 Running a Test ModelTo test if the installation was successful, we will run an example model in 20-sim and generate C-

    code that will be transferred to 20-sim 4C to run on your target. The model is called Test.emx and

    has no external inputs or outputs.

    Expor t in g t he 20 - s im Mode l t o 20 - s im 4C

    1. From the Windows Start menu open 20-sim.2. In 20-sim load the model

    C:\ Program Files\ 20-sim 4C 1.1\ examples\ 20-sim\ Test.emx

    If your version of 20-sim 4C is installed on a different location, please use the correct path.

    The model Test.emx loaded in 20-sim.

    4

  • 8/7/2019 20sim4CReferenceManual

    9/53

    1. Installing

    The model Test.emx contains one submodel (named Test).

    3. Select the submodel Test and from the Model menu select Go Down.

    The submodel Test contains a block diagram model with no external inputs or outputs.

    As you can see it is a block diagram model of a first order systemwhich contains no external inputs

    or outputs.

    4. From the Model menu select Start Simulator.Now the 20-sim Simulator opens showing an empty plot.

    5. In the Sim u la t orfrom the Simulation menu select Run to start a simulation.You should see a stepwise change in the setpoint signal and a first order response of the system.

    The simulation results of the model Test.emx.

    We will generate C-code from this model and run it on a target.

    5

  • 8/7/2019 20sim4CReferenceManual

    10/53

    1. Installing

    6. In the Simulator, from the Tools menu select Real Time Toolbox and C-code Generation.The C-code Generation dialog will pop-up.

    7. Make sure it looks like the figure below. If the 20-sim 4C is not shown, go back to tasknumber 7 and check if the correct ini-file was entered.

    The C-code generation menu in 20-sim.

    8. Click on the Submodel button and select the submodel Test. The C-code Generationdialog should look like:

    The C-code generation menu in 20-sim.

    6

  • 8/7/2019 20sim4CReferenceManual

    11/53

    1. Installing

    Note that a default location for the C-code files is given in the Output Directory field: C:\temp\20sim-

    4C\%SUBMODEL_NAME%, where %SUBMODEL_NAME% will be replaced by the submodel name. If

    you want to use a different location, please enter it here.

    9.

    Click the OK button to close the dialog.

    Now the model will be exported to 20-sim 4C as C-code. All code files are stored in a temporary

    folder. A dialog may appear asking you to open such a folder:

    The folder for temporary code files.

    If everything works fine, 20-sim 4C will be opened, with the Test model loaded.

    20-sim 4C with the Test model loaded.

    If some error occurs and 20-sim 4C does not open, please check the troubleshooting section.

    20-s im 4C Se t t i ngs and Mon i to r ing

    We will enter the settings to get the model running on your target and choose the variables that we

    would like to monitor.

    Conf i gu re

    1. Click on the Configure Target button .2. Click on the Select button, select the proper target and click OK .

    7

  • 8/7/2019 20sim4CReferenceManual

    12/53

    1. Installing

    The next pictures show as an example the Torsion Bar target.

    Select the proper target.

    3. Enter a useful name for your target in the Name field.4. From the IP-address field click the drop down button.20-sim 4C will now start a search to find the IP-addresses of connected target.

    Finding the IP-address.

    If a firewall is installed, a warning message may pop-up:

    The Windows firewall message when the Refresh button is clicked.

    8

  • 8/7/2019 20sim4CReferenceManual

    13/53

    1. Installing

    5. Click the Unblock button (or a similar button if another firewall message is shown) if thename of the program is 20-sim 4C and the publisher is Controllab Products B.V. Repeat

    step number 4.

    6.

    A list of IP-addresses of connected targets will be shown. If more than one address is listed,

    please make sure you choose the correct address.

    7. Click on the Apply button.If everything was installed and connected successfully, the Configure Target button should turn

    into green.

    The configuration was entered successfully.

    If the Configure Target button has turned to red please check the Troubleshootingsection.

    8. Click on the Configure Model button .9. We will not make any changes to the default settings, so click the Apply button.Now the Configure Model button should turn into green.

    Connect

    10. Click on the Connect button .11. Our model does not have external inputs or outputs that we have to connect so click the

    Apply button.

    9

  • 8/7/2019 20sim4CReferenceManual

    14/53

    1. Installing

    Com pi l e

    12. Click on the Compile button .Now the Compile button should turn into green. If it has turned into red please check the

    Troubleshootingsection for help.Com m an d

    Our model has no external inputs or outputs. To make sure its runs properly we have to monitor its

    internal variables during running. That is why we will first choose the variables that we will monitor z

    13. In the tree-view click Command and Browse.14. Click on the plus sign of the Browse item. Now it will expand showing the available

    submodels.

    15. Click on the Step submodel.Now a list of two parameters (amplitude and start_time) and one variable (output) should be visible.

    The list of parameters and variables of the submodel Step.

    The variable output has two gray dots (Mon and Log) at the left. You can click these dots to select

    the variable for monitoring or logging.

    16. With your mouse pointer go to the variable output and click on the grey dot to select it formonitoring.

    10

  • 8/7/2019 20sim4CReferenceManual

    15/53

    1. Installing

    20-sim 4C should now look like:

    The list of parameters and variables of the submodel Step.

    Now we will choose a second variable for monitoring.

    17. Click the submodel Gain and select the variable output for monitoring.To see the variables that have been chosen for monitoring we have to click the Monitor item

    18. In the tree-view click Command and Monitor.20-sim 4C should now look like:

    The list of monitored variables.

    11

  • 8/7/2019 20sim4CReferenceManual

    16/53

    1. Installing

    12

    Now we will choose open a plot and start to run the model on the target.

    19. Click on the Monitor button to show a plot.20. Click on the Run button to start running the model on the target.Now you should see the following plot after 10 seconds of running. The plot shows a stepwise change

    in the setpoint signal and a first order response of the system.

    The monitored variables, shown in a plot.

    If your results are similar, the Torsion Bar is properly installed. If the results are not similar but some

    other variable is shown in the plot, check if the correct variables were chosen for monitoring.

  • 8/7/2019 20sim4CReferenceManual

    17/53

    2. Working with 20-sim 4C

    2Working with 20-sim 4C2.1 Introduction20-sim 4C is a prototyping environment that allows you to export C-code to hardware like PC 104

    systems and ARM-9 processor boards. The name 4C stands for Configure, Connect, Compile and

    Command and these are the tasks that you have to perform to get code running on a target. The

    main window of 20-sim 4C shows these tasks at the top of the window.

    20-sim 4C helps you to get 20-sim models running as C-code on real-time processors.

    Model

    The collection of C-code files that will be exported to the target is called a model, like the model in

    20-sim. The model is shown in a tree at the left of the main window as a blue and red coloured circle.

    The tree also shows the chosen target and the tasks that can be performed.

    Conf igu re

    During configuration you have to enter the IP-address the target, give the running time of the code

    etc.

    Connect

    If the target has connections to external devices (e.g. sensors, actuators) you have to connect these

    with the proper inputs and outputs of your model.

    Com pil e

    To get the C-code running on a target, a compiler is used to create executable code.

    Com ma nd

    With the command buttons you can run the executable code on a target, stop it, monitor and log

    variables.

    13

  • 8/7/2019 20sim4CReferenceManual

    18/53

    2. Working with 20-sim 4C

    2.2 Working Order20-s im

    You can import your own C-code in 20-sim 4C, but the easiest way to get code running, is to

    generate it with 20-sim. 20-sim 4C will be opened automatically with the C-code loaded.

    1. Open 20-sim and load your model.2. Start the Simulator.3. In the Simulator from the Tools menu select the Real Time Toolbox command and C-code

    Generation.

    4. Select a Target and select the model to generate code from.5. Click OK to generate the C-code.20-sim 4C will automatically start and the generated C-code will be loaded.

    20 -s im 4C

    The name 4C stands for Configure, Connect, Compile and Command and that is the correct working

    order to get code running on external targets. You can click the buttons at the top of the window

    from left to right. The working order is also shown in the tree-view at the left of the window.

    1. Configure: enter target specific setting and model specific settings.2. Connect: connect model inputs and outputs with hardware inputs and outputs.3. Compile: compile the model (C-code) for the target.4. Command: run the compiled model and do e.g. measurements.

    Click the buttons at the top of the window, from left to right.

    14

  • 8/7/2019 20sim4CReferenceManual

    19/53

    2. Working with 20-sim 4C

    All the buttons and icons use color to reflect the state of the tasks. The following colors are used :

    Grey : The item is currently not availableRed : The item has failed an action. (See the output or process log at the bottom of the

    screen for details.)

    Orange : The item is out of date and needs user action.Green : The item is ok and needs no further attention.

    2.3 ConfigureThe Configure process has two phases. The Target Configuration phase and the Model Configuration

    phase. You can click two buttons: Configure Target and Configure Model.

    Conf igur e Target

    In the middle of the Configure Target tab the status of the available models is shown.

    During Target Configuration you have to select the target and enter the IP address of the target.

    1. First Select the desired target by pressing the Select button.A dialog will be opened showing a list of supported targets. If desired, you create your own targets.

    The Target Configuration Path shows the location of the corresponding Target Specification files.

    15

  • 8/7/2019 20sim4CReferenceManual

    20/53

    2. Working with 20-sim 4C

    Select the proper target from a list of supported targets.

    2. Select your target and close the dialog by pressing Ok.3. Click on the IP-Address to find the IP-address of your target. 20-sim will automatically

    detect connected targets and show a list of IP-addresses.

    4. Click the Refresh button at the left of the IP address to check if a connection can beestablished.

    If the connection cannot be made, the Configure Target button will be shown with a red color. If

    the connection was successful, the Configure button will be shown with a green color.

    5. Change the name at the Name field if desired. The name will be displayed in the tree-view.Normally every second the target is polled to retrieve its state. This may cause some jitter in

    extreme cases. You can minimize the communication between 20-sim 4C and the target by selecting

    the Disable browse updates option.

    Conf igur e Model

    The model can run for a specific time at a specific rate (the sample frequency).

    1. Enter the time to run a model as the Finish Time.2. Enter the rate in seconds (choose Discrete Time Interval) or as a frequency (choose

    Frequency or Omega)

    16

  • 8/7/2019 20sim4CReferenceManual

    21/53

    2. Working with 20-sim 4C

    Specify how long the model should run at which rate.

    3. Click the Apply button after the settings have been entered.The Configure Model button will change from orange into green. If an error occurs theConfigure

    Model button will turn into red.

    2.4 ConnectMost targets can read sensor data or steer actuators. You have to connect the inputs and outputs of

    the model with the inputs and outputs of the selected target. An example is shown in the figure

    below. The model has two inputs (EncoderLoad and EncoderMotor) and one output (PWM). We haveto choose the matching input and output of the target.

    Connect the inputs and outputs of a model with the inputs and outputs of the target.

    17

  • 8/7/2019 20sim4CReferenceManual

    22/53

    2. Working with 20-sim 4C

    I npu t s

    In the inputs list under Modelportname you will see a list of inputs.

    1. Select one of the inputs (mouse pointer on top and click the left mouse button).Now the Connect button will be active.

    2. Click the Connectbutton.The Connect dialog will appear. In this dialog you can select one out of a set of matching hardware

    inputs.

    Use the Connect dialog to choose a matching hardware input or output.

    3. In the first fieldselect the type of hardware input to connect with.If there is only one hardware input, the second field will be empty. If there are multiple hardware

    inputs, at the port field you must specify which one you want to connect.

    4. At the secondfield, specify which of the multiple inputs you want to select.5. Click OK to close the Connect dialog.

    The model input is now connected with a hardware input.

    18

  • 8/7/2019 20sim4CReferenceManual

    23/53

    2. Working with 20-sim 4C

    In the inputs list you will see the model input and the connected hardware input. Under

    Modelportname will find the model inputs. Under Targetportname the connected hardware inputs are

    shown. Under Targetpins the physical address of the hardware outputs are shown (you can use this

    name to find the correct pin at the hardware layout).

    6. If you have multiple model inputs, you have to repeat these steps until all inputs areconnected.

    O u t p u t s

    7. The model outputs have to be matched with hardware outputs in a similar way as the inputs.8. If all inputs and outputs are connected you must click the Apply button.The Connect button will change from orange into green. If an error occurs theConnect button

    will turn into red. The Process tab at the bottom of the window can be selected to view more detailed

    information.

    2.5 CompileIf the Configuration and Connection were successful, the Configure buttons and the Connect buttons

    are shown in green. Now we can start the cross compiler to convert the model (the C-code files) into

    target executable code.

    1. Click the Com pi lebutton.If the compilation is successful, the Compile button will change fromorange into green. If an

    error occurred, the Compile button will change into red. You have to read the log and try to solve the

    problems.

    Click the Compile button to compile the model into target executable code.

    19

  • 8/7/2019 20sim4CReferenceManual

    24/53

    2. Working with 20-sim 4C

    2.6 CommandOnce the code has been compiled successfully, it needs to be transferred to the target and

    started/stopped. There are three command buttons (at the top of the window):

    1. Run2. Run with logging3. StopRu n

    The first of the Command buttons is Run button . If you click the Run button the model is

    transferred to the target and starts running. The Run button will become grey (and disabled). The

    Stop button will now become active and green and you can click it to stop the running model.

    Furthermore the Command Browse view will be opened.

    Use the Run, Log and Stop buttons to control the model running on a target.

    Run w i t h Logg in g

    The second button of the Command buttons is Run with Logging button . If the button is orangethe logger needs to be configured, pressing the button will automatically open the logger

    configuration tab. If the button is green the model is transferred to the target and logging is started.

    After the logging has completed a data file is written to disk (see Output for details) and depending

    on the configuration a plot will be shown. For more information on Logging see Monitoring and

    Logging.

    Stop

    You can use the Stop button to stop a running model.

    20

  • 8/7/2019 20sim4CReferenceManual

    25/53

    2. Working with 20-sim 4C

    2.7 Command BrowseWhen a model is running on the target the Command Browse view is active. At the bottom of the

    window you can see the current time & the stoptime of the model. Also the idle time and busy time

    will be displayed. The Command Browse viewenables the viewing of all variables of a model as well

    as Change Parameters on-line. Furthermore in the Command Browse view, variables can be selected

    for monitoring and logging.

    Use the Run, Log and Stop buttons to control the model running on a target.

    L ist o f S igna lsThe Browse list contains the following columns:

    Type : The type of the variable, see below. Name : This column displays the hierarchical name (reflects model structure) of the signal. Value : The column displays the value of the signal. The value is updated every second when

    the model is running on the target. If the color of the value is blue the value has been

    changed but not been applied to the target yet. See Change Parameters for more details.

    Unit : This column display the unit for the signal. Mon : You can click on the dot to select the signal for monitoring. The dot will change into the

    monitor icon. When a model is running, the variables that have been chosen for monitoring,

    are shown. You can click the Monitor button at the bottom of the window, to show a plot of

    the monitored variables. See Run with Monitoring for more details.

    Log: You can click on the dot to select the signal for logging. The dot will change into thelogging icon. See for Run with Logging more details.

    Fav: This column will shows if a signal has been marked as a favorite. A complete list offavorites can be seen by selecting the Favorites node in the tree.

    21

  • 8/7/2019 20sim4CReferenceManual

    26/53

    2. Working with 20-sim 4C

    Types

    The following types are available in the Browse list:

    I = Input O = Output C = Constant V = Variable P = Parameter A = Alias (reference to another signal with a different name)Hie ra rchy

    If a model contains hierarchy (i.e. the model contains submodels which themselves may contain

    submodels etc.), the list will only show the variables and parameters of the top of the model. In the

    tree-view, the Browse node will then show a plus sign.

    In the tree-view, click the Browse node to see the variables and parameters of the top of the model.

    If you click the plus sign of the Browse node, the model will be expanded showing the underlying

    submodels. The plus sign is changed into a minus sign. if you click on the minus sign, the expanded

    tree will be closed again.

    If you click on the plus sign, the tree will be expanded showing the underlying submodels.

    22

  • 8/7/2019 20sim4CReferenceManual

    27/53

    2. Working with 20-sim 4C

    You can select a submodel, to show the signals it contains. If the submodel contains underlying

    submodels, a plus sign will be shown. You can click the plus sign to expand and show all the

    submodels. The plus sign will change into a minus sign etc.

    You can select a submodel to show its variables and parameters.

    2.8 Monitoring and LoggingWhen a model is running on a target, you can inspect the values of all the variables to see if it is

    working as it should or to perform measurements. 20-sim 4C provides two ways of inspecting

    variables: Monitoring and Logging.

    Monitoring: inspect variables at real-time when running. Logging: inspect variables off-line.Monitoring is useful for a quick inspection or to measure slow varying variables. Because the variable

    values have to be transferred from the target to 20-sim 4C during runtime, the refresh rate for

    monitoring is limited. This means once every few milliseconds a new value will be shown and the

    values in between are missed. Monitoring is also referred to as signal tracing.

    Logging is useful for detailed measurements of all variable values. During logging, the values are

    stored in the target memory. When the logging has stopped the results are transferred from the

    target to 20-sim 4C and stored on file. Logging is also referred to as data acquisition.

    2.9 Run w ith MonitoringAfter configuring, connecting and compiling, you can run a model on the target. The variables (and

    parameters...) can monitored in two ways:

    Monitoring in the command browse view Monitoring in a real-time plot

    23

  • 8/7/2019 20sim4CReferenceManual

    28/53

    2. Working with 20-sim 4C

    Moni t or in g in th e Com m and Brow se v iew

    When running the model on the target, all variables can be monitored (inspected) by opening a

    model node in the command browse tree. For each model node in the tree the variables are

    displayed as they change on the running target. Note that monitoring may not show all the samples

    since a limited refresh rate is applied.

    Mon i to r ing in a rea l - t im e p lo t

    The second option is to view monitored values in a real-time plot (a live plot). First variables need to

    be selected for monitoring, see Select variables for logging and monitoring for more details.

    After variables have been selected, press the Monitor button in theCommand Browse tab. Now

    the real-time plot will be opened. The Monitor button can be pressed when the model is running and

    from that time the variables will be plotted. Also the Monitor button can be pressed before running,

    such that variables are logged from the start. The picture below shows a sample of the real-time

    plot.

    Click the Monitor button to open a plot showing the monitored variables.

    2.10Run w ith LoggingThe second button of the Command buttons is Run with Logging button . If the button is green

    the logging has been configured and can be started. Pressing the button will start the model on the

    target with logging. After the period of logging (which can be configured) has passed, the logging

    data is transferred from the target to 20-sim 4C and saved to a file. The filename will be shown in

    the output window. Furthermore, the results will be shown in a plot that will be popped-up after the

    file has been stored. If the model is still running after logging, it can be stopped by pressing the stop

    button.

    24

  • 8/7/2019 20sim4CReferenceManual

    29/53

    2. Working with 20-sim 4C

    After logging has been completed the results can be shown in a plot.

    Conf igur e Logger

    If the Run with Logging is orange, the logging needs to be configured. Pressing the Run with Logging

    button now will open the Configure Logger tab.

    In the Configure Logger tab you can select the log file.

    The following options can be configured:

    25

  • 8/7/2019 20sim4CReferenceManual

    30/53

    2. Working with 20-sim 4C

    Selected Variables: You can select which variables should be logged by clicking the Selectbutton. The Select button will open the 'top' model node and here variables can be selected by

    clicking the dot in the Log column. See Select variables for logging and monitoring for more

    details. If no variables are selected, this will appear in red text before the select button and

    the logging is not configured completely. (It makes no sense to start the logging process

    without variables to log.)

    File: The filename and the directory can be specified by pressing either the Browse button ortype the path and filename in the text field. Furthermore you can choose to overwrite existing

    files and to add the date & time to the filename.

    Time: The start time and stop time can be specified. Plot: A plot will be shown after the logging if the Show plot after run optionis selected.

    Multiple runs will be shown in one plot if the Show multiple runs in one plot option is selected.

    You have to click the Apply button after the settings have been entered. The Run with Logging button

    will then change from orange into green. If an error occurs the Run with Logging button will turninto red.

    2.11Select variables for logging and monitoringVariables (and parameters...) can be selected for monitoring and/or logging.

    1. In the tree-view click Command and Browse.Now you will see all the variables and parameters that are available in a model. If the model contains

    hierarchy, you can expand it to show all the underlying submodels. A variable can be selected for

    monitoring or logging by pressing the dot in respectively the Mon column or Log column. The

    following picture shows the result.

    Select the variable that should be monitored or logged.

    26

  • 8/7/2019 20sim4CReferenceManual

    31/53

    2. Working with 20-sim 4C

    After having selected a variable for monitoring and/or logging it is placed in the list of

    monitored/logged signals. To view the list of all monitored/logged signals select the Log node or

    Monitor node in the tree. The following pictures show examples.

    List of all logged variables.

    List of all monitored variables.

    27

  • 8/7/2019 20sim4CReferenceManual

    32/53

    2. Working with 20-sim 4C

    28

    2.12Change ParametersYou can control the behaviour of a running model by changing parameter values on-line:

    1. In the tree-view click Command and Browse.Now you will see all the variables and parameters that are available in a model. If the model contains

    hierarchy, you can expand it to show all the underlying submodels.

    2. Click on the plus sign to show all the underlying submodels.3. Select the desired submodel.4. Select the desired parameter.5. In the Value field at the bottom of the tab, change the parameter value, followed by the

    Enter key.

    The changed value will now become blue to indicate that the value has been changed but not yet has

    been applied. The value has not been applied instantly since you may desire to change multiplevalues at the same time.

    6. If desired, repeat the previous steps to change otherparameter values.7. Click on the Apply button at the bottom of the tab, to apply the changes.The changed parameters will get the color black again as their new value is applied.

    You can change multiple parameters values and click Apply to instantly apply the changes.

  • 8/7/2019 20sim4CReferenceManual

    33/53

    Advanced Options

    3Advanced Options3.1 Loading Models20-sim 4C is automatically started when you generate C-code in 20-sim. You can however start 20-

    sim 4C manually and load your own models.

    1. From the Windows Start menu open 20-sim 4C.2. From the Fi lemenu select New Proj ect. (A model can only be added to a target in a

    project.)

    You will be asked for a name and location of the project.

    3. From the Pro jec tmenu select Add Targe t.4. From the Pro jec tmenu select Add Mode l.You will be asked for a model name with the extension .mcfwhich stands for model specification file.This is an XML based file that 20-sim 4C uses for a description of the model.

    3.2 Multiple TargetsYou can control multiple targets from a single version of 20-sim 4C. The easiest way to make this

    work is to generate a project for each single target and test it separately. Then you create a new

    project an load the various models:

    1. Start 20-sim 4C2. From the Fi lemenu select New Proj ect.You will be asked for a name and location of the project.

    3. From the Pro jec tmenu select Add Targe t. Choose the first target4. From the Pro jec tmenu select Add Mode l. Select the model that corresponds to the first

    target.

    5. Repeat step 3 and 4 for the remaining targets.Now you are ready to run all the targets and control their operation from a single version of

    20-sim 4C.

    29

  • 8/7/2019 20sim4CReferenceManual

    34/53

    Advanced Options

    30

  • 8/7/2019 20sim4CReferenceManual

    35/53

    4. Targets

    4Targets4.1 IntroductionYou can choose from a set of built-in targets in 20-sim 4C or define your own targets. The targets

    should be equipped with a real-time operating system that is supported by 20-sim 4C.

    B u i lt - i n t a rg e t s

    1. PC104 Mechatronic Demonstrator: This a demonstration setup based on the PC104 with theSensory 526 multifunctional IO board.

    2. PC/PC104 (NO I/O): This is a generic PC/PC104 target without defined IO running RTAI Linux.3. PC/PC104 with Sensoray 526: This is a generic PC/PC104 target with the Sensoray 526

    multifunction IO board (www.sensoray.com) running RTAI Linux.

    4. ARM 7260: This is the TS-7260 board of Technologic Systems (www.embeddedarm.com)running RTAI Linux.

    5. ARM 7300 Torsion Bar Setup: This a demonstration setup based on the TS-7300.6. ARM 7300: This is the TS-7300 board of Technologic Systems (www.embeddedarm.com)

    running RTAI Linux.

    7. ARM 7300 with TS9700: This is the TS-7300 board mounted with the TS-9700 IO-boardproviding more (analog) IO.

    Def ine your ow n t a rge ts

    Each target is defined by a so called Target Specification file. By defining a new Target Specification

    file a new target will be defined. The format is open and you can define your own targets if you like

    to do so. Please contact Controllab Products B.V. for more details about creating/defining your own

    targets.

    31

  • 8/7/2019 20sim4CReferenceManual

    36/53

    4. Targets

    4.2 PC104 Mechatronic DemonstratorThe Mechatronic Demonstrator is a setup that demonstrates the most import aspects of a real

    machine:

    1. Frame mass and Frame flexibility2. Motor inertia3. Drive flexibility

    The Mechatronic Demonstrator.

    The setup is controlled with a PC/PC104 with Sensoray 526.

    I npu ts and Ou tp u t s

    The input output of the Mechatronic Demonstrator has been limited to the following inputs and

    outputs :

    Dig i t a l I npu ts

    Four 24-bit quadrature encoder inputs.A n a l o g Ou t p u t s

    One 16-bit analog output.Suppl ie r

    The Mechatronic Demonstrator is a product of Controllab Products B.V. Please contact Controllab

    Products B.V. for more details about this set-up.

    Operat i ng System s

    The Mechatronic Demonstrator has been tested with the following operating systems:

    RTAI: You can order an SD Flash card with RTAI linux and the 20-sim 4C targetdaemon.Netw ork

    The default IP address for the Mechatronic Demonstrator is 192.168.1.174

    32

  • 8/7/2019 20sim4CReferenceManual

    37/53

    4. Targets

    4.3 PC/ PC104 (NO I/ O)The PC/PC104 is a generic target (mostly an X86 based compatible CPU) without any specific

    Input/Output. However on the PC/PC104 add on boards can be mounted to give it inputs and

    outputs. The following picture shows a PC/104 stack with some mounted boards.

    PC104 with mounted add on boards.

    I npu ts and Ou tp u t s

    No inputs or outputs.

    Suppl ie r

    Please contact Controllab Products B.V. for a suitable provider.

    Operat i ng System s

    The PC/PC104 has been tested with the following operating systems:

    RTAI: You can order an SD Flash card with RTAI linux and the 20-sim 4C targetdaemon.Netw orkThe default IP address for the ARM 7300 is 192.168.1.174.

    33

  • 8/7/2019 20sim4CReferenceManual

    38/53

    4. Targets

    4.4 PC/ PC104 w ith Sensoray 526A generic PC/PC104 target with mounted a Sensory 526 card to provide Input Output functionality.

    PC104 and Sensory 526 card.

    I npu t s and Outpu t s

    Ana log & D ig i t a l I npu ts

    Four 24-bit quadrature encoder inputs. Eight 16-bit analog inputs.

    8 x Digital Input. Binary input.

    A n a l o g & D i g i t a l Ou t p u t s

    Four 16-bit analog outputs. 8 x Digital Output. Binary output.Suppl ie r

    The Sensoray 526 is a product of Sensoray. More information can be found on the website:

    http://www.sensoray.com/products/526data.htm

    Operat i ng System s

    The PC/PC104 with Sensory 526 board has been tested with the following operating systems:

    RTAI: You can order an SD Flash card with RTAI linux and the 20-sim 4C targetdaemon.Netw ork

    The default IP address for the PC/PC104 with Sensory 526 is 192.168.1.174

    34

  • 8/7/2019 20sim4CReferenceManual

    39/53

    4. Targets

    4.5 ARM 7260The TS-7260 is a compact Single Board Computer based upon the Cirrus EP9302 ARM9 CPU and set

    of on-board peripherals. The board is optionally equipped with a SD-card.

    The Arm 7260 board.

    I npu t s and Outpu t s

    The board is equipped with a CPLD with predefined configuration providing the following IO. (Not all

    inputs & outputs can be used at the same time)

    Dig i t a l I npu ts

    1 x Quadrature Encoder Input. The Encoder Input can have no reset and a reset on positive ornegative index pulse.

    1 x Edge Counter Input. The Edge Counter Input can have no reset and a reset on positive ornegative edge.

    8 x Digital Input. Binary input.D i g it a l O u t p u t s

    1 X Pulse Width Modulation Output. Pulse Width Modulation output e.g. used to drive a motorvia a H-Bridge.

    8 x Digital Output. Binary output. 2 x LED. Two LED's are present on the board,Suppl ie r

    The TS 7260 is a product of Technologic Systems. More information can be found on the website:

    http://www.embeddedarm.com/products/board-detail.php?product=TS-7260.

    Operat i ng System s

    The TS 7260 board has been tested with the following operating systems:

    RTAI: You can order an SD Flash card with RTAI linux and the 20-sim 4C targetdaemon.Netw ork

    The default IP address for the ARM 7300 is 192.168.1.174

    35

  • 8/7/2019 20sim4CReferenceManual

    40/53

    4. Targets

    4.6 ARM 7300 Torsion Bar SetupThe Torsion Bar Setup is a compact affordable demonstration setup that demonstrates some

    important features of a real machine:

    1. Motor inertia2. Load3. Drive flexibility

    The Torsion Bar Setup.

    I npu t s and Outpu t s

    The interface of the ARM 7300 has been limited to the following inputs and outputs:

    Dig i t a l I npu ts

    2 x Quadrature Encoder Input. The Encoder Input can have no reset and a reset on positive ornegative index pulse.

    D i g it a l O u t p u t s

    1 PWM output, to drive the motor via the H-bridge which is on the interface board. 2 x LED. Two LED's are present on the board.Suppl ie r

    The Torsion Bar Setup is a product of Controllab Products B.V. Please contact Controllab Products

    B.V. for more details about this set-up.

    Operat i ng System s

    The Torsion Bar Setup has been tested with the following operating systems:

    RTAI: You can order an SD Flash card with RTAI linux and the 20-sim 4C targetdaemon.Netw ork

    The default IP address for the Torsion Bar Setup is 192.168.1.174

    36

  • 8/7/2019 20sim4CReferenceManual

    41/53

    4. Targets

    4.7 ARM 7300Descr ip t ion

    The TS-7300 is a compact Single Board Computer based upon the Cirrus EP9302 ARM9 CPU and aset of on-board peripherals. The board is equipped with a SD-card which contains the OS.

    The ARM 7300 board.

    I npu t s and Outpu t s

    The board is equipped with a Cyclone II FPGA with predefined configuration providing the following

    IO. (Not all inputs & outputs can be used at the same time)

    Dig i t a l I npu ts

    2 x Quadrature Encoder Input. The Encoder Input can have no reset and a reset on positive ornegative index pulse.

    2 x Edge Counter Input. The Edge Counter Input can have no reset and a reset on positive ornegative edge.

    8 x Digital Input. Binary input.D i g it a l O u t p u t s

    2 X Pulse Width Modulation Output. Pulse Width Modulation output e.g. used to drive a motorvia a H-Bridge.

    8 x Digital Output. Binary output. 2 x LED. Two LED's are present on the board.Suppl ie r

    The TS 7300 is a product of Technologic Systems. More information can be found on the website:http://www.embeddedarm.com/products/board-detail.php?product=TS-7300.

    Operat i ng System s

    The TS 7300 board has been tested with the following operating systems:

    RTAI: You can order an SD Flash card with RTAI linux and the 20-sim 4C targetdaemon.Netw ork

    The default IP address for the ARM 7300 is 192.168.1.174

    37

  • 8/7/2019 20sim4CReferenceManual

    42/53

    4. Targets

    38

    4.8 ARM 7300 w ith TS-9700Descr ip t ion

    The TS-7300 with TS-9700, is the ARM 7300 mounted with the TS-9700 peripheral board. The TS-

    9700 provides additional analog Inputs/Outputs.

    The TS-9700 peripheral board.

    I npu t s and Outpu t s

    Additional to the interface of the ARM 7300 the following inputs and outputs are available:

    Ana log I npu ts

    8 channel 12-bit Analog to Digital Converter with precision 0.2% Analog Reference. Each A/Dchannel is jumper selectable for: 0 to 2.5V input, 0 to 10V input, 0 to 20mA input.

    A n a l o g Ou t p u t s

    4 channel 12-bit Digital to Analog Converter (optional). DAC outputs are 0 to 5V range.Suppl ie r

    The TS 7300 is a product of Technologic Systems. More information can be found on the website:

    http://www.embeddedarm.com/products/board-detail.php?product=TS-9700.

    Operat i ng System s

    The TS 7300 board has been tested with the following operating systems:

    RTAI: You can order an SD Flash card with RTAI linux and the 20-sim 4C targetdaemon.Netw ork

    The default IP address for the ARM 7300 with TS-9700 is 192.168.1.174

  • 8/7/2019 20sim4CReferenceManual

    43/53

    Operating Systems

    5Operating Systems5.1 IntroductionTo make a target work properly it should have some kind of an operating system. A small program,

    called the targetdaemon, runs on this operating system, to perform the communication between 20-

    sim 4C and the target. A targetdaemon is provided for RTAI-Linux.

    5.2 TargetdaemonThe targetdaemon is a small program that runs on the target in order to communicate with 20-sim

    4C on the host pc. The targetdaemon executes the commands given by the operator of 20-sim 4C,

    for instance starting a model or changing a value. The targetdaemon uses port 1500 for

    communication on the TCP/IP network.

    5.3 RTAI LinuxRTAI stands for Real-Time Application Interface. It is a real-time extension for the Linux kernel -

    which lets you write applications with strict timing constraints for Linux.

    Vers ion

    RTAI Linux version 3.2 is supported

    Hardw areRTAI supports several architectures:

    x86 (with and without FPU and TSC) x86-64 PowerPC ARM (StrongARM; ARM7: clps711x-family, Cirrus Logic EP7xxx, CS89712, PXA25x) MIPSSuppl ie r

    Like Linux itself the RTAI software is a community effort. More information on RTAI can be found at:

    www.rtai.org.

    39

  • 8/7/2019 20sim4CReferenceManual

    44/53

    Operating Systems

    40

  • 8/7/2019 20sim4CReferenceManual

    45/53

    6. Troubleshooting

    6Troubleshooting6.1 IntroductionThere are various reasons why the 20-sim 4C may not work. Please check the following items to

    solve possible errors.

    1. Make sure the target is powered on.2. Make sure a network or cross cable is connected to your PC and your target.3. Check if the software is properly installed.4. Check the Error pages to see if your problem is documented.

    6.2 SoftwareGeneral1. Check if the Operating System of your PC is Windows 2000, Windows XP or Windows Vista.2. Check if your PC is connected to a network or that a cross cable is plugged in.20-s im

    1. Open 20-sim and check if the program is properly working, e.g. load a example model andtry to simulate it.

    2. In 20-sim from the Help menu choose Register / Update License .... This opens theRegistration/Update License dialog.

    3. In the Registration/Update License dialog select the License Viewer button. This opens theLicense Viewer.

    The 20-sim License Viewer.

    4. Check if all toolboxes (also 20-sim 4C!) are available. If not all toolboxes are available,contact you local distributor or contact Controllab Products.

    41

  • 8/7/2019 20sim4CReferenceManual

    46/53

  • 8/7/2019 20sim4CReferenceManual

    47/53

    6. Troubleshooting

    6.3 Errors20-s im

    I do n o t see the 20-s im 4C ta rge t

    If you are generating C-code in 20-sim and see the list of targets below, you have forgotten tochange the ini-file for C-code Generation.

    The 20-sim 4C target is not listed

    Please go to the number 7 of the 20-sim installation and change the location of the ini-file.

    20 -s im 4C

    Conf i gu re Targe t Bu t t on i s r ed

    If the Configure Target button stays red, no connection could be made to the target.

    1. Make sure the target is powered on. If a fatal crash has occurred, switch the power off forand after a few seconds switch it on again. Then try to search for an IP-address again.

    2. Make sure you have a cross cable or network cable connected to your PC and your target.Com pi le Bu t t on is red

    If the Compile button stays red, compilation was not finished successfully.

    1. Check if the right target was chosen.My F i rew a l l g i ves a Warn ing

    If you click the Refresh button of the Configure Target tab, 20-sim 4C will scan the network for

    connected targets. An active firewall will respond by giving a warning message:

    43

  • 8/7/2019 20sim4CReferenceManual

    48/53

    6. Troubleshooting

    The Windows firewall message when the Refresh button is clicked.

    You should allow 20-sim 4C access to the network to find the connected targets. If you do not allow

    access, the correct IP-address can not be shown.

    1. Click the Unblock button (or a similar button if another firewall message is shown) if thename of the program is 20-sim 4C and the publisher is Controllab Products B.V.

    2. Please contact you network administrator if the name of the program is not 20-sim 4C or thepublisher is not Controllab Products B.V.

    3. Please contact you network administrator if you do not have permission to change the firewallsettings.

    20- s im 4C does no t f i nd an I P -address

    1. First of all, make sure that a network is connected to your PC and your target.2. Check if the proper target is connected.3. Check with your network manager that the network is not block traffic between your PC and

    your target.

    4. If this fails, remove the network connection and connect a cross cable directly between yourtarget and your PC.

    5. The default network address of the Torsion Bar is 192.168.1.174. Make sure the networkinterface on the host pc has a network IP-address in the same range.

    Wh at t o do w i t h m u l t i p l e I P -Addresses

    20-sim 4C automatically searches for targets which are connected to a network. If more than one IP-

    address is listed, it means that several targets are connected to the network. To find out the address

    of a target, if more than one address is listed do the following:

    1. Switch the power on of your target.2. In 20-sim 4C click on theConfigure Target button.3. From the IP-Address field click the drop down button.20-sim 4C will now start a search to find the IP-addresses of connected targets.

    44

  • 8/7/2019 20sim4CReferenceManual

    49/53

    6. Troubleshooting

    Finding connected targets.

    After a few seconds the search is ready and a list of IP-addresses is shown.

    1. Copy the list of IP-addresses to notepad.2. Switch the power offof your target.3. Again click the IP-Address button and copy the list of IP-addresses. The address that is

    missing (compared to the previous list) is the address of your target.

    In most networks, IP-addresses are automatically assigned. In most networks, once an address is

    assigned, it will stay the same. If you are not sure about the assignment of addresses in your

    network, please contact your network manager.

    45

  • 8/7/2019 20sim4CReferenceManual

    50/53

    6. Troubleshooting

    46

  • 8/7/2019 20sim4CReferenceManual

    51/53

    6. Troubleshooting

    Index

    20-sim 4.0 1

    20-sim 4.0 Professional 1

    A 21

    ARM 39

    ARM 7260 35

    ARM 7300 37, 38

    ARM 7300 Torsion Bar Setup 36

    ARM 7300 with TS-9700 38

    Browse list 21

    Browse node 21

    Built-in targets 31

    busy time 21

    C 21C-code Generation 2

    C-code Generation dialog 2

    Change Parameters 28

    Code Generation tab 1, 2

    Command 4, 13, 20

    Command Browse 21

    Command Browse view 23

    Compile 4, 13, 19

    Configure 4, 13, 15

    Configure Model 15

    Configure Target 15Connect 4, 13, 17

    Connect dialog 17

    Connecting 1

    Controllab Products B.V. 1

    Cross Cable 1

    current time 21

    data acquisition 23

    Define your own targets 31

    Discrete Time Interval 15

    Fav 21

    Finish Time 15, 21firewall 4

    Frequency 15

    Green 14

    Grey 14

    hierarchy 21

    I 21

    idle time 21

    ini-file 2

    input 17

    inputs 17

    Installation 1

    Installing 20-sim 2

    Installing 20-sim 4C 1, 3

    IP-address 4, 15

    license 1

    Log 21, 26

    Log column 26

    Logging 23, 26

    MIPS 39

    Model 13

    Modelportname 17Mon 21

    Mon column 26

    monitor 4, 26

    Monitoring 23, 26

    Multiple Targets 29

    Name 4, 15, 21

    Network Cable 1

    O 21

    Omega 15

    Operating Systems 39

    Orange 14outputs 17

    P 21

    Parameters 28

    PC/PC104 34

    PC/PC104 (NO I/O) 33

    PC/PC104 with Sensoray 526 34

    PC104 Mechatronic Demonstrator 32

    port 17

    port 1500 39

    PowerPC 39

    real-time plot 23Red 14

    Refresh 15

    Requirements 1

    RTAI Linux 39

    Run 4, 20

    Select variables 26

    Sensoray 526 34

    signal tracing 23

    47

  • 8/7/2019 20sim4CReferenceManual

    52/53

    Index

    Stop 20

    stop time 21

    submodels 21

    target 4

    Target Specification file 31

    TargetDaemon 39

    Targetpins 17

    Targetportname 17

    Targets 31

    tasks 13, 14

    TCP/IP 39

    tree-view 14

    TS-9700 38

    Type 21

    Unit 21

    V 21

    Value 21

    Windows 1

    Windows 2000 1

    Windows Vista 1

    Windows XP 1

    x86 39

    x86-64 39

    48

  • 8/7/2019 20sim4CReferenceManual

    53/53

    20-sim 4C is a prototyping environment that allows you to

    export C-code to hardware like PC 104 systems and ARM-9

    processor boards. This allows you to perform various tasks:

    : You can run a code block that reads sensor

    signals.

    : You can log data and import it in 20-sim for

    analysis.

    : You can create a machine controller in 20-sim and

    export it to hardware.

    The name 4C stands for onfigure, onnect, ompile and

    ommand and these are the tasks that you have to perform

    to get code running on a target.

    Measurement

    Analysis

    Control

    C C C

    C