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
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.
Yeah but I don't knoe anything about coding would like to seems you can do a lot more with macros.
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
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.
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
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