SCL TIA,

: 2013-06-21

: canada

: SCL



RMP_SOAK.



ramp_soak
RMP_SOAK





RMP_SOAK TIA. .
SCL , SCL TIA Portal.



:



DB_NBR : BLOCK_DB ;
offset : int;
value := DB_NBR.DW[offset]



TIA BLOCK_DB. PEEK POKE ( ):



PEEK_(AREA := ,
DBNUMBER:= ,
BYTEOFFSET:= )

AREA :
16#81
16#82
16#83 M
16#84

DBNUMBER DINT, DB_ANY

BYTEOFFSET DINT

Data type



:



// checksum
// TIA Portal v12

FUNCTION_BLOCK "ramp soak"
{ S7_Optimized_Access := 'FALSE' }
VERSION : 0.1


// reverse by komatic
// adapdet by canada
(*
RMP_SOAK , ,
() ,
,
.
RMP_SOAK
,
.
.

:
RMP_SOAK;
;
"" ;
;
;

.
*)
VAR_INPUT
DF_OUTV : REAL ; //
DB_NBR : DB_ANY ; //
TM_SNBR : INT ; // (CONT_ON)
TM_CONT : TIME ; // (CONT_ON)
DFOUT_ON : BOOL ; //
RMPSK_ON : BOOL ; //
HOLD : BOOL ; //
CONT_ON : BOOL ; //
CYC_ON : BOOL ; //
TUPDT_ON : BOOL ; //
COM_RST : BOOL ; //
CYCLE : TIME := T#1S; //
END_VAR
VAR_OUTPUT
OUTV : REAL ; //
QR_S_ACT : BOOL ; // -
NBR_ATMS : INT ; //
RS_TM : TIME ; //
T_TM : TIME ; //
RT_TM : TIME ; //
END_VAR
VAR
sOutEnd : REAL ;
sOutOld : REAL ;
siNbratms : INT ;
stRstm : TIME ;
stTtm : TIME ;
stRttm : TIME ;
sbStart : BOOL ; //
sbQrsact : BOOL ; //
END_VAR
VAR_TEMP
Sollwert : REAL ;
dOutNeu : REAL ; //
dJ : INT ; // ⠠ //int
END_VAR


BEGIN
Sollwert:=DF_OUTV; //
IF COM_RST //
THEN
stTtm:=T#0MS; //
FOR dJ:=0 TO WORD_TO_INT(PEEK_WORD(area := 16#84, dbNumber := #DB_NBR, byteOffset := 0)) - 1 BY 1 DO
stTtm:=DINT_TO_TIME(DWORD_TO_DINT(PEEK_DWORD(area := 16#84, dbNumber := #DB_NBR, byteOffset :=(#dJ*8+6))))+stTtm;
//
END_FOR;
dOutNeu:=0.0; //
stRttm:=stTtm;
sOutEnd:=0.0;
siNbratms:=0;
stRstm:=T#0MS;
sbStart:=1;
sbQrsact:=0;
ELSE
IF RMPSK_ON
THEN
IF sbStart
THEN
dOutNeu:=DWORD_TO_REAL(PEEK_DWORD(area := 16#84, dbNumber := #DB_NBR, byteOffset := 2));
//
sOutEnd:=DWORD_TO_REAL(PEEK_DWORD(area := 16#84, dbNumber := #DB_NBR, byteOffset := 10));
//
stRstm :=DINT_TO_TIME(DWORD_TO_DINT(PEEK_DWORD(area := 16#84, dbNumber := #DB_NBR, byteOffset := 6)));
//
stRttm:=stTtm;
siNbratms:=1;
sbStart:=0;
sbQrsact:=1;
ELSE
IF HOLD
THEN
sbQrsact:=0;
dOutNeu:=sOutOld;
IF CONT_ON
THEN
sOutEnd:=DWORD_TO_REAL(PEEK_DWORD(area := 16#84,dbNumber := #DB_NBR,byteOffset := (TM_SNBR*8+2)));
stRttm:=TM_CONT;
stRstm:=TM_CONT;
siNbratms:=TM_SNBR;
FOR dJ:=siNbratms TO WORD_TO_INT(PEEK_WORD(area := 16#84,dbNumber := #DB_NBR,byteOffset := 0)) - 1 BY 1 DO
stRttm:=DINT_TO_TIME(DWORD_TO_DINT(PEEK_DWORD(area := 16#84,dbNumber := #DB_NBR, byteOffset := (dJ*8+6))))+stRttm;
END_FOR;
END_IF;
ELSE
IF stRstm > CYCLE
THEN
dOutNeu:=(sOutEnd-sOutOld) / DINT_TO_REAL(TIME_TO_DINT(stRstm))
* DINT_TO_REAL(TIME_TO_DINT(CYCLE)) + sOutOld;
stRstm:=stRstm-CYCLE;
stRttm:=stRttm-CYCLE;
ELSE
IF siNbratms < WORD_TO_INT(PEEK_WORD(area := 16#84,dbNumber := #DB_NBR,byteOffset := 0))
THEN
sOutEnd:=DWORD_TO_REAL(PEEK_DWORD(area := 16#84,dbNumber := #DB_NBR,byteOffset := ((siNbratms+1)*8+2)));
dOutNeu:=DWORD_TO_REAL(PEEK_DWORD(area := 16#84,dbNumber := #DB_NBR,byteOffset := (siNbratms*8+2)));
stRstm:=DINT_TO_TIME(DWORD_TO_DINT(PEEK_DWORD(area := 16#84,dbNumber := #DB_NBR,byteOffset := (siNbratms*8+6))));
siNbratms:=siNbratms+1;
sbQrsact:=1;
stRttm:=stRttm-CYCLE;
ELSE
IF CYC_ON
THEN
sbStart:=1;
ELSE
sbQrsact:=0;
END_IF;
dOutNeu:=DWORD_TO_REAL(PEEK_DWORD(area := 16#84,dbNumber := #DB_NBR,byteOffset := (siNbratms*8+2)));
END_IF;
END_IF;
END_IF;
END_IF;
ELSE
sbStart:=1;
dOutNeu:=0.0;
QR_S_ACT:=0;
END_IF;
IF TUPDT_ON //
THEN
stTtm:=T#0MS;
stRttm:=stRstm;
FOR dJ:=0 TO WORD_TO_INT(PEEK_WORD(area := 16#84,dbNumber := #DB_NBR,byteOffset := 0))-1 BY 1 DO
stTtm:=DINT_TO_TIME(DWORD_TO_DINT(PEEK_DWORD(area := 16#84,dbNumber := #DB_NBR,byteOffset :=(dJ*8+6))))+stTtm;
END_FOR;
FOR dJ:=siNbratms TO WORD_TO_INT(PEEK_WORD(area := 16#84,dbNumber := #DB_NBR,byteOffset := 0))-1 BY 1 DO
stRttm:=DINT_TO_TIME(DWORD_TO_DINT(PEEK_WORD(area := 16#84,dbNumber := #DB_NBR,byteOffset := (dJ*8+6))))+stRttm;
END_FOR;
END_IF;
END_IF;
IF DFOUT_ON
THEN
dOutNeu:=Sollwert;
sbQrsact:=0;
END_IF;
OUTV:=dOutNeu;
sOutOld:=dOutNeu;
QR_S_ACT:=sbQrsact;
NBR_ATMS:=siNbratms;
RS_TM:=stRstm;
T_TM:=stTtm;
RT_TM:=stRttm;
END_FUNCTION_BLOCK



, Modular PID Control.



ramp_soak



: TIA DB.
DB. , DB.



, "Optimized block acces" ( ), DB_NBR.
TIA 12 , DB.



ramp_soak
, RAMP_SOAK



TIA External source ( .scl), .



:





. .







: 8113

:     : 2013-06-21

, Siemens .
DB_NBR.DW[offset] TIA.
:)

:     : 2014-01-13

! - Generate Blocks from source ( '?'), ? !

: canada    : 2014-01-15

: .

: test124q    : 2015-05-15

- (DWORD_TO_DINT .
:
stRstm:=DINT_TO_TIME(PEEK_DWORD(area := 16#84, dbNumber := #DB_NBR, byteOffset := 6));

:
stRstm:=DINT_TO_TIME(DWORD_TO_DINT(PEEK_DWORD(area := 16#84, dbNumber := #DB_NBR, byteOffset := 6)));

- http://dfpd.siemens.ru/forum/viewtopic.php?p=163585

TIA PORTAL v13 v12.

: test124q    : 2015-05-15

Modular PID Control - http://dfpd.siemens.ru/assets/files/infocenter/Documetations/Automation_systems/STEP7/Run%20Time/PID_Standart_r.pdf

: komatic    : 2015-05-15

>test124q
,

:

(4000 max):

: