[?] runtime totalizing

SIMATIC S7-200/300/400, Step7, PCS7, CFC, SFC, PDM, PLCSIM,
SCL, Graph, SPS-VISU S5/S7, IBHsoftec, LOGO ...
Post Reply
sudanee
Posts: 61
Joined: Thu Mar 19, 2009 11:00 am
Location: Sudan

[?] runtime totalizing

Post by sudanee » Thu Mar 21, 2013 7:23 am

Hi
I am looking for function to calculate runtime for motor, signal ..... in specific period of time
for CPU 300

thanx

FLiMBO
Posts: 5
Joined: Tue Apr 27, 2010 7:33 pm

Re: [?] runtime totalizing

Post by FLiMBO » Thu Mar 21, 2013 10:51 am

FB31
Show

Code: Select all

FUNCTION_BLOCK FB31
TITLE ='MOTOR_WORK_HOUR'
VERSION : 0.1


VAR_INPUT
  RUNNIG : BOOL ;	//MOTOR RUNING
  CYCLE_TIME : REAL ;	//OB35 CYCLE TIME AS milisecond
  RESET : BOOL ;	//RESET MOTOR WORKING TIME
END_VAR
VAR_OUTPUT
  WORK_TIME : REAL ;	//MOTOR WORKING TIME AS HOUR
END_VAR
VAR
  ADDED : REAL ;	
END_VAR
VAR_TEMP
  CYCLE_RATIO : REAL ;	
END_VAR
BEGIN
NETWORK
TITLE =

      L     3.600000e+006; 
      L     #CYCLE_TIME; 
      /R    ; 
      T     #CYCLE_RATIO; 
      NOP   0; 
NETWORK
TITLE =

      A     #RUNNIG; 
      AN    #RESET; 
      JNB   _001; 
      L     1.000000e+000; 
      L     #ADDED; 
      +R    ; 
      T     #ADDED; 
_001: NOP   0; 
NETWORK
TITLE =

      A     #RUNNIG; 
      AN    #RESET; 
      JNB   _002; 
      L     #ADDED; 
      L     #CYCLE_RATIO; 
      /R    ; 
      T     #WORK_TIME; 
_002: NOP   0; 
NETWORK
TITLE =

      A     #RESET; 
      =     L      4.0; 
      A     L      4.0; 
      JNB   _003; 
      L     0.000000e+000; 
      T     #WORK_TIME; 
_003: NOP   0; 
      A     L      4.0; 
      JNB   _004; 
      L     0.000000e+000; 
      T     #ADDED; 
_004: NOP   0; 
END_FUNCTION_BLOCK
insert this source code as a stl source and compile. It will generate FB31. You should call FB31 in any cyclic OB. IF you use OB35 (OB default cycle time is 100 msn) WORK_TIME:=100.0

sudanee
Posts: 61
Joined: Thu Mar 19, 2009 11:00 am
Location: Sudan

Re: [?] runtime totalizing

Post by sudanee » Thu Mar 21, 2013 11:00 am

thank you FLiMBO (tyou)
I will check and give feedback

sudanee
Posts: 61
Joined: Thu Mar 19, 2009 11:00 am
Location: Sudan

Re: [?] runtime totalizing

Post by sudanee » Thu Mar 21, 2013 9:16 pm

work like a charm
simple and perfect

I appreciate your help


(tyou)

indian
Posts: 122
Joined: Fri Aug 11, 2006 6:16 pm
Location: Russia, Komi

Re: [?] runtime totalizing

Post by indian » Fri Mar 22, 2013 11:07 pm


Guille
Posts: 32
Joined: Fri Oct 03, 2008 2:17 am
Location: America

Re: [?] runtime totalizing

Post by Guille » Sat Mar 23, 2013 12:32 am

Hello,
another way to measure time is shown here:

for TIA V11
http://support.automation.siemens.com/W ... reecontent

and here for step7 v5.5
http://support.automation.siemens.com/N ... reecontent

and also you can see here:

viewtopic.php?f=1&t=19300

greetings

Post Reply