Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
VAUnity
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Institute of Technical Acoustics (ITA)
VAUnity
Commits
68454f53
Commit
68454f53
authored
7 years ago
by
Dipl.-Ing. Jonas Stienen
Browse files
Options
Downloads
Patches
Plain Diff
Adding homogeneous medium script
parent
a659990a
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
VAUHomogeneousMedium.cs
+88
-0
88 additions, 0 deletions
VAUHomogeneousMedium.cs
with
88 additions
and
0 deletions
VAUHomogeneousMedium.cs
0 → 100644
+
88
−
0
View file @
68454f53
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
VA
;
public
class
VAUHomogeneousMedium
:
MonoBehaviour
{
[
Tooltip
(
"Speed of sound [m/s]"
)]
public
double
SpeedOfSound
=
341
;
[
Tooltip
(
"Relative humidity [percent]"
)]
public
double
RelativeHumidity
=
20
;
[
Tooltip
(
"Temperature [degree celsius]"
)]
public
double
Temperature
=
20
;
[
Tooltip
(
"Static pressure [Pascal]"
)]
public
double
StaticPressure
=
101125
;
[
Tooltip
(
"Shift speed / wind speed [m/s]"
)]
public
Vector3
ShiftSpeed
=
new
Vector3
(
0
,
0
,
0
);
[
Tooltip
(
"If set to true, the initial values will be received from server and will override the manually set values"
)]
public
bool
OverrideFromServer
=
false
;
private
double
SpeedOfSoundShadow
;
private
Vector3
ShiftSpeedShadow
;
private
double
RelativeHumidityShadow
;
private
double
StaticPressureShadow
;
private
double
TemperatureShadow
;
void
Start
()
{
if
(
OverrideFromServer
)
{
SpeedOfSound
=
VAUAdapter
.
VA
.
GetHomogeneousMediumSoundSpeed
();
VAVec3
_ShiftSpeed
=
VAUAdapter
.
VA
.
GetHomogeneousMediumShiftSpeed
();
ShiftSpeed
.
Set
((
float
)
_ShiftSpeed
.
x
,
(
float
)
_ShiftSpeed
.
y
,
(
float
)
_ShiftSpeed
.
z
);
RelativeHumidity
=
VAUAdapter
.
VA
.
GetHomogeneousMediumRelativeHumidity
();
StaticPressure
=
VAUAdapter
.
VA
.
GetHomogeneousMediumStaticPressure
();
Temperature
=
VAUAdapter
.
VA
.
GetHomogeneousMediumTemperature
();
}
else
{
VAUAdapter
.
VA
.
SetHomogeneousMediumSoundSpeed
(
SpeedOfSound
);
VAVec3
_ShiftSpeed
=
new
VAVec3
(
ShiftSpeed
.
x
,
ShiftSpeed
.
y
,
ShiftSpeed
.
z
);
VAUAdapter
.
VA
.
SetHomogeneousMediumShiftSpeed
(
_ShiftSpeed
);
VAUAdapter
.
VA
.
SetHomogeneousMediumRelativeHumidity
(
RelativeHumidity
);
VAUAdapter
.
VA
.
SetHomogeneousMediumStaticPressure
(
StaticPressure
);
VAUAdapter
.
VA
.
SetHomogeneousMediumTemperature
(
Temperature
);
}
SpeedOfSoundShadow
=
SpeedOfSound
;
ShiftSpeedShadow
=
ShiftSpeed
;
RelativeHumidityShadow
=
RelativeHumidity
;
StaticPressureShadow
=
StaticPressure
;
TemperatureShadow
=
Temperature
;
}
void
Update
()
{
if
(
SpeedOfSound
!=
SpeedOfSoundShadow
)
{
VAUAdapter
.
VA
.
SetHomogeneousMediumSoundSpeed
(
SpeedOfSound
);
SpeedOfSoundShadow
=
SpeedOfSound
;
}
if
(
ShiftSpeed
!=
ShiftSpeedShadow
)
{
VAVec3
_ShiftSpeed
=
new
VAVec3
(
ShiftSpeed
.
x
,
ShiftSpeed
.
y
,
ShiftSpeed
.
z
);
VAUAdapter
.
VA
.
SetHomogeneousMediumShiftSpeed
(
_ShiftSpeed
);
ShiftSpeedShadow
=
ShiftSpeed
;
}
if
(
RelativeHumidity
!=
RelativeHumidityShadow
)
{
VAUAdapter
.
VA
.
SetHomogeneousMediumRelativeHumidity
(
RelativeHumidity
);
RelativeHumidityShadow
=
RelativeHumidity
;
}
if
(
StaticPressure
!=
StaticPressureShadow
)
{
VAUAdapter
.
VA
.
SetHomogeneousMediumStaticPressure
(
StaticPressure
);
StaticPressureShadow
=
StaticPressure
;
}
if
(
Temperature
!=
TemperatureShadow
)
{
VAUAdapter
.
VA
.
SetHomogeneousMediumTemperature
(
Temperature
);
TemperatureShadow
=
Temperature
;
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment