Perform trigonometric function, such as sin, arcsin, arctan2, etc.
Perform trigonometric function, the trigonometric object is defined through its parameters, which give the port widths and the kind of trigonometric function (sin, arcsin, cos, arccos, tan, arctan, arctan2, repro).
- Author
- Benjamin Scholz
- Date
- 05.09.2007 BSC: Second version.
-
20.07.2011 KGA: Ported to FhSim 2.0.
-
25.07.2011 KGA: Added documentation.
Example configuration excerpt
<Lib
LibName = "fhsim_base"
SimObject = "Math/Trigonometric"
Name = "A"
PortWidth = "2"
TrigonometricFunction = "sin"
/>
...
<Connection
A.In = "10,4"
/>
Supported trigonometric functions
Function | Input ports | Input name |
Sine | 1 | sin |
ArcSine | 1 | arcsin |
Cosine | 1 | cos |
ArcCosine | 1 | arccos |
Tangent | 1 | tan |
ArcTangent | 1 | arctan |
Reciprocal | 1 | repro |
Four quadrant arc tangent | 2 | arctan2 |
Input Ports
Name | Width | Description |
In | <PortWidth> | The input port for sin, asin, cos, arccos, tan, arctan, repro |
In1 | <PortWidth> | The input port for arctan2; adjacent side |
In2 | <PortWidth> | The input port for arctan2; opposite side |
Output Ports
Name | Width | Description |
Out | <PortWidth> | The result of the trigonometric operation. |
Configuration parameters
Name | Width | Description |
PortWidth | 1 | The number of elements in the input and output ports. |
TrigoFunc | 1 | Selection of trigonometric function, see table above. Legacy, overridden by <TrigonometricFunction> |
TrigonometricFunction | 1 | Selection of mathematical function, see table above. Overrides <TrigoFunc> |
Initial conditions
This SimObject contains no initial conditions.
Full example file
<Contents>
<OBJECTS>
<Lib
LibName="base"
SimObject="Math/Trigonometric"
Name="Sin"
TrigoFunc="sin"
/>
<Lib
LibName="base"
SimObject="Math/Trigonometric"
Name="ASin"
TrigoFunc="arcsin"
/>
<Lib
LibName="base"
SimObject="Math/Trigonometric"
Name="Cos"
TrigoFunc="cos"
/>
<Lib
LibName="base"
SimObject="Math/Trigonometric"
Name="ACos"
TrigoFunc="arccos"
/>
<Lib
LibName="base"
SimObject="Math/Trigonometric"
Name="Tan"
TrigoFunc="tan"
/>
<Lib
LibName="base"
SimObject="Math/Trigonometric"
Name="ATan"
TrigoFunc="arctan"
/>
<Lib
LibName="base"
SimObject="Math/Trigonometric"
Name="ATan2"
TrigoFunc="arctan2"
/>
<Lib
LibName="base"
SimObject="Math/Trigonometric"
Name="Repro"
TrigoFunc="repro"
/>
</OBJECTS>
<INTERCONNECTIONS>
<Connection
Sin.In="3.14159265359"
ASin.In="0"
Cos.In="3.14159265359"
ACos.In="0"
Tan.In="0"
ATan.In="0"
ATan2.In1="1.5707963267948966"
ATan2.In2="0"
Repro.In="4"
/>
</INTERCONNECTIONS>
<INITIALIZATION>
<InitialCondition
/>
</INITIALIZATION>
<INTEGRATION>
<Engine
IntegratorMethod="2"
NumCores="1"
TOutput="0, 3:1:5, 30"
LogStates ="1"
stepsize ="0"
HMax="0.002"
HMin="0.00000001"
AbsTol="1e-3" RelTol="1e-3"
UseRSSNormInsteadOfInfNorm="0"
FileOutput="objects:all"
/>
</INTEGRATION>
</Contents>
This SimObject is referred to as Math/Trigonometric