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
Create or log into your Cesium Ion account at https://ion.cesium.com/.
On the Cesium Ion page, click Access Tokens.
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/.
Click Create.
To create a model to visualize a simulation using Cesium Ion, see Create a Model for Visualization.
Create a Model for Visualization
Create a Simulink model and add these blocks:
Simulation 3D Aircraft block
Simulation 3D Scene Configuration block
Two Constant blocks
Two Terminator blocks
Open the Simulation 3D Aircraft block and set Color to
Green
.Connect one Constant block to the Translation input port of the Simulation 3D Aircraft block. Set Constant value to
zeros(11,3)
.Connect the second Constant block to the Rotation input port of the Simulation 3D Aircraft block. Set Constant value to
zeros(11,3)
.Connect the Attitude and WoW ports of the Simulation 3D Aircraft block to the Terminator blocks.
Set the model Stop time to
inf
.
Configure the Geospatial Configuration Parameters and Run the Simulation
In the model created from Create a Model for Visualization, open the Simulation 3D Scene Configuration block:
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.
The Create new token dialog box appears.
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 Ion Paste To Authentication Manager > Create new token Dialog Box Name Token ID Token Token value For example, for token ID
MyNewUserToken
, enter these values.To store the token ID and value, click OK.
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.
In the rest of the Geospatial tab, set these values.
Parameter Value Origin height 3000
Origin latitude 41.892469
Origin longitude -87.643373
Map style Aerial
Additional asset IDs [96188]
Use advanced Sun Sky Selected Solar time 8.25
Time zone -5
Day 21
Month 9
Year 2022
Use daylight saving time Selected DST start day 10
DST start month 3
DST end day 3
DST end month 11
DST switch hour 2
Run the simulation.
The simulation streams the aircraft with the 3D map and terrain data in an Unreal Engine executable window.
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.
See Also
Simulation 3D Aircraft | Simulation 3D Scene Configuration