<lib version="1.3.0" name="C:\Users\tiziano.tremonti\Box\Toolbox Eliwell\Libraries\Basic_Addons_Lib_FS\Basic_Addons_Lib_v1.3.0\Basic_Addons.plclib" fullXml="true" link="true">
	<descr>&lt;HTML&gt;The Basic Addons library provides added functions in line with the Basic library of the software.
The key functionalities of the library are:
&lt;ul&gt;
  &lt;li&gt;&lt;b&gt;Data Conversion:&lt;/b&gt;
    &lt;ul&gt;
    &lt;li&gt;Double Integer to Word&lt;/li&gt;
    &lt;li&gt;Double Word to Bit&lt;/li&gt;
    &lt;li&gt;Unsigned Double Integer to Word&lt;/li&gt;
    &lt;li&gt;Word to Double Integer&lt;/li&gt;
    &lt;li&gt;Word to Unsigned Double Integer&lt;/li&gt;
	lt;li&gt;String (max 31) to 16 Words&lt;/li&gt;
    lt;li&gt;16 Words to String (max 31)&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Data Interpretation:&lt;/b&gt;
    &lt;ul&gt;
    &lt;li&gt;2 Words interpreted with the IEEE754 real data format&lt;/li&gt;
    &lt;li&gt;4 Words interpreted with the IEEE754 real data format&lt;/li&gt;
	&lt;li&gt;a IEEE754 real value split in 2 Words&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;b&gt;Bit in a Word:&lt;/b&gt;
    &lt;ul&gt;
    &lt;li&gt;Set/Reset a bit of a word&lt;/li&gt;
    &lt;li&gt;Read a bit of a word&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
   &lt;li&gt;&lt;b&gt;Linear Conversion:&lt;/b&gt;
    &lt;ul&gt;
    &lt;li&gt;Linear Integer Converter&lt;/li&gt;
    &lt;li&gt;Linear Unsigned Integer Converter&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt; 
&lt;/ul&gt;

The library supports all the &lt;b&gt;targets&lt;/b&gt; which are available in SoMachine HVAC.&lt;br&gt;
The library is tested/supported on SoMachine HVAC v2.4.1 / EcoStruxure Machine Expert HVAC 1.0.0 and greater versions.&lt;/p&gt;

&lt;b&gt;The Basic Addons Library Resources (updated documentation, etc.) are availabe at 
&lt;a href= https://schneider-electric.box.com/s/nrofepuzc6gtzh9v5spgyhta7nl8ib8d  target= _blank &gt;this link&lt;/a&gt;.&lt;/b&gt;

&lt;p&gt;&lt;/p&gt;
&lt;b&gt;&lt;span style='color:green;'&gt;Publisher:&lt;/b&gt;&lt;/span&gt; HVAC Solution Center, Alpago (BL) - Italy&lt;br&gt;
&lt;b&gt;&lt;span style='color:green;'&gt;Authors:&lt;/b&gt;&lt;/span&gt; Federico Marcassa, Pierpaolo Armeli&lt;br&gt;</descr>
	<libWorkspace>
		<folder name="basic_addons" id="304">
			<folder name="Conversion">
				<Pou name="DintToWord"/>
				<Pou name="DWordToBit"/>
				<Pou name="UdintToWord"/>
				<Pou name="WordToDint"/>
				<Pou name="WordToUdint"/>
				<Pou name="String31ToWord16"/>
				<Pou name="Word16ToString31"/>
			</folder>
			<folder name="Data Interpretation">
				<Pou name="Word2ToIEEE754"/>
				<Pou name="Word4ToIEEE754"/>
				<Pou name="IEEE754ToWord2"/>
			</folder>
			<folder name="Bit in Word">
				<Pou name="ReadWordBit"/>
				<Pou name="SRBitWord"/>
			</folder>
			<Pou name="PowReToRe_BasL"/>
			<folder name="Linear Conversion">
				<Pou name="iLinConv"/>
				<Pou name="uiLinConv"/>
			</folder>
		</folder>
	</libWorkspace>
	<globalVars/>
	<retainVars/>
	<constantVars/>
	<functions>
		<function name="uiLinConv" version="1.0.0">
			<descr>Linear Unsigned Integer Converter

X1 is mapped to Y1
X2 is mapped to Y2
between X1 and X2 a linear conversion is applied.
If LIMITED input is TRUE the output is limited between Y1 and Y2

If X1=X2 the function becomes a step regardless to LIMITED input</descr>
			<returnValue>UINT</returnValue>
			<vars>
				<inputVars>
					<var name="uiValue" type="UINT"/>
					<var name="uiX1" type="UINT"/>
					<var name="uiX2" type="UINT"/>
					<var name="uiY1" type="UINT"/>
					<var name="uiY2" type="UINT"/>
					<var name="LIMITED" type="BOOL">
						<descr>If TRUE out is saturated outside interval [x1,x2]</descr>
					</var>
				</inputVars>
				<localVars>
					<var name="Scaler_tmp" type="DINT"/>
					<var name="Ymin" type="DINT"/>
					<var name="Ymax" type="DINT"/>
				</localVars>
			</vars>
			<iecDeclaration active="FALSE"/>
			<sourceCode type="ST">
				<![CDATA[	IF uiX2=uiX1 THEN
	
		Scaler_tmp := (uiY1)*TO_UINT(uiValue<uiX1) + (uiY2)*TO_UINT(uiValue>=uiX1);
	
	ELSE
	
		Scaler_tmp := TO_DINT(uiValue-uiX1)*TO_DINT(uiY2-uiY1)/TO_DINT(uiX2-uiX1)+TO_DINT(uiY1);
	
	END_IF;
	
	IF LIMITED THEN
	
		IF uiY1<uiY2 THEN
			Ymin := TO_DINT(uiY1);
			Ymax := TO_DINT(uiY2);
		ELSE
			Ymin := TO_DINT(uiY2);
			Ymax := TO_DINT(uiY1);
		END_IF;	
	
		Scaler_tmp := LIMIT(Scaler_tmp,Ymin,Ymax);
		
	END_IF;
	
	uiLinConv := TO_UINT(Scaler_tmp);
	
]]>
			</sourceCode>
		</function>
		<function name="iLinConv" version="1.0.0">
			<descr>Linear Integer Converter

X1 is mapped to Y1
X2 is mapped to Y2
between X1 and X2 a linear conversion is applied.
If LIMITED input is TRUE the output is limited between Y1 and Y2

If X1=X2 the function becomes a step regardless to LIMITED input
if iValue=-32768 output is -32768</descr>
			<returnValue>INT</returnValue>
			<vars>
				<inputVars>
					<var name="iValue" type="INT"/>
					<var name="iX1" type="INT"/>
					<var name="iX2" type="INT"/>
					<var name="iY1" type="INT"/>
					<var name="iY2" type="INT"/>
					<var name="LIMITED" type="BOOL">
						<descr>If TRUE out is saturated outside interval [x1,x2]</descr>
					</var>
				</inputVars>
				<localVars>
					<var name="Scaler_tmp" type="DINT"/>
					<var name="Ymin" type="DINT"/>
					<var name="Ymax" type="DINT"/>
				</localVars>
			</vars>
			<iecDeclaration active="FALSE"/>
			<sourceCode type="ST">
				<![CDATA[IF iValue <= -32765 THEN

	iLinConv := iValue;

ELSE
	IF iX2=iX1 THEN
	
		Scaler_tmp := (iY1)*TO_INT(iValue<iX1) + (iY2)*TO_INT(iValue>=iX1);
	
	ELSE
	
		Scaler_tmp := TO_DINT(iValue-iX1)*TO_DINT(iY2-iY1)/TO_DINT(iX2-iX1)+TO_DINT(iY1);
	
	END_IF;
	
	IF LIMITED THEN
	
		IF iY1<iY2 THEN
			Ymin := TO_DINT(iY1);
			Ymax := TO_DINT(iY2);
		ELSE
			Ymin := TO_DINT(iY2);
			Ymax := TO_DINT(iY1);
		END_IF;	
	
		Scaler_tmp := LIMIT(Scaler_tmp,Ymin,Ymax);
		
	END_IF;
	
	iLinConv := TO_INT(Scaler_tmp);
	
END_IF;	

]]>
			</sourceCode>
		</function>
		<function name="PowReToRe_BasL" version="1.0.0" hidden="true">
			<returnValue>REAL</returnValue>
			<vars>
				<inputVars>
					<var name="Base" type="REAL"/>
					<var name="Exponent" type="REAL"/>
				</inputVars>
			</vars>
			<iecDeclaration active="FALSE"/>
			<sourceCode type="ST">
				<![CDATA[IF Base>0.0 AND Exponent>=0.0 THEN
	PowReToRe_BasL := EXP(Exponent*LN(Base));
ELSE
	PowReToRe_BasL := -32768.0;
END_IF;
]]>
			</sourceCode>
		</function>
		<function name="SRBitWord" version="1.0.0">
			<descr>Set/Reset a bit of a word

Example:
(* Set Bit 7 *)
wValue := SRBitWord(wInput:=wValue,xBitValue:=TRUE,usBitIndex:=7);</descr>
			<returnValue>WORD</returnValue>
			<vars>
				<inputVars>
					<var name="wInput" type="WORD">
						<descr>Word to be updated</descr>
					</var>
					<var name="xBitValue" type="BOOL">
						<descr>New Bit Value</descr>
					</var>
					<var name="usiBitIndex" type="USINT">
						<descr>Bit To be updated Index 0...15</descr>
					</var>
				</inputVars>
				<localVars>
					<var name="wMask" type="WORD"/>
				</localVars>
			</vars>
			<iecDeclaration active="FALSE"/>
			<sourceCode type="ST">
				<![CDATA[(************************************************************************************
*	  																				*
*				SCHNEIDER ELECTRIC CONFIDENTIAL & PROPRIETARY						*
*																					*
*************************************************************************************
* THIS WORK CONTAINS VALUABLE CONFIDENTIAL AND PROPRIETARY INFORMATION:				*
* DISCLOSURE; USE OR REPRODUCTION OUTSIDE OF SCHNEIDER ELECTRIC AUTOMATION GMBH		*
* IS PROHIBITED EXCEPT AS AUTHORIZED IN WRITING. THIS UNPUBLISHED WORK IS			*
* PROTECTED BY THE LAWS OF THE UNITED STATES AND OTHER COUNTRIES. IN THE EVENT		*
* OF PUBLICATION THE FOLLOWING NOTICE SHALL APPLY:									*
*																					*
* "COPYRIGHT 2018 SCHNEIDER ELECTRIC AUTOMATION GMBH								*
* ALL RIGHTS RESERVED."																*
*************************************************************************************
*************************************************************************************
* APPLICATION	: HVAC&R															*
* MODULE		: Basic_Addons														*
*************************************************************************************
* FUNCT/FB NAME : SRBitWord															*
*																					*
* PURPOSE		: Set/Reset a bit of a word											*
*																					*
* PARAMETER		: See Function/FB description										*
* INPUT			: See Function/FB description										*
* OUTPUT		: See Function/FB description										*
*																					*
*************************************************************************************
* REVISION HISTORY: 												 				*
* 												 									*
* Rev  	Date	  	Programmer			Comment 									*
* --------------------------------------------------------------------------------- *
* 1  	09-04-18 	Federico Marcassa	First release 								*
* 												 									*
*************************************************************************************)

wMask:=SHL(UINT#1, MIN(15,usiBitIndex));
IF 	xBitValue THEN
	SRBitWord:= (wInput OR wMask);
ELSE
	SRBitWord:= (wInput AND (NOT(wMask)));
END_IF;

]]>
			</sourceCode>
		</function>
		<function name="ReadWordBit" version="1.0.0">
			<descr>Read a bit of a word

Example:
xbit7 := ReadWordBit(wValue,7);</descr>
			<returnValue>BOOL</returnValue>
			<vars>
				<inputVars>
					<var name="wInput" type="WORD">
						<descr>Word to be read</descr>
					</var>
					<var name="usiBitIndex" type="USINT">
						<descr>Bit To be read Index 0...15</descr>
					</var>
				</inputVars>
				<localVars>
					<var name="wMask" type="WORD"/>
				</localVars>
			</vars>
			<iecDeclaration active="FALSE"/>
			<sourceCode type="ST">
				<![CDATA[(************************************************************************************
*	  																				*
*				SCHNEIDER ELECTRIC CONFIDENTIAL & PROPRIETARY						*
*																					*
*************************************************************************************
* THIS WORK CONTAINS VALUABLE CONFIDENTIAL AND PROPRIETARY INFORMATION:				*
* DISCLOSURE; USE OR REPRODUCTION OUTSIDE OF SCHNEIDER ELECTRIC AUTOMATION GMBH		*
* IS PROHIBITED EXCEPT AS AUTHORIZED IN WRITING. THIS UNPUBLISHED WORK IS			*
* PROTECTED BY THE LAWS OF THE UNITED STATES AND OTHER COUNTRIES. IN THE EVENT		*
* OF PUBLICATION THE FOLLOWING NOTICE SHALL APPLY:									*
*																					*
* "COPYRIGHT 2018 SCHNEIDER ELECTRIC AUTOMATION GMBH								*
* ALL RIGHTS RESERVED."																*
*************************************************************************************
*************************************************************************************
* APPLICATION	: HVAC&R															*
* MODULE		: Basic_Addons														*
*************************************************************************************
* FUNCT/FB NAME : ReadWordBit														*
*																					*
* PURPOSE		: Conversion of 2 Words into a REAL value using IEEE754 32bit format*
*																					*
* PARAMETER		: See Function/FB description										*
* INPUT			: See Function/FB description										*
* OUTPUT		: See Function/FB description										*
*																					*
*************************************************************************************
* REVISION HISTORY: 												 				*
* 												 									*
* Rev  	Date	  	Programmer			Comment 									*
* --------------------------------------------------------------------------------- *
* 1  	09-04-18 	Federico Marcassa	First release 								*
* 												 									*
*************************************************************************************)

wMask:=SHL(UINT#1, MIN(15,usiBitIndex));
ReadWordBit:= (wInput AND wMask)<>0;

]]>
			</sourceCode>
		</function>
		<function name="WordToUdint" version="1.0.0">
			<descr>Compose a double unsigned integer from 2 words

Example:
udiValue := WordToUdint(wLValue,wHValue);</descr>
			<returnValue>UDINT</returnValue>
			<vars>
				<inputVars>
					<var name="wLSW" type="WORD">
						<descr>Less Significative Word</descr>
					</var>
					<var name="wMSW" type="WORD">
						<descr>Most Significative Word</descr>
					</var>
				</inputVars>
			</vars>
			<iecDeclaration active="FALSE"/>
			<sourceCode type="IL">
				<![CDATA[(************************************************************************************
*	  																				*
*				SCHNEIDER ELECTRIC CONFIDENTIAL & PROPRIETARY						*
*																					*
*************************************************************************************
* THIS WORK CONTAINS VALUABLE CONFIDENTIAL AND PROPRIETARY INFORMATION:				*
* DISCLOSURE; USE OR REPRODUCTION OUTSIDE OF SCHNEIDER ELECTRIC AUTOMATION GMBH		*
* IS PROHIBITED EXCEPT AS AUTHORIZED IN WRITING. THIS UNPUBLISHED WORK IS			*
* PROTECTED BY THE LAWS OF THE UNITED STATES AND OTHER COUNTRIES. IN THE EVENT		*
* OF PUBLICATION THE FOLLOWING NOTICE SHALL APPLY:									*
*																					*
* "COPYRIGHT 2018 SCHNEIDER ELECTRIC AUTOMATION GMBH								*
* ALL RIGHTS RESERVED."																*
*************************************************************************************
*************************************************************************************
* APPLICATION	: HVAC&R															*
* MODULE		: Basic_Addons														*
*************************************************************************************
* FUNCT/FB NAME : WordToUdint														*
*																					*
* PURPOSE		: Compose a double unsigned integer from 2 words					*
*																					*
* PARAMETER		: See Function/FB description										*
* INPUT			: See Function/FB description										*
* OUTPUT		: See Function/FB description										*
*																					*
*************************************************************************************
* REVISION HISTORY: 												 				*
* 												 									*
* Rev  	Date	  	Programmer			Comment 									*
* --------------------------------------------------------------------------------- *
* 1  	09-04-18 	Federico Marcassa	First release 								*
* 												 									*
*************************************************************************************)

	(*---------- Word values -----------------*)
	(*										  *)
	(*	UDINT <- | H word1 | L word0 |		  *)
	(*										  *)
	(*----------------------------------------*)

	(*	Low word *)

	LD		wLSW
	TO_UDINT
	ST		WordToUdint

	(*	High word *)

	LD		wMSW
	TO_UDINT	
	SHL		16
	ADD		WordToUdint
	ST		WordToUdint

]]>
			</sourceCode>
		</function>
		<function name="WordToDint" version="1.0.0">
			<descr>Compose a double integer from 2 words

Example:
diValue := WordToDint(wLValue,wHValue);</descr>
			<returnValue>DINT</returnValue>
			<vars>
				<inputVars>
					<var name="wLSW" type="WORD">
						<descr>Less Significative Word</descr>
					</var>
					<var name="wMSW" type="WORD">
						<descr>Most Significative Word</descr>
					</var>
				</inputVars>
			</vars>
			<iecDeclaration active="FALSE"/>
			<sourceCode type="IL">
				<![CDATA[(************************************************************************************
*	  																				*
*				SCHNEIDER ELECTRIC CONFIDENTIAL & PROPRIETARY						*
*																					*
*************************************************************************************
* THIS WORK CONTAINS VALUABLE CONFIDENTIAL AND PROPRIETARY INFORMATION:				*
* DISCLOSURE; USE OR REPRODUCTION OUTSIDE OF SCHNEIDER ELECTRIC AUTOMATION GMBH		*
* IS PROHIBITED EXCEPT AS AUTHORIZED IN WRITING. THIS UNPUBLISHED WORK IS			*
* PROTECTED BY THE LAWS OF THE UNITED STATES AND OTHER COUNTRIES. IN THE EVENT		*
* OF PUBLICATION THE FOLLOWING NOTICE SHALL APPLY:									*
*																					*
* "COPYRIGHT 2018 SCHNEIDER ELECTRIC AUTOMATION GMBH								*
* ALL RIGHTS RESERVED."																*
*************************************************************************************
*************************************************************************************
* APPLICATION	: HVAC&R															*
* MODULE		: Basic_Addons														*
*************************************************************************************
* FUNCT/FB NAME : WordToDint														*
*																					*
* PURPOSE		: Compose a double integer from 2 words								*
*																					*
* PARAMETER		: See Function/FB description										*
* INPUT			: See Function/FB description										*
* OUTPUT		: See Function/FB description										*
*																					*
*************************************************************************************
* REVISION HISTORY: 												 				*
* 												 									*
* Rev  	Date	  	Programmer			Comment 									*
* --------------------------------------------------------------------------------- *
* 1  	09-04-18 	Federico Marcassa	First release 								*
* 												 									*
*************************************************************************************)

	(*---------- Word values -----------------*)
	(*										  *)
	(*	DINT <- | H word1 | L word0 |		  *)
	(*										  *)
	(*----------------------------------------*)

	(*	Low word *)

	LD		wLSW
	TO_DINT
	ST		WordToDint

	(*	High word *)

	LD		wMSW
	TO_DINT	
	SHL		16
	ADD		WordToDint
	ST		WordToDint

]]>
			</sourceCode>
		</function>
	</functions>
	<functionBlocks>
		<functionBlock name="String31ToWord16" version="1.0.0" creationDate="1552554403" lastModifiedDate="1552987455">
			<title>Copy String content into a vector of Words</title>
			<descr>This function can be used to create the vector of values needed to send a string through modbus</descr>
			<vars>
				<inputVars>
					<var name="s31input" type="STRING" length="31">
						<descr>Input string - Max size 31</descr>
					</var>
				</inputVars>
				<outputVars>
					<var name="w16output" type="WORD" dim0="16">
						<descr>Output Word Vector</descr>
					</var>
				</outputVars>
				<localVars>
					<var name="iIndex" type="INT"/>
					<var name="usPtr1" type="@USINT"/>
					<var name="usPtr2" type="@USINT"/>
					<var name="xStringEnd" type="BOOL"/>
				</localVars>
			</vars>
			<iecDeclaration active="FALSE"/>
			<interfaces/>
			<methods/>
			<sourceCode type="ST">
				<![CDATA[usPtr1 := ADR(s31input);
usPtr2 := ADR(w16output[0]);
xStringEnd := FALSE;

FOR iIndex := 0 TO 30 DO

	IF @usPtr1 = 0 THEN
		xStringEnd := TRUE;		
	END_IF;	
	IF xStringEnd THEN
		@usPtr2 := 0;
	ELSE
		@usPtr2 := @usPtr1;
	END_IF;	
	usPtr1 := usPtr1+1;
	usPtr2 := usPtr2+1;

END_FOR;
// Write in any case an end of string in the last byte
@usPtr2 := 0;
]]>
			</sourceCode>
		</functionBlock>
		<functionBlock name="Word16ToString31" version="1.0.0" creationDate="1552554403" lastModifiedDate="1552987520">
			<title>Copy String content into a vector of Words</title>
			<descr>This function can be used to create the string related to a vector of word values read through modbus</descr>
			<vars>
				<inputVars>
					<var name="w16input" type="WORD" dim0="16">
						<descr>Input Word Vector</descr>
					</var>
				</inputVars>
				<outputVars>
					<var name="s31output" type="STRING" length="31">
						<descr>Output string - Max size 31</descr>
					</var>
				</outputVars>
				<localVars>
					<var name="iIndex" type="INT"/>
					<var name="usPtr1" type="@USINT"/>
					<var name="usPtr2" type="@USINT"/>
					<var name="xStringEnd" type="BOOL"/>
				</localVars>
			</vars>
			<iecDeclaration active="FALSE"/>
			<interfaces/>
			<methods/>
			<sourceCode type="ST">
				<![CDATA[usPtr1 := ADR(w16input[0]);
usPtr2 := ADR(s31output);

xStringEnd := FALSE;

FOR iIndex := 0 TO 30 DO

	IF @usPtr1 = 0 THEN
		xStringEnd := TRUE;		
	END_IF;	
	IF xStringEnd THEN
		@usPtr2 := 0;
	ELSE
		@usPtr2 := @usPtr1;
	END_IF;	
	usPtr1 := usPtr1+1;
	usPtr2 := usPtr2+1;

END_FOR;
// Write in any case an end of string in the last byte
@usPtr2 := 0;
]]>
			</sourceCode>
		</functionBlock>
		<functionBlock name="IEEE754ToWord2" version="1.0.0">
			<descr>Conversion of a REAL value IEEE754 32bit format into the related 2 Words

Example:
RealToWordInstance(rInput:=rValue);
wL:=RealToWordInstance.wL;
wH:=RealToWordInstance.wH;</descr>
			<vars>
				<inputVars>
					<var name="rInput" type="REAL">
						<descr>Real Value</descr>
					</var>
				</inputVars>
				<outputVars>
					<var name="wH" type="WORD">
						<descr>High Word</descr>
					</var>
					<var name="wL" type="WORD">
						<descr>Low Word</descr>
					</var>
				</outputVars>
				<localVars>
					<var name="uintptr" type="@UINT"/>
				</localVars>
			</vars>
			<iecDeclaration active="FALSE"/>
			<interfaces/>
			<methods/>
			<sourceCode type="ST">
				<![CDATA[
uintptr := ADR(rInput);

wL := @uintptr;
uintptr :=  uintptr + 2;
wH := @uintptr;
]]>
			</sourceCode>
		</functionBlock>
		<functionBlock name="Word4ToIEEE754" version="1.0.0">
			<descr>Conversion of 4 Words into a REAL value using IEEE754 64bit format.
Note: a loss of accuracy takes inevitably place in the conversion, due to the fact that the 64bit-REAL format is not supported by the platform (wL2 not used).

Example:
WordToRealInstance(w1H:=w1HValue,w1L:=w1LValue,w2H:=w2HValue,w2L:=w2LValue);
rValue := WordToRealInstance.IEEE754;</descr>
			<vars>
				<inputVars>
					<var name="w1H" type="WORD">
						<descr>High Word 1</descr>
					</var>
					<var name="w1L" type="WORD">
						<descr>Low Word 1</descr>
					</var>
					<var name="w2H" type="WORD">
						<descr>High Word 2</descr>
					</var>
					<var name="w2L" type="WORD">
						<descr>Low Word 2</descr>
					</var>
				</inputVars>
				<outputVars>
					<var name="rIEEE754" type="REAL">
						<descr>Real Value</descr>
					</var>
				</outputVars>
				<localVars>
					<var name="fullbit" type="DWORD"/>
					<var name="exponent" type="REAL"/>
					<var name="fullbit1" type="DWORD"/>
					<var name="mantisse" type="REAL"/>
					<var name="exponentInt" type="INT"/>
					<var name="mantisseDW" type="DWORD"/>
				</localVars>
			</vars>
			<iecDeclaration active="FALSE"/>
			<interfaces/>
			<methods/>
			<sourceCode type="ST">
				<![CDATA[fullbit := SHL(TO_UDINT(w1H),16) OR TO_UDINT(w1L);

exponentInt:=TO_INT(SHR(fullbit AND 16#7FF00000,20))-1023;
exponent := TO_REAL(exponentInt);

mantisseDW := (fullbit AND 16#000FFFFF);
IF exponentInt<>-1023 THEN
	mantisseDW := mantisseDW OR 16#00100000;
ELSE
	mantisseDW := SHL(mantisseDW,1);	
END_IF;	
mantisseDW := SHL(mantisseDW,10);
w2H := SHR(w2H,6);
mantisseDW := mantisseDW OR TO_UDINT(w2H);
mantisse := TO_REAL(mantisseDW) / TO_REAL(16#40000000);

rIEEE754 := PowReToRe_BasL (2.0,exponent);
rIEEE754 := rIEEE754 * mantisse;
IF (fullbit AND 16#80000000)<>0 THEN
	rIEEE754 := -rIEEE754;
END_IF;	
]]>
			</sourceCode>
		</functionBlock>
		<functionBlock name="Word2ToIEEE754" version="1.0.0">
			<descr>Conversion of 2 Words into a REAL value using IEEE754 32bit format

Example:
WordToRealInstance(wL:=wLValue,wH:=wHValue);
rValue := WordToRealInstance.IEEE754;</descr>
			<vars>
				<inputVars>
					<var name="wH" type="WORD">
						<descr>High Word</descr>
					</var>
					<var name="wL" type="WORD">
						<descr>Low Word</descr>
					</var>
				</inputVars>
				<outputVars>
					<var name="rIEEE754" type="REAL">
						<descr>Real Value</descr>
					</var>
				</outputVars>
				<localVars>
					<var name="udintptr" type="@UDINT"/>
				</localVars>
			</vars>
			<iecDeclaration active="FALSE"/>
			<interfaces/>
			<methods/>
			<sourceCode type="ST">
				<![CDATA[(************************************************************************************
*	  																				*
*				SCHNEIDER ELECTRIC CONFIDENTIAL & PROPRIETARY						*
*																					*
*************************************************************************************
* THIS WORK CONTAINS VALUABLE CONFIDENTIAL AND PROPRIETARY INFORMATION:				*
* DISCLOSURE; USE OR REPRODUCTION OUTSIDE OF SCHNEIDER ELECTRIC AUTOMATION GMBH		*
* IS PROHIBITED EXCEPT AS AUTHORIZED IN WRITING. THIS UNPUBLISHED WORK IS			*
* PROTECTED BY THE LAWS OF THE UNITED STATES AND OTHER COUNTRIES. IN THE EVENT		*
* OF PUBLICATION THE FOLLOWING NOTICE SHALL APPLY:									*
*																					*
* "COPYRIGHT 2018 SCHNEIDER ELECTRIC AUTOMATION GMBH								*
* ALL RIGHTS RESERVED."																*
*************************************************************************************
*************************************************************************************
* APPLICATION	: HVAC&R															*
* MODULE		: Basic_Addons														*
*************************************************************************************
* FUNCT/FB NAME : WordToReal														*
*																					*
* PURPOSE		: Conversion of 2 Words into a REAL value using IEEE754 32bit format*
*																					*
* PARAMETER		: See Function/FB description										*
* INPUT			: See Function/FB description										*
* OUTPUT		: See Function/FB description										*
*																					*
*************************************************************************************
* REVISION HISTORY: 												 				*
* 												 									*
* Rev  	Date	  	Programmer			Comment 									*
* --------------------------------------------------------------------------------- *
* 1  	09-04-18 	Federico Marcassa	First release 								*
* 												 									*
*************************************************************************************)

udintptr := ADR(rIEEE754);

@udintptr := TO_UDINT(wL)+SHL(TO_UDINT(wH),16);

]]>
			</sourceCode>
		</functionBlock>
		<functionBlock name="UdintToWord" version="1.0.0">
			<descr>Split a double unsigned integer into two words

Example:
UdintToWordInstance(udiInput:=udiValue);
wL := UdintToWordInstance.wLSW;
wH := UdintToWordInstance.wMSW;</descr>
			<vars>
				<inputVars>
					<var name="udiInput" type="UDINT">
						<descr>Input Value</descr>
					</var>
				</inputVars>
				<outputVars>
					<var name="wLSW" type="WORD">
						<descr>Less Significative Word</descr>
					</var>
					<var name="wMSW" type="WORD">
						<descr>Most Significative Word</descr>
					</var>
				</outputVars>
			</vars>
			<iecDeclaration active="FALSE"/>
			<interfaces/>
			<methods/>
			<sourceCode type="IL">
				<![CDATA[(************************************************************************************
*	  																				*
*				SCHNEIDER ELECTRIC CONFIDENTIAL & PROPRIETARY						*
*																					*
*************************************************************************************
* THIS WORK CONTAINS VALUABLE CONFIDENTIAL AND PROPRIETARY INFORMATION:				*
* DISCLOSURE; USE OR REPRODUCTION OUTSIDE OF SCHNEIDER ELECTRIC AUTOMATION GMBH		*
* IS PROHIBITED EXCEPT AS AUTHORIZED IN WRITING. THIS UNPUBLISHED WORK IS			*
* PROTECTED BY THE LAWS OF THE UNITED STATES AND OTHER COUNTRIES. IN THE EVENT		*
* OF PUBLICATION THE FOLLOWING NOTICE SHALL APPLY:									*
*																					*
* "COPYRIGHT 2018 SCHNEIDER ELECTRIC AUTOMATION GMBH								*
* ALL RIGHTS RESERVED."																*
*************************************************************************************
*************************************************************************************
* APPLICATION	: HVAC&R															*
* MODULE		: Basic_Addons														*
*************************************************************************************
* FUNCT/FB NAME : UdintToWord														*
*																					*
* PURPOSE		: Split a double unsigned integer into two words					*
*																					*
* PARAMETER		: See Function/FB description										*
* INPUT			: See Function/FB description										*
* OUTPUT		: See Function/FB description										*
*																					*
*************************************************************************************
* REVISION HISTORY: 												 				*
* 												 									*
* Rev  	Date	  	Programmer			Comment 									*
* --------------------------------------------------------------------------------- *
* 1  	09-04-18 	Federico Marcassa	First release 								*
* 												 									*
*************************************************************************************)

	(*---------- UDINT value -----------------*)
	(*										  *)
	(*	UDINT -> | H word1 | L word0 |		  *)
	(*										  *)
	(*----------------------------------------*)

	(*	Low byte *)

	LD		udiInput
	TO_UINT
	ST		wLSW

	(*	High byte *)

	LD		udiInput
	SHR		16
	TO_UINT
	ST		wMSW

]]>
			</sourceCode>
		</functionBlock>
		<functionBlock name="DWordToBit" version="1.0.0">
			<descr>Split a double word into 32 bits

Example:
DWordToBitInstance(dwInput:=dwValue);
xbit7 := DWordToBitInstance.xb7;</descr>
			<vars>
				<inputVars>
					<var name="dwInput" type="DWORD">
						<descr>Input Value</descr>
					</var>
				</inputVars>
				<outputVars>
					<var name="xb0" type="BOOL">
						<descr>Bit 0</descr>
					</var>
					<var name="xb1" type="BOOL">
						<descr>Bit 1</descr>
					</var>
					<var name="xb2" type="BOOL">
						<descr>Bit 2</descr>
					</var>
					<var name="xb3" type="BOOL">
						<descr>Bit 3</descr>
					</var>
					<var name="xb4" type="BOOL">
						<descr>Bit 4</descr>
					</var>
					<var name="xb5" type="BOOL">
						<descr>Bit 5</descr>
					</var>
					<var name="xb6" type="BOOL">
						<descr>Bit 6</descr>
					</var>
					<var name="xb7" type="BOOL">
						<descr>Bit 7</descr>
					</var>
					<var name="xb8" type="BOOL">
						<descr>Bit 8</descr>
					</var>
					<var name="xb9" type="BOOL">
						<descr>Bit 9</descr>
					</var>
					<var name="xb10" type="BOOL">
						<descr>Bit 10</descr>
					</var>
					<var name="xb11" type="BOOL">
						<descr>Bit 11</descr>
					</var>
					<var name="xb12" type="BOOL">
						<descr>Bit 12</descr>
					</var>
					<var name="xb13" type="BOOL">
						<descr>Bit 13</descr>
					</var>
					<var name="xb14" type="BOOL">
						<descr>Bit 14</descr>
					</var>
					<var name="xb15" type="BOOL">
						<descr>Bit 15</descr>
					</var>
					<var name="xb16" type="BOOL">
						<descr>Bit 16</descr>
					</var>
					<var name="xb17" type="BOOL">
						<descr>Bit 17</descr>
					</var>
					<var name="xb18" type="BOOL">
						<descr>Bit 18</descr>
					</var>
					<var name="xb19" type="BOOL">
						<descr>Bit 19</descr>
					</var>
					<var name="xb20" type="BOOL">
						<descr>Bit 20</descr>
					</var>
					<var name="xb21" type="BOOL">
						<descr>Bit 21</descr>
					</var>
					<var name="xb22" type="BOOL">
						<descr>Bit 22</descr>
					</var>
					<var name="xb23" type="BOOL">
						<descr>Bit 23</descr>
					</var>
					<var name="xb24" type="BOOL">
						<descr>Bit 24</descr>
					</var>
					<var name="xb25" type="BOOL">
						<descr>Bit 25</descr>
					</var>
					<var name="xb26" type="BOOL">
						<descr>Bit 26</descr>
					</var>
					<var name="xb27" type="BOOL">
						<descr>Bit 27</descr>
					</var>
					<var name="xb28" type="BOOL">
						<descr>Bit 28</descr>
					</var>
					<var name="xb29" type="BOOL">
						<descr>Bit 29</descr>
					</var>
					<var name="xb30" type="BOOL">
						<descr>Bit 30</descr>
					</var>
					<var name="xb31" type="BOOL">
						<descr>Bit 31</descr>
					</var>
				</outputVars>
			</vars>
			<iecDeclaration active="FALSE"/>
			<interfaces/>
			<methods/>
			<sourceCode type="IL">
				<![CDATA[(************************************************************************************
*	  																				*
*				SCHNEIDER ELECTRIC CONFIDENTIAL & PROPRIETARY						*
*																					*
*************************************************************************************
* THIS WORK CONTAINS VALUABLE CONFIDENTIAL AND PROPRIETARY INFORMATION:				*
* DISCLOSURE; USE OR REPRODUCTION OUTSIDE OF SCHNEIDER ELECTRIC AUTOMATION GMBH		*
* IS PROHIBITED EXCEPT AS AUTHORIZED IN WRITING. THIS UNPUBLISHED WORK IS			*
* PROTECTED BY THE LAWS OF THE UNITED STATES AND OTHER COUNTRIES. IN THE EVENT		*
* OF PUBLICATION THE FOLLOWING NOTICE SHALL APPLY:									*
*																					*
* "COPYRIGHT 2018 SCHNEIDER ELECTRIC AUTOMATION GMBH								*
* ALL RIGHTS RESERVED."																*
*************************************************************************************
*************************************************************************************
* APPLICATION	: HVAC&R															*
* MODULE		: Basic_Addons														*
*************************************************************************************
* FUNCT/FB NAME : DWordToBit														*
*																					*
* PURPOSE		: Split a double word into 32 bits									*
*																					*
* PARAMETER		: See Function/FB description										*
* INPUT			: See Function/FB description										*
* OUTPUT		: See Function/FB description										*
*																					*
*************************************************************************************
* REVISION HISTORY: 												 				*
* 												 									*
* Rev  	Date	  	Programmer			Comment 									*
* --------------------------------------------------------------------------------- *
* 1  	09-04-18 	Federico Marcassa	First release 								*
* 												 									*
*************************************************************************************)

			LD		dwInput
			AND		16#00000001
			NE		0
			ST		xb0

			LD		dwInput
			AND		16#00000002
			NE		0
			ST		xb1

			LD		dwInput
			AND		16#00000004
			NE		0
			ST		xb2

			LD		dwInput
			AND		16#00000008
			NE		0
			ST		xb3

			LD		dwInput
			AND		16#00000010
			NE		0
			ST		xb4

			LD		dwInput
			AND		16#00000020
			NE		0
			ST		xb5

			LD		dwInput
			AND		16#00000040
			NE		0
			ST		xb6

			LD		dwInput
			AND		16#00000080
			NE		0
			ST		xb7

			LD		dwInput
			AND		16#00000100
			NE		0
			ST		xb8

			LD		dwInput
			AND		16#00000200
			NE		0
			ST		xb9

			LD		dwInput
			AND		16#00000400
			NE		0
			ST		xb10

			LD		dwInput
			AND		16#00000800
			NE		0
			ST		xb11

			LD		dwInput
			AND		16#00001000
			NE		0
			ST		xb12

			LD		dwInput
			AND		16#00002000
			NE		0
			ST		xb13

			LD		dwInput
			AND		16#00004000
			NE		0
			ST		xb14

			LD		dwInput
			AND		16#00008000
			NE		0
			ST		xb15
			
			LD		dwInput
			AND		16#00010000
			NE		0
			ST		xb16

			LD		dwInput
			AND		16#00020000
			NE		0
			ST		xb17

			LD		dwInput
			AND		16#00040000
			NE		0
			ST		xb18

			LD		dwInput
			AND		16#00080000
			NE		0
			ST		xb19
			
			LD		dwInput
			AND		16#00100000
			NE		0
			ST		xb20

			LD		dwInput
			AND		16#00200000
			NE		0
			ST		xb21

			LD		dwInput
			AND		16#00400000
			NE		0
			ST		xb22

			LD		dwInput
			AND		16#00800000
			NE		0
			ST		xb23
			
			LD		dwInput
			AND		16#01000000
			NE		0
			ST		xb24

			LD		dwInput
			AND		16#02000000
			NE		0
			ST		xb25

			LD		dwInput
			AND		16#04000000
			NE		0
			ST		xb26

			LD		dwInput
			AND		16#08000000
			NE		0
			ST		xb27
			
			LD		dwInput
			AND		16#10000000
			NE		0
			ST		xb28

			LD		dwInput
			AND		16#20000000
			NE		0
			ST		xb29

			LD		dwInput
			AND		16#40000000
			NE		0
			ST		xb30

			LD		dwInput
			AND		16#80000000
			NE		0
			ST		xb31

]]>
			</sourceCode>
		</functionBlock>
		<functionBlock name="DintToWord" version="1.0.0">
			<descr>Split a double integer into two words

Example:
DintToWordInstance(diInput:=diValue);
wL := DintToWordInstance.wLSW;
wH := DintToWordInstance.wMSW;</descr>
			<vars>
				<inputVars>
					<var name="diInput" type="DINT">
						<descr>Input Value</descr>
					</var>
				</inputVars>
				<outputVars>
					<var name="wLSW" type="WORD">
						<descr>Less Significative Word</descr>
					</var>
					<var name="wMSW" type="WORD">
						<descr>Most Significative Word</descr>
					</var>
				</outputVars>
			</vars>
			<iecDeclaration active="FALSE"/>
			<interfaces/>
			<methods/>
			<sourceCode type="IL">
				<![CDATA[(************************************************************************************
*	  																				*
*				SCHNEIDER ELECTRIC CONFIDENTIAL & PROPRIETARY						*
*																					*
*************************************************************************************
* THIS WORK CONTAINS VALUABLE CONFIDENTIAL AND PROPRIETARY INFORMATION:				*
* DISCLOSURE; USE OR REPRODUCTION OUTSIDE OF SCHNEIDER ELECTRIC AUTOMATION GMBH		*
* IS PROHIBITED EXCEPT AS AUTHORIZED IN WRITING. THIS UNPUBLISHED WORK IS			*
* PROTECTED BY THE LAWS OF THE UNITED STATES AND OTHER COUNTRIES. IN THE EVENT		*
* OF PUBLICATION THE FOLLOWING NOTICE SHALL APPLY:									*
*																					*
* "COPYRIGHT 2018 SCHNEIDER ELECTRIC AUTOMATION GMBH								*
* ALL RIGHTS RESERVED."																*
*************************************************************************************
*************************************************************************************
* APPLICATION	: HVAC&R															*
* MODULE		: Basic_Addons														*
*************************************************************************************
* FUNCT/FB NAME : DintToWord														*
*																					*
* PURPOSE		: Split a double integer into two words								*
*																					*
* PARAMETER		: See Function/FB description										*
* INPUT			: See Function/FB description										*
* OUTPUT		: See Function/FB description										*
*																					*
*************************************************************************************
* REVISION HISTORY: 												 				*
* 												 									*
* Rev  	Date	  	Programmer			Comment 									*
* --------------------------------------------------------------------------------- *
* 1  	09-04-18 	Federico Marcassa	First release 								*
* 												 									*
*************************************************************************************)

	(*---------- DINT value ------------------*)
	(*										  *)
	(*	DINT -> | H word1 | L word0 |		  *)
	(*										  *)
	(*----------------------------------------*)

	(*	Low byte *)

	LD		diInput
	TO_UINT
	ST		wLSW

	(*	High byte *)

	LD		diInput
	SHR		16
	TO_UINT
	ST		wMSW

]]>
			</sourceCode>
		</functionBlock>
	</functionBlocks>
	<programs/>
	<macros/>
	<structs/>
	<typedefs/>
	<enums/>
	<subranges/>
	<interfaces/>
</lib>