Recent

Author Topic: [SOLVED] PascalSCADA no access to DB on a S7-300 CPU  (Read 814 times)

af0815

  • Sr. Member
  • ****
  • Posts: 324
[SOLVED] PascalSCADA no access to DB on a S7-300 CPU
« on: April 18, 2019, 11:34:45 am »
I work with PascalSCADA 0.7.5.0 from OPM.

Access with the TTCP_UDPPort, TISOTCPDriver and TPLCTagNumber works for Flags (german: 'Merker') works without a problem. (Memreadfunc, Memwritefunc = 3, MemAdress = FlagAdress, PLCRack = 0, PLCSlot = 2, TagType = pttWord).

If i want to access  DB 200:DBW2 it doesnt work and return and io??? Error ( I have no PLC actual for tests)
(Memreadfunc, Memwritefunc = 4, MemAdress = 2,Mem_FileDB=200,  PLCRack = 0, PLCSlot = 2, TagType = pttWord).

Have i forgotten/misconfigured something ?

Attached a minimal Demo Project.
It uses the Packages pascaslscada (OPM), pascalscada_hmi (OPM) and RuntimeTypeInfoControls
« Last Edit: April 30, 2019, 08:10:24 am by af0815 »
regards
Andreas

avra

  • Hero Member
  • *****
  • Posts: 1600
    • Additional info
Re: PascalSCADA no access to DB on a S7-300 CPU
« Reply #1 on: April 18, 2019, 06:27:22 pm »
You should test with actual plc or plc simulator that you can find here:
http://snap7.sourceforge.net/
You need to test for a plc that can be pinged, and DB/DBW combo that actually exists in such plc. Mentioned serverdemo application can be tested with DB1, DB2 and DB3. For more you would need to adjust plc simulator code.

You can also try Snap7 or Pasettimino FPC libraries as an alternative.
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

af0815

  • Sr. Member
  • ****
  • Posts: 324
Re: PascalSCADA no access to DB on a S7-300 CPU
« Reply #2 on: April 18, 2019, 08:24:31 pm »
avra, i wrote access to markers/flag is working to this plc. With the emulator from snap7 it is working too. With Snap7 it is working (my Plan B). But PascalSCADA is more comfortable (and i have some issue with multi-SPS access in parallel with snap7).

I can access the DB with RedLion Devices (G12, CR3000) too. Only with PascalSCADA i have this issue with DBs (not MKs). Passettimio is no alternative, because it have to work on Windows and Rasbian (and sometimes normal Debian/Ubuntu). And in my last tests some time ago pasttimio  was not working under Linux. BTW. look at the comfortable HMI components written by Fabio.
« Last Edit: April 18, 2019, 08:29:33 pm by af0815 »
regards
Andreas

avra

  • Hero Member
  • *****
  • Posts: 1600
    • Additional info
Re: PascalSCADA no access to DB on a S7-300 CPU
« Reply #3 on: April 19, 2019, 09:17:31 pm »
I tried your example to read/write tag from Snap7 serverdemo DB1, and it works. I just changed IP address and made TCP_UPDPort1 Active to true. Check firewall and antivirus.
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

af0815

  • Sr. Member
  • ****
  • Posts: 324
Re: PascalSCADA no access to DB on a S7-300 CPU
« Reply #4 on: April 19, 2019, 09:50:29 pm »
I have no trouble with the simulated S7 cpu from Snap7, only with a real S7 300 PLC. The access looks slightly different with Snap7 and PascalScada, this is visible in the Simulator. I have to wait for a test with a real device.
regards
Andreas

avra

  • Hero Member
  • *****
  • Posts: 1600
    • Additional info
Re: PascalSCADA no access to DB on a S7-300 CPU
« Reply #5 on: April 19, 2019, 11:32:59 pm »
There are two things you can check:

1) See if you have enough PG and S7 connections. Unlike real plc, simulated plc does not have any connection limit so maybe that is why access to simulated plc works. Snap7 can connect as PG (like Step7 or TiaPortal), as S7 (like pc SCADA) or as OP (like HMI panel). Maybe it connects as PG and your app tries to connect as S7, and there are enough PG but not enough S7 connections. If there are no free connections (they must be reserved first) of the type that your app needs, your app will not be able to connect. You can increase reserved connections of each type in Step7/TiaPortal. You need to ask author what connection type is used by PascalSCADA, or check sources and see if it can be selected as with Snap7. Snap7 clientdemo by default connects to your plc with PG connection, but you should try to connect with it also as S7 and as OP. If for example you connect as S7 and now you get similar error as with PascalSCADA, then you are probably on the right track to find the root of the problem.

2) Check if your S7-300 is of lean type. If it is, then total number of connections is only 4. You need to have at least one free and reserved connection of your app type in order to have a successful connection. If there are HMI panels, Step7, some SCADA or some OPC server running, it will be very hard to find a free connection. If you do not have lean model of S7-300 then your total number of connections is much higher, but anyway you need to make reservations for your app connection type.
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

af0815

  • Sr. Member
  • ****
  • Posts: 324
Re: PascalSCADA no access to DB on a S7-300 CPU
« Reply #6 on: April 20, 2019, 09:28:09 am »
The count of connection must be ok, because i can read/write from/to Markers at the same time. So the count of connections will be not the bottleneck. MK works DB not.

But your tip, snap 7 connection is default as PG. -> In my plan B programm (with snap 7 connection) is use Connectiontype 2 = OP and this works with MK and DB.

I have to check some parameters with a real device. I have no acces to TIA and the PLC direct.
regards
Andreas

af0815

  • Sr. Member
  • ****
  • Posts: 324
Re: PascalSCADA no access to DB on a S7-300 CPU
« Reply #7 on: April 20, 2019, 10:31:33 am »
I have asked Fabio (from PascalSCADA) direct on http://www.pascalscada.com/.

BTW: The Screenshoots at http://www.pascalscada.com/screenshots/ are very nice and shows the power of PascalSCADA.
regards
Andreas

af0815

  • Sr. Member
  • ****
  • Posts: 324
Re: PascalSCADA no access to DB on a S7-300 CPU
« Reply #8 on: April 30, 2019, 08:07:43 am »
Solution: Replace the error in front of the screen.  :o ;D

There was a double mistake.
A) The adress/DB info was wrong (exchanged Adr <-> DB), reading/writing to an not existing DB will cause an error  ;D
B) You have to know the exact length of the DB , reading / writing out of bonds will cause a different error  ;D

In a test enviroment your DB is normaly long enough, so you see never an error, but in the wild the DB have an excact length. And sometimes you get blind and see not the mistake by yourself.
regards
Andreas