sim3d.environment.WeatherConfiguration
Description
Use the sim3d.environment.WeatherConfiguration object to create a weather configuration
object to control the weather and the position of the sun in the 3D environment. After you
create a sim3d.environment.WeatherConfiguration object, you can modify aspects of the environment by
setting property values.
Creation
Syntax
Description
creates a default weather configuration object in the 3D environment.weather = sim3d.environment.WeatherConfiguration()
sets properties using one or more name-value arguments. For example, to control the
position of the sun, set weather = sim3d.environment.WeatherConfiguration(PropertyName=Value)EnableGeospatialSun to
true.
Properties
All the properties are run-time configurable.
Sun Attributes
Altitude angle in a vertical plane between the rays of the sun and the horizontal
projection of the rays, specified as any value between -90 and
90, in deg.

Use the SunAltitude and SunAzimuth
properties to control the time of day in the scene. For example, to specify sunrise in
the north, set SunAltitude to 0 deg and
SunAzimuth to 180 deg.
Example:
weather.SunAltitude = 60
Data Types: double
Azimuth angle in the horizontal plane measured from the south to the horizontal
projection of the sun rays, specified as any value between 0 and
360, in deg.

Use the SunAltitude and SunAzimuth
properties to control the time of day in the scene. For example, to specify sunrise in
the north, set SunAltitude to 0 deg and
SunAzimuth to 180 deg.
Example:
weather.SunAzimuth = 50
Data Types: double
Option to enable geospatial sun, specified as 0
(false) to not enable the geospatial sun or 1
(true) to enable it. Enabling geospatial sun is useful to
simulate conditions near the poles or at locations with disproportionate lengths of
day versus night.
Example: EnableGeospatialSun = 1
Data Types: logical
Latitude of geolocation on earth, specified as a scalar, in deg.
Example:
weather.Latitude = 4
Dependencies
To set Latitude, set EnableGeospatialSun
to 1.
Data Types: double
Longitude of geolocation on earth, specified as a scalar, in deg.
Example:
weather.Longitude = 5
Dependencies
To set Longitude, set EnableGeospatialSun
to 1.
Data Types: double
Time zone that specifies the number of hours offset from the Coordinated Universal
Time (UTC) or Greenwich Mean Time (GMT), specified as any value between
-12 and 12.
Example:
weather.Longitude = 5
Dependencies
To set TimeZone, set EnableGeospatialSun
to 1.
Data Types: double
Option to enable daylight saving time, specified as 0
(false) if daylight saving time is not enabled or
1 (true) if it is enabled.
Example:
weather.IsDaylightSavingTime = 1
Dependencies
To set IsDaylightSavingTime, set
EnableGeospatialSun to 1.
Data Types: logical
Date, specified as an integer in the format YYYY-MM-DD.
Example:
weather.Date = 2024-07-01
Dependencies
To set Date, set EnableGeospatialSun to
1.
Data Types: string
Time, specified as an integer in the format HH:MM:SS.
Example:
weather.Time = 1:30:00
Dependencies
To set Time, set EnableGeospatialSun to
1.
Data Types: string
Weather Attributes
Density of clouds, specified as any value between 0 and
100, in percent. This property controls the amount of light that
can pass through the clouds, making them appear transparent or dense.
Example:
weather.CloudDensity = 40
Data Types: double
Speed of clouds, specified as any value between -100 and
100. The clouds move from west to east for positive values and
east to west for negative values.
Example:
weather.CloudSpeed = 50
Data Types: double
Option to enable volumetric clouds, specified as 0
(false) if volumetric clouds are not enabled or
1 (true) if they are enabled.
Example:
weather.EnableVolumetricClouds = 1
Data Types: logical
Amount of clouds, specified as any value between 0 and
100, in percent.
Example:
weather.CloudCoverage = 50
Dependencies
To set CloudCoverage, set
EnableVolumetricClouds to 1.
Data Types: double
Height of clouds at which they appear, specified as any value between
5 and 20, in km.
Example:
weather.CloudAltitude = 10
Dependencies
To set CloudAltitude, set
EnableVolumetricClouds to 1.
Data Types: double
Amount of rain particles, specified as any value between 0 and
100, in percent. This property controls how heavy or light the
rain appears in the scene as well as wetness, rain puddles, and ripples. Use
CloudDensity and RainDensity properties to
control rain in the environment.
Example:
weather.RainDensity = 50
Data Types: double
Option to enable raindrops on camera lens, specified as 0
(false) if raindrops on the camera lens are not enabled or
1 (true) if they are enabled.
Example:
weather.EnableRaindropsOnLens = 1
Data Types: double
Thickness of fog, specified as any value between 0 and
100, in percent. This property controls how opaque or transparent
the fog appears in the scene.
Example:
weather.FogDensity = 50
Data Types: double
Amount of snowfall, specified as any value between 0 and
100, in percent. This property controls the intensity of
snowfall.
Example:
weather.RainDensity = 50
Data Types: double
Examples
Create a weather configuration object using the sim3d.environment.WeatherConfiguration object and create a 3D environment with snowfall.
Create 3D Environment
Create a 3D environment using the sim3d.World object.
world = sim3d.World();
Create Weather Configuration
Create a weather configuration object using the sim3d.environment.WeatherConfiguration object.
weather = sim3d.environment.WeatherConfiguration();
Set the SnowDensity property to 50 to set the environment with snowfall.
weather.SnowDensity = 50;
Add the weather to the world.
add(world,weather);
Run Simulation
Run the co-simulation and view the 3D environment with snowfall.
sampletime = 0.02; stoptime = 10; run(world,sampletime,stoptime);
More About
Use SunAltitude and SunAzimuth to control the
sun position.
SunAltitude— Altitude angle in a vertical plane between the sun rays and the horizontal projection of the rays.SunAzimuth— Azimuth angle in the horizontal plane measured from the south to the horizontal projection of the sun rays.

Alternatively, enable EnableGeospatialSun to use
Latitude, Longitude, Date,
Time, and TimeZone to control sun position.
Enabling geospatial sun allows you to simulate conditions near the poles or at locations
with disproportionate lengths of day versus night.
This table summarizes sun position settings for specific times of day.
| Time of Day | Property Settings | 3D Environment |
|---|---|---|
Midnight |
|
|
Sunrise in the north |
|
|
Noon |
|
|
Use CloudDensity and CloudSpeed to control
clouds in the scene. Set EnableVolumetricClouds to use
CloudCoverage and CloudAltitude to control
volumetric clouds in the scene.
This table summarizes settings for specific cloud conditions.
| Cloud Condition | Property Settings | 3D Environment |
|---|---|---|
Clear |
|
|
Heavy |
|
|
| Heavy |
|
|
Use FogDensity to control fog in the scene.
This table summarizes settings for specific fog conditions.
| Fog Condition | Property Settings | 3D Environment |
|---|---|---|
None |
|
|
Heavy |
|
|
Use CloudDensity and RainDensity to control
rain in the scene.
This table summarizes settings for specific rain conditions.
| Rain Condition | Property Settings | 3D Environment |
|---|---|---|
Light |
|
|
Heavy |
|
|
Use SnowDensity to control snow in the scene.
This table summarizes settings for specific snow conditions.
| Snow Condition | Property Settings | 3D Environment |
|---|---|---|
| Heavy | SnowDensity: 50 |
|
Version History
Introduced in R2024b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)










