You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

Reply
 
Thread Tools Display Modes
Old April 7th, 2021, 01:53 AM   #1
WuShockKS
Member
United States

WuShockKS is offline
 
Join Date: Mar 2021
Location: Kansas
Posts: 3
Structured Text Pump Control

Hello,
I am new to plcs and using structured text IEC 61131-3.

I want to turn off and on a pump based on level setpoints from an analog signal. I have the text.

if tankLevel > HighSP then
hspump1out := 0.0;
elsif tanklevel < LowSP then
hspump1out := 1.0;
end_if;

But how do I get the program to repeat? Once the level lowers to kick on the pump the program ends and does not turn off at the top setpoint.

Thanks
  Reply With Quote
Old April 7th, 2021, 02:10 AM   #2
L D[AR2,P#0.0]
Lifetime Supporting Member
United Kingdom

L D[AR2,P#0.0] is offline
 
Join Date: Nov 2006
Location: UK
Posts: 6,227
Post a screen shot of your code running with the level greater than the setpoint. Also post how your floating point hspump1out controls the pump off/on
__________________
S7-300 to 1500 conversions done - email to s7conversions@hotmail.com
  Reply With Quote
Old April 7th, 2021, 02:22 AM   #3
WuShockKS
Member
United States

WuShockKS is offline
 
Join Date: Mar 2021
Location: Kansas
Posts: 3
I didn't understand floating point HS1Pumpout. It is a single digital output bit.
Attached Images
File Type: png Screenshot (6).png (72.5 KB, 96 views)
  Reply With Quote
Old April 7th, 2021, 02:47 AM   #4
parky
Member
United Kingdom

parky is offline
 
parky's Avatar
 
Join Date: Oct 2004
Location: Midlands
Posts: 3,097
Never seen that normally it should be true or false as outputs for pumps etc. will be digital (Boolean) not floats.
The code would normally be called cyclically in a task so runs every scan.
  Reply With Quote
Old April 7th, 2021, 02:51 AM   #5
cardosocea
Member
United Kingdom

cardosocea is offline
 
Join Date: Nov 2016
Location: Fields of corn
Posts: 1,815
Silly question, but what platform is this? This reminds me of the OMRON (20 odd years ago) that needed an instruction to tell them to cycle the program at the end of the program. Perhaps your platform has similar?
  Reply With Quote
Old April 7th, 2021, 05:49 AM   #6
drbitboy
Lifetime Supporting Member
United States

drbitboy is offline
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 2,602
Is it ELSIF or ELSEIF in this implementation? help.codesys.com seems to use ELSIF, but there are a few occurrences of ELSEIF there.
  Reply With Quote
Old April 7th, 2021, 07:17 AM   #7
L D[AR2,P#0.0]
Lifetime Supporting Member
United Kingdom

L D[AR2,P#0.0] is offline
 
Join Date: Nov 2006
Location: UK
Posts: 6,227
Here is an example showing the value of the variables when the plc is running. Your screen shot does not show any, it is a repeat of your original post in a different format.
Attached Images
File Type: jpg pump1.jpg (38.8 KB, 89 views)
__________________
S7-300 to 1500 conversions done - email to s7conversions@hotmail.com
  Reply With Quote
Old April 7th, 2021, 07:43 AM   #8
Mara
Member
Finland

Mara is offline
 
Join Date: Jan 2017
Location: Finland
Posts: 83
Pump is turned ON if the value is higher than HighSp and OFF if value is lower than LowSp. My question is: what if the value is BETWEEN the low- and high limit?

Edit: You will need something like this (don't know exactly since i don't know your application)

IF Level < LowSp AND level <HighSp THEN

Pump:=TRUE;

ELSE

Pump:= FALSE;

END_IF

Last edited by Mara; April 7th, 2021 at 07:51 AM.
  Reply With Quote
Old April 7th, 2021, 07:50 AM   #9
drbitboy
Lifetime Supporting Member
United States

drbitboy is offline
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 2,602
Quote:
Originally Posted by Mara View Post
Pump is turned ON if the value is higher than HighSp and OFF if value is lower than LowSp. My question is: what if the value is BETWEEN the low- and high limit?

No change from the previous scan's value; this is bang-bang control with a hysteresis gap.
  Reply With Quote
Old April 7th, 2021, 07:55 AM   #10
ndzied1
Lifetime Supporting Member
United States

ndzied1 is offline
 
ndzied1's Avatar
 
Join Date: Aug 2002
Location: Chicago, Illinois
Posts: 2,604
Quote:
Originally Posted by WuShockKS View Post

But how do I get the program to repeat? Once the level lowers to kick on the pump the program ends and does not turn off at the top setpoint.

Thanks
The program (POU in IEC speak) should be in a “task” that repeats.
__________________
nOrM
======================
nOrM=Norman Dziedzic Jr.
I've never been to China but my phone has.
  Reply With Quote
Old April 7th, 2021, 04:59 PM   #11
Tom8940
Member
Denmark

Tom8940 is offline
 
Join Date: Jun 2018
Location: Denamrk
Posts: 4
Alternating pump control.jpg
Perhaps this can help you on the way
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
3 pump Pressure control. croc LIVE PLC Questions And Answers 7 August 24th, 2013 09:38 AM
fp0 structured text iungerich1 LIVE PLC Questions And Answers 1 November 26th, 2012 09:03 PM
Strings in Logix5000 Structured Text whumphrey LIVE PLC Questions And Answers 3 November 24th, 2012 05:50 AM
Mitsubishi Q Series Structured Text cobra_phil LIVE PLC Questions And Answers 0 April 24th, 2012 10:01 AM
Again and again. How to start? Alex Pel LIVE PLC Questions And Answers 33 December 31st, 2004 12:10 PM


All times are GMT -4. The time now is 02:00 PM.


.