blob: 178ecfbfca6dc5077d4a60af225a2fb6c97744cd [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE FBType SYSTEM "http://www.holobloc.com/xml/LibraryElement.dtd">
<FBType Comment="Adds two REAL values" Name="FB_RANDOM">
<Identification Classification="Mathematic" Function="RANDOM" Standard="61499-1" Type="Mathematical function"/>
<VersionInfo Author="GE" Date="2012-05-31" Organization="4DIAC-Consortium" Version="1.0"/>
<CompilerInfo header="package fb.rt.mathnew;">
<Compiler Language="Cpp" Product="GCC" Vendor="GNU" Version="&gt;3.0"/>
<Compiler Language="Cpp" Product="Unknown" Vendor="MSVCpp" Version="1"/>
</CompilerInfo>
<InterfaceList>
<EventInputs>
<Event Comment="Initializes the random with the specified seed, if not called the generated values will always be identical" Name="INIT" Type="Event">
<With Var="SEED"/>
</Event>
<Event Comment="Calculates a new random number between 0 and 1" Name="REQ" Type="Event"/>
</EventInputs>
<EventOutputs>
<Event Name="INITO" Type="Event"/>
<Event Comment="Execution Confirmation" Name="CNF" Type="Event">
<With Var="VAL"/>
</Event>
</EventOutputs>
<InputVars>
<VarDeclaration Comment="the seed to initialize the random, a seed of 0 (zero) uses the current systemtime as seed" InitialValue="0" Name="SEED" Type="UINT"/>
</InputVars>
<OutputVars>
<VarDeclaration Comment="Function output" Name="VAL" Type="REAL"/>
</OutputVars>
</InterfaceList>
<BasicFB>
<ECC>
<ECState Comment="Initial State" Name="START" x="855.0" y="285.0"/>
<ECState Comment="Normal execution" Name="REQ" x="215.0" y="755.0">
<ECAction Algorithm="REQ" Output="CNF"/>
</ECState>
<ECState Comment="" Name="State" x="2015.0" y="430.0">
<ECAction Algorithm="INIT" Output="INITO"/>
</ECState>
<ECTransition Comment="" Condition="REQ" Destination="REQ" Source="START" x="555.0" y="600.0"/>
<ECTransition Comment="" Condition="1" Destination="START" Source="REQ" x="215.0" y="425.0"/>
<ECTransition Comment="" Condition="INIT" Destination="State" Source="START" x="1705.0" y="320.0"/>
<ECTransition Comment="" Condition="1" Destination="START" Source="State" x="1585.0" y="680.0"/>
</ECC>
<Algorithm Comment="ALG" Name="INIT">
<Other Language="AnyText" Text="// WARNING - Don't forget to add #include &lt;time.h&gt;&#13;&#10;&#13;&#10;if (SEED() == 0) {&#13;&#10; srand( (unsigned int) time(NULL) );&#13;&#10;} else {&#13;&#10; srand( SEED() );&#13;&#10;}"/>
</Algorithm>
<Algorithm Comment="Normally executed algorithm" Name="REQ">
<Other Language="AnyText" Text="VAL() = (TForteFloat) ((rand() % 32767) / 100000.0); // RAND_MAX is a constant defined in &lt;cstdlib&gt;. Its default value may vary between implementations but it is granted to be at least 32767.&#10;"/>
</Algorithm>
</BasicFB>
</FBType>