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.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


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

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old October 11th, 2018, 09:03 AM   #16
Jonnie_R
Member
Wales

Jonnie_R is offline
 
Join Date: Feb 2012
Location: Brecon
Posts: 91
Yes if you set it as periodical execution on a time basis. There are a couple of options for controlling how a macro runs, you can even run macros on screens opening and closing.
  Reply With Quote
Old October 11th, 2018, 09:51 AM   #17
sparkie
Lifetime Supporting Member
United States

sparkie is online now
 
Join Date: Nov 2014
Location: KS
Posts: 784
So here is my macro. I'm wanting it to run only when the screen is active, and periodically. Looking into it now, but the idea is to set an upper limit of 100 and a lower limit based on whatever the the lower setpoint happens to be for data entry. This prevents them from enter a value for the upper limit that is lower than the lower limit+1
Code:
macro_command main()
short chillerOneMinVal
short chillerTwoMinVal
short chillerOneMaxVal
short chillerTwoMaxVal

GetData(chillerOneMinVal, "MainPLC", 4x, 30, 1)
GetData(chillerTwoMinVal, "MainPLC", 4x, 33, 1)

chillerOneMinVal = chillerOneMinVal + 1
chillerTwoMinVal = chillerTwoMinVal + 1

chillerOneMaxVal = 100
chillerTwoMaxVal = 100

SetData(chillerOneMinVal, "Glycol HMI", LW, 10, 1)
SetData(chillerTwoMinVal, "Glycol HMI", LW, 12, 1)

SetData(chillerOneMaxVal, "Glycol HMI", LW, 11, 1)
SetData(chillerTwoMaxVal, "Glycol HMI", LW, 13, 1)

end macro_command
It compiles fine, so I think this should execute okay. Just wanted another set of eyes before I headed out there.
  Reply With Quote
Old October 11th, 2018, 10:00 AM   #18
Greg7683
Member
United States

Greg7683 is offline
 
Join Date: Jun 2018
Location: Plainfield IN
Posts: 198
I really wish I understood this macro stuff.
  Reply With Quote
Old October 11th, 2018, 10:03 AM   #19
sparkie
Lifetime Supporting Member
United States

sparkie is online now
 
Join Date: Nov 2014
Location: KS
Posts: 784
Quote:
Originally Posted by Greg7683 View Post
I really wish I understood this macro stuff.
It is basically a little tidbit of simple code that you can run based on various parameters, like startup, a button being clicked, periodical, on some event, etc. Each manufacturer that does macros has their own little customized language, so that adds to the confusion. Rockwell uses a custom VBA, I'm not sure what this easybuilder is based on. Looks like BASIC. Wonderware has their own scripting language, iFix uses VBA as well, etc.
  Reply With Quote
Old October 11th, 2018, 10:06 AM   #20
Greg7683
Member
United States

Greg7683 is offline
 
Join Date: Jun 2018
Location: Plainfield IN
Posts: 198
Quote:
Originally Posted by sparkie View Post
It is basically a little tidbit of simple code that you can run based on various parameters, like startup, a button being clicked, periodical, on some event, etc. Each manufacturer that does macros has their own little customized language, so that adds to the confusion. Rockwell uses a custom VBA, I'm not sure what this easybuilder is based on. Looks like BASIC. Wonderware has their own scripting language, iFix uses VBA as well, etc.

Yeah but I don't knoe anything about coding would like to seems you can do a lot more with macros.
  Reply With Quote
Old October 11th, 2018, 10:12 AM   #21
sparkie
Lifetime Supporting Member
United States

sparkie is online now
 
Join Date: Nov 2014
Location: KS
Posts: 784
Quote:
Originally Posted by Greg7683 View Post
Yeah but I don't knoe anything about coding would like to seems you can do a lot more with macros.
Might be worth doing some visual basic tutorials. Python is actually all the rage right now. Everyone at school is learning it. Not me. I'm sticking with good ole C.
  Reply With Quote
Old October 11th, 2018, 10:20 AM   #22
kvogel
Member
United States

kvogel is online now
 
Join Date: Jan 2011
Location: Colorado
Posts: 63
Looks like that should work to do what you are describing.

I tend to group like code together by like "objects" in order to be a bit more readable, but that's only a minor quibble and personal preference.


SetData(chillerOneMinVal, "Glycol HMI", LW, 10, 1)
SetData(chillerOneMaxVal, "Glycol HMI", LW, 11, 1)

SetData(chillerTwoMinVal, "Glycol HMI", LW, 12, 1)
SetData(chillerTwoMaxVal, "Glycol HMI", LW, 13, 1)

I would also make your var names a bit more descriptive

You have

chillerOneMinVal = chillerOneMinVal + 1

Unless you are replacing the chillerOneMinVal with another value (which I believe you are not) this would make more sense to someone reading it later.

chillerOneMinEntryLimit = chillerOneMinVal + 1

If you are allowing the user to change both the chiller min val and the chiller max val you might want to have some code to cross check the values. There are situations where the user might want to be able change a min value but can't because the max value prevents the change. How does the code handle these situations. Do you instruct the user to raise the upper value first, clearing the way for the lower value to be raised or does the code force the upper value so it remains greater than the lower value?

Cheers

Ken
  Reply With Quote
Old October 11th, 2018, 10:23 AM   #23
sparkie
Lifetime Supporting Member
United States

sparkie is online now
 
Join Date: Nov 2014
Location: KS
Posts: 784
So here is what I found in the manual. You can run the macro every 0.5 seconds as long as the window is open by going into "Window Attributes" and setting the "Cycle" option in the macro settings section of the "Window Attributes" dialog box, in case anyone is reading this in the future.

You can set a local bit to be set to ON if the input is invalid, and and use his to create a popup window. Now I'm just looking in on how to do that.
  Reply With Quote
Old October 11th, 2018, 10:26 AM   #24
sparkie
Lifetime Supporting Member
United States

sparkie is online now
 
Join Date: Nov 2014
Location: KS
Posts: 784
Quote:
Originally Posted by kvogel View Post
Looks like that should work to do what you are describing.

I tend to group like code together by like "objects" in order to be a bit more readable, but that's only a minor quibble and personal preference.


SetData(chillerOneMinVal, "Glycol HMI", LW, 10, 1)
SetData(chillerOneMaxVal, "Glycol HMI", LW, 11, 1)

SetData(chillerTwoMinVal, "Glycol HMI", LW, 12, 1)
SetData(chillerTwoMaxVal, "Glycol HMI", LW, 13, 1)

I would also make your var names a bit more descriptive

You have

chillerOneMinVal = chillerOneMinVal + 1

Unless you are replacing the chillerOneMinVal with another value (which I believe you are not) this would make more sense to someone reading it later.

chillerOneMinEntryLimit = chillerOneMinVal + 1

If you are allowing the user to change both the chiller min val and the chiller max val you might want to have some code to cross check the values. There are situations where the user might want to be able change a min value but can't because the max value prevents the change. How does the code handle these situations. Do you instruct the user to raise the upper value first, clearing the way for the lower value to be raised or does the code force the upper value so it remains greater than the lower value?

Cheers

Ken
Actually, I do want to change that value to minVal + 1. You have to set the maxVal to at least 1 greater than the minVal. The upper value changes dynamically with the lower value. There should also never be a situation where the upper value is set to a number greater than 100.

The lower limit is set by the PLC reading the setpoint from a process controller. This can dynamically change in several ways, so it is best to get this value from the PLC.
  Reply With Quote
Old October 11th, 2018, 10:34 AM   #25
Jonnie_R
Member
Wales

Jonnie_R is offline
 
Join Date: Feb 2012
Location: Brecon
Posts: 91
To create a pop up make it as a normal screen but a reduced size if that's what you want. Then create a direct window object in the common window, which is screen 4. The direct window will work over all screens but can be called by your invalid input bit. Your pop up can then reset this bit as an acknowledgement type situation and close the window.


Hope that makes sense.
  Reply With Quote
Old October 11th, 2018, 10:40 AM   #26
kvogel
Member
United States

kvogel is online now
 
Join Date: Jan 2011
Location: Colorado
Posts: 63
It's possible I'm misunderstanding but here is what I am thinking you are confusing the high & low set points with the entry limits. Setting the entry limits will not affect the actual values of the set points only how they can be changed by the user. You still need to cross check the set points and for any situations which might mess up the calculations of the entry limits.

You have a range in which the chiller runs in. The lower end of the range can be between your process low and a point which the user sets. The upper end of the range is set by the user to a value between the lower range value and your process high.

You have two set points, a low range set point and a high range set point

You also have four INPUT range limits, two of which are predetermined by the limits of the process, the Low-Low and the High-High and two which are determined by the value of the other set point. The low entry limit of the HIGH set point must be 1 greater than the Low set point and the high entry limit of the low set point must be less than the high set point.

Cheers
  Reply With Quote
Old October 11th, 2018, 11:24 AM   #27
sparkie
Lifetime Supporting Member
United States

sparkie is online now
 
Join Date: Nov 2014
Location: KS
Posts: 784
Quote:
Originally Posted by Jonnie_R View Post
To create a pop up make it as a normal screen but a reduced size if that's what you want. Then create a direct window object in the common window, which is screen 4. The direct window will work over all screens but can be called by your invalid input bit. Your pop up can then reset this bit as an acknowledgement type situation and close the window.


Hope that makes sense.
Thanks a ton. I have a macro that sets the notification bit to 0 when the popup window opens. The popup window has a close button.



Quote:
Originally Posted by kvogel View Post
It's possible I'm misunderstanding but here is what I am thinking you are confusing the high & low set points with the entry limits. Setting the entry limits will not affect the actual values of the set points only how they can be changed by the user. You still need to cross check the set points and for any situations which might mess up the calculations of the entry limits.

You have a range in which the chiller runs in. The lower end of the range can be between your process low and a point which the user sets. The upper end of the range is set by the user to a value between the lower range value and your process high.

You have two set points, a low range set point and a high range set point

You also have four INPUT range limits, two of which are predetermined by the limits of the process, the Low-Low and the High-High and two which are determined by the value of the other set point. The low entry limit of the HIGH set point must be 1 greater than the Low set point and the high entry limit of the low set point must be less than the high set point.

Cheers
I think we just have a miscommunication going on. What you are saying is exactly what I'm doing. I don't want to change/modify any values for the tags I'm setting my limit to, only to prevent the operator from entering a value that is out of range.

As always, appreciate your guys help. Also, here is a link to a video below for the Greg as he was asking about macros:

https://www.youtube.com/watch?v=TEHvtoBkYZY
  Reply With Quote
Old October 11th, 2018, 12:35 PM   #28
Greg7683
Member
United States

Greg7683 is offline
 
Join Date: Jun 2018
Location: Plainfield IN
Posts: 198
Quote:
Originally Posted by sparkie View Post
Thanks a ton. I have a macro that sets the notification bit to 0 when the popup window opens. The popup window has a close button.





I think we just have a miscommunication going on. What you are saying is exactly what I'm doing. I don't want to change/modify any values for the tags I'm setting my limit to, only to prevent the operator from entering a value that is out of range.

As always, appreciate your guys help. Also, here is a link to a video below for the Greg as he was asking about macros:

https://www.youtube.com/watch?v=TEHvtoBkYZY

Thanks
  Reply With Quote
Old October 12th, 2018, 04:19 AM   #29
sparkie
Lifetime Supporting Member
United States

sparkie is online now
 
Join Date: Nov 2014
Location: KS
Posts: 784
Worked like a charm guys. Thanks for the help there.
  Reply With Quote
Old October 12th, 2018, 05:45 AM   #30
Greg7683
Member
United States

Greg7683 is offline
 
Join Date: Jun 2018
Location: Plainfield IN
Posts: 198
What does that macro actually do.
  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
Easybuilder Pro Rockwell Tag Import Kev77 LIVE PLC Questions And Answers 0 June 8th, 2018 02:07 PM
Unity Pro Tag Addressing Question Bmoore14 LIVE PLC Questions And Answers 3 August 9th, 2017 08:28 PM
question on define address in unity pro xl qikuidg LIVE PLC Questions And Answers 8 September 24th, 2013 07:48 AM
versa pro back to LM90 LIVE PLC Questions And Answers 8 December 28th, 2004 09:29 AM
Pro Tool Pro Spreadsheet johnskii LIVE PLC Questions And Answers 0 November 19th, 2003 09:39 AM


All times are GMT -5. The time now is 04:11 PM.


.