Home

pbsSoftLogic User Manual

image

Contents

1. WritestartElement Tag Writed ttributestring Name l Write Attributestring Value 01 ToSrringdg ll WriteEndE lement j OPCTagWode e 8 4 WritestartElsementi i Tag Hrite ttributestringi Mame a Old Write ttributestring Value 5 Old Tostring WriteEndElement OPCTadgMode 8 4 4 WritestartElement Tag Hrite ttributeStringi Mame R1 old Write ttributeStringi Value R1 Old Tostring WriteEndElement OPCTaugMNode e 48 4 WriteEndElement StaticData w Close l zi fendreqgion And end of FB you need to save value of Static data on XML file for using in next cycle pbsSoftLogic User Manual Write Outputs public static void ES Listzobject Obji ref List lt ohject gt Objol 1 string TmpPath obji 0 ToStringi l string PID Obji 1 ToStringil string VSLEName Obji Zz ToString il Read Inputs and define Variables Mar Old Data region Write Outputs Objo Addiol Zendregian And at the end value of all output signals should be writing on Objo list pbsSoftLogic User Manual SR FB Implementation public static void SR List lt object gt Obji ref List lt object gt Oobjoj i string TmpPath Obji 0 ToStrindaql string PID Obj 1 1 ToStringt i string VSLEName Obj71 2 TosString ead Inputs and define Variables Read Static data Bolve Logid Map Old Data W
2. lt OPCSrvTaqs gt lt version gt 1 0 O lt Yversion gt lt Block Name DIL Type BI Slavelp L IP startaAdd L Count 64 wait 200 Enable True s gt lt Block Name DOL Type BO SslaveID l IP startAdd 40956 Count 32 wait 200 Enable True s gt lt Block Name 4T1 Type AI slaveID l IP Startadd 10 Count 8 wait 200 Enables True s gt lt Block Mames piagl Type S S slaveID2 l IP StartAdd 100 Count 8 wait LO0 Enable True fr lt Block Name DI2 Type BI SlaveID 2 IP startaAdd L Count 64 wait 200 Enable True gt lt Block Name Do2 Type BO slaveID2 2 IP StartAdd 4096 Count 32 wait 200 Enable Trus s gt lt Block Name AI2 Type AI Slavelp 2 IP StartaAdd 10 Count 8 wait 200 Enable True s gt lt Block Name Diaqe Type S S slaveID2 2 IP StartAdd 100 Count 8 wait Lo0 Enable True gt lt Block Name DI3 Type BI Slavelp 3 IP startAdd 1 count 64 wait 200 Enable True s gt lt Block Name DO3 Type BO Slavelb 3 IP startAdd 40956 Count 32 wait 200 Enable True gt lt Block Name 4I3 Type AI Slavelb 3 IP Startadd 10 Count 8 wait 200 Enables True s gt lt Block Name Diag3 Type S S slaveID 3 IP StartAdd 100 Count 8 wait Lo0 Enable True fr lt foPcsrvTags gt pbsSoftLogic User Manual Block Name Unique name if Block Type Block Type BI DI Digital Input Modb
3. pbsSoftLogic User Manual You can use filezilla for transferring liblEC11313 so file to controller Please notice that transfer mode must be Binary in Filzilla 4 IEEE kx ok DAFNA H st 192 168 127 151 Username root Password Port HG ike 44 rw Tesponse 277 Entering Passive Mode 197 168 127 7 150 129 1B7 ammand LIST 1esponse 150 Opening BINARY mode data connection For bin ls tesponse 228 Transfer complete tatus Directory listing successful Local site Jhame kamjan Documents pbst X IEC11313 Release Remote site home pbsLx Fhlib a H amp moxa p AU amp drdib RETT i fblib B metadata x1 lt Merge Fili x Filesi Filet Last modified P sion Owner G WIECH 373 ge Filesize Filetype Lastmodified Permission Gvmer Gro E a Lua UF luac X5KB luac ile 09 15 2013 rw r rontroot E Logical libCounters so 5 3 KB sotile O7 21 2013 rw r rootroot t B Math librEC11313 30 31 KB so file 03 15 2013 7wr rootroot Filename Filesize Filetype Last modified libLegical so 16 5 KB amp o file Dz 21 2013 w r rootroot _ libMath ca 1244 KB so file Dz zt z013 4wer rootroot MainiEC11313 d 151 B d fila 09 15 2013 01 libProcess se 51 1 KB some 09 11 2012 rw r rook root MaintEC11313 42 KB otile 05 15 201301 libTimers so 18 2 KB so file Or 21 2013 ver rootroot WDIECI1313 50 jy 9 1 KB so file 09 15 2013
4. Modbus Slave Output tgs Note 2 Runtime kernel in Controller will check every min for Modbus Slave changes and will copy changes to internal flash memory so if you change set points by Modbus master and restart controller before one min pass then controller is not keeping last value of set points Modbus Slave Driver operation 1 Modbus master is reading all Input Tags DI Al FI by polling You should write on all Modbus Slave Input Signal on your logic Connect to FB output ports 2 Modbus master is writing all output signals DO AO FO You should read output tags in your logic Connect to FB input ports pbsSoftLogic User Manual dnps DITag1 dnps DOBTagi Bc JuiseGen An nitCount mslave DOTag1 dnps AlTag1 dnps AOBTagl In above sample logic mslave DOTag1 is an output signal from Modbus master Linked to FB input port and mslave AiTag1 is an input signal to modbus master Linked to FB output ports pbsSoftLogic User Manual 8 DNP3 Slave Configuration pbsSoftlogic supports DNP3 slave driver for Linux WinCE controllers Please refer to www dnp org web site for detail information about DNP3 protocol You can define up to 4 dnp3 slave instances for a controller Each DNP3 slave instance can be connected to separate DNP3 master SCADA At each instance you can define 1024 DNP tags As physical layer you can select RS232 and TCP IP Defining new DNP3 slave driv
5. ME DRV HMI RTU PUMP1 FA DRV IO 1 PMP1 STS RUN www pbscontrol com pbsSoftLogic User Manual 5 Quick Startup In this segment you will write a simple logic with PSLE and Simulate and run on Linux controller Step1 Make a new Application with PSLE Run VSFBEditor exe In File Menu Select New SEDbD SORLOUICTE E eet tel File Edit Debug Project View Window Tools Help Dir ed x Fale ololalalal EL Comment InputSignal OutputSignal Math amp Timers 5 Counters Logical H Process In left panel you can see different ready FB and in right panel Function Block application area Open Timers Group and select PulseGen Drag and Drop it to program area File Edit Debug Project View Window Tools Help Dae Sales elc Is FBList E Comment InputSignal OutputSignal H Math c Timers OnTimer OffTimer PulseGen PulseGen 2 RampGen RampGen SinGen H Counters Logical H Process PulseGen is generating continues pulse with same time duration Low and High pbsSoftLogic User Manual When Trg input is changing from low to high 0 to 1 Pulse train will start at Q output with Low and High Duration equal to Time input In FB list panel drag and drop Inputsignal and connect it to Trg Input Then Drag and drop OutputSignal and link it to Q output Leave Time input without any connection Fil
6. Type AI Init 0 Address 4 gt Tag Mame AITaq5 Type AI Tnit 0 Addresgs b5 gt Tag Mame AITadq 6 Type AI Init 0 Address r 6 gt Tag Name AITaq Type AI Init 0 Address gt pbsSoftLogic User Manual Digital Output Tag Definition uis Tag Tag Tag Tag Tag Tag Tag Tag Tag Tag Tag Tag Tag Tag Tag Ta Tag Tag Tag Tag Tag Tag Tag Tag SP Tag Tag Tac Tag Tag Tag Name DOT aq Name DOTadq1i Name DOT aq2 NMame DOT aq Name DOT aq Name DOT aq 5 Name DOT aq Name DOT adq7 Name DOT aqB8 Name DOT aq5 Name DOT adqi Mame DOTadqi1 Name DOTaqi2 Name DOTadqi3i Name DOTadqi4i Name DOTadqi 5 Name DOTadqi o Name DOTagli Name DOTag1li Name DOTaqis9 Name DOTag20 Name DOTag21 Name DOT aq22 Name DOT aq23 NMame DOT aq 4 Name DOT aq25 Name DOT aq26 Name DOT aq21 Name DOTadq287 Name DOT aq29 NMame DOT aq3 0 Name DOT aq3t1 Type DO Type Dbo Type DO Type DO Type DoO Type DO Type DoO Type DoO IType DO Ly pe i Type DoO Type Dbo Iype DbOo Iype DOT Type DO IType DO Type DO Type Dbo Iype DO IvYpe D Iype DboO lype DOo Type Dbo Lf pe Type Dbo Iype DO IYpe LD Type Dbo Type Dbo Iype DO Type Dbo Type DOTT Init 09 Thi os Init 0 IniIt 00 InitC 0 Inip en Init 0 in
7. Disable Controller IP 1 92 1 68 o 1 50 OPC Drv Dead Time sec o 6 From general tab Restart Controller pbsSoftLogic User Manual For each controller you need to have license file for life time operation Without License it will work for 30 Min and you need to restart Controller We have following license for controller runtime RTU PLC functionality and Modbus Master Slave protocol This is basic license for each controller DNP3 Slave License EC870 5 101 104 Slave License BACNET License You need to purchase each license separately from your supplier or directly through www pbscontrol com web site You can purchase basic license and purchase other license for your controller But your license key is same for each controller When you purchase pbsSoftLogic License you will receive a license key For activating license do following steps 1 Open project setting page and select License Tab a Project Options General Time Setting LAN Setting Stats License Kernel Manage License for Controller License Key Site Modbus DNP3 M IEC8705 BACNET Get License Read License Copy License to from Web from Controller Controller 2 To be sure that your PC is connected to Internet and Controller In the same time 3 Copy and Paste Controller license Key to License key text Box 4 Write some description about your project Project name country
8. Logical BOOL OPC TAG BOOL i Logical Memory OPC_TAG_BOOL LogicalRandom OPC TAG BOOL i Logical Square OPC_T4G_BOOL o c Numeric I2 OPC TAG 12 0 Numeric I4 OPC TAG 14 9 o c Numeric R4 OPC_TAG_R4 o 8 Numeric R8 OPC TAG R8 g OPC Nymenc Sing Numeric Memory UPC TAG RI8 c Numeric Ramp OPC TAG R8 o Numeric Random OPC TAG R8 O Numeric Sine OPC TAG R8 gt Numeric Square OPC TAG R8 i Numeric Step OPC TAG R8 i i Numeric Triangle OPC_TAG_R8 rl HMI OPC H After finish logic compile logic from project compile menu Transfer configuration file to Controller by Project Transfer Configuration menu Transfer Logic file to controller by Project Transfer Logic menu Restart runtime kernel psleWin32RT exe When you transfer Logic and configuration to controller pbssoftLogic will use following files and change their names as following suppose project name is win32 Win32 lx it is compiled configuration file will copy to controller and its name changed to logic cfg Win32 c11 it is compiled logic file will copy to controller and its name changed to logic c11 pbsSoftLogic User Manual OPC client Driver runtime specifications Remote Server name 128 characters OPC server name 256 characters OPC Item name 128 characters OPC Server DA 2 0 Selected OPC Items will read one time and Driver start time after that OPC
9. Stats License Kernel Driver List Path Logic Scan Time ms 500 instance DAS ECUI911 ss N secu io LOCAL_IO Watch Dog Sec fp 0 Disable Controller IP ho jo jo no OPC Drv Dead Time sec 5 Click on LOCAL 10 driver and right click on it Driver List Name Path Type Enabl Logic Scan Time ms 500 mmaster mmaster ModbusHaster M t ee iec div Nec div IEC8705Slave Controller Ecu 1 311 i graten a l New Driver Watch Dog Sec o 0 Disable Controller IP 1 0 o o 1 OPC Drv Dead Time sec ej pbsSoftLogic User Manual 6 Select explorer Edit Local lO xml file You can see a xml file for all ECU 1911 I Os You can change Tag Name based on your logic and project Digital Signal Definition Tag Name DITaqO0 Type DI Init 0 Address 0 Tag Name DITaqg1 Type DI Init 0 Address 1 gt Tag Name DITag2 Type DI Init 0 Address 2 gt Tag Hame DITag3 Type DI Init 0 Address 3 gt Tag Name DITagqg4 Type DI Init 0 Address A gt Tag Name DITaq5 Type DI Init 0 Address h Tag Name DITaq 6 Type DI Init Address 6 gt Tag Name DITagi Type DI Init 0 Address 7 gt Tag Hame DITaq8 Type DI Init 0 Address B8 gt Tag Name DITaq9 Type DI Init 0 Address 9 lt Tagq Name DITag10 Type DI Init 0 Address 10 Tag Name DITaqg11 Type DI Init 0 Address 11 gt Tag Name DITag12 T
10. lt Desc gt Communication Mode Balance B Unbalan U lt Desc gt lt Value gt B lt Value gt lt Node gt pbsSoftLogic User Manual lt Node gt lt Name gt KParam lt Name gt lt Desc gt KParameter 17 32767 max difference recive sequence number to send state variable lt Desc gt lt Value gt 12 lt Value gt lt Node gt lt Node gt lt Name gt WParam lt Name gt lt Desc gt WParameter 1 32767 Latest ACK after reciving W I format APDUs lt Desc gt lt Value gt 8 lt Value gt lt Node gt lt Node gt lt Name gt TOParam lt Name gt lt Desc gt TOParameter Timeout of Connection establishment sec Desc lt Value gt 30 lt Value gt lt Node gt lt Node gt lt Name gt T1Param lt Name gt lt Desc gt T1Parameter Timeout of Send test APDU sec lt Desc gt lt Value gt 15 lt Value gt lt Node gt lt Node gt lt Name gt T2Param lt Name gt lt Desc gt T2Parameter Timeout for ACK in case of no data message sec lt Desc gt lt Value gt 10 lt Value gt lt Node gt pbsSoftLogic User Manual lt Node gt lt Name gt T3Param lt Name gt lt Desc gt T3Parameter Timeout for sending test frames in case of a long idle state sec lt Desc gt lt Value gt 20 lt Value gt lt Node gt IEC Slave Tag file IECSTags xml Name Tag Name Should be unique in your logic Type IEC Tags type Following type is supported DI Digital input IEC Tag Type 1 30 M SP NA 1 Al A
11. pbsSoftLogic User Manual Linux WinCE Win32 Target pbsSoftLogic User Manual 2014 1 Introduction 2 PbsSoftLogic Installation 3 Basic concepts 4 Function Block programming Language 5 Quick Startup 6 Modbus Master Configuration and integration with remote I O Modules 7 Modbus Slave Configuration 8 DNP3 Slave Configuration 9 IEC870 5 Slave 101 104 Configuration 10 User defined function block 11 Runtime Kernel for Linux WinCE and transferring License to Controller 12 Project Settings facilities 13 ECU 1911 Local I O Definition 14 OPCClient Driver Configuration for Win32 Target Pea ee pbsSoftLogic User Manual 1 Introduction pbsSoftLogic is open RTU PLC Programming Environment from pbsControl pbsSoftlogic is developed by Dot Net technology Its development version is running on Windows operating system pbsSoftLogic has following specifications Standard Function Block programming Environment Lua scripting Language is supported for user defined Function Blocks development Developed application can be run on Embedded Windows WinCE and Embedded linux OS Offline simulation of developed application on windows More than 100 Ready and tested Function block for easy programming pbsSoftLogic Engineering running on windows Develop by Function Block language Develop User defined FB by Lua Simulate on Windows Transfer Configuration
12. 11 10 9 8 1 6 3 3 er Description LED RS 232 Serial Port VGA port USB port Networking port Digital output Digital input Analog input RS 485 Serial Port owitch Power OO MO Dm a BB wl N Sm O pbsSoftLogic User Manual ECU 1911 Field wiring is cum es o 2 Voltage DC a DC Ground 24V O 24V 24V pbsSoftLogic User Manual Defining ECU 1911 Local I O in pbsSoftLogic 1 At project setting select ECU 1911 as controller type General Time Setting LAN Setting Stats License Kamel Driver List Name Path Type Enable b mslave mslaye ModbusSlave Iv Logic Scan Time ms 500 mmaster mmaster ModbusMaster dps inps DNP3Slave t iec_drv iec_drv IEC8705Slave Controller Ecu 1911 z Watch DogfSec jo 0 Disable Controller IP ho jo jo fi OPC Drv Dead Time sec 2 Right click at driver list and select new Driver Driver List ooo Hame Path Type Enable Ld mzlave imslaye ModbusSlave i Instance Controller ECU 1311 veten bogen jo 0 Disable me Controller IP fio o fo i OPC Dry Dead Time sec 3 Select New Driver and select LOCAL 10 from list Write a Unique name for Driver Click on Make Driver Driver Lo CAL IO Name lecu_iol pbsSoftLogic User Manual 4 New Local I O driver is adding to list of drivers Options General Time Setting LAN Setting
13. 5 Click on get License from Web Site It will connect to pbscontrol web site and get all purchase licenses 6 Modbus DNP3 IEC and BACNet check boxs will be checked based on your purchase pbsSoftLogic User Manual 7 Click on Copy License to Controller It will move license file to controller 8 From General tab restart Controller If you have a controller and want to check its license click on Read License from Controller 12 Project Settings facilities There are many facilities in setting page in pbsSoftLogic Editor Open Setting Page you can see following tabs ac Project Options General Time Setting LAN Setting Stats License Kernel Driver List pbsHMI Integration Enable Name Path Type Enable B PM DRV PM DRV ModbusMaster md Instance o Controller z Watch DoglSec o 0 Disable Controller IP 1 92 1 68 i 27 1 52 PC Drv Dead Time sec o General Time Setting LAN Setting Stats License Kernel General Tab In This page you can set following parameters Logic Scan time Msec Controller Type pbsSoftLogic User Manual Watch Dog Value in sec if Value is 0 DWT is disabled Controller IP address Communication Drivers Restart Controller Delete Logic Delete Configuration Set Startup will set all necessary modules in Startup path of controller For a new controller before running any Commands in setting
14. ICONICS SimulatorOPCDA X pbszModbusSlave OPCSrvI3 Uu m au OPC explorer will look at psle OPC directory and find all files with OPCXMLn xml name format and will make a new file with OPCXML n 1 xml name when n is max number in the OPC directory You can rename OPC configuration file by running Explorer menu and rename file by windows utilities By running refresh Menu Defined OPC configuration file panel will be refreshed with new names After you make a new OPC configuration file select OPC server at Installed OPC server panel and connect to OPC server by right click menu los HCONICS SimulatorO POEA d de UP pbsModbusSlave OPCSrv13 Connect FEE CONICS SimulatorOPC Tj E np ModbusSlave OPESrvI4 Disconnect EN List View TR JAN Kepware KEPServerEX pbsM odemMBOPC ifs Icon view a pbsSoftLogicOPCSrySimu ME MOXA SNMPOPC rt I g y it k pbsControl DNP3Slave_OPCServer 1_0 TriangleBicroWw orks OPCDA 1 BENE RIO un a oe www pbscontrol com Page 128 pbsSoftLogic User Manual From OPC server tags Panel select all tags that you want to add in configuration You can use Filter at right side to find OPC tags You can press and hold Ctrl Key and select multiple items by left click Right click on selected Tags and run Select Menu pbsSoftLogic OPC Explorer File Edit Help Tags Selected Tag Parameters Flat Branch OPC_TAG_BOOL String and date data typ
15. Node gt TCPPort ModbusTCP Communication port Default value is 502 lt Node gt lt Name gt ShiftAddress lt Name gt lt Desc gt ShiftAddress lt Desc gt lt Value gt 0 lt Value gt pbsSoftLogic User Manual lt Node gt Shift Address this value with add to all Modbus Slave Address that is request from master Modbustags xml file in following figure you can see typical Modbus Slave Tags that is generate by pbsSoftLogic when you make a new Modbus Slave Driver File Edit Format View Help lt xml versione 1 0 gt lt OPCSryTagqs gt zversions 1 0 0z verslion Tag Mame pITagl Type DI Init 0 Address L Log 0 gt Tag Mame pITag2 Type DI Init 0 address 2 Log 0 gt lt Tag Mame pITad3 Type DI Init 0 address 3 Log 0 gt lt Tag Mame pITau4 Type DI Init 0 address 4 Log 0 gt lt Tag Mame pITad5 Type DI Init O address 5 Log 0 gt lt Tag Mame pITad6 Type DI Init 0 address 6 Log 0 gt lt Tag Mame pITad Type DI Init 0 address F Log 0 gt lt Tag Name DITags Type DI Init 0 Address 8 Log 0 gt xTag Mame AITadl Types AI Init 0 Address 1 Log 0 gt xTag Name AITaq2 Types AI Init 0 Address 2 Log 0 gt lt Tag Mame AITad3 Type AI Init 0 Address 3 Log 0 gt lt Tag Mame AITagd4 Type AI Init 0 Address 4 Log 0 gt Tag Mame AITag5 Type AI Init 0 Address 5 Log 0 gt Tag M
16. pbsSoftLogic User Manual lt Node gt lt Name gt SBOTimeOut lt Name gt lt Desc gt SBOTimeOut Sec lt Desc gt lt Value gt 10 lt Value gt lt Node gt Select before Operate delay lt Node gt lt Name gt NoCommTimeout lt Name gt lt Desc gt NoCommTimeout Sec lt Desc gt lt Value gt 0 lt Value gt lt Node gt Time that RTU is checking communication if there is no any communication in this period RTU will close connection in TCP Mode 0 means communication checking is disabling Unit is in second pbsSoftLogic User Manual DNP3Tags xml When you make a new driver pbsSoftLogic will make a default DNP3 Tags file You can edit this file and add or remove tags Name Tag Name It should be unique in your Logic Type DNP3 Tag Type We support following types DI Digital input Read By Master with different variations DNP Group1 2 Al Analog input Read By Master with different variations DNP Group 30 31 32 33 CNT Counter Read By Master with different variations DNP Group 20 21 22 23 Fl Float Input DNP Group 100 DOB Digital Output Block Write by master with different mode DNP Group 12 13 AOB Analog Output Block Write by master with different mode DNP Group 41 DO DO Status Read By Master with different variations DNP Group 10 11 AO AO Status Read By Master with different variations DNP Group 40 DPI Double Bit Binary Read By Master with different variations DNP
17. reqion Read Static data string mPath TmpPath ARS PID VSLEName if File Exists mPath trus i xmlDocument xmldoc new ml Document i xmldoc LoadimPathi zmlHodeList TmpzmlNodeList xmldoc GcerElementsByTagNHameii Tadg foreach XmlNode TmpEHMLNode in TmpzmlNodeList i switch TmpanLNode ttributes Name InnerText i pase ILLU Q1 bool Parse TmpzEMLHode ttributes Value InnserText break case 5 Old 2 Old bool ParseiTmpxHMLNode ttributes Value InnerText break case Ri old Rl Old bool ParseiTmpzHLHode A ttriburtes Value InnerText break fendregion Any FB has one code but separate static data for each FB instance When runtime kernel of pbsSoftLogic is calling a FB inside FB Code it will find Static data file by combination of FB Name Unique Identifier PID and Logic name string mPath TmpPath RS_ PID VSLEName Static data is any data that you want to keep its value when you return from function In RS FB sample Output signal Q1 old value of S and old value of R1 are static data Runtime kernel of pbsSoftLogic is using RamDisk and XML files for modeling static data file So any instance of a FB has one XML file in RAM Disk which all Static data will keep there pbsSoftLogic User Manual Solve Logic public static void RS List lt ohbject gt Obji ref Listtobject gt Objo 1 string TmpPatrh obji 0 ToStringd
18. string PID Obji 1 ToStringi i l string VSLEHMame Obji z ToStringil Read Inputs and define Variables wead Static data region Solve Logic 1f S true amp amp 35 Old falsej i ff Raising Edge detect for 5 nl TEVE H ifiiRl true amp amp R1 Old false i ff Raising Edge detect for Ri Q1 false H endregion Map Old Data Write Static data Write Outputs For RS FB when Raising Edge detect for S Q1 value will set to true and if Raising edge detect for R1 Q1 value will reset to false Because R1 raising edge detection is after s if both of them happened Q1 will be rest to false pbsSoftLogic User Manual Map Old data public static void ES Listcobjecr Obji ref Listtohject gt objo i string TmpPath obji 0 ToString string PID oObji 1 ToStrind string VSLEName Obj1 2 ToString ead Inputs and define Variables ead Static E alve Logi c reqion Map Old Data s Old 3 R1 Old Ri fendreqion Write Outputs S Old and R1 Old should map to S and R1 So S Old and R1 Old has value of S and R1 but for one cycle before pbsSoftLogic User Manual Write Static data Hregion Write Static data FileStream fs new FileStreamimPath FileMode Create amlLTextWriter w new zxmlTextWriter fs null Formatting Formatting Indented lndentation 5 w WriteZztartDbocumenti l WritesStartElsementi StaticData
19. 01 makefile 1 1 KB File 09 15 2013 01 objects mk 7316 mk file 09 15 2013 O12 seres mik 38BB mk file Do 15 2013 01 1 subdir mk 7238 mk file 00 15 2013 O12 Selected 1 Ale Total size 9 1 KB Server Local Ale Directio Remote file Size Priority Status Queuedflles Failed transfers Successful transfers 2 www pbscontrol com 7 files Total size 119 7 KB pbsSoftLogic User Manual 10 2 Lua UDF Development Lua scripting language is developed at 1993 by Roberto lerusalimschy Walder Celes and Luiz Henrique at university of PUC Rio Brazil http www lua org authors html For detail information about Lua please refer to www lua org For quick Lua introduction please visit http www inf puc rio br roberto talks ppl 2012 pdf In last 20 years Lua is used in many projects and devices TVs Samsung routers Cisco keyboards Logitech printers Olivetti set top boxes Verizon M2M devices Sierra Wireless calculators TI Nspire Wireshark Snort Nmap VLC Media Player LuaTeX Adobe Lightroom One million lines of Lua code Slashdot News for nerds Feb 1 2012 Wikipedia Chooses Lua as its new template language Lua is used in many game development environments as programming framework Corona SDK http www coronalabs com products corona sdk Gideros Studio http www giderosmobile com Moai http www getmoai com Love https
20. C SE NC 1 System information in monitor direction 70 End of initialization M El NA 1 System information in control direction lt 100 gt Interrogation command C IC NA 1 lt 101 gt Counter interrogation command C CI NA 1 lt 103 gt Clock synchronization command C CS NA 1 Basic application functions Station initialization Cyclic data transmission Spontaneous transmission Global Station interrogation Clock synchronization Command transmission Direct command transmission Direct set point command transmission Select and execute command Select and execute set point command Transmission of integrated totals Mode B Local freeze with counter interrogation Counter read Counter freeze without reset Counter freeze with reset Counter reset General request counter pbsSoftLogic User Manual Class IEC Supported two classes Class1 and Class2 From IEC870 5 101 standard The polling procedure is supported by the link layer which requests user data of classes 1 and 2 In general ASDUs containing the causes of transmission periodic cyclic are assigned to be transmitted with the link layer data class 2 and all time tagged or spontaneously transmitted ASDUs are assigned to be transmitted with the link layer data class 1 Other ASDUs with other causes of transmission of low priority such as background scan may also be assigned to data class 2 and must be listed in the interoper
21. FB in logic by pbsSoftLgic automatically Open FB properties window and find InstanceName and FBName By Default InstanceName and FBName has same value but if you change InstanceName to any unique name in logic pbsSoftLogic pbsSoftLogic User Manual will use InstanceName as unique Identifier and InstanceNane will pass as second item in Input Object list Obji 2 third item in Input Object List is always Logic name public static void FRS List lt ohject gt Ob ji ref Listcobject Obj ja i string TmpPath Oobji U0 ToString i l string FID Obji 1 ToStringd string VSLEName Obji z ToString i Hregion Read Inputs and define Variables bool 3 bool Parse obhji 3 ToStringdil bool Rl bool Parse O0bj1 4 ToStringt bool Qi false bool 5 Old false bool R1 Old false fendreqion E olwe Logi c Jerite Outputs i puts pbsSoftLogic will pass FB Input values from Obji 3 For example for RS Flip Flop value of S input is passed to Obji 3 and value of R1 is passed to Obji 4 You can have maximum 32 Input and 32 output port for each FB This is your responsibilities to change type of Inputs inside FB pbsSoftlogic is passing all values as object to FB Because we need to detect Rising edge of S and R1 signals so we must define two more variables S_Old and R Old Q1 is FB Output signal All Output Signals should be static pbsSoftLogic User Manual Read Static data
22. OPCExplorer pbsLagicSimulatar 3i VSFBEditor BE VSLE JE VSOPCClient me VSOPCSImu In VSStartup S Janus Datas dll S Janus Windows Commonse4 dll S Janus Windows GridExw4 dll S Janus Windows ULv4 dll luaS1 dll S Iua52 dll amp Lualnterface dll Northwoods Gao dll S Northwoods G0 Draw dll Narthwands Go Svg dl S Northwoods Go xmldll 5 phsL MP dll S phbs PC CIAPI dil S PBSOPCclient dll S phsOPCsraAPT dll S CNW hale Cammaon dll amp OWhale Editor dll amp OWhale Syntax dll amp OW hale syntax Parsers dll S OW hale Syntax schemes dll S WEOP C Svr dll ey VSFBEditor exe alobalSettings options Pea ee pbsSoftLogic User Manual 3 Basic concepts Writing logic for industrial automation plants and SCADA systems is a critical task It is not recommended to use low level language like c c and CH for such projects because of following reasons 1 Notreusable 2 Difficult to transfer project to others and train other engineers for continuing project 3 High risk in application runtime for stability and error free 4 Notfuture proof 5 Getting Long time for project development Function Block language is a language for control engineers They can focus on process logic without Worry about software part FB is full graphical language with many tested and ready functions inside Using function block language has following benefits 1 10096 reusable
23. There are many tested and ready functions that can be used in different projects with complete document 2 t is very easy to train Control and process engineers for using and programming 3 pbsSoftLogic is used in many projects and sites in last few years so there aren t error in the runtime and development environment 4 You can use pbsSoftLogic and Function block language as framework for whole your Automation Projects Life time of pbsSoftLogic will be 15 years minimum 5 Very easy and shortly you can develop process logic Simulate and load to controllers pbssoftLogic is an IDE for developing Function Blocks programs Simulate and downloading to Linux WinCE based controllers You can use Lua Scripting language for developing new FB All FB source code of pbsSoftLogic are open source Pea ee pbsSoftLogic User Manual 4 Function Block Programming Language Main element of a Function Block program is FB Function Block In Following you can see a few simple examples Example1 Pumping DRV IO 1 PMP1 STS RUM DRV DNP PUMPING DRV IO 1 PMP2 STS RUN In this logic two signals PMP1 STS RUN and PMP2 STS RUNare input to OR FB and Output will write to PUMPING Signal Example 2 Instance Power calculation DRV HMEINS POWER l 100 In Example 2 PM1 ActivePower is multiply by 100 PMP2 Activepower is multiply by 100 and both results will add together and will write to P
24. add m library to project E gt Resource Builders v C C Build Build Variables Discovery Options Environment Logging Settings Tool Chain Editor gt C C General Project References Run Debug Settings gt Task Repository WikiText Settings Cross Settings Libraries l v Cross GCC Compiler m Preprocessor Symbols Includes Optimization amp Debugging Warnings Miscellaneous v i Cross GCC Linker General amp Libraries amp Miscellaneous Shared Library Settings v Cross GCC Assembler General Library search path L amp ES oe pbsSoftLogic User Manual In project settings Miscellaneous enable Position Independent Code PIC Properties for 1EC11313 Settings T gt Resource Builders Configuration All configurations gt Manage Configurations v C C Build Build Variables bicomry Colis Tool Settings amp Build Steps Build Artifact Binary Parsers Error Parsers Envi Cross Settings Other flags c fmessage length 0 Logging v Cross GCC Compiler M verb Settings erbose v Preprocessor u Tool Chain Editor symbols _ Support ANSI programs ansi C C General Includes amp Position Independent Code PIC Project eden 8 Optimization in a Debugging gt Task Repository 8 warnings WikiText Miscellaneous v i Cross GCC Linker amp General Li
25. equivalent to if not x then x v end That is it sets x to a default value v when x Is not set provided that x is not set to false Another useful idiom is a and b or c or simply a and b or c because and has a higher precedence than or It is equivalent to the C expression a b c provided that b is not false For instance we can select the maximum of two numbers x and y with a statement like max x gt y and x or y When x y the first expression of the and is true so the and results in its second expression x which is always true because it is a number and then the or expression results in the value of its first expression x When X y is false the and expression is false and so the or results in its second expression y The not operator always returns a boolean value print not nil gt true print not false gt true print not 0 gt false print not not 1 gt true print not not nil gt false pbsSoftLogic User Manual Lua denotes the string concatenation operator by two dots If any operand is a number Lua converts this number to a string Operator precedence in Lua follows the table below from the higher to the lower priority A not unary 96 c D Lm RME PS and or All binary operators are left associative except for exponentiation and concatenation which are right associative Therefore the following expressions on the left are equivalent to tho
26. love2d or Codea http twolivesleft com Lua is fast small and very reliable Lua is an active project and worldwide accepted as scripting language So we selected Lua instead of ST as pbsSoftLogic scripting language for developing user defined Function blocks Lua Virtual machine is integrated to pbssoftlogic Linux Runtime kernel Version 1 5 and logic simulator We didn t include Lua in pbsSoftLogic windows Runtime because you can develop UDF by CH and no need for Lua We will use Lua for developing UDF for Linux based controllers and logic simulator pbsSoftLogic User Manual When you use Lua for developing UDF you don t need to use Linux cross compiler For developing Lua UDF you need to do following steps 1 Defining FB Input Output structure define UDF body This step is same as CH C UDF development 2 Write UDF script by pbsSoftLogic Lua Editor 3 Compile Lua source code for checking programming errors 4 Test Lua UDF by Logic simulator 5 Transfer Lua source code to controller We will compile Lua source code just for checking programming errors We do not transfer compiler code to linux controller When you transfer Lua UDF to controller it will transfer Lua UDF source code pbsSoftLogic Linux controller compiles Lua UDF source code when it load UDF pbsSoftLogic User Manual 10 2 Lua Language basics Lua is dynamically typed language There are eight basic type in Lua
27. output signal ou1 out2 Three static signal state dt inputiold o State shows current state of FB o dtis date time signal In Lua os time function returns seconds from 1 1 1970 When you compare current time with dt it shows seconds passed from dt o inputiold is used for detecting rising edge of input1 signal Read Static data 23 local fr io open TmpPATH NewLua FB TmpPID _ TmpLogic dat r 24 if fr nil then 25 while true do 26 line fr read 27 if line nil then 28 i j string find line 29i n string sub line 1l j 1 30 if n state then 31 state tonumber string sub line j 1 32i end 33 if n dt then 34 dt tonumber string sub line j 1 35 end 36 if n inputlold then 37 inputlold tonumber string sub line j 1 38 end 39 add more static variables here 40 if n varstatici then 41 varstatici tonumber string sub line j tl 42 end 43 if n outl then 44 outl tonumber string sub line j 1 45 end 46 if n out2 then 47 out2 tonumber string sub line j 1 48 end 49 Ali Output Variables should be Static 50 if n out3 then 51i out3 tonumber string sub line jti 52i end 53 else 54 break 55 end 56 end 57i fr close 58 end pbsSoftLogic User Manual In pbsSoftlogic static data is simulated by a data file In Controll
28. 0 User defined function block pbsSoftLogic has open structure for adding new Function block by user to platform User defined FB UDF has the same performance as internal FB in pbsSoftLogic There are two ways for adding new FB to pbsSoftLogic 1 Using CH for simulator and Windows Runtime and GCC Cross compiler for embedded linux 2 Using Lua scripting language In this section we will describe both solutions First solution is difficult and you need to develop C and C code for your FBand compile it by GCC under Linux OS Second solution is very simple and effective and no need to do any cross compiling for Linux kernel Lua www Lua org is one the most famous scripting language in the market and it is used in many projects and applications world wised pbsSoftLogic Linux runtime engine supports Lua Ver 5 2 2 which is latest version For learning Lua language please refer to www lua org web site pbsSoftLogic User Manual 10 1 CH and CUDF development Three steps are required for adding UDF to pbsSoftLogic 1 Defining FB Input Output structure 2 Writing CH code for simulator and Windows Kernel 3 Writing C Code for Linux Kernel and Cross compiling for embedded linux CH and C Source code of all internal FB are included in pbsSoftLogic You can use these source codes to make new FB and expand platform For Editing and compiling CH Codes pbsSofLogic has integrated professional CH editor and comp
29. 25et Input lt Desc lt Type gt bool lt Type gt zInit Falsez Init z Input lt Input gt zHame HBHiz Name zDesc Reset Inputz Desc zTyvpe boolz Type zInit Falsez Init lt r Input z InputList zxoutputList LOUC put lt Name gt O1 lt Name gt zDesc 01 Outputc Desc lt Type gt bool lt Type gt zInit Falsez Init lt Output gt lt OutputList gt lt FBDD gt lt FEDef gt pbsSoftLogic User Manual Open FBD directory and copy and paste one of existing FB Body files change its name to IEC11313 SR xml change its content as following z2xml wersion 1 0 7 gt zFBDetf zVersion 1 0 0z Version lt FRBDD gt lt Name gt SR lt Mame zDesc 5R Flip Flop lt Desc gt z ctive Truesez ictive lt Tnterface gt lt Interface gt lt InputList gt lt Input gt zMame 51 z Name zDesc 5et Input lt Desc gt zTyvpe boolz Type zInit Falsez Init lt r Input lt Input gt lt Name gt Rer Mame zDesc Reset Inputz Desc zTyvpe boolz Type zInit Falsez Init z Input lt r InputList gt lt OutputList gt lt Output gt lt Name gt O1 lt Name gt zDesc oi Outputzc Desc lt Type gt sbool lt Type gt zInit False c Init lt Output gt lt OutputList gt lt FEDD z FBDef pbsSoftLogic User Manual In this stage you can use IEC11313 group in SoftLogic Editor Close FBEditor and run it again You can see a new IEC11313 group is added to
30. 27 Chan 1 Change Source code of IEC11313 groups as following namespace IECII313 i public class Classi HarshalByRefOobject i public static void Es List lt ohject gt obji ref List lt object gt Chia public static void SR List lt ohject gt Obji ref List lt object gt Chia H H namespace name should be name of group IEC11313 Class name should be Class1 Donot remove MarshalByRefObject from code pbsSoftLogic User Manual Any FB Function has following format Public static void name of FB List lt object gt Obji ref List lt object gt Objo Change name of FB and do not change any other variables List lt object gt Obji list of objects that is passed to FB List lt object gt Objo list of output Objects that is return from Function All pbssoftLogic FB Source code has following format public static void RS List lt ohject gt Obji ref List lt object gt objal i string TmpPath bji ToStr ing string PID Obj1 1 ToString string VSLEName Obji z ToString il Read Inputs and define Variablez E olwe Logi d Weite Outputs i puts Obji O First item in Input Object List is always pbsSoftLogic Temporary path for reading and writing Static data of FBs Obji 1 second item in Input Object List is always Unique Identifier for FB Each FB instance has a unique identifier in logic Open FB properties window and find PartID PartID has always unique value for each
31. 7 armgg14 9 40 AM File Folder J Fblib F 1 2014 1 58 PM File Folder J Imp z71 f2014 12 11 PM File Folder E GetMacID 6 30 2014 7 59PM Application E license 72014 2 22 AM License F logic 71912014 9 46 AM C11 File F logic 71912014 9 46 AM CFG File m pslewin32RT Fi1Of2014 3 48 PM Application WT client dll 782014 1 05 PM Application extension pbsSoftLogic User Manual psleWin32RT exe is main application for kernel It should be in Windows Auto start routine Logic c11 compiled pbsSoftLogic Logic file Transferred by pbsSoftlogic Eng A Logic cfg compiled pbsSoftlogic Configuration file Transferred by pbsSoftlogic Eng License lic license file that is linked to MACID of Controller psleWin32RT exe will works for 30 min without License file GetMacID exe utility program for making license file You need to run getMaclD exe and send MacID to supplier for getting permanent license file Drvlib communication driver library A Fblib Function block implementation library c and Lua Lmp Logic monitoring protocol library WtClient dll main dll file for OPC DA2 0 client driver pbsSoftlogic is using FTP for transferring logic and configuration file to Controller So you need to install FTP server on target controller with Windows32 OS Install FileZilla server or use internal windows FTP Server services and define root user with root password Set C PSLERT as default path of FTP server f
32. AN Setting from Controller Write LAN Settings it will Write LAN settings to controller Read LAN Configuration it will read current ALN configuration fro controller For changing controller IP address 1 Read LAN Settings 2 Change IP address for each LAN port and other settings 3 Write New Settings to Controller Controller Stat tab Read CPU Information It will Read Hardware Information from controller pbsSoftLogic User Manual ag Project Options General Time Setting LAN Setting Stats License Kernel Processor FA525 rev 1 v4l Read CPU Info BogoMIPS 76 38 Features Sup half CPU implementer Ox66 CPU architecture 4 CPU variant 0x0 Read mem Info ee E F REEE CPU part Ox5S26 CPU rewision ae Read FlashInto Hardware Moxa CPU development platform Revision OOOO Serial O000000000000000 Free mem Usage Read memory information shows detail of memory usage of controller General Time Setting LAN Setting Stats License Kernel MemTotal 61116 KB MemFree 5626 kB Buffers 96 KB Cached 6626 kB awapcached 0 kB Active 4244 kB Inactive 4596 kB Active anon 1916 KBE Inactive anon O kB Active filel a20 kB Inactive filel 4596 kB Unevictahle 0 kB Mlocked O kB awapTotal O kB awapFree O kB Dirty 12 kB Writehback 0 kB AnonPages 1952 kB Mapped 23650 kB 2hmem O kB olab adis EE aBseclaimable 304 kB sUnreclaim alla kB Eernels
33. CP and IEC870 5 104 for communicating between two controllers pbsSoftLogic User Manual Defining OPC client Driver Open project setting page and right click on Driver list then select OPCCIient Driver pbsSoftLogic New Driver Driver DHP3HhMaster DHP3Slave Name IEC8705Master IECB7055lave IECB705 103Master Instance OPCClent OPCServer LOCAL 10 Make Driver d Select a unique name for driver and select driver instance You can connect to 8 OPC server on each controller in the same time Each OPC server connection should have unique Instace ID HA pbsSoftLogic New Driver Driver oPCClient Name sz oPc Instance h Make Driver Click on Make Driver Button pbsSoftLogic will make basic definition in your project pbsSoftLogic User Manual OPC client Driver pbsSoftLogic runtime kernel will connect to other OPC servers DA2 0 OPC Server Driver pbsSoftLogic runtime kernel will act as OPC Server and other client can connect to it In this part we will talk about OPC Client Driver m Options General Time Setting LAN Setting Stats License Kernel Driver List Name Path Type Enable 40 Div MO Div ModbusMaster mm Logic Scan Time ms 50 gt S7 OPC S7_OPC OPCCIent Controller WIN32 z Watch Dog Sec o 0 Disable Controller IP 1 27 o o 1 Controller RamDrive temp Path e temp pbsSoftLogic will make a new folder in project dir
34. Desc gt lt Value gt 3 lt Value gt lt Node gt pbsSoftLogic User Manual lt Node gt lt Name gt MasterlPAddress lt Name gt lt Desc gt MasterlPAddress lt Desc gt lt Value gt 127 0 0 1 lt Value gt lt Node gt lt Node gt lt Name gt TCPIPPort lt Name gt lt Desc gt TCPIPPort lt Desc gt lt Value gt 2404 lt Value gt lt Node gt lt Node gt lt Name gt MasterAddress lt Name gt lt Desc gt MasterAddress lt Desc gt lt Value gt 1 lt Value gt lt Node gt lt Node gt lt Name gt LocallPAddress lt Name gt lt Desc gt LocallPAddress lt Desc gt lt Value gt 127 0 0 1 lt Value gt lt Node gt lt Node gt lt Name gt PhysicalLayerScanTime lt Name gt lt Desc gt PhysicalLayerScanTime lt Desc gt lt Value gt 100 lt Value gt lt Node gt pbsSoftLogic User Manual lt Node gt lt Name gt lInstance lt Name gt lt Desc gt Instance lt Desc gt lt Value gt 1 lt Value gt lt Node gt lt Node gt lt Name gt COTZ lt Name gt lt Desc gt Cause of Transmition Size 1 2 lt Desc gt lt Value gt 1 lt Value gt lt Node gt lt Node gt lt Name gt CAOAZ lt Name gt lt Desc gt Common Address of ASDU Size 1 2 lt Desc gt lt Value gt 1 lt Value gt lt Node gt lt Node gt lt Name gt lOZ lt Name gt lt Desc gt Information Object Size Size 1 2 3 lt Desc gt lt Value gt 1 lt Value gt lt Node gt lt Node gt lt Name gt MODE lt Name gt
35. FBEditor and it has two Function Blocks File Edit Debug Project View Window Tools Help Olea x 8 e ol le E FBList m Comment InputSignal OutputSignal amp Math Timers Counters Logical Process t L2 L2 Drag and drop RS and SR Flip flops in a new application RS and SR Flip Flops are ready to use in any Function block application pbsSoftLogic User Manual Making CH Implementation of RS and SR Flip Flops Step1 make a new directory in VSLESrc named IEC11313 It should be the same name of Group Step2 Copy and paste one of existing FB group source code to IEC11313 directory You can use Timers directory class1 cs code Copy class1 cs file to IEC11313 directory Do not change Calss1 cs to any other name Step3 By Windows FB Editor Utility open VSLESrc lEC11313 class1 cs code SE pistone Char FE ein File Edi Search Tosh Cormpile QI Idosmmmw9 d s CaS T 4e IFEDCTI T ncc Explons xi E IT using System liming System Coal lece fens Gamer bes using Syares Ling I 3 j using System Text EJ using Jyst m XZml a uming Sysatem Io 7 O namespace 18011213 5 i EL public class Clas i MarshalByEefOb ect 15 i public static void FS Liscdobject gt bji ref Lisreobjecr Objoj ELET public static void ZE Listiohjasctr Obj1 ref Listzcbject Obja tine Cel Deretipton Lines 3
36. Group 3 4 Class Based on DNP3 Standard we have class 0 1 2 3 4 Class O means current value of tags without event buffering So if you put class O for a tag RTU is not buffering tag changes and every time master read tag RTU will send current value Class 1 2 3 4 there is no different or priority between different classes So if you put class 1 2 3 or 4 for a tag RTU will buffer all tag changes with time and will report to Master SCADA There is a cyclic buffer with 10 000 events for each DNP Type in RTU Address DNP3 tag address Al and FI are using same address range Log When set to 1 for DOB and AOB Tags RTU will keep last value of Set Point in internal memory flash and if you restart RTU it will use latest set points from Master SCADA RTU will check AOB and DOB changes every min and if it detect changes it will save them on internal flash memory Init Init Value of a tag lt Tag Name AITag7 Type AI Class 1 Init 0 Address 7 Log 2 lt Tag Name AITaqg8 Type AI Class 1 Init Address 8 Log 2 lt Tag Name CHTTaugl1 Type CHT Class 1 Init 0 dddress 1 Log 0 lt Tag Name CHTTaug2 Type CHT Class 1 Init 0 dddress 2 Log 0 lt Tag Name CHTTaug3 Type CHT Class 1 Init 0 dddress 3 Log 0 lt Tag Name CHTTaug4 Type CHT Class 1 Init 0 dddress 4 Log 0 lt Tag Name CHTTaug5 Type CHT Class 1 Init 0 dddress 5 Log 0 lt Tag Na
37. Logic User Manual Step6 Monitor your logic at Controller From project menu Select Connect to controller If your controller is connected to your development PC and runtime kernel of PSLE is installed on Linux WinCE Controller It will connect and your logic page color will change to green 44 pbsSoftLogic Function Edi File Edit Debug Project View Window Tools Help Delal E FBList Comment InputSignal OutputSignal Math 3 Timers OnTimer OffTimer PulseGen FS e wv Ou oN aN A J amp PulseGen2 RampGen QPulse RampGen 2 SinGen Counters amp Logical H Process From Project Menu Select Connect to controller Then Select Monitoring On pbsSoftLogic Function Edi File Edit Debug Project View Window Tools Help Ci co e Xele e cC 2 9 FBList Comment InputSignal OutputSignal Math Timers OnTimer OffTimer PulseGen PulseGen2 RampGen RampGen SinGen H Counters Logical H Process QPulse Small LED at top will start to blink and it shows that logic is in monitoring state Step7 Force signals Right Click on CNT BZTrue input Signal and select force pbsSoftLogic User Manual 4 pbsSoftLogic Function Block Editor File Edit Debug Project View Window Tools Help Darl tal lele o c s FBList Comment InputSignal OutputSignal Math amp Timer
38. MI Integration Enable Name Path Type Enable ID Drv 40 Div ModbusMaster Iv Logic Scan Time ms 500 PH Div PM Drv ModbusMaster V r Instance o Controller hd Watch Dog Sec o Disable Controller IP f 92 iD 68 o f 50 PC Drv Dead Time sec o pbsSoftLogic User Manual Right click on IO Drv and select explorer pbsSoftLogic will open IO Drv directory Three files are generated by pbsSoftlogic at this directory Options xml communication parameter Like Serial Port Baud rate ModbusBlocks xml Modbus Block Definitions ModbusTags xml Modbus Tags Definitions Edit options xml file You can set following parameters for ModbusMaster Driver Each XML node has a name Don t change it Desc Don t change it and Value Set based on Description Node lt Name gt PhysicalLayer lt Name gt lt Desc gt RS232 RS485 RS424 TCP lt Desc gt lt Value gt RS232 lt Value gt lt Node gt PhysicalLayer For Modbus RTU Select one of RS232 RS485 and RS422 For ModbusTCP select TCP lt Node gt lt Name gt COMPort lt Name gt lt Desc gt Serial Port for Communication 1 2 3 4 5 lt Desc gt lt Value gt 1 lt Value gt lt Node gt COMPort will be used for ModbusRTU protocol Node lt Name gt BaudRate lt Name gt lt Desc gt 9600 19200 36400 52700 115200 lt Desc gt lt Value gt 9600 lt Value gt lt Node gt BaudRate will be used for ModbusRTU protocol lt Node gt l
39. Nil no value default value of a variable before initialization Boolean has value false and true Number double precision floating point String sequence of characters like pbsSoftlogic userdata not used in pbsSoftlogic thread not used in pbsSoftlogic table will use for passing FB input outputs to Lua Tables are the main data structure in Lua Look at following samples a create a table and store its reference in a k x a k 10 new entry with key x and value 10 a 20 great new entry with key 20 and value great print a x gt 10 k 20 print a k gt great a x a x 1 increments entry x In pbsSoftLogic we pass FB input output values by Table In following figure you can see very simple pbsSoftLogic Lua function You should follow same structure for your UDF function fun3 Obji TmpPath PID SRAMPath SDPath are same for all FB Do not delete them local Objo TmpPATH Obji 1 TmpPID Obji 2 TmpLogic Obji 3 TmpSRam Obji 4 TmpSD Obji 5 read inputs inl tonumber Obji 6 in2 tonumber Obj i 7 define output signals local outl 0 local out2 0 read Static data Solev logic save static data write outputs Objo 1 tostring outl Objo 2 tostring out2 return Objo end pbsSoftLogic User Manual Obji input table to FB It contains all FB inputs The firs
40. P 192 168 1 100 Startadd L Count 64 wait 200 Enables True fr xBlock Name BOL Type BO slaveID 2 l Ip 192 168 1 100 Startadd 4096 Count 32 wait 200 Enables True gt lt Block Name AT1 Type AI slaveID l IP 192 168 1 100 Startadd 10 Count 8 wait 200 Enable True gt lt Black Name Diaql Type S YS slaverp2 l P 192 168 1 100 Startadd LO0 Count 8 wait LO0 Enable True s gt lt Block Name DI2 Type BI Slavelb L IP2 182 168 1 101 Startadd 1 Count 64 wait 200 Enable True gt zBlock Mame z po2 Types BO SlaveID2 l IP 192 168 1 101 Startadd 4096 Count 32 wait 200 Enables True gt lt Block Mame AIZ Type AI SlaveID l IP 192 168 1 101 Startadd 10 Count 8 wait 200 Enable True fr lt Block Name Diag2 Types svYs slavsID2 1 IP2 182 158 1 101 Startadd Lo0 Count 8 wait 100 Enable True s gt lt Block Name DI3 Type BI slaveID l IP2 182 168 1 102 Startadd 1 Count 64 wait 200 Enable True gt lt Blaock Mame z pos Type BO slaveID l IP 132 168 1 102 Startadd 4096 Count 32 wait 200 Enables True gt lt Block Mame AIS Type AI SlaveID l P 192 168 1 102 startAdd l0 Count 8 wait 200 Enable True fr lt Block Name Diag3 Types svYs slavsID2 l IP2 182 1568 1 102 Startadd Lo0 Count 8 wait l 00 Enable True s gt lt fOPCSrvTaqs gt Modbus Master Driver is polling Devices based on Modbus Block Fi
41. R NI 151 mslave DOTag1 dnps AOBTag1 iec_drv DOTag1 pbsSoftLogic User Manual 14 OPC Client Driver Configuration for Win32 Target pbsSoftlogic Version 1 7 supports Windows 32 Target the same way as Linux and wince target There are two windows32 runtime kernels for pbsSofLogic Runtime kernel that is based on OPC standard VSLE exe we named this kernel PCWIN32 in project setting This is pure Dot Net Kernel and is developed by C VSLE exe is mostly used for Subsystem integration based on OPC technology Runtime kernel that is compiled from Linux and wince kernel c source code for win32 This is high performance kernel and can be used as PLC RTU applications on embedded Win32 controller We named this kernel WIN32 in project setting This part is talking about Win32 runtime and how we can use it Win32 Kernel is just based on driver concepts and it has following drivers built in Modbus RTU TCP master Slave DNP3 Master Slave IEC870 5 101 104 Master Slave IEC870 5 103 master OPC client Driver OPC server Driver O O O O Open API Driver for C interfacing with runtime kernel Download latest Win32 target from www pbscontrol com Unzip it on any drive in your controller Suppose we unzipped kernel on C PSLERT Directory er Windows OS C PSLERT 3 Search P k Help brary Share with New Folder J ow Name gt Date modified Type Siz J dr vlib
42. Settings 1 Changing Time Zone and current Time of Controller Linux Kernel 2 Changing LAN Configuration of Controller Linux Kernel 3 See status of controller Linux Kernel 4 Defining Communication protocols for logic 5 Setting Controller scan time IP address controller Type and Watch dog parameters 6 Deleting Controller Logic and Configuration 7 Reset Controller 8 Shutdown Controller Kernel Linux Kernel 9 Set Startup parameter in Controller Linux Kernel pbsSoftLogic User Manual Step4 Compile Logic From project menu Select Compile It will show error list of your logic if there are errors in logic Alagi Futon Bock eiiis f hi al aj Fic tia E Pie Edit Debug Propert View Window Tools Help Compiled logic is an XML file with the same name of Logic but with extension c11 So your compiled file for APP1 Logic is APP1 c11 Stepb Transfer Logic and configuration to Controller Logic and Configuration files are transferred by FTP to controller so no need to be connected to controller for transferring logic and configuration From Project menu select Transfer Logic It will transfer your compiled Logic to Controller From Project Menu Select Transfer Configuration It will transfer App1 Ix file to controller When Configuration is transferred completely it will show Configuration Transferred Message box Reset Controller from Setting Page pbsSoft
43. Srack 3lz KB PageTables 172 EB pbsSoftLogic User Manual Read Version Read Controller Linux Version GCC compiler version General Time Setting LAN Setting Stats License Kernel Linux version 2 6 38 8 root imoxa gcc version 4 4 2 GCC 43 Fri May 24 17 45 53 CST 2013 Read CPU Info Read Version ReadFlash Info Free mem Read Flash Information O Project Options General Time Setting LAN Setting Stats License Kernel Filesystem 1k hlocks Used Available Uses Mounted on Read CPU Info rootfs 5532 7824 1008 893 fdev root mta pei 7o24 1008 894 T een TEE dev ram3 1003 g 943 18 dev dev ram 459 21 453 4 yar fdev mtdb locks 5120 812 4308 165 tmp RE ETIN fdev mtdb locks 5120 Biz 43308 16 home dev mtdbalack3 5120 Biz 4308 16 etc tmpfs 14746 14746 Os dewv shm dev rami 15863 3 15041 D var ramdisk Free mem Usage m af E Jn Eu Ld pbsSoftLogic User Manual Read Free Memory ag Project Options General Time Setting LAH Setting Stats License Kernel total used free shared butters Read CPU Info Mem 29500 15744 13756 o 2148 SWan 0 oO Total 29500 15744 13756 Read mem Info Head Version Read FlazhInfo Free mem Usage Usage this is equal to top command in linux ad Project Options General Time Setting LAN Setting Stats License Kernel He JMem 16116K used 13384K free OK s
44. ability document In this case it has to be considered that the link request of class 1 occurs at a different point of time to or from the link request of class 2 which may influence the correct sequence of the ASDUS delivered to the application layer of the controlling station In response to a class 2 poll a controlled station may respond with class 1 data when there is no class 2 data available Init IEC Tag Init Value Address IEC Tag Address Log When set to 1 for DO AO FO and DPO Tags RTU will keep last value of Set Point in internal memory flash and if you restart RTU it will use latest set points from Master SCADA RTU will check AO DO FO and DPO changes every min and if it detect changes it will save them on internal flash memory lt lag Name riragbo i1yDe ri 1as2 i1 i1nir u ad dresz ne Log u gt Tag Name FITag7 Type FI Class 1 Init 0 Address 7 Log 0 lt Tag Name FiTag Type FI Class 1 Init 0 Address 8 Log 2 lt Tag Name CHTTagl Type CHT Class 1 Init 0 Address 1 Logs 0 lt Tag Name CHTTag Type CHT Class 1 Init 0 iddress 2 Logs 0 lt Tag Name CHTTag3 Type CHT Class 1 Init 0 Address 3 Log 0 lt Tag Name CHTTagd Type CHT Class 1 Init 0 iddress 4 Logs 0 gt lt Tag Name CHTTag5 Type CHT Class 1 Init 0 Address 5 Logs 0 lt Taq Name CHTTag 6 Type CHT Class 1 Init 0 iddres
45. ame AITad6 Type AI Init 0 Address 6 Log 0 gt lt Tag Mame AITad Type AI Init 0 Address 7 Log 0 gt lt Tag Mame AITadS Type AI Init 0 address 8 Log 0 gt lt Tag Mame poTadl Type DO Init O address 1 Log 0 gt lt Tag Name DOTaq2 Type po Init O address 2 Log 0 gt lt Tag Mame poTad3 Type Dpo Init 0 Address 3 Log 0 gt lt Tag Name DOTaqg4 Type DO Init 0 Address 4 Log 0 gt lt Tag Name DOTaq5 Types Dpo Init 0 Address 5 Log 0 gt xTag Name DOTage Types po Init 0 Address 6 Log 0 gt lt Tag Mame poTag Type DO Init 0 Address 7 Log 0 gt lt Tag NMame poTagBS Type po Init 0 Address 8 Log 0 gt Tag Mame AoTagl Type 40 Init 0 address L Log 0 gt lt Tag Mame AoTad2 Type 40 Init 0 address 2 Log 0 gt lt Tag Mame AoTad3 Type 40 Init 0 address 3 Log 0 gt lt Tag Name 40Taq4 Type 40 Init 0 address 4 Log 0 gt lt Tag Mame AoTad5 Type 40 Init 0 address 5 Log 0 gt lt Tag Mame AoTad6 Type 40 Init 0 address 6 Log 0 gt lt Tag Mame AOTad Type 40 Init 0 Address F Log 0 gt lt Tag Name 407Taq8 Type 40 Init 0 Address 8 Log 0 gt lt fOPCSryTaqgs gt Each Modbus Tag has following properties Name Unique Modbus Tag Name pbsSoftLogic will read this names and you can use Tags name in your logic Type Tag Type all Input Types must be writ
46. an separate Modbus Network to two or three separate network ModbusTags xml All Modbus Tags will define in this file FEEditor used this file for accessing tags Modbus Tag has following format In ModbusTags xml file Tag SlavelD 1 BlockName DI1 Address 1 Name DITag1 Tag SlavelD 1 BlockName DI1 Address 2 Name DITag2 lt Tag SlavelD 1 BlockName DI1 Address 3 Name DITag3 gt Tag SlavelD 1 BlockName DI1 Address 4 Name DITag4 gt Tag SlavelD 1 BlockName DI1 Address 5 Name DITag5 Tag SlavelD 1 BlockName DI1 Address 6 Name DITag6 gt Tag SlavelD 1 BlockName DI1 Address 7 Name DITag7 Tag SlavelD 1 BlockName DI1 Address 8 Name DITag8 SlavelD Slave ID You need to put it SlavelD here for faster access of FbEditor Blockname Same Block name in ModbusBlocks xml pbsSoftLogic User Manual Address Modbus Tag Address Start from 0 No need to Write like Modbus Format like 10001 Just write address of Tag Name Modbus Tag Name SlavelD Tag Name should be unique for Modbus Master Driver For All other salve drivers Modbus DNP3 and IEC8705 Tag Name should be unique For Diag Block you need to define following tags lt Tag SlavelD 1 BlockName Diag Address 100 Name OnLine gt lt Tag SlavelD 1 BlockName Diag Address 101 Name sendNum gt Tag SlavelD 1 BlockName Diag Address 102 Name RecNum Fi
47. and logic to controllers Monitor Logic at runtime and update logic TCP IP y UNO 1110 UNO 1019 Controller Controller I O Modules ECU 1911I For update version of pbsSoftLogic please visit www pbscontrol com Current Version 1 7 0 Date July 2014 NN pbsSoftLogic User Manual Supported and tested Hardware 1 ECU 1911 with WinCE5 0 2 UNO1019 with WinCE5 0 3 A240 with embedded Linux 4 UC7112 Plus with embedded Linux 5 W406 with embedded Linux 6 APAX5522LX with embedded Linux WinCE 7 UNO 1110 with windows CE 6 0 8 Any PC based controller with windows 32 OS 2 pbsSoftLogic installation pbsSoftLogic Eng is running on following Operating systems WindowsXP Windows Vista windows7 Windows Server 2008 and windows Server 2010 You need to install Dot Net Frame 3 5 on your machine for proper operation of pbsSoftLogic You can download pbsSoftLogic from http www pbscontrol com download html Simply unzip PSLE rar file and run VSFBEditor exe pbssoftLogic files and directories FBCSEditor exe User defined Function block editor for Windows and simulation Target OPCExplorer exe OPC Configuration file for connecting to OPC servers with Windows Target pbsLogicSimulator exe Logic Simulator VSFBEditor exe Main Application for developing Function block projects VSOPCClient exe OPC configuration runtime for windpws Target Please refer to user manual of pbsSoftlogi
48. arch Tool Compile cl H BARA Li LN Messager Evert Log bre Ca Dacin Source code of Lua UDF is at PSLE LuaSrc directory You can define Lua functions and Lua Function Blocks in pbsSoftLogic Lua Function Function Without static data Lua Function Block Function With Static data pbsSoftLogic User Manual In Lua FB Editor execute New Lua Function from File menu It will make NewLuaFun Lua file at PSLE LuaSrc directory Lua FB Editor will make NewLua_Fun function as template for Lua Functions 1 function NewLua Fun Obji 2 Lua Function Function without static data There is no memory in function code 3 local Objo 4 Define Output Variables 5j local out1 0 6 local out2 0 7 add more output variables here 8 Define Intrnal Variables 9 Read Input variables 10j Inputl tonumber Obji 6 11j Input2 tonumber Obji 7 12 add more input variables here 13 Solve Logic 14 Write your logic here 15j outl Inputl Input2 16 out2 Inputl Input2 17 Write outputs 18 Objo 1 tostring outl 19 Objo 2 tostring out2 20 return Objo 21 end There is no memory in Lua Functions Input signals will pass to function and output values will calculate based on current value of inputs At following figure we calculate x 2 Y 2 0 5 function fun3 Ob ji Lua Function Function without static data There is
49. braries Miscellaneous Shared Library Settings v B Cross GCC Assembler amp General RestoreDefaults Apply OK cancel Open MainlEC11313 c source code in eclipse Change name of UpCounter functions to RS and DownCounter function to SR Any C FB has following format void RS pbsObject Obji pbsObject Objo Don t change function format and just change name of function to SR and RS obji is list of all inputs to function objo is list of all FB outputs pbsSoftLogic User Manual In Linux kernel first FB input is passed by index 5 of obji int S 2 Obji 5 dvalue void RS pbsObject Obji pbsObject Objo char TmpPath 64 char PID 32 char ProgName 32 char TmpSRamPath 64 char TmpSDPath 64 int S Obji 5 dvalue int R1 Obji 6 dvalue Index 0 to 4 is used for passing system data for reading writing static data strcpy TmpPath Obji 0 strvalue strcpy PID Obji 1 strvalue strcpy ProgName Obji 2 strvalue strcpy TmpSRamPath Obji 3 strvalue strcpy TmpSDPath Obji 4 strvalue Read Static data FILE m db DBStruct db elem char TmpStaticDataPath 128 strcpy TmpStaticDataPath TmpPath strcat TmpStaticDataPath RS sircat TmpStaticDataPath ProgName sircat TmpStaticDataPath sircat TmpStaticDataPath PID strcat TmpStaticDataPath dat AAA AAA pbsSoftLogic User Manual Reading Static data m db fopen T
50. c with Windows Target pbsOPCSimu exe OPC server simulator VSLE exe Runtime engine of pbsSoftLogic for windows Target VSStartup exe Startup application for windows Target This application is running all required OPC Clients and servers based on a predetermined sequence at startup of Windows Controller pbsLMP dll Logic Monitoring Protocol will use for Logic monitoring in Linux Controller options xml basic options of pbsSoftlogic cfg Directory basic definition of Function blocks OPC simulator and startup sequence doc Directory user manual of pbsSoftlogic OPC Directory saved OPC Configuration files by OPCExplorer exe application LuaSrc Directory Source code of Lua Function blocks CSrc Directory Source code of C Function blocks Pea ee pbsSoftLogic User Manual Timezone Directory Time Zone file for Linux controller VSLE Directory default developed application with pbsSoftLogic you can put application and its deriver at any location VSLELib Directory inside Function blocks implementation by C language Compiled source code VSLESrc Directory Source code of Function block implementation by CH Language NN pbsSoftLogic User Manual IO Drv J License J linus J Lua5rc H OPC J ru J schemes J target J Temp di Timezone m uk di VSLE Ju VSLELib Ju VSLESIC amp amp FBCSEditor amp FBLuaEditor uc ili
51. ck on finish button Copy paste one of existing source code from CSrc directory to new project directory Suppose you will copy counter source file MainCounters c to IEC11313 directory Rename MainCounters c to MainlEC11313 c Select IEC11313 project in eclipse and refresh project to include MainlEC11313 c file to project pbsSoftLogic User Manual There is include directory in CSrc folder that need to be included to IEC11313 project open project properties in eclipse and add Include directory path to project gt Resource Builders v C C Build Build Variables Discovery Options Environment Logging Settings Tool Chain Editor gt C C General Project References Run Debug Settings gt Task Repository WikiText Settings Configuration Release Active Tool Settings Build Steps PBuild Artifact Binary Parsers Error Parsers Cross Settings v B Cross GCC Compiler Preprocessor Symbols Includes Optimization Debugging warnings Miscellaneous v i Cross GCC Linker General Libraries Miscellaneous Shared Library Settinas Include paths I Include files include home kamjoo Documents pbsLX include Manage Configurations puse Cancel Select release mode as active mode in manage configuration Add include directory for Debug and release configuration If you use GCC mathematical library in UDF you need to
52. d Windows Runtime Kernel Open FB header file from File menu and select open FB Header It will open FBDefh xml file TTT arti a E pinContied CSharp FB mac File Edi Search Tools Cornpile 3DetailName ViFIHD Timers Jin amp n xmli Detailhsme Hber Page Setup Close Code Explorer fr ZEII a756 G Eran Eka Jae Ccounrers Name lag lt beserClodbter Groupa ledit Ei Chek ees Te eee ke bu 8B FALSE 12410 FEDE z amp z zNnme flpCounrer c Name 203 spet ilhame FDDicount amp r B U pCounker xmli Detaillame RA z TBDc Y 2 amp 5 Li FE De 226 z Name DomwncCounr er Mae zd Deta ilN amp me VFBDi Counters Dawncounter xmic Detailkame zem zi FEDSES r89 Jagg lt FRLigec gt lei lt GP Gt pt iei re fr gupp 254 Nase Logical Nese 255 zbesc Logic amp lc Dezr FIT tActiver TEuRi Rhctiver 3897 FAL iag ET Line 206 Char 31 FBDefh xml file contains all pbsSoftLogic FB header internal and UDF For each FB group there is a Group Tag in FBDefh xml file with following format lt Group gt Nane gt Counters lt Name gt zDesc Counter Groups Desc z ctive Truez ictive ZFBLhist ZFBDef zHame UpCounter Namse zbetailName FBD Counters UpCounter xml lt DetailName gt z FBDef zFBDetf lt Name gt DownCounter lt Name gt lt DetailName gt FED Counters DownCounter xml lt Deta
53. de gt RTU DNP3 Address pbsSoftLogic User Manual lt Node gt lt Name gt MasterlPAddress lt Name gt lt Desc gt MasterlPAddress lt Desc gt lt Value gt 10 0 0 11 lt Value gt lt Node gt DNP3 master SCADA IP address lt Node gt lt Name gt TCPIPPort lt Name gt lt Desc gt TCPIPPort lt Desc gt lt Value gt 20000 lt Value gt lt Node gt TCP Port for using in TCP Connection by default it is 20000 lt Node gt lt Name gt MasterAddress lt Name gt lt Desc gt MasterAddress lt Desc gt lt Value gt 1 lt Value gt lt Node gt DNP3 Master SCADA Address lt Node gt lt Name gt LocallPAddress lt Name gt lt Desc gt LocallPAddress lt Desc gt lt Value gt 10 0 0 10 lt Value gt lt Node gt Controller LAN Port for communication with master SCADA pbsSoftLogic User Manual lt Node gt lt Name gt PhysicalLayerScanTime lt Name gt lt Desc gt PhysicallayerScanTime lt Desc gt lt Value gt 100 lt Value gt lt Node gt lt Node gt Name lInstance Name Desc Instance Desc Value 1 Value Node Driver instance number 1 2 3 4 lt Node gt lt Name gt TCPIPMode lt Name gt lt Desc gt 0 TCP Listening End Point 1 UDP endpoint 2 TCP Dual End Point lt Desc gt lt Value gt 0 lt Value gt lt Node gt lt Node gt lt Name gt AppFrameSize lt Name gt lt Desc gt AppFrameSize lt Desc gt lt Value gt 2000 lt Value gt lt Node gt
54. different instance number Look at following example IA240 should connect to I O Modules and Power monitor network by two different Modbus Master networks Oncell 2111 IA240 GSM GPRS Modem Controller EN hin e CELL r Li y 7 i gt LJ ModbusTCP ModbusRTU RS485 DNP3 IEC870 101 RS232 ModbusRTU RS485 ee AUT 7 WE Master Pa Instance 1 N Name O_Drv w Power Meters Drives ModbusRTU RS485 Soft Starters Master Instance 2 Name PM Drv Physical I Os Pumps status commands Inlet Outlet pressure Inlet Outlet flow meter Duty Levels level transmitter Duty Selector switch Configuration for Modbus Master Driver for I O Modules 9 pbsSoflogie New Driver M MedbusMaster flo Dry Instance I pbsSoftLogic User Manual Configuration for Modbus Master Driver for Power Monitor Devices ai pbsSoftLogic New ee ModbusMaster PM_Drv Instance Click on Make Driver button pbsSoftlogic will make separate directories with same name of Driver at logic path J IO Orv 1 25 2013 9 41 AM File falder J Ph Dr 1 25 2013 9 44 SM File falder 2 appl 7 23 2013 8 00 PM C11 File 1KB appi T 256 2013 8 53 AM CFG File 2 KB Ej appi 1 26 2013 6 53 AM LX File 1 KE appi 1 23 2013 9 56 Ph XML File 1 KB Following items are adding to Driver list in setting page General Time Setting LAN Setting Stats Driver List pbsH
55. drivers like modbus you need to add Modbus scan time to logic scan time to calculate real scan time of whole IO and logic Controller RAM Driver Temp Path pbsSoftLogic runtime kernel is using files for keeping static data of Function blocks Because at each scan runtime kernel is open read and write static data to files so it is too much better to use ram drive for saving static data files You can download very professional and free RAM Disk Driver from http memory dataram com products and services software ramdisk Web Site We tested Data ram disk in many projects and it is 100 compatible with pbsSoftLogic pbsSoftLogic User Manual Controller IP you can use PC based controllers like UNO 1150 UNO 1170 and use separate laptop for programming Then you need to set PC Based controller IP here When programming PC and controller PC are same then you can use 127 0 0 1 as Controller IP Programming Station pbsSofLogic Eng IP 192 168 0 5 PC Based controller PC Based controller UNO 1170 UNO 1170 IP 192 168 0 10 IP 192 168 0 11 PSLE Win32 Target PSLE Win32 Target FTP Server FTP Server In above sample we used two UNO 1170 as controllers and one station as programming station You need to make two separate project for each UNO 1170 If you need to pass data between controllers then you can define modbas TCP master on one controller and Modbus TCP slave on another controller You can also use DNP3 over T
56. e 70 outl 1 71 out2 Input2 72i else 73 outl 0 74 out2 D 75 end 76 else 75 outl 0 78 out2 0 79 end 80 inputlold Inputl 81 Save Static data 82i local fw io open TmpPATH NewLua FB TmpPID _ TmpLogic dat w 83 fw write state tostring state n 84 fw write dt tostring dt n BS fw write inputlold _ tostring inputiold n 86 fw write outil tostring outl n 87 fw write out2 tostring out2 n 88 fw close 89 Write outputs 90 Objo 1 tostring out 1 91 Objo 2 tostring out2 92 return Objo 93 end pbsSoftLogic User Manual After reading input signals and static tags you need to solve your logic Always remember that your logic is executing many times in a second For detecting rising edge or falling edge of a signal you need to compare current value of signal with value of signal at last cycle if Inputl 1 and inputlold then dt of time fi save start time here state 1 end Input1 is current value of signal and input1Old is last value of signal At end of function block always you need to map current value of signal to old value inputlold Input 1 Normally function block is in a specific state at each cycle So you need to define state static tag and set its value by input signal changes or internally in the function block In above example when there is r
57. e Edt Debug Project View Window Toul Help Olas eed m es os eo When an Input Port is not connecting to any signal it will take default value that is preset for each FB you can change FB Input Default values Click on InputSignal which is connected to Trg Input of PulseGen FB Click on OPC name and change it to CNT Constant Click on SignalName and write B True Click on OutputSignal that is connected to Q Output of PulseGen FB pbsSoftLogic User Manual Change OPC name to LNK Link Click on SignalName and Write any name you want Like QPulse LNK is like internal tag in Logic and you can have any number of internal Tags Save you logic Click on save Button at top Make a new Directory in C PSLETest APP1 and save your logic with app1 name inside APP directory At bottom part of Editor you can see full path and name of your logic pbsSoftLogic Functic ACL a File Edit Debug Project View Window Tools Help InputSignal OutputSignal Math zi Timers OnTimer OffTimer PulseGen PulseGen2 RampGen RampGen SinGen amp Counters Logical H Process CAPSLEtest APP1 app1 xml Step2 simulate your logic pbsSoftLogic User Manual From Project menu select Simulation You will see following page 9 pbscontrol SoftLogic Simulator C PSLEtest APPi a Inputs FB Instances Comments Links Search Logic Statu
58. e you are controlling a Pump by Drive1V2 FB By changing FB Instancename to Pumpi1Mng Compiler will use Pump1Mng as identification of FB at compile time By default it is using PartID property which is always unique in the logic pbsSoftLogic User Manual Primary Selection igz A es 2 El Destinations I Northwoods Go GoNodeNo ExeSeq 230 FBGroup Process FBName DrivelV2 First Northwoods Go GoListGrour GoObject VSFBE ditor InfoN ode8 Header Northwoods Go GoGroup f Icon Northwoods Go GoL istt Image HMEPUMP1 ENABLE InputListN ame Collection InputPortNum 9 InstanceName PumplMng Northwoods Go GoT ext Pump Manage I M Northwoods Go GoGeneralt aan z LeftPortsCount 3 Links Northwoods Go GoNodeLinl Nodes Northwoods o GoNodeNo EN Observers Northwoods Go GoCollectior DRV_IO 1 _CMD DutputListN ame Collection DutputPortNum 5 k Ports Northwoods Go GoNodePor s h RightPortsCount 5 H DRV_HMI PUMP1_CMD Shape 1 SourceLinks Northwoods Go GoNodeLinl Sources Northwoods Go GoNodeNor StaticT agslD i x Text DriveV2 DRV DNP PT FAILED ToolTipT ext InstanceName FW IRE FAITE OEIRATLTYTIE AAS FANCA TA You can browse logic by FB Instance name from Debug menu FB Instance List item By Double clicking on Instance name Logic will focus on that part HMEPUMP1 ENABLE Pump1 Manage j DRV RV IO 1 PMP1
59. eEndElementi OPCTagMode 5 8 4 4 WriteEndE lement 7 Staticbata w Close fi fendreqion pbsSoftLogic User Manual public static void SE Listzobjectr Ob Ji ret Listtobject gt Obja i string TmpPath Obji O0 ToString i string PID Ohbji 1 ToStringi l string VSLEMame Obji sz ToString i Read Inputs and define Variables Read Static data Bolve Logiq Map Old Data Write Static data reqion Write Outputs Oh 70 Adda ol Zendregion pbsSoftLogic User Manual In this stage you can compile IEC11313 group Select Make FB from Compile Menu FB compiler will make IEC11313 dll file at PSLE VSLELib Directory meme rie Search Teal Compile Gu 2 OHA e Hae IEC Epler NTA TPR i 9 hsiLs object Obj ne Loio Obr 8 ad Ura t mA Umit I ae Syre l S i Namespace IEC11313 I using Syetem Cel Lections Gener ici 5 9 Oa Canl 3 using Sytem Ling E 4 using System Tent Methodi SR 5 using System fel amp using Jystem lo r amp fo nesespace 18011515 a i 10 punlic class Classi Narsbealbyfet bject ii 1 132 13 publie static void PS List cob ecr 0bj1i ref Listucobjeec Obie ict et if public static void Z2niListsobject QObji ref Listsabject CObjal 239 24a 241k zac Massaga Event beg Le Ce Deepens Succerstuly complesd For testing RS and SR functio
60. ectory with same driver name wins Ge Computer Windows 05 fC pbsControl PSLE V5SLE wind File Edit view Tools Help Organize Include in library Share with New Folder HE E 7 yr Esunrtes Name gt Dake modified Type Size EE Desktop i HMI OPC 7 9 2014 9 46 AM File Folder f amp SkyDrive 1 IO Dry 6 30 2014 8 23PM File Folder iCloud Photos Wb 57 orc 7 9 2014 2 06 AM File Folder m Downloads y Sg Recent places win3z FI92014 9 46 AM C11 File ia win3z 7112014 7 55 AM CFG File Libraries a win3z 792014 9 46 AM Lx File ES Documents win32 Filif2014 7 19 AM AML Document al Music i Pictures BE videos jE Computer E windaws7 OS C cow Local Disk E o CD Drive 4 Inside S7 OPC directory you can see OPCTags xml file we will keep all parameters and tags inside OPCTags xml file For making OPCTags xml you should use pbsSoftlogic OPC configurator utility at Tools menu Ed pbsSoftLogic Function Block Editor win32 xml a File Edit Debug Project View Window Tools Help Ba x5 a rs T OPC Configurator olea Re oe L A Windows FB Editor E FBList Lua FB Editor Comment InputSignal OutputSignal Math Timers Counters Logical Process H IEC11313 H LuaUDF H LuaPumpMng S7 OPC Numeric Sine Selected OPC server Tags OPC configuration parameters Defined OPC configuration files Tags Selected Tag Para
61. en click on Comment and change its content Comment is like a dynamic size yellow text box Duty Mode calculation 1 e e 1 JRV 1O 1 DTY SEL POS 1 By selecting comments items from Debug menu you can see list of all Comments in the logic By Double click on any comment logic will focus there and you can easily browse all logic by comments bsSoftogie Function Block Editor wg file fdr Oebug Project View Window Tool Help Olea ele olla InputSignal OutputSignal Math i Timers Counters Logical Process RHS L f DRV DNP P1 CONSTANT OFF Hn DNE ING DRV ONP P1 CONSTANT ON oe ac rm DAY ONP P2 CONSTANT OFF ORV_IO T DRV_ONPP1_CONSTANT_ON DRV_ONP P1 CYCLING DRV DNP P1 MAINTENANCE ALM DRV DNP P2 MAINTENANCE ALM Duty Macie cafcutalion J PUO imb en wae DRV e eros i mum P2 Cussert Scale and Watch D xL rv DAY 10 PMP1 INHIBIT SGML SEL er Pure a NN 3 IM i Manage DAV 10 PMP2 INHIBIT SGML MAP DNP Signal fo P1 MAP ONP Signal for PZ MAP PI Faut and status to ONP MAP P2 l auk and status to DNP DEWA GEN Statut Map to ONP pbsSoftLogic User Manual Function Block Programming Rules 1 FB Inputs Left side always connect to one source You can connect one source I O Signal Internal Link Tag and Constant to different FB Inputs But Multiple Source to One FB Input is not valid 2 FB Outputs Right Side can be connecting to diff
62. er Open project setting Right click on driver list Select New Driver Select DNP3Slave as Driver type Type a unique name for Driver name Select unique Instance for driver General Time Setting LAN Setting Stats License Kernel Driver List Logic Scan Time ms Instance Controller WatchDog Sec Controller IP PC Drv Dead Timefsec Rese a Delete Controller Delete Logic Configuration Set Startup Click on make driver button pbsSoftLogic will make option file and DNP3 Slave tags files and will make a new directory with the same name of Driver name in logic path Options xml define communication parameters DNP3Tags xml define dnp3 tags pbsSoftLogic User Manual Options xml parameters lt Node gt lt Name gt PhysicalLayer lt Name gt lt Desc gt RS232 TCP lt Desc gt lt Value gt TCP lt Value gt lt Node gt You can select physical layer between RS232 and TCP lt Node gt lt Name gt COMPort lt Name gt lt Desc gt Serial Port for Communication 1 2 3 4 5 lt Desc gt lt Value gt 2 lt Value gt lt Node gt Controller Serial port for RS232 Communication lt Node gt lt Name gt BaudRate lt Name gt lt Desc gt 9600 19200 36400 52700 115200 lt Desc gt lt Value gt 19200 lt Value gt lt Node gt Communication baud rate lt Node gt lt Name gt SlaveAddress lt Name gt lt Desc gt SlaveAddress lt Desc gt lt Value gt 3 lt Value gt lt No
63. er ram disk If Logic scan time is set to 500 msec then every second whole logic will execute for two times For each function block we have one static data file which is located on ram disk Because static data files are located on ram disk so continues read write of static data files will not make damage on controller and we will not lose system performance Static data file name is generated from function Block name function block unique ID and logic name Function Block Unique ID TmpPID and Logic name TmpLogic are passed by pbsSoftLogic Linux kernel to function block In Static data file name you need to change function block name to your UDF name For above FB Static data file is as following figure Etate 0 dt 13 79658085 inputialcdz nutlz put 4 0 Weread static data file line by line and find value of static signals and initialize static data tags at beginning of FB Always consider output signals as static and save their values in static data file Normally output signals are not calculated in function block at each cycle so you need to use old value of output signals in current cycle 59 Solve Logic 60 Write your logic here 61 if Inputi 1 and inputiold 0 then 62 dt os time save start time here 63 state 1 64 end 65 if Inputl 0 and inputlold 1 then 66 state 0 67 end 68 if state 1 then 69 if os time dt 10 then compare current time with start tim
64. erent Signals Not Constant Signals 3 There is no limitation on number of FB interconnections level 4 Logic execution each FB has an Execution number Click on FB and press F4 you can see FB properties window Scroll properties to find ExeSeq a Properties pe mn Emmm Primary Selection jlez 21 E Movable True PickableB ackground False Printable True Reshapable True Resizable False ResizesRealtime False Selectable True ToEndSegmentLengthSt 4 True 242 4063 106 21875 2834 18384 Location 2834 184 136 1875 Right 2940 18384 136 187546 106 BottomL abel Northwoods Go GoT ext Button ChildN ames Count 12 DestinationLinks Northwoods Go GoNodeLinl Destinations Northwoods Go GoNodeNo FBGroup Logical FBName SELECTOR2 First Northwoods Go GoListGrour w BL RUD ACTIO E et ExeSeq When you start to develop logic FBEditor will increase ExeSeq number for each FB that you use automatically but you can change its sequence and by this way you can control execution sequence of logic We advise to set all ExeSq numbers manually because when you copy paste some part of logic FBEditor will put same values for pasted elements FBEditor will sort all Fbs by ExeSeq number and compile and make output file by ExeSeq order 5 Logic FB Instance name each FB has FBName and instance name these two properties are equal by default but you can change Instance name to any unique name in your logic Suppos
65. es are not supported in pbsSoftLogic for OPC client Driver Following Data Types are supported VT 12 2 byte signed int VT I4 4 byte signed int VT R4 4 byte real VT R8 8 byte real VT BOOL True 1 False 0 VT I1 signed char VT UI1 unsigned char VT UI2 unsigned short VT UI4 unsigned long VT I8 signed 64 bit int VT UIS8 unsigned 64 bit int VT INT signed machine int VT UINT unsigned machine int pbsSoftLogic User Manual At right Panel you can see OPC tag properties OPC_TAG_H4 Tag Access OPC server tag has Read Access by client 1 OPC server tag has write Access by client 2 OPC server tag has Read write Access by client 3 VT_BOOL has different definition in OPC VT_BOOL True 1 False 0 But in pbsSoftLogic Runtime kernel it is mapped as following VT_BOOL True 1 False 0 After selecting OPC tags click on Selected Tags Tab you can see list of selected tags and at right side Tag properties with Tag Value pbsSoftLogic OPC Explorer File Edit Help Tags Selected Tag Parameters When you click on each tag Tag properties will be update at right panel Click on Parameters tab you can see OPC connection parameter page OPC driver uses following parameters OPC Server Group refresh Time OPC Server Group percent Dead band Instance Other parameters are for PCWIN32 target and not used in Win32 Target pbsSoftLogic User Manual OPC Server Group pe
66. evices You can set modbus master driver communication parameter from project setting page In project setting page you can see list of configured drivers for your logic Right click on driver list you can add a new driver or explore defined driver General Time Setting LAN Setting Stats Driver List pbsHMI Integration Enable Name Path Type Enable ee DRV IO drv_io ModbusM aster Logic Scan Time ms 100 DRV DNP drv_dnp DNP3Slave DRV PHS drv_pms ModbusMaster Instance o DRV HMI drv hmi ModbusSlave Controller w406 gt New Driver Watch Dog Sec o 0 Disable Explorer Controller IP hs hes o o PC Drv Dead Time sec 20 z Reset Delete ETA hutdown RTU Save Exit Controller Delete Logic Configuration Set Startup prm For defining a new Modbus Master Driver right click on Driver list and select New Driver ud pbsSoftLogic New Driver mm ModbusMaster PMSLIO Instance jz In new driver page select communication protocol Type Driver Name and select Driver instance Driver pbsSoftLogic supports ModbusMaster ModbusSlave DNP3Slave and IEC870 5 Slave protocols Select ModbusMaster for Modbus Master protocol pbsSoftLogic User Manual Name Unique Driver Name Instance Instance number for each type of Driver If you have two Modbus Master Network in project then you need to define two ModbusMaster Driver with Different name and
67. ewOPCI1 PDf veserver OPC configuration file will be saved at psle OPC directory This file is same file that is used in OPC client driver configuration www pbscontrol com Page 132 For saving OPC configuration as OPC driver configuration at file menu select Save as Driver File pbsSoftLogic OPC Explorer Edit Help OPCML x Save and close configuration file then run Save as Driver File menu and select Driver path You should select same folder that is made by pbssoftlogic when you define OPC Client driver in project setting page pbsSoftLogic OPC Explorer File Edit Help Tags Selected Tag Parameters APAX logic 2 wins2 HMI OPC VSLELib 2 VSLESrC i WinCeSrc dA di T M T E It will copy OPC configuration file at driver folder with OPCTags xml name pbsSoftLogic User Manual Using OPC Tags in your logic use InputSignal or Outputsignal Elements in your logic Right click on Inputsignal or Outputsignal elements Select DRV Signals Select OPC signal from Driver list signals md File Edit Debug Project View Window Tools Help Ola e Re cl s FBList Comment InputSignal i H Math H Timers oR 2 iced s Time ESI Driver Input signals LuaUDF LuaPumpMng Fe T 5s 9 10 Drv 2 57 OPC Do OPC TAG BOOL bekami OPC TAG 14 1 LogicalDataltem OPC TAG BOOL WE NumericDataltem OPC TAG R8
68. hrd 2152K buff 7016K cached Load average 0 00 0 00 0 00 7m PID PPID USER STAT VSZ MEM CPU COMMAND Om 1002 994 root R 2308 85 23 top n 3 867 866 root 3 12948 44 65 pbsSLELX 664 646 root 3 12948 445 0 pbsSLELX 866 864 root 3 12948 44 03 pbsSLKLX 666 866 root 3 12948 44 0 pbsSLEKLX 875 866 root 3 12948 445 0 pbsSLELX 987 935 nobody 5 7168 243 0 usr bin httpd k start d etc apache 989 935 nobody 3 7168 24 0 usr bin httpd k start d etc apache 990 935 nobody s 7168 243 O amp usr bin httpd k start d etc apache 988 935 nobody 5 7168 24 O amp usr bin httpd k start d etc apache 991 935 nobody s 7168 24 0 usr bin httpd k start d etc apache 3 7 935 1 root s 7144 243 O amp usr bin httpd k start d etc apache 994 993 root 3 2428 St 0 bash 846 816 root s 2384 Bs O amp bin sh etc init d rcS 816 761 root s 2380 8 amp 0 bin sh etc init d rcS 761 760 root 5 2376 Bs 0 bin sh etc init d moxarcs 1000 836 root 3 1776 55 0 bin ftpd 1 993 536 root 5 1376 5 0 bin telnetd 536 1 root 3 1356 5 0 bin inetd 985 1 root 5 1320 4 0 dheped etho 1 O root Ss 1316 4 O init f www pbscontrol com Page 110 pbsSoftLogic User Manual 13 ECU 1911 Local I O Definition ECU 1911 is one of our main controllers for SCADA projects ECU 1911 has following specifications General Power Consumption 10 W Typical Power Requirements 24 VDC Typical 10 Min 30 Max VDC OS Sup
69. ilName gt lt FEDet gt z FBList lt Group gt pbsSoftLogic User Manual Above Group definition is for Counters Group FBList tag contains all FB for this group For each FB there is an FBDef Tag with Name and DetailName elements Copy and paste counters Group Tag and change its tags as following lt Group gt lt Name gt IEC11313 lt Name gt zDesc IECI1313 Group lt Desc gt z ictive Truecz Active lt FRBList gt lt FEDert gt lt Name gt RS lt Name zDetailName FBD IEC11313 RS xml lt DetailName gt zx FBDef ZFBDef zName 3Rz Name zDetailName FBD IEClil313 SR xmlc DetailName z FBDef z FBList lt Group Save FBDefh xml file You can define any number of FB header definition in FBList tag DetailName value is relative path of FB body definition XML file Name value is Name of FB that is shown in FBeditor As a naming standard we will use following format for FB body definition file groupName FBName xml and all FB Body files are locate at FBD directory pbsSoftLogic User Manual Open FBD directory and copy and paste one of existing FB Body files change its name to IEC11313 RS xml change its content as following c xml VEESion 1 0 73 gt lt FBDet gt zxVersion 1 0 0z Version ZFBDD zName B23zx Name zDesc R3 Flip Flopz Desc z ctive Truesez Lictive lt Tnterface gt lt Interface gt lt InputList gt lt Input gt lt Narme gt S lt Mame zpesc
70. iler so you don t need to use other IDE or compiler for Writing CH code For editing and compiling C Codes you need to use linux Operating system MOXA Cross compilers for different Controllers and Eclipse IDE In this section we will describe details of above steps with implementation of a simple UDF UDF is not related to a specific project but it will include to platform You can find CH Source code of all internal FB at PSLE VSLESrc Directory For defining new UDF you need to define new FB Group FB Group includes many FBs Suppose we want to define a new FB Groups for IEC1131 3 standard and add two Function Block for RS and SR Flip Flop In following figure you can see the definition of RS and SR flip flop from IEC1131 3 standard SR RS BOOL 4S1 BOOL lS BOOL jR Qi BOOL BOOL JR Qi1 BOOL FUNCTION BLOCK SR flip flop set dominant VAR INPUT S1 BOOL R BOOL END VAR VAR OUTPUT Q1 BOOL END VAR Q1 S1 OR NOT R AND Q1 END FUNCTION BLOCK FUNCTION BLOCK RS flip flop reset dominant VAR INPUT S BOOL R1 BOOL END_VAR VAR_OUTPUT Q1 BOOL END VAR Q1 NOT R1 AND S OR Q1 END FUNCTION BLOCK www pbscontrol com pbsSoftLogic User Manual Step1 Define FB body Edit FBDefh xml file in PSLE cfg directory Run Windows FB Editor Utility from Tools menu in pbsSoftLogic Editor FB editor can be use for defining new FB body and CSharp implementation for Simulator an
71. ing in logic and all Output types must read in logic Input Types DI Digital input Al Analog input FI Floating point Input In Al Space will take 2 Address Register INTI Long input In Al Space will take 2 Address Register INTUI unsigned long In Al Space will take 2 Address Register pbsSoftLogic User Manual SFI Swap Floating point Input In Al Space will take 2 Address Register SINTI Swap Long input In Al Space will take 2 Address Register SINTUI Swap unsigned long In Al Space will take 2 Address Register Output Types DO Digital Output AO Analog Output FO Floating point Output In AO Space will take 2 Address Register INTO Long Output In AO Space will take 2 Address Register INTUO unsigned long In AO Space will take 2 Address Register SFO Swap Floating point Output In AO Space will take 2 Address Register SINTO Swap Long Output In AO Space will take 2 Address Register SINTUO Swap unsigned long In AO Space will take 2 Address Register Init init value of Modbus Slave Tag Address Modbus Slave Tag Address Log If Log value is 1 Driver will always used latest value of Modbus tag not Init Value Suppose you define a set point with init value of 10 If Modbus Master change this value to 12 0 and you restart controller Modbus Slave Driver will use 12 as init value of Tag Note 1 This facility is just works for AO DO and FO Tags
72. ip m Inip ps Inip vge lInip ww init Lupe Inib pD lnip upm Init r Ingp n p Init Nv ip go Inip tp Init nr BG ee ee YB Init 0 A gigs Tnit 9 Init 0 Tnit 9 Init p Init 0 Init o Init min Init 0 Addrezs r r Address 1 Addrezg 2 Address 3 Addrezsg 4r Address h Address 6 Address y Addrezs B Address g gt i gt gt f j gt gt j gt i gt i gt Address 10 Addresz 11 Addresg 12 Addresz 13 Address 14 Addresz 15 Address 16 Addresz 17 Address 15 Addresz i9 Addresg 20 Addreszs 21 Addresg 22 Address 243 Addresg z24 Addresg rghb5 r Address 26 Address 2 7 Address r 28 Addresg g29 Address a30 Address 31 gt T gt T gt gt gt T gt T T gt i gt gt gt gt p gt T i gt gt pbsSoftLogic User Manual 7 Use Local I O in your logic by opening driver list and select signals dnps DiTag1 dnps DOBTag1 Mn seGe m a Time T 5s E mslave H mmaster E dnps iec_drv ecu io DIT ag DI 0 DITag1 DI_1 DITag2 DI 2 DITag3 DI 3 DITag4 DI 4 DITag5 DI 5 DITag6 DI 6 DITag DI 7 DITag8 DI_8 DiTag9 DI_9 DITag10 DI_10 DITag11 DI_11 DITag12 DI 12 DITag13 DI 13 DITag14 DI 14 DITag15 DI 15 i IT ARI
73. ising edge at Input1 signal we will set state to 1 and will save time by os time function os time returns current time from 1 1 1970 in seconds In following code when Inut1 signal has falling edge FB will go to state zero 1f Inputl 0 and inputlold 1 then state D end In following code when FB is in state one it will map Input2 to out2 and sets out1 to 1 for 10 seconds If before 10 seconds falling edge detecting for Input1 signal FB goes to state O if state 1 then if os time dt lt 10 then compare current time with start time outi 1 outz InputZ else outi I outz I end else outi outz end For calculating elapsed time always use above technique After solving your logic you need to save static data and write output signals pbsSoftLogic User Manual Lua expression from programming in Lua 3ed written by Roberto ierusalimschy Lua supports the usual arithmetic operators the binary addition subtraction multiplication division exponentiation 9e modulo and the unary negation All of them operate on real numbers For instance x 0 5 computes the square root of x while x 1 3 computes the inverse of its cubic root The following rule defines the modulo operator a 96 b a math floor a b b For integer operands it has the usual meaning with the result always having the same sign as the second argument For real
74. ize Include in library Share with New folder E IM yr ERU RS Mame E Date madified Type size EE Desktop RS I test 8 1 2013 2 52 AM XML File 1 KE d Downloads E SR A test a Tr2013 2 52 AM XML File 1 KE 5 Recent Places f SkyDrive Eed Mbata Thren i These are static data files for RS and SR Function blocks Open Static data file for RS function block you can see following items k xml versians 1 0 7 gt lt Staticbata gt lt Taq Name O1 value False gt lt Taq Name s old value False gt lt Taq Mame Rl old Yalue False Yr lt StaticData gt This is the same XMI file that you save in RS C code pbsSoftLogic User Manual Writing C code for Linux and cross compiling of UDF We developed an UDF with CH and compile it for simulator and windows runtime If you want to run your UDF on linux controller like W406 A240 UC7112 you must write UDF by C and compile it for embedded linux For cross compiling for embedded linux you need to have following software s 1 Ubuntu Linux distribution You can download from http www ubuntu com download desktop 2 Install ubuntu on a Virtual Machine like VMWare or install it on a PC 3 Download eclipse IDE from http www eclipse org downloads and download Eclipse IDE for C C Developer for linux 32 or 64 bit 4 MOXA has different cross compiler for different linux based controller Based on your controller download cross compiler fro
75. le For ModbusRTU and ModbusTCP For Above ModbusBlocks xml file Modbus Driver will do following sequence 1 Send DI1 Block Update Diag1 Send Counter 2 Wait for 200 msec 3 Get Answer and update Modbus Tags Update Diag1 Rec Counter Diag1 ErrorCounter 0 Diag1 Online 1 pbsSoftLogic User Manual 4 If There is no answer from Device Increase Diag1 ErrorCounter if it Is more than 3 Make Device offline Diag1 Online 0 5 Check Write Queue for Writing on DO or AO Blocks If there is any item in Write Queue Write it to Device otherwise send Request for Next Block 6 Send Ali Block Update Diag1 SendNum 7 Wait for 200 Msec 8 Get Answer and update Modbus Tags Update Diag1 Rec Counter Diag1 ErrorCounter 0 Diag1 Online 1 9 If There is no answer from Device Increase Diag1 ErrorCounter if it Is more than 3 Make Device offline Diag1 Online 0 Check Write Queue for Writing on DO or AO Blocks If there is any item in Write Queue Write it to Device otherwise send Request for Next Block 11 Repeat Steps 1 to 10 for Device 2 12 Repeat Steps 1 to 10 for Device 3 10 Scan Time Calculation for above configuration Scan time for whole signals will be calculate as following 200 DI1 50 200 AI1 50 200 DI2 50 200 AI2 50 200 DI3 50 200 AI3 50 3000 msec 3 sec if there is no write command If you want to reduce scan time you can increase BaudRate and reduce Block Wait time Or you c
76. m following links Tool Chain for Linux Kernel 2 6 x for IA24X W3XX LX Series UC 7112 LX Plus 1A3341 http www moxa com support sarch result aspx type soft amp prod id 121 amp type id 6 2 Tool chain for W406 IA26X LX and EM2260 LX http www moxa com support sarch result aspx type soft amp prod id 34 amp type id 6 3 Tool chain for UC 8400 LX Series http www moxa com support sarch result aspx type soft amp prod id 443 amp type id 6 4 Linux Tool Chain for ioPAC 8500 C Series http www moxa com support sarch result aspx type soft amp prod id 939 amp type id 6 5 Linux Tool Chain for ioLogik W5348 HSDPA C and ioPAC 8020 C series http www moxa com support sarch result aspx type soft amp prod id 605 amp type id 6 5 Install cross compiler for your hardware on ubuntu by sh command as following sudo sh path and name of tool chain you should runsh command with sudo command as linux supervisor ubuntu will ask your supervisor password and start to install cross compiler at usr local arm linux directory pbsSoftLogic User Manual NOTE if you installed other cross compilers in ubuntu rename them before installing new cross compiler You can rename arm linux directory with following command sudo nautilus This will open a file explorer with supervisor right so you have access to rename arm linux directory In following figure you can see my ubuntu usr local directory with diffe
77. met s EEE FEEFEE Installed OPC servers on thispc Connected OPC server Tags or network PC salpiadoid se 340 www pbscontrol com Page 126 pbsSoftLogic User Manual Defined OPC configuration files At Top left panel you can see all defined OPC configuration files These files are located at PSLE OPC folder Installed OPC Servers At Bottom left panel you can see all installed OPC servers on this machine or remote PC For browsing OPC servers on remote machine you need to do all setting for OPC on network for both PC OPC network operation is dependent too much on Operating systems and it is out of scope for this document For connecting to remote PC at Edit menu select Set remote Server then type Server Name of IP address for getting all installed OPC servers on that Machine OPC Server Server Mame IP OK Cancel For changing to local Machine from Edit menu select Set Local Server pbsSoftLogic OPC Explorer Tags Selected Tag P Set Remote Server Flat Branch Set Local Server Dk FloatCtrl pbsSoftLogic User Manual For defining new OPC Configuration file right click on Defined OPC Configuration panel And select new menu posSottLogic OPC Explorer Em ER E File Edit Help Tags Sele OPCAML OPCAML OPCXML OPCXML OPCXML test xml Open Close Start VSLE OPC Client List View Icon View Explorer Refresh
78. mpStaticDataPath rb if m db NULL first time generate this file User default value for static data else Read Value of static data while feof m_db 0 fread amp db elem sizeof db elem 1 m db if stremp db elem name SOld 0 SOld atoi db_elem value j if strcemp db elem name R10Old 220 R10ld atoi db elem value j if stremp db elem name Q1 0 Q1 atoi db elem value fclose m db In RS FB old status of S R 1 and Q1 value should be static You need to make all outputs in FB with static data as static tags pbsSoftLogic User Manual Solve logic map old values and write outputs if S 1 amp amp SOld 0 if R1 1 amp amp R1Old 0 Q121 Q120 Objo 0 dvalue Q1 Map New Static data to old one SOld S R1Old H1 Write static data Save Static data m db fopen TmpStaticDataPath wb strcpy db_elem name SOld sprintf db_elem value d SOld fwrite amp db_elem sizeof db_elem 1 m_db strcpy db_elem name R1 Old sprintf db_elem value d R1Old fwrite amp db elem sizeof db elem 1 m db strcpy db elem name Q1 sprintf db_elem value d Q1 fwrite amp db_elem sizeof db_elem 1 m_db felose m db In this stage you can compile FB Eclipse will make libIEC11313 so file at release directory You should copy this file to controller home pbsLX fblib directory
79. municating over RS232 and IEC870 5 104 is communicating over TCP For each IEC Driver instance you can define 1024 IEC Tags Defining new IEC Driver Open project setting and right click on driver list Select new driver and then select IEC8705Slave Type Deriver name and select instance as following figure voe 0 pee IE Driver List Logic Scan Time ms Instance IEC8705Slave Controller Name liec_Drv Watch Dog Sec Instance hoo x Controller IP PC Drv Dead Time sec MakeDriver Rese Nelete Controller Delete Loge Configuration Set Startup pbsSoftlogic will make a default configuration and IEC tags in a directory located at logic path Directory name is name of driver IEC870 5 driver files Options xml define communication parameters ECSTags xml define IEC slave tags pbsSoftLogic User Manual Communication parameters optione xml file content lt Node gt lt Name gt PhysicalLayer lt Name gt lt Desc gt RS232 TCP lt Desc gt lt Value gt RS232 lt Value gt lt Node gt lt Node gt lt Name gt COMPort lt Name gt lt Desc gt Serial Port for Communication 1 2 3 4 5 lt Desc gt lt Value gt 1 lt Value gt lt Node gt lt Node gt lt Name gt BaudRate lt Name gt lt Desc gt 9600 19200 36400 52700 115200 lt Desc gt lt Value gt 19200 lt Value gt lt Node gt lt Node gt lt Name gt SlaveAddress lt Name gt lt Desc gt SlaveAddress lt
80. n blocks you can write a simple logic as following SR Gl In above logic OPC tags ST R Sand R1 are dummy tags but LNK SR Q1 and LNK RS Q4 are internal tags in logic pbsSoftLogic User Manual You can simulate above logic by Simulator utility D pbscontrol SoftLogic Simulator CApbsControl PSLE WSLE test2 xmll Inputs FB Instances Comments Links Search Logic Status Name Value TagType i False bool R False bool 5 False bool Ri Fase bool OPC IECTI3I3 E oo 1 _ False _ F 7 MIG m R OPC IEC11313 BINE O 9 False False R1 a1 LNK oec cd R1 This logic is not running on real pbsSoftLogic Windows Kernel because you need to have real OPC tags but it works under Simulator D pbscontrol SoftLogic Simulator C pbsControl PSLE VSLE test2 xml Inputs FB Instances Comments Links Search Logic Status TagType bool bool bool Ciectsi3 7 BEEN 2 p X T R E R orc IECIT 5 O False iR qi tee INK OPC 2111717 RS Ql R1 www pbscontrol com Page 79 pbsSoftLogic User Manual gt pbscontrol SoftLogic Simulator CApbs Inputs FB Instances Comments Links Search Tagl ype bool bool bool bool Open ram disk drive and open temp directory you can see two XML files GJ computer Local Dik E temp n a Scorch TEP Organ
81. nalog Input IEC Tag Type 9 34 M ME NA 1 M ME TD 1 FI Float Input IEC Tag Type 13 36 M ME NC 1 M ME TF 1 CNT Counter IEC Tag Type 15 37 M IT NA 1 M IT TB 1 DPI Double Point Information IEC Tag Type 3 4 M DP NA 1 M DP TA 1 DO Digital Output IEC Tag Type 45 C SC NA 1 AO Analog Output IEC Tag Type 48 C SE NA 1 FO Float Output IEC Tag Type 50 C SE NC 1 DPO Double command IEC Tag Type 46 C DC NA 1 Process information in monitor direction 1 Single point information M SP NA 1 93 double point information M DP NA 1 4 double point information with time tag M DP TA 1 9 Measured value normalized value M ME NA 1 13 Measured value short floating point value M ME NC 1 15 Integrated totals M IT NA 1 21 Measured value normalized value without quality descriptor M ME ND 1 30 Single point information with time tag CP56Time2a M SP TB 1 34 Measured value normalized value with time tag CP56Time2a M ME TD 1 36 Measured value short floating point value with time tag CP56Time2a M ME TF 1 37 Integrated totals with time tag CP56Time2a M IT TB 1 pbsSoftLogic User Manual Process information in control direction lt 45 gt Single command C SC NA 1 lt 46 gt double command C DC NA 1 lt 48 gt Set point command normalized value C SE NA 1 50 Set point command short floating point value
82. no memory in function code local Objo Define Output Variables local L 0 add more output variables here Define Intrnal Variables Read Input variables tonumber Obji 6 tonumber Obji 7 add more input variables here Solve Logic Write your logic here L X 42 Y 2 0 5 Write outputs Objo 1 tostring L return Objo end X Y In Lua FB Editor execute New Lua Function Block from File menu It will make NewLuaFB Lua file at PSLE LuaSrc directory Lua FB Editor will make NewLua FB function as template for Lua Function block pbsSoftLogic User Manual 1 function NewLua FB Obji 2 Lua Function Block Function with static data There is memory in function Block code 3j local Objo 4 TmpPath PID VSLEName SRAMPath SDPath are same for all FB Do not delete them 51 TmpPath Oobji 1 6 PID Obji 2 7 VSLEName Obji 3 8 SRAMPath Obji 4 9 i SDPath Obji 5 10 Define Output Variables 11 local outl 0 12 local out2 0 13 add more output variables here 14 pefine Intrnal Variables 15j local state 0 this is static signal so we will keep its last value in FB memory block 16 local dt 0 17 local inputlold 0 18j Read Input variables 19 Inputl tonumber Obji 6 20 Input2 tonumber Obji 7 21 add more input variables here 22i Read Static data In this Lua FB sample we consider following variables Two
83. operands it has some extra uses For instance x 1 is the fractional part of x and so x x 1 is its integer part Similarly x x 0 01 is x with exactly two decimal digits x math pi print x x 0 01 gt 3 14 Lua provides the following relational operators 2 lt lt SS SSS YE All these operators always produce a boolean value The operator tests for equality the operator is the negation of equality We can apply both operators to any two values If the values have different types Lua considers them not equal Otherwise Lua compares them according to their types Specifically nil is equal only to itself The logical operators are and or and not Like control structures all logical operators consider both the boolean false and nil as false and anything else as true The and operator returns its first argument if it is false otherwise it returns its second argument The or operator returns its first argument if it is not false otherwise it returns its second argument print 4 and 5 gt 5 print nil and 13 gt nil print false and 13 gt false print 4 or 5 gt 4 print false or 5 gt 5 Both and and or use short cut evaluation that is they evaluate their second operand only when necessary Short cut evaluation ensures that expressions like type v table and v tag h1 do not cause run time errors Lua will not try to evaluate v tag when v is not a table A useful Lua idiom is x x or v which is
84. or root user root user should has write read access to c PSLERT directory Make a new project and set project setting as following General Time Setting LAN Setting Stats License Kernel Driver List Name Path Type Enable Logic Scan Time ms 50 Controller wiN32 Watch Dog Sec o 0 Disable Controller IP 27 jo jo Zz Controller RamDrive temp Path levem Save Exit Miis Delete Logic mcns Set Startup Controller Type is Win32 Logic Scan time ms period for reading all inputs running logic and writing all outputs We name this time logic scan time When you connect and monitor logic you can see real value for logic scan time Logic Scan Time in settings Real Logic Scan Time sleep Time Suppose you set Logic Scan time in Setting page to 50 ms but real logic scan time is 20 ms So kernel will sleep for 30 ms at each cycle pbsSoftLogic User Manual El pbsSoftLogic Function Block Editor win32 xml oJ File Edit Debug Project View Window Tools Help 8 x Dag e 5 Es e e Ee FBList in Comment InputSignal 7 OutputSignal Math Timers Counters Logical Process fEC11313 LuaUDF LuaPumpMng GetAIIFB Logic Scan Time 6 nf C ApbsControl P SLEXVSLEXwin32Xwin32 xml 4 43 903 4 You can see real logic scan time at bottom side of logic monitoring page In above sample real logic scan time is 6 ms When you are using
85. or linux home pbsLX drvlib msix libpbsModbusSLX so pbsSoftLogic Modbus Slave implementation for linux uc7112 rar Runtime kernel for IA240 1A241 W341 W321 UC7112Plus IA3341 w406 rar Runtime kernel for IA260 1A261 1A262 EM2260 When you unzip uc7112 rar and w406 rar you can see following directories i dedib gt fblib d Imp pbsSLKLX pbsSoftLogic User Manual For transferring pbsLX directory to controller do following tasks 1 Open project setting page and click on kernel Tab To be sure that Controller IP address is correct on General Tab 2 Click on Browse Button and select pbsLX Directory that you want to transfer to controller To be sure that you select correct runtime Kernel for your controller Kernel Path CApbsControhPSLEMarget uc7112 pbsLX sf Transfer to 5 hutdown RTU Controller Kernel 3 If controller has old Runtime Kernel first Shutdown RTU Kernel 4 Click on Transfer To Controller Button It will transfer all files and directories to controller but not changing logic and configuration 5 If it is new controller without any kernel in General Tab click on Set Startup Button to put all necessary modules in controller startup path accu General Time Setting LAN Setting Stats License Kernel Driver List I pbsHMI Integration Enable Name Path Type Enable gt PH DRY XPH DRV ModbusMaster lv Instance o Controller w406 z Watch Dog Sec o 0
86. ort 1 can be Modbus Master and COM Port 2 Modbus Slave There is Software limitation for number of Instances for any protocol in pbsSoftLogic maximum 8 You can run 8 instances of Modbus Slave on the same Controller and connect to different modbus master in the same time For each instance of Modbus slave Driver we have following tables Digital inputs Tags 1024 Digital Output Tags 1024 Analog input Tags 1024 Analog Output Tags 1024 For Adding Modbus Slave Driver to an Application open Project settings and right click on Driver list Select ModbusSlave Driver and fill other fields ll E oc pbsSoftlogic New Driver s Lan ES ModbusSlave HMI Dry Instance I Click on make Driver Button pbsSoftlogic will make basic files for Modbus Slave Communication Close this page Modbus Slave Driver is added to Driver list pbsSoftLogic User Manual Right click on Modbus Slave Driver and select explorer You can see two files in HMI Drv directory a Project Options ai m oir gt lt aks General Time Setting LAN Setting Stats Driver List I pbsHMI Integration Enable Path Type Enable MO DRY ModbusMaster iv Logic Scan Time ms PM_DRV ModbusMaster IV HMI_Dry ModbusSlave lv id DERE LUG L CAL A Controller i WatchDog Sec d gt Computer Windows OS C PSLEtest APP1 HMI Dre Search HMI P Controller IP Organi
87. ower Instance Signals Write on two different sources NN pbsSoftLogic User Manual Example 3 m P 1 DRV HMI RTU LEVEL Level Calculation Cm WW Level duse AM JS ma DRV I TEM Level Transmiter DRV HMERTU LT FAULTY Main Element of a Function Block Program 1 Input Output Signals Normally links to Communication Drivers and Local I O 2 FB Ready Function Blocks 3 Interconnection between 1 0 Signals FBs and between FBs 4 Constant signals different type of Constant Signals Integer I Float F Boolean B Time T Constant Signal Format Type Value l 10 f amp 10 5 B amp True T 1h10m20s PE pbsSoftLogic User Manual 5 Internal Link Tags unlimited internal link tag is possible in logic but each instance should have different name Links with same name has same value in logic NC Duty You can see list of all Link Tags in Debug Menu Link List Item 4 pbsSoftLogic ti Edit a File Edit Debug Project View Window Tools Help Bla gt Sale olelalslal lv InputSignal OutputSignal Math Timers Counters Logical m Process By double click on each link item Logic will focus on Link Signal So you can easily browse and check all link signals pbsSoftLogic User Manual 6 Comments you can put comment everywhere in logic Drag a Comment element from FBList and Drop it in the logic Th
88. page you need to set Startup and restart controller manually Time Setting Clo O O General Time Setting LAN Setting Stats License Kernel Set Controller Time one Dubai honge Setfi NTP server time windows com Set Controller Time with PC Read Controller A X lt Time Set Controller Time Zone Select your location from list box and click on Change TimeZone Read Controller Time Will read current Date time and time Zone of controller Set Time will set Controleller time from NTP Server it can be a computer on the network or any Time web site But controller should connect to Internet Set Controller Time with PC It will set Controller time from PC that is running pbsSoftLogic LAN Settings pbsSoftLogic User Manual General Time Setting LAN Setting Stats License Kernel available TT TT HEEEEUEHHHHEEEEUEEHHHEEEUEEEHHHHEEEUUUEHHHEHE Settings Settings We always want the loopback interface auto ethO ethi lo Configuration auto ethO lo iface lo inet loopback embedded ethernet LAN1 iface ethO inet static address 192 168 127 152 network 192 168 127 0 netmask 255 255 255 0 broadcast 192 168 127 255 gateway 192 168 127 1 embedded ethernet LAN2 iface ethi inet static address 192 168 126 254 network 192 168 126 0 netmask 255 255 255 0 broadcast 192 166 126 255 gateway 192 168 126 1 Read LAN Setting It will read current L
89. port Windows CE 5 0 System Hardware CPU Xscale PXA 270 520MHz L1 Memory Onboard 64 MB SDRAM 32 MB Flash Storage 1 x type I II Compact Flash slot Support FAT16 and UP TO 2 GB Digital Input L Channels 32 O Type Sink Wet Contact Logic 0 0 gt 10 V Logic 1 19 30 V Isolation 3000 VDC Connector Terminal Block 14 22 AWG Digital Output Channels 32 O Type Power Relay Form A L Contact Rating AC 5A 250 V DC 5 A 30 V Resistive Load Isolation 500 VDC L Connector Terminal Block 14 22 AWG Analog Input Channels 8 differential Resolution 16 bits Sampling rate 10 Hz sec total Input Impedance Voltage 20 MO Current 120 Q Build in 120 Q for Current L Input Range 0 gt 150 mV 0 gt 500 mV 0 1V 0 5V 0 10V 0 15 V 150 mV 500 mV 1 V 5 V 10 V 15 V 20 mA 4 20 mA Environment Humidity 5 gt 95 40 C non condensing Operating Temperature 20 70 C 4 158 F 5 85 RH Storage Temperature 40 80 C 40 176 F pbsSoftLogic User Manual I O Interface Serial Ports 1 x RS 232 with DB9 RTS CTS TX RX 3 x RS 485 with Terminal Block connector Automatic RS 485 data flow LAN 2 x 10 100Base T RJ 45 ports USB Port 1 x USB OpenHCl Rev 1 1 compliant DO Relay r Power FRS 4854 f DTE m SSS DO Relay qs n RETo sansa DADDOTAELTTTE
90. rcent Dead band definition from OPC standard The percent change in an item value that will cause a subscription callback for that value to a client This parameter only applies to items in the group that have Analog signals OPC Server Group refresh Time definition from OPC standard The fastest rate at which data changes may be sent to client for items in this group Instance Instance number is same as driver instance number For saving configuration click on configuration name and save it by right click menu pbsSoftLogic OPC Explorer l ER File Edit Help Tags Selected Tag Parameters me QV OX QV QC QN OF OPCXML OPCXML OPCXML OPCXML OPCXML OPCXML OPCXML OPC Publish Period h Sec OPC Server Group Refresh Time 100 mSec OPCXML OPCXML OPCXML test xml Instance nh New V Include Time Lable Save Open V Include Tag Type Close v Write Values to OPC Server By Changes Start VSLE OPC Client List View Icon View Explorer Refresh by Call Back From Device From Cach gt Read Method ICONICS SimulatorOPCDA AD pbsModbusSlave_OPCSivi3 Single Group A ICONICS Simulator PCDA 2 X pbsModbusSlave_OPCSrvl4 ME Kepware KEPServerEX V5 X pbsM odemMBOPC A MOXA SNMPOPC X pbsSoftLogicOPCSrvSimu ME pbsControl DNP3Slave OPCServerV1 0 X TriangleMicroW orks OPCDA 1 ME obsControl DNP3 N
91. rent cross compilers s zmr arm linux arm linux 8020 arm linux 8500 arm linux uc7 112 arm linux uc8410 bin Active cross compiler has arm linux directory name In above figure active cross compiler is W406 series If you want to compile for ioPAC8020 rename arm linux to arm linux w406 then rename arm linux 8020 to arm linux You can find source code of all pbsSoftLogic at c PSLE CSrc directory Open eclipse IDE and make a new C Project Project name should be exactly same name of UDF group for our example IEC11313 C Project C Project lt gt Create C project of selected type Project name IEC11313 Use default location Browse Project type Toolchains gt GNU Autotools Cross GCC Y Executable Linux GCC Empty Project Hello world ANSI C Project v amp Shared Library Empty Project gt amp Static Library gt Makefile project amp Show project types and toolchains only if they are supported on the platform Q Back Net Cancel Finish Project Type Share Library pbsSoftLogic User Manual Toolchain Cross GCC Click on Next Cross GCC Command Configure the Cross GCC path and prefix Cross compiler prefix arm linux Cross compiler path usr local arm inux bin Browse lt Back Next gt Cancel Finish Set Cross Compiler prefixes and cross compiler path as above figure Cli
92. rite Static dat Write Outputs pbsSoftLogic User Manual public static void SE List lt ohbject gt Obji ref List lt tobject gt oObjo i string TmpPath Obji O0 ToString il string PID Objifl1 ToStringt i string VSLEMame Ohjife TosStringt i region Read Inputs and define Variables bool 51 bool Parsei obji 3 ToStringil bool hool Parse Obj 1 4 Tostring i bool Qi false bool sal Old false bool R Old false fendreqion Write Outputa pbsSoftLogic User Manual reqion Read Static data string mPath TmpPath iSSR to PID V3LEName it File ExistsimPath true 1 zmlDocument xmldoc new AmlDocument ij ximldoc LoadimPath amlModeList TmpzmlModeList xmldoc GetElementsbyTagnhame Tag foreach zxmlMHode TmpEMLNode in TmpzmlHodeList 1 switch iTmpzMLHMode ttributes IHame InnerText 1 Case LIT Q1 bool Parsei TmpzxMLMHode htrtributes Value InnerText break case Sl Old al Old bool Parse TmpEzMLHode ttributes Value InnerText break case ER Old R old bool ParseiTmpzMLHode A ttributes Value InnerText hresuk Zendregion pbsSoftLogic User Manual public static void SE List lt ohbject gt Obji ref Listcobject objoj i string TmpPath oObji U0 ToString i string PID Objif 1 ToString i string VS2SLEMame Objife TosStringt i Read Inputs and define Variables Read Static da
93. rme CHTTaq6 Types CHT Clasa 1 Init 0 iddress 6 Log 0 fo pbsSoftLogic User Manual DNP3 Slave driver Operation 1 Master SCADA will read all Input Signals DI Al Fl DO AO DPI You need to write all Input Signals in your logic Link to FB right ports 2 Master SCADA will write Output Signals DOB AOB You need to read all Output Tags in your logic Link to FB left Ports dnps DiTag1 dnps DOBTagi E p i 4 mslave AlTag1 mslave DOTag1 dnps AlTag1 dnps AOBTagl In above logic we have following DNPs signals Dnps DOBTagl1 is a DOB signal which is written by DNP Master dnps DiTag1 is a Di signal which is read by DNP Master dnps AOBTag1 AOB signal Analog Output which is written by DNP Master dnps AlTag1 Al Analog input Signal which is read by DNP Master DNP3 function codes which are implemented Read class 0 1 2 3 4 Integrity command Read Event by exception RBE Time synchronization Enable Disable unsolicited communications Transfer data from RTU to Master SCADA Dynamic Class assign Freezing counters Write pbsSoftLogic User Manual 9 IEC870 5 Slave 101 104 Configuration pbsSoftLogic supports IEC870 5 101 104 protocols for communication with master SCADA You can setup maximum four IEC slave instance for each RTU It means you can connect to 4 Separate SCADA master in the same time IEC870 5 101 is com
94. rst tag is Online If device is answer to Driver request its value is 1 otherwise it is O sendNum Number of Send Request by driver Maximum value is 10 000 RecNum Number of received Answer to driver Maximum value is 10 000 You can use above tags like normal Modbus Tag in your logic b IM BELEE FEVEL Mo Ume oR ie 1 AI8 2 AH 154 DRV JO 1 PMP2 STS MAN DRV HMI RTU PMP2 STR MANUAL 1AIB 3 AIT 155 1AIB 4 AN 156 i 118 6 Al 158 o m LAB 7 AN 153 DRV IMS RTU PMP2 STR AUTO 1418 8 AN 160 B DRV n PMP2 STS MUTO l 1 418_9 411_161 oe LAIB 10 Al1_162 1 AI8 11 AH 163 i be 1 AI8 12 AN 164 ie 1 AI8 13 AN 165 o 1 AI8 14 AN 166 RTU Healthy 1AI8 15 AH 167 i fe I OnLine Jag IUU i Lone m 3 RV IO 1 RTU HLTY SGNL ReadSyslnfo e nm DRV IO 1 DRY RUN FLT SW L m 1 QleadSvslnfo c we THOS TE TA Aa mm gt Number of Modbus Master Driver for each controller 8 Instance Number of Modbus tags for each Instance 1024 Number of Modbus Blocks for each instance 64 Number of Modbus Devcices for each instance 32 pbsSoftLogic User Manual 7 Modbus Slave Configuration pbssoftLogic supports Modbus slave Driver for communication with HMI Devices or any other Modbus Master systems You can run Modbus master and salve on the same Controller in the same time but they should have separate resource For example COM P
95. s Name Value TagT ype In the left panel you can see Logic signals and in right side you can see your application Note for proper running of Simulator you need to set following parameters in c psle options xml file lt Node gt lt Name gt ResourcePath lt Name gt lt Desc gt Resource Directory Path lt Desc gt lt Value gt e Resource lt Value gt lt Node gt lt Node gt lt Name gt TempPath lt Name gt lt Desc gt Temp Directory Path lt Desc gt lt Value gt e Temp lt Value gt lt Node gt We advise to install RAM Disk Driver on your PC because Simulator and Windows Runtime Engine will write all Function block static data to TempPath You can download very professional and free RAM Disk Driver from memory dataram com products and services software ramdisk Web Site We tested Data ram disk in many projects and it is 10096 compatible with pbsSoftLogic After you install Data RamDisk change TempPath and ResourcePath to RAMDisk Drive Step3 Edit Project Settings pbsSoftLogic User Manual Open Project menu and select settings Select Controller type and type IP address of controller General Time Setting LAN Setting Stats Driver List rr pbsHMI Integration Enable RE Name Path IT ype Enable r Logic Scan Time ms Controller WatchDog Sec o 0 Disable Controller IP hs2 s jo jiso OPC DivDeadTimefsec 0 You can do following tasks with Project
96. s OnTimer OffTimer PulseGen PulseGen2 RampGen RampGen 2 SinGen H Counters 5 Logic UTR C E H Process 1 000000 Lock Force Release ER In Tag Force Window Click on Lock Button The link between InputSignal and PulseGen Trg input will be change to red a applxml GPulse ii 000000 Force Release Change Value of Signal to O and click on Force PulseGen Q output will stop Again change signal value to 1 and click on force button Again PulseGen Q output starts to change its value between 1 and O Click on Release button and link color will change to black pbsSoftLogic User Manual Note 1 In Linux WinCE Kernel runtime all signals type is double So you will see value 0 and 1 for Boolean Digital Signals not true false 2 When you Force a tag it will force just input signal of FB not tag It means if you use TAG1 in different location in logic and when you force it in a FB it will force only for that FB not whole Logic 3 Only FB inputs can be force Step8 Disconnect from Logic In project Menu Select Disconnect From Controller Logic page color will come back to smoke white and all logic monitoring values will hide pbsSoftLogic User Manual 6 Modbus Master Configuration and integration with remote I O Modules PbsSoftLogic supports Modbus Master Driver for communication with I O Modules and other Modbus Slave D
97. s 6 Logs 0 gt lt Tag Name CHTTag Type CHT Class 1 Init 0 Address 7 Logs 0 lt Tag Nene CHTTag Type CHT Class 1 Init 0 Address 8 Log 0 lt Tag NWame DPITagl Type DPI Class 1 Init 0 Address 1 Log 0 lt Tag Name DPITag Type DPI Class 1 Init 0 Address Log 0 lt Tag Name DPITag3 Type DPI Class 1 Init 0 ddress 3 Log 0 lt Tag Name DPITag4d Type DPI Class 1 Init 0 Address 4 Log 0 lt Tag Name DPITaqg5 Type DPI Class 1 Init 0 ddress 5 Log 0 gt lt Tag Name DPITag6 Type DPI Class 1 TInit 0 Address 6 Log 0 lt Tag Name DPTTag Type DPI Class 1 Init 0 iddress 7 Log O gt lt Tag Name DPITag Type DPI Class 1 Init 0 Address 8 Log 0 lt Tag Name D0Tagi Type D0 Class 1 Init 0 Address 1 Log 0 gt aT n mL FL AR Fh l M UTR FL Il i T o gu M Fh l 1 h N T 1 ROG pbsSoftLogic User Manual IEC 870 5 Slave driver Operation 1 Master SCADA will read all Input Signals DI Al FI DPI CNT You need to write all Input Signals in your logic Link to FB right ports 2 Master SCADA will write Output Signals DO AO FO DPO You need to read all Output Tags in your logic Link to FB left Ports liec drv DITag1 In above logic master will write to iec_drv DOTag1 and will read iec_drv DITag1 pbsSoftLogic User Manual 1
98. sc gt 1 2 lt Desc gt lt Value gt 1 lt Value gt lt Node gt StopBit ModbusRTU Stop Bit lt Node gt lt Name gt Parity lt Name gt lt Desc gt None Even Odd lt Desc gt lt Value gt None lt Value gt lt Node gt Parity Modbus RTU Parity Communication lt Node gt lt Name gt SlaveAddress lt Name gt lt Desc gt SlaveAddress lt Desc gt lt Value gt 3 lt Value gt lt Node gt pbsSoftLogic User Manual SlaveAddress Modbus RTU TCP slave ID lt Node gt lt Name gt FlowControl lt Name gt lt Desc gt NO FLOW CONTROL HW FLOW CONTROLSW FLOW CONTROL lt Desc gt lt Value gt NO FLOW CONTROL lt Value gt lt Node gt FlowControl Flow Control for ModbusRTU lt Node gt lt Name gt PhysicalLayerScanTime lt Name gt lt Desc gt PhysicalLayerScanTime lt Desc gt lt Value gt 100 lt Value gt lt Node gt PhysicalLayerScanTime Modbus Slave Driver will read Serial or TCP port every PhysicalLayerScanTime msec if master request is large like Writing many Modbus Signals it is better to increase this value 100 msec is optimized for may applications lt Node gt Name Instance Name lt Desc gt Instance lt Desc gt lt Value gt 1 lt Value gt lt Node gt Instance If you have many ModbusSlave Driver on a controller each one must has unique Instance number maximum 8 Node lt Name gt TCPPort lt Name gt lt Desc gt TCPPort lt Desc gt lt Value gt 502 lt Value gt lt
99. se on the right a i lt b 2 1 lt gt a i lt b 2 1 54x 2 8 lt gt 5 x 2 8 a lt y and y lt Z lt gt a lt y and y lt Z X 2 lt gt X 2 X y z lt gt x y z Assignment is the basic means of changing the value of a variable or a table field a hello world t n 2 t n 1 Lua allows multiple assignment which assigns a list of values to a list of variables in one step Both lists have their elements separated by commas For instance in the assignment a b 10 2 x if then else An if statement tests its condition and executes its then part or its else part accordingly The else part is optional if a lt 0 then a 0 end if a b then return a else return b end if line gt MAXLINES then showpage line 0 end while As the name implies a while loop repeats its body while a condition is true As usual Lua first tests the while condition if the condition is false then the loop ends otherwise Lua executes the body of the loop and repeats the process local i 1 while ali do print a i i i 1 end pbsSoftLogic User Manual Numeric for The for statement has two variants the numeric for and the generic for A numeric for has the following syntax for var exp1 exp2 exp3 do lt something gt end This loop will execute something for each value of var from exp1 to exp2 using exp3 as the step to increment var This third expression is optional when ab
100. sent Lua assumes 1 as the step value As typical examples of such loops we have for i 2 1 f x do print i end for i 2 10 1 1 do print i end If you want a loop without an upper limit you can use the constant math huge for i 2 1 math huge do if 0 3 i 3 20 i 2 500 gt 0 then print i break end end pbsSoftLogic User Manual 11 Runtime Kernel for Linux and transferring License to Controller pbsSoftLogic has two parts 1 Engineering station Running on windows Operating system 2 Runtime Engine Running on Embedded Linux 2 6 x on controllers IA240 UC7112Plus W406 and runtime version for WinCE controllers ECU 1911 UNO 1019 and UC 7122 In this section we will talk about Linux Runtime engine You can download latest Linux runtime engine for different MOXA controllers from http www pbscontrol com download html page pbsSoftLogic Runtime Engine for Linux has following format tlocates at home pbsLX directory home pbsLX pbsSLKLX file is main runtime module It is an executable Linux file home pbsLX Imp libpbsLMP so logic monitoring protocol implementation for linux home pbsLX fblib libCounters so libLogic so libMath so libProcess so libTimers so linux implementation of pbsSoftlogic internal Function blocks For each FB group there is one linux dynamic library home pbsLX drvlib mmix libpbsModbusMLx so pbsSoftLogic Modbus Master RTU TCP implementation f
101. server should write Changes by call back to OPC client Driver Maximum Number of OPC Tags for each instance 1024 Maximum Number of OPC instance 8
102. t Name gt DataBit lt Name gt lt Desc gt 7 8 lt Desc gt lt Value gt 8 lt Value gt lt Node gt pbsSoftLogic User Manual DataBit will be used for ModbusRTU protocol lt Node gt lt Name gt StopBit lt Name gt lt Desc gt 1 2 lt Desc gt lt Value gt 1 lt Value gt lt Node gt StopBit will be used for ModbusRTU protocol lt Node gt lt Name gt Parity lt Name gt lt Desc gt None Even Odd lt Desc gt lt Value gt None lt Value gt lt Node gt Parity will be used for ModbusRTU protocol lt Node gt lt Name gt Instance lt Name gt lt Desc gt Instance lt Desc gt lt Value gt 1 lt Value gt lt Node gt Instance Driver Instance Number lt Node gt lt Name gt TCPPort lt Name gt lt Desc gt TCPPort lt Desc gt lt Value gt 502 lt Value gt lt Node gt TCPPort ModbsuTCP Port number Default Value 502 pbsSoftLogic User Manual ModbusBlocks xml pbsSoftlogic Modbus modeling is based on Block Concept We start with a simple example to show concepts of Block Suppose we want to configure Modbus network for following system ModbusRTU RS485 ID 1 ID 2 ID 3 DI 64 Bit 1 to 64 DI 64 Bit 1 to 64 DI 64 Bit 1 to 64 DO 32 Bit 4096 to 4128 DO 32 Bit 4096 to 4128 DO 32 Bit 4096 to 4128 AI 8 Word 10 to 17 AI 8 Word 10 to 17 AI 8 Word 10 to 17 ModbusBlocks xml for above configuration lt xml versions 1 0 7
103. t fifth element is used by pbsSoftlogic Linux kernel to pass following data to any UDF Obji 1 path of RAMDisk Drive in Linux Controller for saving static data for example it is like mnt ramdisk it include Obji 2 unique Identifier of UDF Obji 3 name of program In Linux Kernel it is always logic Obji 4 SRAM address in controller It is RAM with battery backup It include Obji 5 SD address It is External flash SD card address for data logging It include Points UDF inputs start from key 6 All key value should be as string number 1 2 3 All inputs are pass as string to Lua So you should change its type to number by tonumber function Example in1 tonumber obji 6 This is value of first UDF input objo is return table from Lua Points objo key start from 1 Objo 1 first UDF output Objo 2 second UDF output objo n n th UDF output n 32 All values will return to pbsSoftlogic linux kernel by string format by tostring function objo 1 tostring out1 Last statement in Lua should be return objo pbsSoftLogic included Lua editor Open Lus editor from tools menu pbsSoftLogic User Manual File Edit Debug Project View Window Tools Geal selel KD Cal mm S OPC Configurator ENFBList Windows FB Editar Lua FB Editor Run Lua FB editor You can see following environment File Edit Se
104. ta region Solve Logic 1f R true amp amp R Old falsel i Raising Edge detect for R1 Ol false 1fi Sl true amp amp ol Old false i Raising Edge detect for 5 HI LENE fendreqion Map Old Data Write Static data JE ite Outputs pbsSoftLogic User Manual public static void SE Listzobjectr Obhji ret Listtobject gt Oobhjo i string TmpPath bji 0 ToStringt string PID Ohbji 1 ToStringil string VSLEName Obji z ToStringil Variable mi Read Inputs and define Bolve Logic region Map Old Data S1 Old 51 R Old R Zendregion Write Static dat Write Outputs pbsSoftLogic User Manual Hregion Write Static data FileStream fs new FilestreamimPath FileMode Create AnlLTextWriter w new XmlTextWriterifs null w Formatting Formatting Indented w Indentation 5 2 WritesStartDbocumenti l WriteStartElsementi StraticData WritesStartElement Tag Write ttributestring Nanme Toi Write ttributeStringi value o1 ToString ll WriteEndElementi i OPCTaugMode gu uos WritesStartElementi Tacg Hrite ttributeStringi Mame al Old Hrite ttributeStringi Value al Old Tostring WriteEndElementi OPCTaugMode 8 8 4 WritestartElsement i Tag Hrite ttributestringi HMame E Old Hrite ttributeStringi Value RB Old ToStringill Writ
105. us Input status BO DO Digital Output Modbus Coil BOS DOS Digital Output Status Modbus Coils Status Al Analog Input Modbus input Register AO Analog Output Modbus Holding Register AOS Analog Output Status Modbus Holding Register status SYS Internal for pbsSoftLogic Can be used for reading status of communication SlavelD ID of Slave Device IP IP address of Slave Device Will use for ModbusTCP network StartAddress Start Address of Modbus Block For Digital Bit and for analog Word Count Channel Count Wait Time for driver to wait for getting answer from Slave Device Enable It is Enable or Not If it is not enable it is not polling by driver For SYS Block type Start Address is dummy and it is not use by driver So always put it 100 If you have another block with same start address it is not making any conflict pbsSoftLogic User Manual ModbusBlocks xml file for ModbusTCP ModbusTCP iia ID 1 ID 1 ID 1 IP 192 168 1 100 IP 192 168 1 101 IP 192 168 1 102 DI 64 Bit 1 to 64 DI 64 Bit 1 to 64 DI 64 Bit 1 to 64 DO 32 Bit 4096 to 4128 DO 32 Bit 4096 to 4128 DO 32 Bit 4096 to 4128 AI 8 Word 10 to 17 AI 8 Word 10 to 17 AI 8 Word 10 to 17 ModbusBlocks xml file for above configuration lt xml version 1 0 7 lt OPCSrvTags gt lt version gt 1L 0 0 lt version gt lt Black Name DIL Type s BI SlavelIb L I
106. ype DI Init 0 Address 12 Tag Hame DITaqg13 Type DI Init 0 Address 13 gt Tag Name DITagl14 Type DI Init 0 Address 14 Tag Hame DITaq15 Type DI Init 0 Address 15 gt Tag Name DITaq16 Type DI Init 0 Address 16 gt Tag Name DITag17 Type DI Init 0 Address 17 Tag Name DITaqi18 Type DI Init 0 Address 18 gt Tag Name DITagq19 Type DI Init 0 Address 19 Tag Hame DITaq20 Type DI Init 0 Address 20 gt Tag Name DITag21 Type DI Init 0 Address 21 gt Tag Name DITagq22 Type DI Init 0 Address 22 gt Tag Name DITaq23 Type DI Init 0 Address 23 gt Tag Name DITagqg24 Type DI Init 0 Address 24 Tag Hame DITaq25 Type DI Init 0 Address 25 gt Tag Name DITagqg26 Type DI Init 0 Address 26 gt Tag Name DITagq27 Type DI Init 0 Address 27 gt Tag Name DITaq28 Type DI Init 0 Address 28 gt lt Taq Name DITagq29 Type DI Init 0 Address 29 Tag Hame DITaq30 Type DI Init 0 Address 30 gt Tag Name DITagqg3l Type DI Init 0 Address 31 gt pbsSoftLogic User Manual Analog Input Signal definition Tag Name AITagO Type AI Init 0 Address 0 gt Taq Mame AITagl1 Type AI Tnit 0 Address 1 gt XTag Mame AITaqg2 Type AI Init 0 Address r2 gt Tag Mame AITaq3 Type AI Init 0 Address 3 gt Tag Name AlTag4
107. ze v Include in library v Share with v New folder Name Date modified Type X Favorites d BE Desktop 1 ModbusTags 7 27 2013 1240 PM XML File Jg Downloads options 1 27 2013 12 40 PM XML File T Recent Places f SkyDrive Photo Stream Save Libraries Options xml communication basic parameter ModbusTags xml Modbus Slave Tags Node lt Name gt PhysicalLayer lt Name gt lt Desc gt RS232 RS485 RS422 TCP lt Desc gt lt Value gt RS232 lt Value gt lt Node gt PhysicalLayer Physical layer for Modbus RTU select one of RS232 RS485 or RS422 for ModbusTCP Select TCP lt Node gt lt Name gt Protocol lt Name gt lt Desc gt RTU ASCII lt Desc gt lt Value gt RTU lt Value gt lt Node gt Protocol Modbus RTU or ASCII This version supports RTU Only lt Node gt lt Name gt COMPort lt Name gt lt Desc gt Serial Port for Communication 1 2 3 4 5 lt Desc gt lt Value gt 1 lt Value gt pbsSoftLogic User Manual lt Node gt COMPort Serial Com Port for ModbsuRTU lt Node gt lt Name gt BaudRate lt Name gt lt Desc gt 9600 19200 36400 52700 115200 lt Desc gt lt Value gt 9600 lt Value gt lt Node gt BaudRate Modbus RTU Baudate for communication lt Node gt lt Name gt DataBit lt Name gt lt Desc gt 7 8 lt Desc gt lt Value gt 8 lt Value gt lt Node gt DataBit ModbusRTU Data Bits 7 or 8 lt Node gt lt Name gt StopBit lt Name gt lt De

Download Pdf Manuals

image

Related Search

Related Contents

  Active repeater for wireless telemetry T24-AR operating  EndNote X7 Guide  Philips HD7606 User's Manual  Bedienungsanleitung  iss phone 20 シリーズ iss phone 20A/iss phone 20M  support pédagogique - Culture & Démocratie  Addendum for Version 1.02 (and later) Beta site PDAS-II    magicolor 2200 Installationsanleitung  

Copyright © All rights reserved.
Failed to retrieve file