Easybuilder Pro question #9

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.
 
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.
 
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.
 
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.
 
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.
 
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
 
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.
 
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.
 
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
 
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.



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
 
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
 

Similar Topics

I have EB Pro installed on windows 11, I can open an existing project and edit but when I got to parameters tab and open page I get the hourglass...
Replies
0
Views
48
Hi, I would like to know if it is possible to modify the properties of an object via a macro? For example I have a value of 100, via conditions...
Replies
0
Views
858
Hi, I'm an intern student engineer and I'm tasked with creating a HMI for a control system in EBPro. I need to make an object (motor) which has...
Replies
5
Views
1,725
Hello everyone Im Newbie to Easybuilder and im designing and HMI application where I gotta display a warning message in a pop up window...
Replies
3
Views
1,764
I am banging my head trying to get EB Pro to convert simple math expressions. Ex: 1 Pump conversion coming from a SCP instruction O0 1.1 value...
Replies
2
Views
1,840
Back
Top Bottom