--- a/BeremizIDE.py Wed Aug 08 13:27:44 2018 +0200
+++ b/BeremizIDE.py Wed Aug 08 13:46:19 2018 +0200
@@ -739,6 +739,7 @@
def RefreshStatusToolBar(self):
StatusToolBar = self.Panes["StatusToolBar"]
StatusToolBar.ClearTools()
+ StatusToolBar.SetMinSize(StatusToolBar.GetToolBitmapSize()) --- a/IDEFrame.py Wed Aug 08 13:27:44 2018 +0200
+++ b/IDEFrame.py Wed Aug 08 13:46:19 2018 +0200
@@ -2164,9 +2164,9 @@
self.Bind(wx.EVT_MENU, getattr(self, method), id=id)
self.CurrentEditorToolBar.append(id)
- self.AUIManager.GetPane("EditorToolBar").BestSize(EditorToolBar.GetBestSize())
self.AUIManager.GetPane("EditorToolBar").Show()
+ self.AUIManager.GetPane("EditorToolBar").BestSize(EditorToolBar.GetBestSize()) self.ResetEditorToolBar()
--- a/PLCGenerator.py Wed Aug 08 13:27:44 2018 +0200
+++ b/PLCGenerator.py Wed Aug 08 13:46:19 2018 +0200
@@ -900,6 +900,42 @@
for connection in related:
self.ConnectionTypes[connection] = var_type
+ def GetUsedEno(self, body, connections): + Function checks whether value on given connection + comes from block, that has used EN input and + returns variable name for ENO output. + This is needed to avoid value propagation from blocks + with false signal on EN input. + body of the block for that program is currently generated + connection, that's source is checked for EN/ENO usage + if EN/ENO are not used, then None is returned + Otherwise BOOL variable corresponding to ENO + if len(connections) != 1: + ref_local_id = connections[0].getrefLocalId() + blk = body.getcontentInstance(ref_local_id) + for invar in blk.inputVariables.getvariable(): + if invar.getformalParameter() == "EN": + if len(invar.getconnectionPointIn().getconnections()) > 0: + if blk.getinstanceName() is None: + var_name = "%s%d_ENO" % (blk.gettypeName(), blk.getlocalId()) + var_name = "%s.ENO" % blk.getinstanceName() def ComputeProgram(self, pou):
if isinstance(body, ListType):
@@ -958,11 +994,21 @@
if connections is not None:
expression = self.ComputeExpression(body, connections)
if expression is not None:
+ eno_var = self.GetUsedEno(body, connections) + if eno_var is not None: + self.Program += [(self.CurrentIndent + "IF %s" % eno_var, ())] + self.Program += [(" THEN\n ", ())] self.Program += [(self.CurrentIndent, ()),
(instance.getexpression(), (self.TagName, "io_variable", instance.getlocalId(), "expression")),
self.Program += expression
self.Program += [(";\n", ())]
+ if eno_var is not None: + self.Program += [(self.CurrentIndent + "END_IF;\n", ())] elif isinstance(instance, BlockClass):
block_type = instance.gettypeName()
self.ParentGenerator.GeneratePouProgram(block_type)
--- a/README.md Wed Aug 08 13:27:44 2018 +0200
+++ b/README.md Wed Aug 08 13:46:19 2018 +0200
@@ -8,89 +8,94 @@
With Beremiz, you conform to standards, avoid vendor lock, and contribute to the better future of Automation.
+Beremiz consists of two components: +* Integrated Development Environment (IDE), [Beremiz.py](https://bitbucket.org/automforge/beremiz/src/tip/Beremiz.py?at=default). It's running on user's computer and is used to write/compile/debug PLC programs and control PLC runtime. +* Reference runtime implementation in python, [Beremiz_service.py](https://bitbucket.org/automforge/beremiz/src/tip/Beremiz_service.py?at=default). It's running on target platform, communicates with I/O and executes PLC program. See official [Beremiz website](http://www.beremiz.org/) for more information.
-sudo apt-get install build-essential bison flex autoconf
-sudo apt-get install python-wxgtk3.0 pyro mercurial
-sudo apt-get install python-nevow python-matplotlib python-lxml python-zeroconf python-cycler
+ sudo apt-get install build-essential bison flex autoconf + sudo apt-get install python-wxgtk3.0 pyro mercurial + sudo apt-get install python-nevow python-matplotlib python-lxml python-zeroconf python-cycler
-hg clone https://bitbucket.org/skvorl/beremiz
-hg clone https://bitbucket.org/mjsousa/matiec
+ hg clone https://bitbucket.org/skvorl/beremiz + hg clone https://bitbucket.org/mjsousa/matiec
+* Build CanFestival (optional) + Only needed for CANopen support. Please read CanFestival manual to choose CAN interface other than 'virtual'. -* Build CanFestival (optional)
-Only needed for CANopen support. Please read CanFestival manual to choose CAN interface other than 'virtual'.
+ hg clone http://dev.automforge.net/CanFestival-3 + cd ~/Beremiz/CanFestival-3 + ./configure --can=virtual
-hg clone http://dev.automforge.net/CanFestival-3
+* Build Modbus library (optional) + Only needed for Modbus support. -cd ~/Beremiz/CanFestival-3
-./configure --can=virtual
+ hg clone https://bitbucket.org/mjsousa/modbus Modbus
+## Run standalone Beremiz runtime ## -### Run standalone Beremiz service ###
+Runtime implementation can be different on different platforms. +For example, PLC used Cortex-M most likely would have C-based runtime. Beremiz project contains reference implementation in python, that can be easily run on GNU/Linux, Windows and Mac OS X. +This section will describe how to run it. +If project's URL is 'LOCAL://', then IDE launches temprorary instance of Beremiz python runtime (Beremiz_service.py) localy as user tries to connect to PLC. This allows to debug programs localy without PLC. +If you want to run Beremiz_service.py as standalone service, then follow these instructions: * Start standalone Beremiz service
-python Beremiz_service.py -p 61194 -i localhost -x 0 -a 1 ~/Beremiz/beremiz_workdir
+ python Beremiz_service.py -p 61194 -i localhost -x 0 -a 1 ~/Beremiz/beremiz_workdir
-* Open/Create PLC project in Beremiz IDE.
-Enter target location URI in project's settings (project->Config->BeremizRoot/URI_location) pointed to your running Beremiz service (For example, PYRO://127.0.0.1:61194).
-Save project and connect to running Beremiz service.
+* Open/Create PLC project in Beremiz IDE. + Enter target location URI in project's settings (project->Config->BeremizRoot/URI_location) pointed to your running Beremiz service (For example, PYRO://127.0.0.1:61194). + Save project and connect to running Beremiz service. +Almost for all functionality exists example in ['tests'](https://bitbucket.org/automforge/beremiz/src/tip/tests/?at=default) directory. +Most of examples are shown on [Beremiz youtube channel](https://www.youtube.com/channel/UCcE4KYI0p1f6CmSwtzyg-ZA). * See [Beremiz youtube channel](https://www.youtube.com/channel/UCcE4KYI0p1f6CmSwtzyg-ZA) to get quick information how to use Beremiz IDE.
@@ -108,7 +113,7 @@
* See official [Beremiz website](http://www.beremiz.org/) for more information.
-### Support and development ###
+## Support and development ## Main community support channel is [mailing list](https://sourceforge.net/p/beremiz/mailman/beremiz-devel/) (beremiz-devel@lists.sourceforge.net).
--- a/controls/DebugVariablePanel/DebugVariablePanel.py Wed Aug 08 13:27:44 2018 +0200
+++ b/controls/DebugVariablePanel/DebugVariablePanel.py Wed Aug 08 13:46:19 2018 +0200
@@ -35,8 +35,6 @@
matplotlib.use('WX') # noqa
-from matplotlib.backends.backend_wxagg import _convert_agg_to_wx_bitmap
from editors.DebugViewer import DebugViewer
from util.BitmapLibrary import GetBitmap
@@ -525,24 +523,6 @@
self.RefreshCanvasPosition()
- width, height = self.GraphicsWindow.GetVirtualSize()
- bitmap = wx.EmptyBitmap(width, height)
- dc = wx.BufferedDC(wx.ClientDC(self.GraphicsWindow), bitmap)
- if self.DraggingAxesPanel is not None:
- destBBox = self.DraggingAxesBoundingBox
- srcBBox = self.DraggingAxesPanel.GetAxesBoundingBox()
- srcBmp = _convert_agg_to_wx_bitmap(self.DraggingAxesPanel.get_renderer(), None)
- srcDC.SelectObject(srcBmp)
- dc.Blit(destBBox.x, destBBox.y,
- int(destBBox.width), int(destBBox.height),
- srcDC, srcBBox.x, srcBBox.y)
if not self.Fixed or self.Force:
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/BACnet/bacnet_0@bacnet/bacnet_slave Wed Aug 08 13:46:19 2018 +0200
@@ -0,0 +1,202 @@
+V(Energy) kilowatt-hours (19) +V(Temperature) degrees-celsius (62) +S'next_EDE_file_version' +VCurrent termperature in Beremiz lab +V(Temperature) degrees-celsius (62) +VCurrent humidity in Beremiz lab +V(Humidity) percent-relative-humidity (29) \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/BACnet/bacnet_0@bacnet/baseconfnode.xml Wed Aug 08 13:46:19 2018 +0200
@@ -0,0 +1,2 @@
+<?xml version='1.0' encoding='utf-8'?> +<BaseParams xmlns:xsd="http://www.w3.org/2001/XMLSchema" IEC_Channel="0" Name="bacnet_0"/> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/BACnet/bacnet_0@bacnet/confnode.xml Wed Aug 08 13:46:19 2018 +0200
@@ -0,0 +1,2 @@
+<?xml version='1.0' encoding='utf-8'?> +<BACnetServerNode xmlns:xsd="http://www.w3.org/2001/XMLSchema" UDP_Port_Number="47808" BACnet_Device_ID="3" BACnet_Communication_Control_Password=" " BACnet_Device_Location="Beremiz lab" Network_Interface="virbr0"/> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/BACnet/beremiz.xml Wed Aug 08 13:46:19 2018 +0200
@@ -0,0 +1,4 @@
+<?xml version='1.0' encoding='utf-8'?> +<BeremizRoot xmlns:xsd="http://www.w3.org/2001/XMLSchema" URI_location="LOCAL://"> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/BACnet/plc.xml Wed Aug 08 13:46:19 2018 +0200
@@ -0,0 +1,601 @@
+<?xml version='1.0' encoding='utf-8'?> +<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"> + <fileHeader companyName="Unknown" productName="Unnamed" productVersion="1" creationDateTime="2018-07-28T02:24:08"/> + <contentHeader name="BACnet" modificationDateTime="2018-07-29T01:54:59"> + <pou name="program0" pouType="program"> + <variable name="EnergyCounter" address="%MD0.2.0"> + <variable name="Temperature" address="%ID0.0.0"> + <variable name="Humidity" address="%ID0.0.1"> + <variable name="TempSimulation"> + <derived name="Simulator"/> + <variable name="HumiditySimulation"> + <derived name="Simulator"/> + <variable name="TemperatureSetPoint" address="%QD0.1.0"> + <variable name="ControlDisable" address="%QX0.4.2"> + <variable name="Heater" address="%IX0.3.0"> + <variable name="Cooler" address="%IX0.3.1"> + <inVariable localId="1" executionOrderId="0" height="30" width="105" negated="false"> + <position x="299" y="521"/> + <relPosition x="105" y="15"/> + <expression>EnergyCounter</expression> + <outVariable localId="2" executionOrderId="0" height="30" width="105" negated="false"> + <position x="654" y="521"/> + <relPosition x="0" y="15"/> + <connection refLocalId="3" formalParameter="OUT"> + <position x="654" y="536"/> + <position x="533" y="536"/> + <expression>EnergyCounter</expression> + <block localId="3" typeName="ADD" executionOrderId="0" height="60" width="67"> + <position x="466" y="506"/> + <variable formalParameter="IN1"> + <relPosition x="0" y="30"/> + <connection refLocalId="1"> + <position x="466" y="536"/> + <position x="404" y="536"/> + <variable formalParameter="IN2"> + <relPosition x="0" y="50"/> + <connection refLocalId="4"> + <position x="466" y="556"/> + <position x="436" y="556"/> + <position x="436" y="585"/> + <position x="401" y="585"/> + <variable formalParameter="OUT"> + <relPosition x="67" y="30"/> + <inVariable localId="4" executionOrderId="0" height="30" width="105" negated="false"> + <position x="296" y="570"/> + <relPosition x="105" y="15"/> + <expression>0.00131</expression> + <comment localId="5" height="67" width="229"> + <position x="27" y="525"/> + <xhtml:p><![CDATA[Always consume some energy]]></xhtml:p> + <block localId="6" typeName="Simulator" instanceName="TempSimulation" executionOrderId="0" height="115" width="134"> + <position x="188" y="661"/> + <variable formalParameter="MinVal"> + <relPosition x="0" y="35"/> + <connection refLocalId="8"> + <position x="188" y="696"/> + <position x="138" y="696"/> + <variable formalParameter="MaxVal"> + <relPosition x="0" y="66"/> + <connection refLocalId="9"> + <position x="188" y="727"/> + <position x="138" y="727"/> + <variable formalParameter="PeriodSeconds"> + <relPosition x="0" y="97"/> + <connection refLocalId="10"> + <position x="188" y="758"/> + <position x="138" y="758"/> + <variable formalParameter="Out"> + <relPosition x="134" y="35"/> + <outVariable localId="7" executionOrderId="0" height="30" width="92" negated="false"> + <position x="421" y="681"/> + <relPosition x="0" y="15"/> + <connection refLocalId="6" formalParameter="Out"> + <position x="421" y="696"/> + <position x="322" y="696"/> + <expression>Temperature</expression> + <inVariable localId="8" executionOrderId="0" height="30" width="105" negated="false"> + <position x="33" y="681"/> + <relPosition x="105" y="15"/> + <expression>18.0</expression> + <inVariable localId="9" executionOrderId="0" height="30" width="105" negated="false"> + <position x="33" y="712"/> + <relPosition x="105" y="15"/> + <expression>30.0</expression> + <inVariable localId="10" executionOrderId="0" height="30" width="105" negated="false"> + <position x="33" y="743"/> + <relPosition x="105" y="15"/> + <expression>120</expression> + <block localId="11" typeName="Simulator" instanceName="HumiditySimulation" executionOrderId="0" height="115" width="134"> + <position x="185" y="803"/> + <variable formalParameter="MinVal"> + <relPosition x="0" y="35"/> + <connection refLocalId="13"> + <position x="185" y="838"/> + <position x="135" y="838"/> + <variable formalParameter="MaxVal"> + <relPosition x="0" y="66"/> + <connection refLocalId="14"> + <position x="185" y="869"/> + <position x="135" y="869"/> + <variable formalParameter="PeriodSeconds"> + <relPosition x="0" y="97"/> + <connection refLocalId="15"> + <position x="185" y="900"/> + <position x="135" y="900"/> + <variable formalParameter="Out"> + <relPosition x="134" y="35"/> + <outVariable localId="12" executionOrderId="0" height="30" width="92" negated="false"> + <position x="418" y="823"/> + <relPosition x="0" y="15"/> + <connection refLocalId="11" formalParameter="Out"> + <position x="418" y="838"/> + <position x="319" y="838"/> + <expression>Humidity</expression> + <inVariable localId="13" executionOrderId="0" height="30" width="105" negated="false"> + <position x="30" y="823"/> + <relPosition x="105" y="15"/> + <expression>55.0</expression> + <inVariable localId="14" executionOrderId="0" height="30" width="105" negated="false"> + <position x="30" y="854"/> + <relPosition x="105" y="15"/> + <expression>78.0</expression> + <inVariable localId="15" executionOrderId="0" height="30" width="105" negated="false"> + <position x="30" y="885"/> + <relPosition x="105" y="15"/> + <expression>58</expression> + <block localId="16" typeName="GT" executionOrderId="0" height="60" width="67"> + <position x="231" y="1103"/> + <variable formalParameter="IN1"> + <relPosition x="0" y="30"/> + <connection refLocalId="18"> + <position x="231" y="1133"/> + <position x="132" y="1133"/> + <variable formalParameter="IN2"> + <relPosition x="0" y="50"/> + <connection refLocalId="22"> + <position x="231" y="1153"/> + <position x="208" y="1153"/> + <position x="208" y="1169"/> + <position x="185" y="1169"/> + <variable formalParameter="OUT"> + <relPosition x="67" y="30"/> + <inVariable localId="18" executionOrderId="0" height="30" width="92" negated="false"> + <position x="40" y="1118"/> + <relPosition x="92" y="15"/> + <expression>Temperature</expression> + <block localId="19" typeName="AND" executionOrderId="0" height="60" width="67"> + <position x="347" y="1059"/> + <variable formalParameter="IN1" negated="true"> + <relPosition x="0" y="30"/> + <connection refLocalId="20"> + <position x="347" y="1089"/> + <position x="263" y="1089"/> + <position x="263" y="1074"/> + <position x="145" y="1074"/> + <variable formalParameter="IN2"> + <relPosition x="0" y="50"/> + <connection refLocalId="16" formalParameter="OUT"> + <position x="347" y="1109"/> + <position x="337" y="1109"/> + <position x="337" y="1133"/> + <position x="298" y="1133"/> + <variable formalParameter="OUT"> + <relPosition x="67" y="30"/> + <inVariable localId="20" executionOrderId="0" height="30" width="104" negated="false"> + <position x="41" y="1059"/> + <relPosition x="104" y="15"/> + <expression>ControlDisable</expression> + <outVariable localId="21" executionOrderId="0" height="30" width="92" negated="false"> + <position x="468" y="1074"/> + <relPosition x="0" y="15"/> + <connection refLocalId="19" formalParameter="OUT"> + <position x="468" y="1089"/> + <position x="414" y="1089"/> + <expression>Cooler</expression> + <inVariable localId="22" executionOrderId="0" height="30" width="146" negated="false"> + <position x="39" y="1154"/> + <relPosition x="146" y="15"/> + <expression>TemperatureSetPoint</expression> + <block localId="17" typeName="LT" executionOrderId="0" height="60" width="67"> + <position x="228" y="1278"/> + <variable formalParameter="IN1"> + <relPosition x="0" y="30"/> + <connection refLocalId="23"> + <position x="228" y="1308"/> + <position x="129" y="1308"/> + <variable formalParameter="IN2"> + <relPosition x="0" y="50"/> + <connection refLocalId="27"> + <position x="228" y="1328"/> + <position x="205" y="1328"/> + <position x="205" y="1344"/> + <position x="182" y="1344"/> + <variable formalParameter="OUT"> + <relPosition x="67" y="30"/> + <inVariable localId="23" executionOrderId="0" height="30" width="92" negated="false"> + <position x="37" y="1293"/> + <relPosition x="92" y="15"/> + <expression>Temperature</expression> + <block localId="24" typeName="AND" executionOrderId="0" height="60" width="67"> + <position x="344" y="1234"/> + <variable formalParameter="IN1" negated="true"> + <relPosition x="0" y="30"/> + <connection refLocalId="25"> + <position x="344" y="1264"/> + <position x="260" y="1264"/> + <position x="260" y="1249"/> + <position x="142" y="1249"/> + <variable formalParameter="IN2"> + <relPosition x="0" y="50"/> + <connection refLocalId="17" formalParameter="OUT"> + <position x="344" y="1284"/> + <position x="334" y="1284"/> + <position x="334" y="1308"/> + <position x="295" y="1308"/> + <variable formalParameter="OUT"> + <relPosition x="67" y="30"/> + <inVariable localId="25" executionOrderId="0" height="30" width="104" negated="false"> + <position x="38" y="1234"/> + <relPosition x="104" y="15"/> + <expression>ControlDisable</expression> + <outVariable localId="26" executionOrderId="0" height="30" width="92" negated="false"> + <position x="465" y="1249"/> + <relPosition x="0" y="15"/> + <connection refLocalId="24" formalParameter="OUT"> + <position x="465" y="1264"/> + <position x="411" y="1264"/> + <expression>Heater</expression> + <inVariable localId="27" executionOrderId="0" height="30" width="146" negated="false"> + <position x="36" y="1329"/> + <relPosition x="146" y="15"/> + <expression>TemperatureSetPoint</expression> + <comment localId="28" height="67" width="229"> + <position x="343" y="734"/> + <xhtml:p><![CDATA[Simple sensor simulation]]></xhtml:p> + <comment localId="29" height="67" width="229"> + <position x="37" y="978"/> + <xhtml:p><![CDATA[Climate control]]></xhtml:p> + <comment localId="30" height="464" width="773"> + <position x="14" y="16"/> + <xhtml:p><![CDATA[This examples shows how to work with BACnet extension. +Extensions requires native BACnet stack to be installed nearby Beremiz. +Following directory structure is expected: +If library is installed elsewhere, then place corresponding paths +in CFLAGS/LDFLAGS in project settings. +For GNU/Linux to install BACnet library in parent directory run following commands: +$ svn checkout https://svn.code.sf.net/p/bacnet/code/trunk/bacnet-stack/ BACnet +After that BACnet extension is ready to be used in Beremiz projects. +BACnet stack implementation contains a lot of test tools. They could be useful during +debugging and BACnet investigation. See "BACnet/bin/readme.txt" for more information about them.]]></xhtml:p> + <pou name="Simulator" pouType="functionBlock"> + <variable name="MinVal"> + <variable name="MaxVal"> + <variable name="PeriodSeconds"> + <variable name="seconds"> + <variable name="BaseVal"> + <variable name="VarVal"> + <xhtml:p><![CDATA[(* pseudo-random variations *) +TON0(IN := TRUE, PT := T#3120s); +seconds := TIME_TO_INT(TON0.ET); +BaseVal := (MaxVal + MinVal)/2.0; +VarVal := (MaxVal-MinVal)*INT_TO_REAL((seconds MOD PeriodSeconds) - (PeriodSeconds/2))/INT_TO_REAL(PeriodSeconds); +Out := BaseVal + VarVal;]]></xhtml:p> + <configuration name="config"> + <resource name="resource1"> + <task name="task0" priority="0" interval="T#20ms"> + <pouInstance name="instance0" typeName="program0"/> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/modbus/beremiz.xml Wed Aug 08 13:46:19 2018 +0200
@@ -0,0 +1,6 @@
+<?xml version='1.0' encoding='utf-8'?> +<BeremizRoot xmlns:xsd="http://www.w3.org/2001/XMLSchema" URI_location="LOCAL://"> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/modbus/modbus_0@modbus/ModbusTCPclient_0@ModbusTCPclient/ModbusRequest_0@ModbusRequest/baseconfnode.xml Wed Aug 08 13:46:19 2018 +0200
@@ -0,0 +1,2 @@
+<?xml version='1.0' encoding='utf-8'?> +<BaseParams xmlns:xsd="http://www.w3.org/2001/XMLSchema" IEC_Channel="0" Name="ModbusRequest_0"/> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/modbus/modbus_0@modbus/ModbusTCPclient_0@ModbusTCPclient/ModbusRequest_0@ModbusRequest/confnode.xml Wed Aug 08 13:46:19 2018 +0200
@@ -0,0 +1,2 @@
+<?xml version='1.0' encoding='utf-8'?> +<ModbusRequest xmlns:xsd="http://www.w3.org/2001/XMLSchema" Function="16 - Write Multiple Registers" SlaveID="0"/> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/modbus/modbus_0@modbus/ModbusTCPclient_0@ModbusTCPclient/ModbusRequest_1@ModbusRequest/baseconfnode.xml Wed Aug 08 13:46:19 2018 +0200
@@ -0,0 +1,2 @@
+<?xml version='1.0' encoding='utf-8'?> +<BaseParams xmlns:xsd="http://www.w3.org/2001/XMLSchema" IEC_Channel="1" Name="ModbusRequest_1"/> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/modbus/modbus_0@modbus/ModbusTCPclient_0@ModbusTCPclient/ModbusRequest_1@ModbusRequest/confnode.xml Wed Aug 08 13:46:19 2018 +0200
@@ -0,0 +1,2 @@
+<?xml version='1.0' encoding='utf-8'?> +<ModbusRequest xmlns:xsd="http://www.w3.org/2001/XMLSchema" Function="04 - Read Input Registers" SlaveID="0" Start_Address="0"/> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/modbus/modbus_0@modbus/ModbusTCPclient_0@ModbusTCPclient/baseconfnode.xml Wed Aug 08 13:46:19 2018 +0200
@@ -0,0 +1,2 @@
+<?xml version='1.0' encoding='utf-8'?> +<BaseParams xmlns:xsd="http://www.w3.org/2001/XMLSchema" IEC_Channel="0" Name="ModbusTCPclient_0"/> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/modbus/modbus_0@modbus/ModbusTCPclient_0@ModbusTCPclient/confnode.xml Wed Aug 08 13:46:19 2018 +0200
@@ -0,0 +1,2 @@
+<?xml version='1.0' encoding='utf-8'?> +<ModbusTCPclient xmlns:xsd="http://www.w3.org/2001/XMLSchema" Remote_Port_Number="1502"/> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/modbus/modbus_0@modbus/ModbusTCPserver_0@ModbusTCPserver/HoldingRegs@MemoryArea/baseconfnode.xml Wed Aug 08 13:46:19 2018 +0200
@@ -0,0 +1,2 @@
+<?xml version='1.0' encoding='utf-8'?> +<BaseParams xmlns:xsd="http://www.w3.org/2001/XMLSchema" IEC_Channel="0" Name="HoldingRegs"/> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/modbus/modbus_0@modbus/ModbusTCPserver_0@ModbusTCPserver/HoldingRegs@MemoryArea/confnode.xml Wed Aug 08 13:46:19 2018 +0200
@@ -0,0 +1,2 @@
+<?xml version='1.0' encoding='utf-8'?> +<MemoryArea xmlns:xsd="http://www.w3.org/2001/XMLSchema" MemoryAreaType="03 - Holding Registers" Nr_of_Channels="1"/> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/modbus/modbus_0@modbus/ModbusTCPserver_0@ModbusTCPserver/InputRegs@MemoryArea/baseconfnode.xml Wed Aug 08 13:46:19 2018 +0200
@@ -0,0 +1,2 @@
+<?xml version='1.0' encoding='utf-8'?> +<BaseParams xmlns:xsd="http://www.w3.org/2001/XMLSchema" IEC_Channel="1" Name="InputRegs"/> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/modbus/modbus_0@modbus/ModbusTCPserver_0@ModbusTCPserver/InputRegs@MemoryArea/confnode.xml Wed Aug 08 13:46:19 2018 +0200
@@ -0,0 +1,2 @@
+<?xml version='1.0' encoding='utf-8'?> +<MemoryArea xmlns:xsd="http://www.w3.org/2001/XMLSchema" MemoryAreaType="04 - Input Registers"/> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/modbus/modbus_0@modbus/ModbusTCPserver_0@ModbusTCPserver/baseconfnode.xml Wed Aug 08 13:46:19 2018 +0200
@@ -0,0 +1,2 @@
+<?xml version='1.0' encoding='utf-8'?> +<BaseParams xmlns:xsd="http://www.w3.org/2001/XMLSchema" IEC_Channel="1" Name="ModbusTCPserver_0"/> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/modbus/modbus_0@modbus/ModbusTCPserver_0@ModbusTCPserver/confnode.xml Wed Aug 08 13:46:19 2018 +0200
@@ -0,0 +1,2 @@
+<?xml version='1.0' encoding='utf-8'?> +<ModbusServerNode xmlns:xsd="http://www.w3.org/2001/XMLSchema" Local_Port_Number="1502" Local_IP_Address="127.0.0.1"/> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/modbus/modbus_0@modbus/baseconfnode.xml Wed Aug 08 13:46:19 2018 +0200
@@ -0,0 +1,2 @@
+<?xml version='1.0' encoding='utf-8'?> +<BaseParams xmlns:xsd="http://www.w3.org/2001/XMLSchema" IEC_Channel="0" Name="modbus_0"/> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/modbus/modbus_0@modbus/confnode.xml Wed Aug 08 13:46:19 2018 +0200
@@ -0,0 +1,2 @@
+<?xml version='1.0' encoding='utf-8'?> +<ModbusRoot xmlns:xsd="http://www.w3.org/2001/XMLSchema"/> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/modbus/plc.xml Wed Aug 08 13:46:19 2018 +0200
@@ -0,0 +1,314 @@
+<?xml version='1.0' encoding='utf-8'?> +<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"> + <fileHeader companyName="Beremiz" productName="Beremiz" productVersion="1" creationDateTime="2018-07-27T13:19:12"/> + <contentHeader name="Modbus" modificationDateTime="2018-07-27T15:43:56"> + <pou name="program0" pouType="program"> + <variable name="Counter"> + <variable name="CounterReadBack"> + <variable name="MasterWriteToReg0" address="%QW0.0.0.0"> + <variable name="MasterReadFromReg1" address="%IW0.0.1.0"> + <variable name="SlaveHoldReg0" address="%IW0.1.0.0"> + <variable name="SlaveInputReg0" address="%QW0.1.1.0"> + <variable name="Generator0"> + <derived name="Generator"/> + <comment localId="4" height="109" width="350"> + <position x="102" y="438"/> + <xhtml:p><![CDATA[Modbus TCP Master writes counter value to one holding register on Modbus TCP Slave and reads it back from other input register.]]></xhtml:p> + <comment localId="3" height="407" width="680"> + <position x="21" y="15"/> + <xhtml:p><![CDATA[This examples shows how to work with Modbus extension. It uses Modbus TCP, but the same functions are available for Modbus RTU as well. Buth protocols are supported. +Modbus extensions requires native Modbus RTU/TCP library to be installed nearby Beremiz. +Following directory structure is expected: +If Modbus library is installed elsewhere, then place corresponding paths +in CFLAGS/LDFLAGS in project settings. +For GNU/Linux to install Modbus library in parent directory run following commands: +$ hg clone https://bitbucket.org/mjsousa/modbus Modbus +After that Modbus extension is ready to be used in Beremiz projects.]]></xhtml:p> + <block localId="5" typeName="CTU" instanceName="CTU0" executionOrderId="0" height="80" width="52"> + <position x="346" y="605"/> + <variable formalParameter="CU" edge="rising"> + <relPosition x="0" y="30"/> + <connection refLocalId="6" formalParameter="OUT"> + <position x="346" y="635"/> + <position x="303" y="635"/> + <variable formalParameter="R"> + <relPosition x="0" y="50"/> + <variable formalParameter="PV"> + <relPosition x="0" y="70"/> + <connection refLocalId="7"> + <position x="346" y="675"/> + <position x="324" y="675"/> + <position x="324" y="703"/> + <position x="302" y="703"/> + <variable formalParameter="Q"> + <relPosition x="52" y="30"/> + <variable formalParameter="CV"> + <relPosition x="52" y="50"/> + <block localId="6" typeName="Generator" instanceName="Generator0" executionOrderId="0" height="60" width="79"> + <position x="224" y="605"/> + <variable formalParameter="PON"> + <relPosition x="0" y="30"/> + <connection refLocalId="1"> + <position x="224" y="635"/> + <position x="154" y="635"/> + <variable formalParameter="POFF"> + <relPosition x="0" y="50"/> + <connection refLocalId="1"> + <position x="224" y="655"/> + <position x="189" y="655"/> + <position x="189" y="635"/> + <position x="154" y="635"/> + <variable formalParameter="OUT"> + <relPosition x="79" y="30"/> + <inVariable localId="1" executionOrderId="0" height="30" width="138" negated="false"> + <position x="16" y="620"/> + <relPosition x="138" y="15"/> + <expression>T#1s</expression> + <inVariable localId="7" executionOrderId="0" height="30" width="138" negated="false"> + <position x="164" y="688"/> + <relPosition x="138" y="15"/> + <expression>32767</expression> + <inOutVariable localId="2" executionOrderId="0" height="30" width="138" negatedOut="false" negatedIn="false"> + <position x="544" y="640"/> + <relPosition x="0" y="15"/> + <connection refLocalId="5" formalParameter="CV"> + <position x="544" y="655"/> + <position x="398" y="655"/> + <relPosition x="138" y="15"/> + <expression>Counter</expression> + <outVariable localId="8" executionOrderId="0" height="30" width="138" negated="false"> + <position x="762" y="640"/> + <relPosition x="0" y="15"/> + <connection refLocalId="2"> + <position x="762" y="655"/> + <position x="682" y="655"/> + <expression>MasterWriteToReg0</expression> + <inVariable localId="9" executionOrderId="0" height="30" width="152" negated="false"> + <position x="81" y="747"/> + <relPosition x="152" y="15"/> + <expression>MasterReadFromReg1</expression> + <outVariable localId="10" executionOrderId="0" height="30" width="137" negated="false"> + <position x="547" y="747"/> + <relPosition x="0" y="15"/> + <connection refLocalId="9"> + <position x="547" y="762"/> + <position x="233" y="762"/> + <expression>CounterReadBack</expression> + <comment localId="11" height="109" width="350"> + <position x="85" y="825"/> + <xhtml:p><![CDATA[Modbus TCP Slave just copies received register value from holding register to input register.]]></xhtml:p> + <inVariable localId="12" executionOrderId="0" height="30" width="152" negated="false"> + <position x="82" y="970"/> + <relPosition x="152" y="15"/> + <expression>SlaveHoldReg0</expression> + <outVariable localId="13" executionOrderId="0" height="30" width="123" negated="false"> + <position x="548" y="970"/> + <relPosition x="0" y="15"/> + <connection refLocalId="12"> + <position x="548" y="985"/> + <position x="234" y="985"/> + <expression>SlaveInputReg0</expression> + <pou name="Generator" pouType="functionBlock"> + <xhtml:p><![CDATA[T1( IN := NOT T2.Q, PT := POFF); +T2( IN := T1.Q, PT := PON); +OUT := T2.Q;]]></xhtml:p> + <configuration name="config"> + <resource name="resource1"> + <task name="task0" priority="0" interval="T#20ms"> + <pouInstance name="instance0" typeName="program0"/>