Author Topic: Using the Recipe.ini file  (Read 4336 times)

Steve Etter

  • Newbie
  • *
  • Posts: 26
    • View Profile
Using the Recipe.ini file
« on: March 12, 2018, 02:51:31 PM »
Is there an example or tutorial out there of how someone is using the recipe.ini file?  I haven't found anything in my searches.

Thanks in advance.
Steve

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Using the Recipe.ini file
« Reply #1 on: March 12, 2018, 03:07:29 PM »
The RecipButton which works with the Recipe.ini file is a very little known about component. The idea is that when the button is clicked, it writes a series of values defined in the recipe.ini (or what is set in the IniFileName property) file.

For example a recipe.ini file may look like this:

[Recipe1]
N7:0=100
N7:1=200
N7:3=300


Then a RecipeButton is added with IniFileName set to Recipe.ini and IniFileSection set to Recipe1.

When the button is clicked, it will write the 3 values to the registers.

The idea is that you can define multiple recipes in a single file and use the IniFileSection property of each button to tell which set of values to write.

Steve Etter

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Using the Recipe.ini file
« Reply #2 on: March 12, 2018, 03:53:44 PM »
Ok.  So it appears that the RecipeButton was designed to have fixed values set for the IniFileName and IniFileSection fields.  I hope those can be set dynamically.

Because I have upwards of 200 recipes on some machines, I would like to have a single screen with maybe 20 recipe selections and buttons so the operators can go to multiple pages.  Each time the operator presses "Next Page" or "Previous Page", the associated recipes for those 20 buttons would change.  I do that today within my PLC, so that part is known.  For the HMI, however, I'm thinking to use a single button (hidden away somewhere) and to then indirectly address the IniFileSection field to the effect of (Please forgive that the coding is incorrect and incomplete.  I'm not in the application right now and it's not my second language yet):

RecipeRead1.Click()
RecipeButton1.IniFileSection = EthernetIPforCLXCom.Read("ProductName1", 1)
Call RecipeButton1.Click()

RecipeRead2.Click()
RecipeButton1.IniFileSection = EthernetIPforCLXCom.Read("ProductName2", 1)
Call RecipeButton1.Click()

and so on.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Using the Recipe.ini file
« Reply #3 on: March 12, 2018, 04:11:45 PM »
Here is how to link that to the PLC.

- In Solution Explorer, expand down the AdvancedHMIControl project
- Expand down the Controls folder
- Right click RecipeButton.vb and select View Code
- Go to line 53 and insert this code just above the #End Region
Code: [Select]
    Public Property PLCAddressIniFileSection As String
-Build the Solution

You will now have a property for the Recipe button named PLCAddressIniFileSection that can be used to link to a tag in the PLC

Steve Etter

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Using the Recipe.ini file
« Reply #4 on: March 22, 2018, 02:43:42 PM »
Here is how to link that to the PLC.

- In Solution Explorer, expand down the AdvancedHMIControl project
- Expand down the Controls folder
- Right click RecipeButton.vb and select View Code
- Go to line 53 and insert this code just above the #End Region
Code: [Select]
    Public Property PLCAddressIniFileSection As String
-Build the Solution

You will now have a property for the Recipe button named PLCAddressIniFileSection that can be used to link to a tag in the PLC
I tried this (and just about every other variation I could think of) and couldn't make the Section dynamic.  I sure would appreciate some help  :)

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Using the Recipe.ini file
« Reply #5 on: March 22, 2018, 03:25:25 PM »
Did you get any errors? Did the new property show for the RecipeButton?

Steve Etter

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Using the Recipe.ini file
« Reply #6 on: March 23, 2018, 12:02:44 PM »
Yes, the value showed up.  No errors.  The recipe button either continued to use the value in the IniFileSection field or, if nothing was in that field, it just didn't do anything.  I verified the STRING value in the referenced PLC tag "should" have been right.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Using the Recipe.ini file
« Reply #7 on: March 23, 2018, 02:18:45 PM »
The RecipeButton was missing the supporting framework for subscriptions. Replace the RecipeButton.vb file with the one attached and see if it works
« Last Edit: March 23, 2018, 02:39:07 PM by Archie »

Steve Etter

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Using the Recipe.ini file
« Reply #8 on: March 23, 2018, 03:09:31 PM »
Archie,

When I replaced the file and built, I got two errors:

BC30456 'GetComComponent" is not a member of 'Utilities'.
BC30456 ' ListSettings' is not a member of 'InParser'.

Both reference the RecipeButton.vb, lines 96 and 151, respectively.

I am downloading the latest version of AdvancedHMI now and will try again.  My version was v399w and the latest is v399x.

Update:  Same error after downloading latest and replacing the file.
« Last Edit: March 23, 2018, 03:29:59 PM by Steve Etter »

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Using the Recipe.ini file
« Reply #9 on: March 23, 2018, 04:57:50 PM »
Archie posted a link to Beta version here:

https://www.advancedhmi.com/forum/index.php?topic=1365.msg11571#msg11571

This version has Utilities.vb and IniParser.vb files with the required code (files located in AdvancedHMIDrivers/Common folder).
Either extract the files and replace the existing in your project or just try using the new Beta  version.

Steve Etter

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Using the Recipe.ini file
« Reply #10 on: March 27, 2018, 07:36:54 AM »
Still no go.  I downloaded the beta version, copied in the updated RecipeButton.vb, and then did the build.  The errors went away but still the recipe button only looks at the IniFileSection rather than the STRING value in the tag assigned to in the PLCAddressIniFileSection.  I tried adjusting the code in the recipe button but nothing I did captured the tag value such that I could use it.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Using the Recipe.ini file
« Reply #11 on: March 27, 2018, 02:30:32 PM »
An updated beta version has been posted with a fix to the RecipeButton. See here:

https://www.advancedhmi.com/forum/index.php?topic=2058

Steve Etter

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Using the Recipe.ini file
« Reply #12 on: March 28, 2018, 01:33:04 PM »
I had to make a number of changes to get it to work the way I wanted, but I finally did.  Below is the button I finished up with.

With this RecipeButton control, you can dynamically set the IniFileSection using the "PLCAddressText" property.  This property also defines the recipe button text.  Furthermore, unlike the original RecipeButton control that needs to be reloaded if the PLC value changes, this one loads the current values.

I suspect there are improvements to be made, but it's a good start I think.