Comparing DBs recipes (S7)

Werner

Member
Join Date
Apr 2005
Location
IJsselstein
Posts
336
I have 31 DB's.

1 DB holds an array[1..50] of reals which are representing the actual speeds of the machine.

And 30 DBs (also array[1..50] of real), that are used to store the machine speeds for 30 recipes.

I want to compare the DB with the actual speeds of the machine with de recipe DB.

So something like:

If DB Actual Speeds <> DB Recipe[Actual recipe Number] Then
Recipe has been changed
end if

I am sure some of you must have made something simular. Can someone post code for the task or show me a "simple" way to compare the two DB's?

(I was looking for a DB block compare function simular like the BLKMV function but couldn't find it so far...)
 
Here's one implementation that assumes the values to be compared are at the start of the DBs:

Code:
FUNCTION FC 1 : BOOL
TITLE =
VERSION : 0.1

VAR_INPUT
  iActualSpeedDB : INT ; 
  iRecipeDB : INT ; 
  iNoOfRealSpeeds : INT ; 
END_VAR
VAR_TEMP
  iLoopCount : INT ; 
  iDBForSpeed : INT ; 
  iDBForRecipe : INT ; 
END_VAR
BEGIN
NETWORK
TITLE =
	  L	 #iActualSpeedDB; 
	  T	 #iDBForSpeed; 
	  L	 #iRecipeDB; 
	  T	 #iDBForRecipe; 
	  LAR1  P#DBX 0.0; 
	  L	 #iNoOfRealSpeeds; 
LA:   T	 #iLoopCount; 
	  OPN   DB [#iDBForSpeed]; 
	  L	 D [AR1,P#0.0]; 
	  OPN   DB [#iDBForRecipe]; 
	  L	 D [AR1,P#0.0]; 
	  ==R   ; 
	  JCN   diff; 
	  +AR1  P#4.0; 
	  L	 #iLoopCount; 
	  LOOP  LA; 
	  SET   ; 
	  R	 #RET_VAL; 
	  JU	exit; 
diff: SET   ; 
	  S	 #RET_VAL; 
exit: SET   ; 
	  SAVE  ; 
END_FUNCTION
 
I have tested the sofware and it works fine. But now for what ever reason it does not compile the block. No errors, no warnings. I deleted the FC out off the block folder in the simatic manager. And still the source file does not compile a new block.

Is this a known problem with the scl compiler?

Edit:

Even if I make deliberate errors in the source file it compiles without errors and warnings?!!! Please help...
 
Last edited:

Similar Topics

I’m running a micro 820 to measure a tank level, then turning on equipment at certain levels. I have an analog input (4-20) that I’m storing and...
Replies
10
Views
275
How do you go about implementing, on the M580 PLC, how many days, hours, minutes before a predefine event in the future? The RRTC_DT yields the...
Replies
3
Views
1,807
This is a Citect SCADA question I have Six variables of type REAL (Float) to compare and determine (identify) which variable has the highest...
Replies
4
Views
1,412
I have currently made a logic to read Serial input from a barcode scanner. The situation is that I need to read the barcode from the machine and...
Replies
5
Views
2,038
Hello, We are using Schneider SCADAPack 357 and Trimble Acutime 2000GPS. We are getting the data as a string(ASCII) from...
Replies
3
Views
1,475
Back
Top Bottom