Siemens MicroMaster 440 Control Through S7315 PLC

Thanks. Do I just have to paste this code into a FC block? Also, do I have to call FB41 seperately? (Is this the convert to analogue block?)
 
I have been thinking about my problem and am not sure if the solution would be for PID control (this may be over-complicated for the task), but to implement a set of rules for when the pressure reaches a particular threshold, send a speed reference to the drive.

I have attached an Excel file of when I need the pumps to start decreasing speed.

Could someone agree what the best control method would be?

Many thanks in advance
 
Use a 40 point lookup table for each drive. The table will contain 40 speeds corresponding to the 40 pressure points.
 
To me it looks like 4 straight lines.
A look-up table would be overkill.
Simply use a scaling function that defines y=f(x) by means of the end points. The end points could be set on a HMI for example.
 
Here's the code for a straight line implementation.
For your pink line:
S1_Constant=100.0
P1_Constant=20.0
P2_Constant=30.0

Code:
FUNCTION FC 3 : VOID
TITLE =
VERSION : 0.1

VAR_INPUT
  S1_Constant : REAL ; 
  P1_Constant : REAL ; 
  P2_Constant : REAL ; 
  Pressure : REAL ; 
END_VAR
VAR_OUTPUT
  rSpeed : REAL ; 
END_VAR
VAR_TEMP
  rSlope : REAL ; 
  rC : REAL ; 
END_VAR
BEGIN
NETWORK
TITLE =calc slope and intercept
	  L	 #P1_Constant; 
	  L	 #P2_Constant; 
	  -R	; 
	  L	 #S1_Constant; 
	  /R	; 
	  T	 #rSlope; 
	  L	 #P2_Constant; 
	  NEGR  ; 
	  L	 #rSlope; 
	  *R	; 
	  T	 #rC; 
NETWORK
TITLE =check for which region to use
	  L	 #Pressure; 
	  L	 #P1_Constant; 
	  <=R   ; 
	  JC	less; 
	  TAK   ; 
	  L	 #P2_Constant; 
	  >=R   ; 
	  JC	more; 
	  JU	linr; 
NETWORK
TITLE =linear part
linr: L	 #Pressure; 
	  L	 #rSlope; 
	  *R	; 
	  L	 #rC; 
	  +R	; 
	  T	 #rSpeed; 
	  JU	Exit; 
NETWORK
TITLE =less or more part
less: L	 #S1_Constant; 
	  T	 #rSpeed; 
	  JU	Exit; 
more: L	 0.000000e+000; 
	  T	 #rSpeed; 
	  JU	Exit; 
NETWORK
TITLE =
Exit: SET   ; 
	  SAVE  ; 
END_FUNCTION
 
Many thanks for the help, it is greatly appreciated. The only thing is that I am only really used to FBD/LAD and have not used a lot of STL.

Could this function be implemented by FBD/LAD?

Regards,
henno2000
 
Here's the same processing in ladder. You have to import the source code and compile it - it will then view in ladder when you open the block.
Code:
FUNCTION FC 4 : VOID
TITLE =
VERSION : 0.1

VAR_INPUT
  S1_Constant : REAL ; 
  P1_Constant : REAL ; 
  P2_Constant : REAL ; 
  Pressure : REAL ; 
END_VAR
VAR_OUTPUT
  rSpeed : REAL ; 
END_VAR
VAR_TEMP
  rSlope : REAL ; 
  rC : REAL ; 
  bLess : BOOL ; 
  bMore : BOOL ; 
  bLinear : BOOL ; 
  rTemp : REAL ; 
END_VAR
BEGIN
NETWORK
TITLE =calc slope
	  A(	; 
	  L	 #P1_Constant; 
	  L	 #P2_Constant; 
	  -R	; 
	  T	 #rTemp; 
	  AN	OV; 
	  SAVE  ; 
	  CLR   ; 
	  A	 BR; 
	  )	 ; 
	  JNB   _003; 
	  L	 #S1_Constant; 
	  L	 #rTemp; 
	  /R	; 
	  T	 #rSlope; 
_003: NOP   0; 
NETWORK
TITLE =calc intercept
	  A(	; 
	  L	 #P2_Constant; 
	  NEGR  ; 
	  T	 #rTemp; 
	  SET   ; 
	  SAVE  ; 
	  CLR   ; 
	  A	 BR; 
	  )	 ; 
	  JNB   _00b; 
	  L	 #rTemp; 
	  L	 #rSlope; 
	  *R	; 
	  T	 #rC; 
_00b: NOP   0; 
NETWORK
TITLE =determine which region to use - pressure less than P1
	  L	 #Pressure; 
	  L	 #P1_Constant; 
	  <=R   ; 
	  =	 #bLess; 
NETWORK
TITLE =determine which region to use - pressure greater than P1
	  L	 #Pressure; 
	  L	 #P2_Constant; 
	  >=R   ; 
	  =	 #bMore; 
NETWORK
TITLE =Linear region
	  AN	#bLess; 
	  AN	#bMore; 
	  =	 #bLinear; 
NETWORK
TITLE =Linear region
	  A(	; 
	  A	 #bLinear; 
	  JNB   _013; 
	  L	 #Pressure; 
	  L	 #rSlope; 
	  *R	; 
	  T	 #rTemp; 
	  AN	OV; 
	  SAVE  ; 
	  CLR   ; 
_013: A	 BR; 
	  )	 ; 
	  JNB   _017; 
	  L	 #rTemp; 
	  L	 #rC; 
	  +R	; 
	  T	 #rSpeed; 
_017: NOP   0; 
NETWORK
TITLE =less region
	  A	 #bLess; 
	  JNB   _01b; 
	  L	 #S1_Constant; 
	  T	 #rSpeed; 
_01b: NOP   0; 
NETWORK
TITLE =more region
	  A	 #bMore; 
	  JNB   _021; 
	  L	 0.000000e+000; 
	  T	 #rSpeed; 
_021: NOP   0; 
END_FUNCTION
 
Many thanks for the help. It is greatly appreciated.

For the above block, I am wanting to send the output 'rSpeed' to the drive as a speed reference, but am unable to do so (IE - DB44.DBW4). This is because the output is a REAL, when I am wanting to send a WORD. Is this simple to change for the structure of the block? (To have a WORD output).

Regards,
henno2000
 
To convert a REAL to an INT:

L "rSPEED"
RND
T "iSPEED"

Notice, maybe you have scaled the iSPEED so that you want to use part of what is after the decimal point.
I.e. iSPEED=1234 means "123.4"
If that is the case, you have to push the values to suit the decimal point.

L "rSPEED"
L 10.0
*R
RND
T "iSPEED"

Also, be sure that rSPEED cannot exceed what can be fit inside an INT, -32768..+32767. Check your scaling.
 
Here's the block updated to output a word where 16384 corresponds to 100% speed.

Code:
FUNCTION FC 4 : VOID
TITLE =
VERSION : 0.1

VAR_INPUT
  S1_Constant : REAL ; 
  P1_Constant : REAL ; 
  P2_Constant : REAL ; 
  Pressure : REAL ; 
END_VAR
VAR_OUTPUT
  wOutput : WORD ; 
END_VAR
VAR_TEMP
  rSlope : REAL ; 
  rC : REAL ; 
  bLess : BOOL ; 
  bMore : BOOL ; 
  bLinear : BOOL ; 
  rTemp : REAL ; 
  rSpeed : REAL ; 
  diTemp : DINT ; 
END_VAR
BEGIN
NETWORK
TITLE =calc slope
	  A(	; 
	  L	 #P1_Constant; 
	  L	 #P2_Constant; 
	  -R	; 
	  T	 #rTemp; 
	  AN	OV; 
	  SAVE  ; 
	  CLR   ; 
	  A	 BR; 
	  )	 ; 
	  JNB   _001; 
	  L	 #S1_Constant; 
	  L	 #rTemp; 
	  /R	; 
	  T	 #rSlope; 
_001: NOP   0; 
NETWORK
TITLE =calc intercept
	  A(	; 
	  L	 #P2_Constant; 
	  NEGR  ; 
	  T	 #rTemp; 
	  SET   ; 
	  SAVE  ; 
	  CLR   ; 
	  A	 BR; 
	  )	 ; 
	  JNB   _002; 
	  L	 #rTemp; 
	  L	 #rSlope; 
	  *R	; 
	  T	 #rC; 
_002: NOP   0; 
NETWORK
TITLE =determine which region to use - pressure less than P1
	  L	 #Pressure; 
	  L	 #P1_Constant; 
	  <=R   ; 
	  =	 #bLess; 
NETWORK
TITLE =determine which region to use - pressure greater than P1
	  L	 #Pressure; 
	  L	 #P2_Constant; 
	  >=R   ; 
	  =	 #bMore; 
NETWORK
TITLE =Linear region
	  AN	#bLess; 
	  AN	#bMore; 
	  =	 #bLinear; 
NETWORK
TITLE =Linear region
	  A(	; 
	  A	 #bLinear; 
	  JNB   _003; 
	  L	 #Pressure; 
	  L	 #rSlope; 
	  *R	; 
	  T	 #rTemp; 
	  AN	OV; 
	  SAVE  ; 
	  CLR   ; 
_003: A	 BR; 
	  )	 ; 
	  JNB   _004; 
	  L	 #rTemp; 
	  L	 #rC; 
	  +R	; 
	  T	 #rSpeed; 
_004: NOP   0; 
NETWORK
TITLE =less region
	  A	 #bLess; 
	  JNB   _005; 
	  L	 #S1_Constant; 
	  T	 #rSpeed; 
_005: NOP   0; 
NETWORK
TITLE =more region
	  A	 #bMore; 
	  JNB   _006; 
	  L	 0.000000e+000; 
	  T	 #rSpeed; 
_006: NOP   0; 
NETWORK
TITLE =scale for drive 0-100 == 0-16384
	  A(	; 
	  L	 #rSpeed; 
	  L	 1.638400e+001; 
	  *R	; 
	  T	 #rTemp; 
	  AN	OV; 
	  SAVE  ; 
	  CLR   ; 
	  A	 BR; 
	  )	 ; 
	  JNB   _007; 
	  L	 #rTemp; 
	  RND   ; 
	  T	 #diTemp; 
_007: NOP   0; 
NETWORK
TITLE =scaled value to output
	  L	 #diTemp; 
	  T	 #wOutput; 
	  NOP   0; 
END_FUNCTION
 
JesperMP said:
Just a small comment:
I think it is better to format the output as INT in stead of WORD.

True, then the output can be sent straight to the drive. The drive parameter for I_Setpoint requires a reference in % (-100 to +100).

To convert to INT I have used the RND function. Is this acceptable? (The number should be limited at 100).

Regards,
henno2000
 
henno2000 said:
To convert to INT I have used the RND function. Is this acceptable? (The number should be limited at 100).
Yes. If the REAL value cannot go outside +/- 100.0 then it is as simple as that:

L "rSPEED"
RND
T "iSPEED"
 
Also, using the example project, I copied across DB44 & DB55, for which there were no parameters displayed. I then copied across FB63 (which contains the parameters), and everything could be viewed.

I know that I need to copy DB44 & DB55 for each individual drive, but do I have to copy FB63 for each individual drive?

Regards,
henno2000
 

Similar Topics

My tutor asked me for this small project: using S7-200 control MM440 with PROFIBUS. Because S7-200 with PROFIBUS module EM277 can only be PROFIBUS...
Replies
4
Views
2,975
fault A0501 (i.e current limit ) displaying whwn i replace siemens 420 drive with mm440. all parameters are crosschecked. please help to...
Replies
4
Views
1,553
I have a Siemens Micromaster 440 (6SE6440-2UC25-5CA1) with encoder module (6SE6400-0EN00-0AA0) and Profibus module (6SE6400-1PB00-0AA0). I'm...
Replies
1
Views
3,063
I am trying, for the first time, to write values to the control word of a Micromaster 440 using an S7-300 PLC. I barely know what I'm doing, and...
Replies
4
Views
2,573
Hello good day : micromaster have a 440 installed on a machine, when I push button start machine micromaster machine works well, up to speed and...
Replies
3
Views
2,169
Back
Top Bottom