Main Content

Visualize with Cesium

Aerospace Blockset™ can now stream 3D map and terrain data of a location using Cesium Ion®. Aerospace Blockset uses Unreal Engine® to build an executable window that visualizes your simulation and uses Cesium® to create a scene for that visualization at runtime. To customize scenes, download the Cesium for Unreal® plugin and use the Aerospace Blockset Interface for Unreal Engine Projects. For information on installing Cesium for Unreal, see Install Cesium for Unreal Plugin. For more information on customizing scenes, see Customize 3D Scenes for Aerospace Blockset Simulations.

Simulating models in the 3D visualization environment requires Simulink® 3D Animation™.

Note

  • To visualize with Cesium, you must start MATLAB® as administrator.

  • The folder installed with your product must be writeable.

    matlabroot\toolbox\shared\sim3d_projects\automotive_project_windows\
    UE\WindowsNoEditor\Engine

This example has you create a Cesium Ion, then create a model and configure it for simulation.

Set Up a Cesium Ion Account

  1. Create or log into your Cesium Ion account at https://ion.cesium.com/.

  2. On the Cesium Ion page, click Access Tokens.

  3. On the Access Tokens page, click Create token to create a new access token. Enter a unique name and note it. Leave the other settings at their default values.

    You use this access token ID in the Access token ID parameter of the Simulation 3D Scene Configuration block. For more information on creating access tokens, see https://cesium.com/learn/ion/cesium-ion-access-tokens/.

  4. Click Create.

To create a model to visualize a simulation using Cesium Ion, see Create a Model for Visualization.

Create a Model for Visualization

  1. Create a Simulink model and add these blocks:

    • Simulation 3D Aircraft block

    • Simulation 3D Scene Configuration block

    • Two Constant blocks

    • Two Terminator blocks

  2. Open the Simulation 3D Aircraft block and set Color to Green.

  3. Connect one Constant block to the Translation input port of the Simulation 3D Aircraft block. Set Constant value to zeros(11,3).

  4. Connect the second Constant block to the Rotation input port of the Simulation 3D Aircraft block. Set Constant value to zeros(11,3).

  5. Connect the Attitude and WoW ports of the Simulation 3D Aircraft block to the Terminator blocks.

    Model containing blocks and connections as described in the procedure.

  6. Set the model Stop time to inf.

Configure the Geospatial Configuration Parameters and Run the Simulation

  1. In the model created from Create a Model for Visualization, open the Simulation 3D Scene Configuration block:

    1. In the Geospatial tab, select Enable geospatial configuration to enable the geospatial configuration parameters.

      To configure this block for geospatial configuration, click the Authentication Manager button at the bottom of the pane. The Manage access tokens dialog box displays. Click Create token.

      Manage access tokens dialog box.

      The Create new token dialog box appears.

    2. In the Create new token dialog box, enter the unique token ID string and copy and paste the access token created from the Cesium Ion page.

      Copy From Cesium IonPaste To Authentication Manager > Create new token Dialog Box
      NameToken ID
      TokenToken value

      For example, for token ID MyNewUserToken, enter these values.

      Create new token dialog box with MyNewUserToken token ID.

    3. To store the token ID and value, click OK.

    4. In the Access token ID parameter of the Geospatial tab, enter the same unique token ID string you specified in the Token ID parameter of the Authentication Manager > Create new token dialog box.

      Access token ID filled with MyNewUserToken

    5. In the rest of the Geospatial tab, set these values.

      ParameterValue
      Origin height3000
      Origin latitude41.892469
      Origin longitude-87.643373
      Map styleAerial
      Additional asset IDs[96188]
      Use advanced Sun SkySelected
      Solar time8.25
      Time zone-5
      Day21
      Month9
      Year2022
      Use daylight saving timeSelected
      DST start day10
      DST start month3
      DST end day3
      DST end month11
      DST switch hour2

  2. Run the simulation.

    The simulation streams the aircraft with the 3D map and terrain data in an Unreal Engine executable window.

  3. To view the aircraft from a preset view, left-click in the executable window and select a number from 1 to 9.

    This view is from preset view 4.

    Visualization of aircraft in Unreal Engine executable window with Cesium at preset view 4.

See Also

|

Related Topics