andrej@2254: <?xml version='1.0' encoding='utf-8'?>
andrej@2254: <project xmlns:ns1="http://www.plcopen.org/xml/tc6_0201" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.plcopen.org/xml/tc6_0201">
andrej@2254:   <fileHeader companyName="Unknown" productName="Unnamed" productVersion="1" creationDateTime="2018-07-28T02:24:08"/>
andrej@2346:   <contentHeader name="BACnet" modificationDateTime="2018-09-26T14:00:21">
andrej@2254:     <coordinateInfo>
andrej@2254:       <fbd>
andrej@2254:         <scaling x="0" y="0"/>
andrej@2254:       </fbd>
andrej@2254:       <ld>
andrej@2254:         <scaling x="0" y="0"/>
andrej@2254:       </ld>
andrej@2254:       <sfc>
andrej@2254:         <scaling x="0" y="0"/>
andrej@2254:       </sfc>
andrej@2254:     </coordinateInfo>
andrej@2254:   </contentHeader>
andrej@2254:   <types>
andrej@2254:     <dataTypes/>
andrej@2254:     <pous>
andrej@2254:       <pou name="program0" pouType="program">
andrej@2254:         <interface>
andrej@2254:           <localVars>
andrej@2254:             <variable name="EnergyCounter" address="%MD0.2.0">
andrej@2254:               <type>
andrej@2254:                 <REAL/>
andrej@2254:               </type>
andrej@2254:             </variable>
andrej@2254:             <variable name="Temperature" address="%ID0.0.0">
andrej@2254:               <type>
andrej@2254:                 <REAL/>
andrej@2254:               </type>
andrej@2254:             </variable>
andrej@2254:             <variable name="Humidity" address="%ID0.0.1">
andrej@2254:               <type>
andrej@2254:                 <REAL/>
andrej@2254:               </type>
andrej@2254:             </variable>
andrej@2254:           </localVars>
andrej@2254:           <localVars>
andrej@2254:             <variable name="TempSimulation">
andrej@2254:               <type>
andrej@2254:                 <derived name="Simulator"/>
andrej@2254:               </type>
andrej@2254:             </variable>
andrej@2254:             <variable name="HumiditySimulation">
andrej@2254:               <type>
andrej@2254:                 <derived name="Simulator"/>
andrej@2254:               </type>
andrej@2254:             </variable>
andrej@2254:           </localVars>
andrej@2254:           <localVars>
andrej@2254:             <variable name="TemperatureSetPoint" address="%QD0.1.0">
andrej@2254:               <type>
andrej@2254:                 <REAL/>
andrej@2254:               </type>
andrej@2254:             </variable>
andrej@2254:             <variable name="ControlDisable" address="%QX0.4.2">
andrej@2254:               <type>
andrej@2254:                 <BOOL/>
andrej@2254:               </type>
andrej@2254:             </variable>
andrej@2254:             <variable name="Heater" address="%IX0.3.0">
andrej@2254:               <type>
andrej@2254:                 <BOOL/>
andrej@2254:               </type>
andrej@2254:             </variable>
andrej@2254:             <variable name="Cooler" address="%IX0.3.1">
andrej@2254:               <type>
andrej@2254:                 <BOOL/>
andrej@2254:               </type>
andrej@2254:             </variable>
andrej@2254:           </localVars>
andrej@2254:         </interface>
andrej@2254:         <body>
andrej@2254:           <FBD>
andrej@2346:             <inVariable localId="1" executionOrderId="0" height="30" width="114" negated="false">
andrej@2254:               <position x="299" y="521"/>
andrej@2254:               <connectionPointOut>
andrej@2346:                 <relPosition x="114" y="15"/>
andrej@2254:               </connectionPointOut>
andrej@2254:               <expression>EnergyCounter</expression>
andrej@2254:             </inVariable>
andrej@2346:             <outVariable localId="2" executionOrderId="0" height="30" width="114" negated="false">
andrej@2254:               <position x="654" y="521"/>
andrej@2254:               <connectionPointIn>
andrej@2254:                 <relPosition x="0" y="15"/>
andrej@2254:                 <connection refLocalId="3" formalParameter="OUT">
andrej@2254:                   <position x="654" y="536"/>
andrej@2254:                   <position x="533" y="536"/>
andrej@2254:                 </connection>
andrej@2254:               </connectionPointIn>
andrej@2254:               <expression>EnergyCounter</expression>
andrej@2254:             </outVariable>
andrej@2254:             <block localId="3" typeName="ADD" executionOrderId="0" height="60" width="67">
andrej@2254:               <position x="466" y="506"/>
andrej@2254:               <inputVariables>
andrej@2254:                 <variable formalParameter="IN1">
andrej@2254:                   <connectionPointIn>
andrej@2254:                     <relPosition x="0" y="30"/>
andrej@2254:                     <connection refLocalId="1">
andrej@2254:                       <position x="466" y="536"/>
andrej@2254:                       <position x="404" y="536"/>
andrej@2254:                     </connection>
andrej@2254:                   </connectionPointIn>
andrej@2254:                 </variable>
andrej@2254:                 <variable formalParameter="IN2">
andrej@2254:                   <connectionPointIn>
andrej@2254:                     <relPosition x="0" y="50"/>
andrej@2254:                     <connection refLocalId="4">
andrej@2254:                       <position x="466" y="556"/>
andrej@2254:                       <position x="436" y="556"/>
andrej@2254:                       <position x="436" y="585"/>
andrej@2254:                       <position x="401" y="585"/>
andrej@2254:                     </connection>
andrej@2254:                   </connectionPointIn>
andrej@2254:                 </variable>
andrej@2254:               </inputVariables>
andrej@2254:               <inOutVariables/>
andrej@2254:               <outputVariables>
andrej@2254:                 <variable formalParameter="OUT">
andrej@2254:                   <connectionPointOut>
andrej@2254:                     <relPosition x="67" y="30"/>
andrej@2254:                   </connectionPointOut>
andrej@2254:                 </variable>
andrej@2254:               </outputVariables>
andrej@2254:             </block>
andrej@2254:             <inVariable localId="4" executionOrderId="0" height="30" width="105" negated="false">
andrej@2254:               <position x="296" y="570"/>
andrej@2254:               <connectionPointOut>
andrej@2254:                 <relPosition x="105" y="15"/>
andrej@2254:               </connectionPointOut>
andrej@2254:               <expression>0.00131</expression>
andrej@2254:             </inVariable>
andrej@2254:             <comment localId="5" height="67" width="229">
andrej@2254:               <position x="27" y="525"/>
andrej@2254:               <content>
andrej@2254:                 <xhtml:p><![CDATA[Always consume some energy]]></xhtml:p>
andrej@2254:               </content>
andrej@2254:             </comment>
andrej@2346:             <block localId="6" typeName="Simulator" instanceName="TempSimulation" executionOrderId="0" height="128" width="143">
andrej@2346:               <position x="188" y="648"/>
andrej@2254:               <inputVariables>
andrej@2254:                 <variable formalParameter="MinVal">
andrej@2254:                   <connectionPointIn>
andrej@2346:                     <relPosition x="0" y="38"/>
andrej@2254:                     <connection refLocalId="8">
andrej@2346:                       <position x="188" y="686"/>
andrej@2346:                       <position x="138" y="686"/>
andrej@2254:                     </connection>
andrej@2254:                   </connectionPointIn>
andrej@2254:                 </variable>
andrej@2254:                 <variable formalParameter="MaxVal">
andrej@2254:                   <connectionPointIn>
andrej@2346:                     <relPosition x="0" y="74"/>
andrej@2254:                     <connection refLocalId="9">
andrej@2346:                       <position x="188" y="722"/>
andrej@2346:                       <position x="138" y="722"/>
andrej@2254:                     </connection>
andrej@2254:                   </connectionPointIn>
andrej@2254:                 </variable>
andrej@2254:                 <variable formalParameter="PeriodSeconds">
andrej@2254:                   <connectionPointIn>
andrej@2346:                     <relPosition x="0" y="110"/>
andrej@2254:                     <connection refLocalId="10">
andrej@2254:                       <position x="188" y="758"/>
andrej@2254:                       <position x="138" y="758"/>
andrej@2254:                     </connection>
andrej@2254:                   </connectionPointIn>
andrej@2254:                 </variable>
andrej@2254:               </inputVariables>
andrej@2254:               <inOutVariables/>
andrej@2254:               <outputVariables>
andrej@2254:                 <variable formalParameter="Out">
andrej@2254:                   <connectionPointOut>
andrej@2346:                     <relPosition x="143" y="38"/>
andrej@2254:                   </connectionPointOut>
andrej@2254:                 </variable>
andrej@2254:               </outputVariables>
andrej@2254:             </block>
andrej@2346:             <outVariable localId="7" executionOrderId="0" height="30" width="98" negated="false">
andrej@2346:               <position x="421" y="671"/>
andrej@2254:               <connectionPointIn>
andrej@2254:                 <relPosition x="0" y="15"/>
andrej@2254:                 <connection refLocalId="6" formalParameter="Out">
andrej@2346:                   <position x="421" y="686"/>
andrej@2346:                   <position x="331" y="686"/>
andrej@2254:                 </connection>
andrej@2254:               </connectionPointIn>
andrej@2254:               <expression>Temperature</expression>
andrej@2254:             </outVariable>
andrej@2254:             <inVariable localId="8" executionOrderId="0" height="30" width="105" negated="false">
andrej@2346:               <position x="33" y="671"/>
andrej@2254:               <connectionPointOut>
andrej@2254:                 <relPosition x="105" y="15"/>
andrej@2254:               </connectionPointOut>
andrej@2254:               <expression>18.0</expression>
andrej@2254:             </inVariable>
andrej@2254:             <inVariable localId="9" executionOrderId="0" height="30" width="105" negated="false">
andrej@2346:               <position x="33" y="707"/>
andrej@2254:               <connectionPointOut>
andrej@2254:                 <relPosition x="105" y="15"/>
andrej@2254:               </connectionPointOut>
andrej@2254:               <expression>30.0</expression>
andrej@2254:             </inVariable>
andrej@2254:             <inVariable localId="10" executionOrderId="0" height="30" width="105" negated="false">
andrej@2254:               <position x="33" y="743"/>
andrej@2254:               <connectionPointOut>
andrej@2254:                 <relPosition x="105" y="15"/>
andrej@2254:               </connectionPointOut>
andrej@2254:               <expression>120</expression>
andrej@2254:             </inVariable>
andrej@2346:             <block localId="11" typeName="Simulator" instanceName="HumiditySimulation" executionOrderId="0" height="137" width="143">
andrej@2254:               <position x="185" y="803"/>
andrej@2254:               <inputVariables>
andrej@2254:                 <variable formalParameter="MinVal">
andrej@2254:                   <connectionPointIn>
andrej@2346:                     <relPosition x="0" y="39"/>
andrej@2254:                     <connection refLocalId="13">
andrej@2346:                       <position x="185" y="842"/>
andrej@2346:                       <position x="135" y="842"/>
andrej@2254:                     </connection>
andrej@2254:                   </connectionPointIn>
andrej@2254:                 </variable>
andrej@2254:                 <variable formalParameter="MaxVal">
andrej@2254:                   <connectionPointIn>
andrej@2346:                     <relPosition x="0" y="78"/>
andrej@2254:                     <connection refLocalId="14">
andrej@2346:                       <position x="185" y="881"/>
andrej@2346:                       <position x="135" y="881"/>
andrej@2254:                     </connection>
andrej@2254:                   </connectionPointIn>
andrej@2254:                 </variable>
andrej@2254:                 <variable formalParameter="PeriodSeconds">
andrej@2254:                   <connectionPointIn>
andrej@2346:                     <relPosition x="0" y="117"/>
andrej@2254:                     <connection refLocalId="15">
andrej@2346:                       <position x="185" y="920"/>
andrej@2346:                       <position x="135" y="920"/>
andrej@2254:                     </connection>
andrej@2254:                   </connectionPointIn>
andrej@2254:                 </variable>
andrej@2254:               </inputVariables>
andrej@2254:               <inOutVariables/>
andrej@2254:               <outputVariables>
andrej@2254:                 <variable formalParameter="Out">
andrej@2254:                   <connectionPointOut>
andrej@2346:                     <relPosition x="143" y="39"/>
andrej@2254:                   </connectionPointOut>
andrej@2254:                 </variable>
andrej@2254:               </outputVariables>
andrej@2254:             </block>
andrej@2346:             <outVariable localId="12" executionOrderId="0" height="30" width="111" negated="false">
andrej@2346:               <position x="418" y="827"/>
andrej@2254:               <connectionPointIn>
andrej@2254:                 <relPosition x="0" y="15"/>
andrej@2254:                 <connection refLocalId="11" formalParameter="Out">
andrej@2346:                   <position x="418" y="842"/>
andrej@2346:                   <position x="328" y="842"/>
andrej@2254:                 </connection>
andrej@2254:               </connectionPointIn>
andrej@2254:               <expression>Humidity</expression>
andrej@2254:             </outVariable>
andrej@2254:             <inVariable localId="13" executionOrderId="0" height="30" width="105" negated="false">
andrej@2346:               <position x="30" y="827"/>
andrej@2254:               <connectionPointOut>
andrej@2254:                 <relPosition x="105" y="15"/>
andrej@2254:               </connectionPointOut>
andrej@2254:               <expression>55.0</expression>
andrej@2254:             </inVariable>
andrej@2254:             <inVariable localId="14" executionOrderId="0" height="30" width="105" negated="false">
andrej@2346:               <position x="30" y="866"/>
andrej@2254:               <connectionPointOut>
andrej@2254:                 <relPosition x="105" y="15"/>
andrej@2254:               </connectionPointOut>
andrej@2254:               <expression>78.0</expression>
andrej@2254:             </inVariable>
andrej@2254:             <inVariable localId="15" executionOrderId="0" height="30" width="105" negated="false">
andrej@2346:               <position x="30" y="905"/>
andrej@2254:               <connectionPointOut>
andrej@2254:                 <relPosition x="105" y="15"/>
andrej@2254:               </connectionPointOut>
andrej@2254:               <expression>58</expression>
andrej@2254:             </inVariable>
andrej@2254:             <block localId="16" typeName="GT" executionOrderId="0" height="60" width="67">
andrej@2254:               <position x="231" y="1103"/>
andrej@2254:               <inputVariables>
andrej@2254:                 <variable formalParameter="IN1">
andrej@2254:                   <connectionPointIn>
andrej@2254:                     <relPosition x="0" y="30"/>
andrej@2254:                     <connection refLocalId="18">
andrej@2254:                       <position x="231" y="1133"/>
andrej@2254:                       <position x="132" y="1133"/>
andrej@2254:                     </connection>
andrej@2254:                   </connectionPointIn>
andrej@2254:                 </variable>
andrej@2254:                 <variable formalParameter="IN2">
andrej@2254:                   <connectionPointIn>
andrej@2254:                     <relPosition x="0" y="50"/>
andrej@2254:                     <connection refLocalId="22">
andrej@2254:                       <position x="231" y="1153"/>
andrej@2254:                       <position x="208" y="1153"/>
andrej@2254:                       <position x="208" y="1169"/>
andrej@2254:                       <position x="185" y="1169"/>
andrej@2254:                     </connection>
andrej@2254:                   </connectionPointIn>
andrej@2254:                 </variable>
andrej@2254:               </inputVariables>
andrej@2254:               <inOutVariables/>
andrej@2254:               <outputVariables>
andrej@2254:                 <variable formalParameter="OUT">
andrej@2254:                   <connectionPointOut>
andrej@2254:                     <relPosition x="67" y="30"/>
andrej@2254:                   </connectionPointOut>
andrej@2254:                 </variable>
andrej@2254:               </outputVariables>
andrej@2254:             </block>
andrej@2346:             <inVariable localId="18" executionOrderId="0" height="30" width="98" negated="false">
andrej@2254:               <position x="40" y="1118"/>
andrej@2254:               <connectionPointOut>
andrej@2346:                 <relPosition x="98" y="15"/>
andrej@2254:               </connectionPointOut>
andrej@2254:               <expression>Temperature</expression>
andrej@2254:             </inVariable>
andrej@2254:             <block localId="19" typeName="AND" executionOrderId="0" height="60" width="67">
andrej@2254:               <position x="347" y="1059"/>
andrej@2254:               <inputVariables>
andrej@2254:                 <variable formalParameter="IN1" negated="true">
andrej@2254:                   <connectionPointIn>
andrej@2254:                     <relPosition x="0" y="30"/>
andrej@2254:                     <connection refLocalId="20">
andrej@2254:                       <position x="347" y="1089"/>
andrej@2254:                       <position x="263" y="1089"/>
andrej@2254:                       <position x="263" y="1074"/>
andrej@2254:                       <position x="145" y="1074"/>
andrej@2254:                     </connection>
andrej@2254:                   </connectionPointIn>
andrej@2254:                 </variable>
andrej@2254:                 <variable formalParameter="IN2">
andrej@2254:                   <connectionPointIn>
andrej@2254:                     <relPosition x="0" y="50"/>
andrej@2254:                     <connection refLocalId="16" formalParameter="OUT">
andrej@2254:                       <position x="347" y="1109"/>
andrej@2254:                       <position x="337" y="1109"/>
andrej@2254:                       <position x="337" y="1133"/>
andrej@2254:                       <position x="298" y="1133"/>
andrej@2254:                     </connection>
andrej@2254:                   </connectionPointIn>
andrej@2254:                 </variable>
andrej@2254:               </inputVariables>
andrej@2254:               <inOutVariables/>
andrej@2254:               <outputVariables>
andrej@2254:                 <variable formalParameter="OUT">
andrej@2254:                   <connectionPointOut>
andrej@2254:                     <relPosition x="67" y="30"/>
andrej@2254:                   </connectionPointOut>
andrej@2254:                 </variable>
andrej@2254:               </outputVariables>
andrej@2254:             </block>
andrej@2346:             <inVariable localId="20" executionOrderId="0" height="30" width="122" negated="false">
andrej@2254:               <position x="41" y="1059"/>
andrej@2254:               <connectionPointOut>
andrej@2346:                 <relPosition x="122" y="15"/>
andrej@2254:               </connectionPointOut>
andrej@2254:               <expression>ControlDisable</expression>
andrej@2254:             </inVariable>
andrej@2254:             <outVariable localId="21" executionOrderId="0" height="30" width="92" negated="false">
andrej@2254:               <position x="468" y="1074"/>
andrej@2254:               <connectionPointIn>
andrej@2254:                 <relPosition x="0" y="15"/>
andrej@2254:                 <connection refLocalId="19" formalParameter="OUT">
andrej@2254:                   <position x="468" y="1089"/>
andrej@2254:                   <position x="414" y="1089"/>
andrej@2254:                 </connection>
andrej@2254:               </connectionPointIn>
andrej@2254:               <expression>Cooler</expression>
andrej@2254:             </outVariable>
andrej@2346:             <inVariable localId="22" executionOrderId="0" height="30" width="162" negated="false">
andrej@2254:               <position x="39" y="1154"/>
andrej@2254:               <connectionPointOut>
andrej@2346:                 <relPosition x="162" y="15"/>
andrej@2254:               </connectionPointOut>
andrej@2254:               <expression>TemperatureSetPoint</expression>
andrej@2254:             </inVariable>
andrej@2254:             <block localId="17" typeName="LT" executionOrderId="0" height="60" width="67">
andrej@2254:               <position x="228" y="1278"/>
andrej@2254:               <inputVariables>
andrej@2254:                 <variable formalParameter="IN1">
andrej@2254:                   <connectionPointIn>
andrej@2254:                     <relPosition x="0" y="30"/>
andrej@2254:                     <connection refLocalId="23">
andrej@2254:                       <position x="228" y="1308"/>
andrej@2254:                       <position x="129" y="1308"/>
andrej@2254:                     </connection>
andrej@2254:                   </connectionPointIn>
andrej@2254:                 </variable>
andrej@2254:                 <variable formalParameter="IN2">
andrej@2254:                   <connectionPointIn>
andrej@2254:                     <relPosition x="0" y="50"/>
andrej@2254:                     <connection refLocalId="27">
andrej@2254:                       <position x="228" y="1328"/>
andrej@2254:                       <position x="205" y="1328"/>
andrej@2254:                       <position x="205" y="1344"/>
andrej@2254:                       <position x="182" y="1344"/>
andrej@2254:                     </connection>
andrej@2254:                   </connectionPointIn>
andrej@2254:                 </variable>
andrej@2254:               </inputVariables>
andrej@2254:               <inOutVariables/>
andrej@2254:               <outputVariables>
andrej@2254:                 <variable formalParameter="OUT">
andrej@2254:                   <connectionPointOut>
andrej@2254:                     <relPosition x="67" y="30"/>
andrej@2254:                   </connectionPointOut>
andrej@2254:                 </variable>
andrej@2254:               </outputVariables>
andrej@2254:             </block>
andrej@2346:             <inVariable localId="23" executionOrderId="0" height="30" width="98" negated="false">
andrej@2254:               <position x="37" y="1293"/>
andrej@2254:               <connectionPointOut>
andrej@2346:                 <relPosition x="98" y="15"/>
andrej@2254:               </connectionPointOut>
andrej@2254:               <expression>Temperature</expression>
andrej@2254:             </inVariable>
andrej@2254:             <block localId="24" typeName="AND" executionOrderId="0" height="60" width="67">
andrej@2254:               <position x="344" y="1234"/>
andrej@2254:               <inputVariables>
andrej@2254:                 <variable formalParameter="IN1" negated="true">
andrej@2254:                   <connectionPointIn>
andrej@2254:                     <relPosition x="0" y="30"/>
andrej@2254:                     <connection refLocalId="25">
andrej@2254:                       <position x="344" y="1264"/>
andrej@2254:                       <position x="260" y="1264"/>
andrej@2254:                       <position x="260" y="1249"/>
andrej@2254:                       <position x="142" y="1249"/>
andrej@2254:                     </connection>
andrej@2254:                   </connectionPointIn>
andrej@2254:                 </variable>
andrej@2254:                 <variable formalParameter="IN2">
andrej@2254:                   <connectionPointIn>
andrej@2254:                     <relPosition x="0" y="50"/>
andrej@2254:                     <connection refLocalId="17" formalParameter="OUT">
andrej@2254:                       <position x="344" y="1284"/>
andrej@2254:                       <position x="334" y="1284"/>
andrej@2254:                       <position x="334" y="1308"/>
andrej@2254:                       <position x="295" y="1308"/>
andrej@2254:                     </connection>
andrej@2254:                   </connectionPointIn>
andrej@2254:                 </variable>
andrej@2254:               </inputVariables>
andrej@2254:               <inOutVariables/>
andrej@2254:               <outputVariables>
andrej@2254:                 <variable formalParameter="OUT">
andrej@2254:                   <connectionPointOut>
andrej@2254:                     <relPosition x="67" y="30"/>
andrej@2254:                   </connectionPointOut>
andrej@2254:                 </variable>
andrej@2254:               </outputVariables>
andrej@2254:             </block>
andrej@2346:             <inVariable localId="25" executionOrderId="0" height="30" width="122" negated="false">
andrej@2254:               <position x="38" y="1234"/>
andrej@2254:               <connectionPointOut>
andrej@2346:                 <relPosition x="122" y="15"/>
andrej@2254:               </connectionPointOut>
andrej@2254:               <expression>ControlDisable</expression>
andrej@2254:             </inVariable>
andrej@2254:             <outVariable localId="26" executionOrderId="0" height="30" width="92" negated="false">
andrej@2254:               <position x="465" y="1249"/>
andrej@2254:               <connectionPointIn>
andrej@2254:                 <relPosition x="0" y="15"/>
andrej@2254:                 <connection refLocalId="24" formalParameter="OUT">
andrej@2254:                   <position x="465" y="1264"/>
andrej@2254:                   <position x="411" y="1264"/>
andrej@2254:                 </connection>
andrej@2254:               </connectionPointIn>
andrej@2254:               <expression>Heater</expression>
andrej@2254:             </outVariable>
andrej@2346:             <inVariable localId="27" executionOrderId="0" height="30" width="162" negated="false">
andrej@2254:               <position x="36" y="1329"/>
andrej@2254:               <connectionPointOut>
andrej@2346:                 <relPosition x="162" y="15"/>
andrej@2254:               </connectionPointOut>
andrej@2254:               <expression>TemperatureSetPoint</expression>
andrej@2254:             </inVariable>
andrej@2254:             <comment localId="28" height="67" width="229">
andrej@2254:               <position x="343" y="734"/>
andrej@2254:               <content>
andrej@2254:                 <xhtml:p><![CDATA[Simple sensor simulation]]></xhtml:p>
andrej@2254:               </content>
andrej@2254:             </comment>
andrej@2254:             <comment localId="29" height="67" width="229">
andrej@2254:               <position x="37" y="978"/>
andrej@2254:               <content>
andrej@2254:                 <xhtml:p><![CDATA[Climate control]]></xhtml:p>
andrej@2254:               </content>
andrej@2254:             </comment>
andrej@2254:             <comment localId="30" height="464" width="773">
andrej@2254:               <position x="14" y="16"/>
andrej@2254:               <content>
andrej@2254:                 <xhtml:p><![CDATA[This examples shows how to work with BACnet extension.
andrej@2254: 
andrej@2254: Extensions requires native BACnet stack to be installed nearby Beremiz.
andrej@2254: Following directory structure is expected:
andrej@2254: <Parent directory>
andrej@2254:   "beremiz"
andrej@2254:   "BACnet"
andrej@2254: 
andrej@2254: If library is installed elsewhere, then place corresponding paths
andrej@2254: in CFLAGS/LDFLAGS in project settings.
andrej@2254: 
andrej@2254: For GNU/Linux to install BACnet library in parent directory run following commands:
andrej@2254: $ svn checkout https://svn.code.sf.net/p/bacnet/code/trunk/bacnet-stack/ BACnet
andrej@2254: $ cd BACnet
andrej@2254: $ make
andrej@2254: 
andrej@2254: After that BACnet extension is ready to be used in Beremiz projects.
andrej@2254: BACnet stack implementation contains a lot of test tools. They could be useful during 
andrej@2254: debugging and BACnet investigation. See "BACnet/bin/readme.txt" for more information about them.]]></xhtml:p>
andrej@2254:               </content>
andrej@2254:             </comment>
andrej@2254:           </FBD>
andrej@2254:         </body>
andrej@2254:       </pou>
andrej@2254:       <pou name="Simulator" pouType="functionBlock">
andrej@2254:         <interface>
andrej@2254:           <outputVars>
andrej@2254:             <variable name="Out">
andrej@2254:               <type>
andrej@2254:                 <REAL/>
andrej@2254:               </type>
andrej@2254:             </variable>
andrej@2254:           </outputVars>
andrej@2254:           <inputVars>
andrej@2254:             <variable name="MinVal">
andrej@2254:               <type>
andrej@2254:                 <REAL/>
andrej@2254:               </type>
andrej@2254:             </variable>
andrej@2254:             <variable name="MaxVal">
andrej@2254:               <type>
andrej@2254:                 <REAL/>
andrej@2254:               </type>
andrej@2254:             </variable>
andrej@2254:             <variable name="PeriodSeconds">
andrej@2254:               <type>
andrej@2254:                 <INT/>
andrej@2254:               </type>
andrej@2254:             </variable>
andrej@2254:           </inputVars>
andrej@2254:           <localVars>
andrej@2254:             <variable name="TON0">
andrej@2254:               <type>
andrej@2254:                 <derived name="TON"/>
andrej@2254:               </type>
andrej@2254:             </variable>
andrej@2254:             <variable name="seconds">
andrej@2254:               <type>
andrej@2254:                 <INT/>
andrej@2254:               </type>
andrej@2254:             </variable>
andrej@2254:             <variable name="BaseVal">
andrej@2254:               <type>
andrej@2254:                 <REAL/>
andrej@2254:               </type>
andrej@2254:             </variable>
andrej@2254:             <variable name="VarVal">
andrej@2254:               <type>
andrej@2254:                 <REAL/>
andrej@2254:               </type>
andrej@2254:             </variable>
andrej@2254:           </localVars>
andrej@2254:         </interface>
andrej@2254:         <body>
andrej@2254:           <ST>
andrej@2254:             <xhtml:p><![CDATA[(* pseudo-random variations *)
andrej@2254: TON0(IN := TRUE, PT := T#3120s);
andrej@2254: IF TON0.Q THEN
andrej@2254:   TON0(IN := FALSE);
andrej@2254: END_IF;
andrej@2254: seconds := TIME_TO_INT(TON0.ET);
andrej@2254: 
andrej@2254: BaseVal := (MaxVal + MinVal)/2.0;
andrej@2254: VarVal  := (MaxVal-MinVal)*INT_TO_REAL((seconds MOD PeriodSeconds) - (PeriodSeconds/2))/INT_TO_REAL(PeriodSeconds);
andrej@2254: 
andrej@2254: Out :=  BaseVal + VarVal;]]></xhtml:p>
andrej@2254:           </ST>
andrej@2254:         </body>
andrej@2254:       </pou>
andrej@2254:     </pous>
andrej@2254:   </types>
andrej@2254:   <instances>
andrej@2254:     <configurations>
andrej@2254:       <configuration name="config">
andrej@2254:         <resource name="resource1">
andrej@2254:           <task name="task0" priority="0" interval="T#20ms">
andrej@2254:             <pouInstance name="instance0" typeName="program0"/>
andrej@2254:           </task>
andrej@2254:         </resource>
andrej@2254:       </configuration>
andrej@2254:     </configurations>
andrej@2254:   </instances>
andrej@2254: </project>