S7 Simulation with Profibus DP

mjoha266

Member
Join Date
Jan 2008
Location
Gothenburg
Posts
34
Yo!

So I want to make a simulation with the DP. I have a CPU318-2 with a DP module. To this I have a DP Master system connencted, and to this I have a C4G-PFP DP Norm Gateway connected. The C4G unit has it's (in) I adress set to 256-271 [1], and the Diagnostic adress set to 8189 [2].

I'm using a SFC14 to read the data from the module and have made the call like this:
 
OPN DI 3

CALL "DPRD_DAT"
LADDR :=W#16#256
RET_VAL:="NotUsedInt"
RECORD :=P#DIX 0.0 WORD 8
NOP 0


Where DB3 is the DB where I want the data.

Now I have tried some different ANY at the RECORD, and LADDR values but I don't get it to work... Here is some errors I get:
with LADDR :=W#16#256
"DIX 0.0 WORD 8" - 8092
"... BYTE 16" - 8090
"... BYTE 1" - 8090

or with LADDR :=W#16#100
"DIX 0.0 WORD 8" - 8092
"... BYTE 16" - 8093

So my Q's then:
1: [1] is this in hex? (ie. should I use 100 or 256 at the ADDR?)
2: [2] what is the diagnostic adr for?
3: Why dosn't it work, and how should I fix it? :) (the "RECORD:=P#DIX 0.0 WORD" 8 is from a working example - with the same H/W config - which is why I'm using it.)

//Thanks!
 
Last edited:
w#16#100 is decimal 256

What do you mean by "DP module" on your 318 ? The 318 has two built in ports that can both be configured to DP. Are you referring to a separate card ?
 
Last edited:
L D[AR2 said:
w#16#100 is decimal 256

What do you mean by "DP module" on your 318 ? The 318 has two built in ports that can both be configured to DP. Are you referring to a separate card ?

Nope, I mean the built in ports.
 
Highlight SFC14 and click on F1 - the error codes are shown in the help. e.g.

Error Code (W#16#...) Explanation
0000 No error occurred.
8090 · You have not configured a module for the specified logical base address or · you have ignored the restriction concerning the length of consistent data or· you have not entered the start address in the LADDR parameter in hexadecimal format.
8092 A type other than BYTE is specified in the ANY reference.
8093 No DP module/PROFINET IO device from which you can read consistent data exists at the logical address specified in LADDR.
80A0 Access error detected while the I/O devices were being accessed.
80B0 Slave failure on external DP interface module.
80B1 The length of the specified destination area is not identical to the user data
length configured with STEP 7.
80B2 System error with external DP interface module.
80B3 System error with external DP interface module.
80C0 The data haven't yet been read by the module.
80C2 System error with external DP interface module.
80Fx System error with external DP interface module.
87xy System error with external DP interface module.
808x System error with external DP interface module.
8xyy General error information, see Evaluating Errors with the Output Parameter RET_VAL
 
Hej Mjoha.

Can you post a link to the sample project ?
What I do not understand, is that if there is a sample project with exactly the same configuration, why you are having problems with making the program.
You must have changed something, as there cannot have been made such a mistake in the original project with LADDR being set to the decimal value.
I also do not understand how it is possible to specify WORDs for the RECORD, as you clearly must specify BYTEs.
So there must have been something wrong with the sample project, or you have changed something with it.
 
Hmm well this is the exact code from the working project:

CALL "DPRD_DAT"
LADDR :=#Addr_W_0
RET_VAL:="NotUsedInt"
RECORD :=P#DIX 52.0 WORD 8
NOP 0


So the HEX/DEC is my fault, and my q was if the adress 256 was in HEX or DEC

And the thing with WORD 8, isn't that the same thing as BYTE 16?

But now to the thing with the consistent data... I'm just simulating (ie. I have no physical PLC yet, thous no DP) can I just set a value at the I 256 (in PLCSIM), which would correspond to my simulated unit (a robot)? (otherwise how do I simulate a (extern) DP unit (like a robot))?
 
And the thing with WORD 8, isn't that the same thing as BYTE 16?
One should think so. But ANY pointers contain information about the data type, and it looks like DPRD_DAT insists it must be BYTEs.

Can you link to the sample project ?

But now to the thing with the consistent data... I'm just simulating (ie. I have no physical PLC yet, thous no DP) can I just set a value at the I 256 (in PLCSIM), which would correspond to my simulated unit (a robot)? (otherwise how do I simulate a (extern) DP unit (like a robot))?
Maybe it is possible that the robot can exchange the data without it having to be consistent, but if so why is the sample project setup with DPRD_DAT ?

Anyway.
If the data must be consistent, then you have to use DPRD_DAT and DPWR_DAT. To simulate, you can manipulate the DB addresses that RECORD points to. And you can manipulate the DB adresses in code or manually in PLCSIM.
If the data does not have to be consistent, then you can just use the I/Q or PI/PQ adresses directly, and you can also manipulate them in code or manually in PLCSIM.
 
Ok, I'm not quite shure that I'm with you all the way there...
What does consistent mean in the PLCworld?
I might be able to solve it like this:

L W#16#100 // Load startaddress
SLW 3 // Transfer to pointer format
LAR1 // Store in address register 1
L PID [AR1,P#0.0] // Pick data from Profibus
T DID 0 // Transfer to STAT byte 52 to 55
L PID [AR1,P#4.0] // Pick data from Profibus
T DID 4 // Transfer to STAT byte 56 to 59
L PID [AR1,P#8.0] // Pick data from Profibus
T DID 8 // Transfer to STAT byte 60 to 63
L PID [AR1,P#12.0] // Pick data from Profibus
T DID 12 // Transfer to STAT byte 64 to 67


But I still have a question then. Can I in any way change the values at the "PI" side (in for example PLCSIM)? I'm working on a verification project here and this exact code comes from a "(big car company) standard blocks library) so don't want to change things in the blocks.


I'm sorry but I can't link the whole project.
 
What does consistent mean in the PLCworld?
Consistent means that the data is transmitted as a block.
If data changes several places in the block, with consistency you make sure that all the changes are activated in the remote partner simultanously.

For data sizes 1, 2 and 4 bytes, you can just use direct i/o addressing (IB2, QW10, PQD20 for example).
But for data sizes 3 bytes and 5 bytes and up you have to use the SFCs that transfer all the data consistently as a block.

It quite normal for datatransfer with "intelligent" devices that the data must be consistent.

But I still have a question then. Can I in any way change the values at the "PI" side (in for example PLCSIM)?
You got me there. I and Q for sure, but I am not certain about PI and PQ. I think that in PLCSIM you just modify the I and Q adresses even though they are outside the proces image. Not sure what PLCSIM then does when it encounters a PI for example of an I address you have modified manually.
 

Similar Topics

Dear all Is any way to simulate profibus DP slave/Master using SIEMENS plcsim or any other program?
Replies
1
Views
1,555
Hi, I would like to assemble a simulator/practice booster pump system that uses PID to maintain steady water pressure under various outlet demands...
Replies
0
Views
74
I am trying to set up a piece of equipment with a Horner HE-X4R. I'd like to use structured text and so far I'm just trying to get a basic On/off...
Replies
0
Views
70
hello every one. i'm new to tiaportal, i have created new project and HMI screen the program works fine with PLC-sim, but when i try to cntrol the...
Replies
9
Views
406
I am looking to upgrade a CompactLogix on V18 to an L83E on V32 which is currently using a Beijer E1151. Does anyone know if the E1151 is directly...
Replies
3
Views
644
Back
Top Bottom