BruControl: Brewery control & automation software

Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum

Help Support Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.
I guess I should know this by now, but I am looking for a Brucontrol Control Element called "Prop Valve".. I recently worked on Background Image and moved stuff around; it vanished! I suspect it is sitting underneath some existing Element, who knows.

It should be hooked to my BC port 4 - any idea how to search for an Element? I switched the visibility icon "on" - no luck so far..
 
It is a Pita and most likely under another element. I have had to find one that was "lost" more than once.

You can look into your configuration file with something like Notepad ++ (I would make a copy and look in the copy) but it is still had to find where it is that way as it will only tell you what Workspace it is on and that it exists.

There are 3 likely possibilities in my mind in this order:
1. Moved Under a different Element
2. Moved to a different Workspace
3. Deleted.

It is easy to check if it was deleted. Try to create another Element on Port 4. If the same type of Element is available in the list, it was deleted.

If moved to a different Workspace, it will be on Top. Open all your Workspaces with the ALL SEEING EYE clicked.

If It is hidden behind a different Element: This is the most likely and also the hardest to find.

Create a new temporary Workspace. With the All Seeing Eye clicked, move each Element of the Workspace to the new Workspace. Each element maintains, it spacing and position, but is in reverse stacked order. You may find your missing element. Move it to the new workspace and move only it to a corner. Move all of the Elements on the Temporary Workspace back to the Original Workspace. Finally move the "lost" one back to the Orginal Workspace. It will be in the corner where you moved it and it will be stacked On Top. If you have elements stacked on top one another, you may need to change the Z order if you somehow changed the order when moving.


That is the reason I requested a "path" for backgrounds and wav files as I have many Alarms. Since it only has 3 Choices for each Alarm, I have several Alarms that are stacked, and they are hard to find.
 
Could you add the Tinseth formula to BruControl?
Not sure how or what formula would be added, as this can already be scripted given you have all the proper variable inputs.
1679916309108.png


[CODE]//mg/l AA = (AA rating in decimal x oz of hops x 7490) / gallons of wort //Bigness factor = 1.65 x 0.000125^(wort gravity - 1) //Boil Time Factor = (1- 2.71828^(-0.04 x Hop Time)) / 4.15 //AAU = Bigness Factor x Boil Time Factor //IBU = AAU x mg/l AA new value x new value AA1 new value AA2 new value BF BF precision = 4 new value BFexp BFexp precision = 4 new value BTF1 BTF1 precision = 4 new value BTF1exp new value BTF2 BTF2 precision = 4 new value BTF2exp //calc hop 1 aa mg/l AA1 = "Hop 1 AA" Value / 100 AA1 *= "Hop 1 Weight OZ" Value * 7490 AA1 /= "Boil Vol Gal" Value //calc hop 2 aa mg/l AA2 = "Hop 2 AA" Value / 100 AA2 *= "Hop 2 Weight OZ" Value * 7490 AA2 /= "Boil Vol Gal" Value //calc bigness factor BFexp = "Boil Gravity OG" Value - 1 BF = .000125 ^ BFexp BF *= 1.65 //calc Boil Time Factor for each hop BTF1exp = -0.04 * "Hop 1 Boil Time MIN" Value x = 2.71828 ^ BTF1exp BTF1 = 1 - x BTF1 /= 4.15 BTF2exp = -0.04 * "Hop 2 Boil Time MIN" Value x = 2.71828 ^ BTF2exp BTF2 = 1 - x BTF2 /= 4.15 //calc utilization for each hop BTF1 *= BF BTF2 *= BF //calc hop addition IBU "Hop 1 IBU" value = AA1 * BTF1 "Hop 2 IBU" value = AA2 * BTF2 //calc total IBU "Total IBU" Value = "Hop 1 IBU" Value "Total IBU" Value = "Total IBU" Value + "Hop 2 IBU" Value stop "IBU_SCR" [/CODE]
 
@RiverCityBrewer
Thanks, This really helped.

I was creating something like this but I was having trouble with expontent calculation.

Do you know how to take the your "Hop 1 Boil Time MIN" and convert to a Time?


I have some globals that use a time to compare with my Boil Timer to drop a Hop. I regularly boil for 90 min and sometimes drop hops at 00:01:30:00 (90 min) or 00:01:15:00 (75 min). I have the drop times as global time elements and have started to create global value elements for the minutes.

I need to convert the Hop 1 MIN (a value global ) to Hop 1 Drop (a time global)

If you look at Hop 2 I have 60 min in Hop 2 MIN and Hop 2 Drop is 00:01:30:00. Hop 2 Drop would need to be converted to 00:01:00:00

This is a pix of my Recipe Workspace where I have various times and Volumes and setpoints for a Brew that we are doing.

I am still trying to get my BrewSmith 3 xml file to import as I have a couple of Glitches in my code still, but the Hop Drop time comes over as minutes.
<Time> 60.00000000</Time>
 

Attachments

  • time.png
    time.png
    149.9 KB · Views: 0
My Code for the IBU Calculations . I modified @RiverCityBrewer 's code to match my named globals for up to 8 hop additions

//scrIBU
//Calculate IBU
//03/27/2023:08:25
//© OakBarn Brewery
// Lots of Help with Orginal Code from @RiverCityBrewing
Code:
//mg/l AA = (AA rating in decimal x oz of hops x 7490) / gallons of wort
//Bigness factor = 1.65 x 0.000125^(wort gravity - 1)
//Boil Time Factor = (1- 2.71828^(-0.04 x Hop Time)) / 4.15
//AAU = Bigness Factor x Boil Time Factor
//IBU = AAU x mg/l AA
// Euler's number
new value "Euler's number"
"Euler's number" =  2.7182818284590452353602874713527
new value "e^ X"
new value "A _A_U"
new value BF
BF precision = 4
new value BFexp
BFexp precision = 4
new value BTF1
BTF1 precision = 4
new value BTF1exp
//calc hop 1 aa mg/l
"A _A_U" = "gblV_Hop1_Actual_AAU_R1" Value / 100
"A _A_U" *= "gblV_Oz_Calculated_Hop1_R1" Value * 7490
"A _A_U" /= "gblVBrew_Lenght_R1" Value
//calc bigness factor
BFexp = "gblV_BoilGravity_R1" Value - 1
BF = .000125 ^ BFexp
BF *= 1.65
//calc Boil Time Factor for each hop
BTF1exp = -0.04 * "gblV_TimeHop1_Min_R1" Value
"e^ X"  = "Euler's number"  ^ BTF1exp
BTF1 = 1 - "e^ X"
BTF1 /= 4.15
//calc utilization for each hop
BTF1 *= BF
//calc hop addition IBU
"gblV_Hop1_Calc_IBU_R1" value = "A _A_U" * BTF1
//calc hop2 aa mg/l
"A _A_U" = "gblV_Hop2_Actual_AAU_R1" Value / 100
"A _A_U" *= "gblV_Oz_Calculated_Hop2_R1" Value * 7490
"A _A_U"/= "gblVBrew_Lenght_R1" Value
//calc bigness factor
BFexp = "gblV_BoilGravity_R1" Value - 1
BF = .000125 ^ BFexp
BF *= 1.65
//calc Boil Time Factor for each hop
BTF1exp = -0.04 * "gblV_TimeHop2_Min_R1" Value
"e^ X"  = "Euler's number"  ^ BTF1exp
BTF1 = 1 - "e^ X"
BTF1 /= 4.15
//calc utilization for each hop
BTF1 *= BF
//calc hop addition IBU
"gblV_Hop2_Calc_IBU_R1" value = "A _A_U" * BTF1
//calc hop3 aa mg/l
"A _A_U" = "gblV_Hop3_Actual_AAU_R1" Value / 100
"A _A_U" *= "gblV_Oz_Calculated_Hop3_R1" Value * 7490
"A _A_U"/= "gblVBrew_Lenght_R1" Value
//calc bigness factor
BFexp = "gblV_BoilGravity_R1" Value - 1
BF = .000125 ^ BFexp
BF *= 1.65
//calc Boil Time Factor for each hop
BTF1exp = -0.04 * "gblV_TimeHop3_Min_R1" Value
"e^ X"  = "Euler's number"  ^ BTF1exp
BTF1 = 1 - "e^ X"
BTF1 /= 4.15
//calc utilization for each hop
BTF1 *= BF
//calc hop addition IBU
"gblV_Hop3_Calc_IBU_R1" value = "A _A_U" * BTF1
//calc hop4 aa mg/l
"A _A_U" = "gblV_Hop4_Actual_AAU_R1" Value / 100
"A _A_U" *= "gblV_Oz_Calculated_Hop4_R1" Value * 7490
"A _A_U"/= "gblVBrew_Lenght_R1" Value
//calc bigness factor
BFexp = "gblV_BoilGravity_R1" Value - 1
BF = .000125 ^ BFexp
BF *= 1.65
//calc Boil Time Factor for each hop
BTF1exp = -0.04 * "gblV_TimeHop4_Min_R1" Value
"e^ X"  = "Euler's number"  ^ BTF1exp
BTF1 = 1 - "e^ X"
BTF1 /= 4.15
//calc utilization for each hop
BTF1 *= BF
//calc hop addition IBU
"gblV_Hop4_Calc_IBU_R1" value = "A _A_U" * BTF1
//calc hop5 aa mg/l
"A _A_U" = "gblV_Hop5_Actual_AAU_R1" Value / 100
"A _A_U" *= "gblV_Oz_Calculated_Hop5_R1" Value * 7490
"A _A_U"/= "gblVBrew_Lenght_R1" Value
//calc bigness factor
BFexp = "gblV_BoilGravity_R1" Value - 1
BF = .000125 ^ BFexp
BF *= 1.65
//calc Boil Time Factor for each hop
BTF1exp = -0.04 * "gblV_TimeHop5_Min_R1" Value
"e^ X"  = "Euler's number"  ^ BTF1exp
BTF1 = 1 - "e^ X"
BTF1 /= 4.15
//calc utilization for each hop
BTF1 *= BF
//calc hop addition IBU
"gblV_Hop5_Calc_IBU_R1" value = "A _A_U" * BTF1
//calc hop6 aa mg/l
"A _A_U" = "gblV_Hop6_Actual_AAU_R1" Value / 100
"A _A_U" *= "gblV_Oz_Calculated_Hop6_R1" Value * 7490
"A _A_U"/= "gblVBrew_Lenght_R1" Value
//calc bigness factor
BFexp = "gblV_BoilGravity_R1" Value - 1
BF = .000125 ^ BFexp
BF *= 1.65
//calc Boil Time Factor for each hop
BTF1exp = -0.04 * "gblV_TimeHop6_Min_R1" Value
"e^ X"  = "Euler's number"  ^ BTF1exp
BTF1 = 1 - "e^ X"
BTF1 /= 4.15
//calc utilization for each hop
BTF1 *= BF
//calc hop addition IBU
"gblV_Hop6_Calc_IBU_R1" value = "A _A_U" * BTF1
//calc hop7 aa mg/l
"A _A_U" = "gblV_Hop7_Actual_AAU_R1" Value / 100
"A _A_U" *= "gblV_Oz_Calculated_Hop7_R1" Value * 7490
"A _A_U"/= "gblVBrew_Lenght_R1" Value
//calc bigness factor
BFexp = "gblV_BoilGravity_R1" Value - 1
BF = .000125 ^ BFexp
BF *= 1.65
//calc Boil Time Factor for each hop
BTF1exp = -0.04 * "gblV_TimeHop7_Min_R1" Value
"e^ X"  = "Euler's number"  ^ BTF1exp
BTF1 = 1 - "e^ X"
BTF1 /= 4.15
//calc utilization for each hop
BTF1 *= BF
//calc hop addition IBU
"gblV_Hop8_Calc_IBU_R1" value = "A _A_U" * BTF1
//calc hop2 aa mg/l
"A _A_U" = "gblV_Hop8_Actual_AAU_R1" Value / 100
"A _A_U" *= "gblV_Oz_Calculated_Hop8_R1" Value * 7490
"A _A_U"/= "gblVBrew_Lenght_R1" Value
//calc bigness factor
BFexp = "gblV_BoilGravity_R1" Value - 1
BF = .000125 ^ BFexp
BF *= 1.65
//calc Boil Time Factor for each hop
BTF1exp = -0.04 * "gblV_TimeHop8_Min_R1" Value
"e^ X"  = "Euler's number"  ^ BTF1exp
BTF1 = 1 - "e^ X"
BTF1 /= 4.15
//calc utilization for each hop
BTF1 *= BF
//calc hop addition IBU
"gblV_Hop8_Calc_IBU_R1" value = "A _A_U" * BTF1
//calc total IBU
"gblV_HBU_R1" Value = "gblV_Hop1_Calc_IBU_R1" Value
"gblV_HBU_R1"  Value = "gblV_HBU_R1" Value + "gblV_Hop2_Calc_IBU_R1" Value
"gblV_HBU_R1"  Value = "gblV_HBU_R1" Value + "gblV_Hop3_Calc_IBU_R1" Value
"gblV_HBU_R1"  Value = "gblV_HBU_R1" Value + "gblV_Hop4_Calc_IBU_R1" Value
"gblV_HBU_R1"  Value = "gblV_HBU_R1" Value + "gblV_Hop6_Calc_IBU_R1" Value
"gblV_HBU_R1"  Value = "gblV_HBU_R1" Value + "gblV_Hop7_Calc_IBU_R1" Value
"gblV_HBU_R1"  Value = "gblV_HBU_R1" Value + "gblV_Hop8_Calc_IBU_R1"Value
delete "e^ X"
delete  "A _A_U"
delete BF
delete BFexp
delete  BTF1
delete BTF1exp
stop "scrIBU"
 
OK, this is a little convoluted and I may be taking advantage of a bug/feature in the interpreter, but here is how I got that to work. It looks like you can't put a raw value to a time without it becoming a very large time value, but you can convert the value to a string and push the string directly to the time.
Hop MIN is your Global Value
Hop Time is your Global Time

new string x
new value y
new string z
y precision = 0

if "Hop MIN" Value >= 60
y = "Hop MIN" Value
y -= 60
z = y
x = "01:" + z
"Hop Time" Value = x
else
x = "00:" + "Hop MIN" Value
"Hop Time" value = x
endif
 
I guess I should know this by now, but I am looking for a Brucontrol Control Element called "Prop Valve".. I recently worked on Background Image and moved stuff around; it vanished! I suspect it is sitting underneath some existing Element, who knows.

It should be hooked to my BC port 4 - any idea how to search for an Element? I switched the visibility icon "on" - no luck so far..
You can also go to a backup but you would loose andy changes made to the configuration including your lost element so it would be where it was.

I always make a quick backup before I start some major changes and then make peroidic backups when I am happy with my changes.
 
OK, this is a little convoluted and I may be taking advantage of a bug/feature in the interpreter, but here is how I got that to work. It looks like you can't put a raw value to a time without it becoming a very large time value, but you can convert the value to a string and push the string directly to the time.
Hop MIN is your Global Value
Hop Time is your Global Time

new string x
new value y
new string z
y precision = 0

if "Hop MIN" Value >= 60
y = "Hop MIN" Value
y -= 60
z = y
x = "01:" + z
"Hop Time" Value = x
else
x = "00:" + "Hop MIN" Value
"Hop Time" value = x
endif
Thanks. Worked great. I have most of the hop calculations done. I have been changing the hops due to the fact that when you import the xml, you could have up to 8 hops. Before I had it set for 2 Bitter Hops, 2 Flavor Hops, and 2 Aroma Hops. I now have generic Hops (Hop 1 to Hop 8).

I needed to rework because sometimes I had 3 flavor hops at different drop times. I just need to rework my "alarms " a little. Since I have up to 8 hops, I will need 3 "Alarm" Elements as I change the background and the wav file depending on if a Bitter Hop, a Flavor Hop or an Aroma Hop. I also have a Hop Rocket and need a different "background" and wav file for that. Would be nice (at least for the "Alarms") to have a path for Background 1 and File 1, that way I would only need one alarm element.

I did a lot of testing and the Calculated IBUs work well. They are affected as you would expect. As an Example, a Hop at 0 min has 0 IBUs. I have the recipe AAU and Oz, but also have an Actual AAU on My Hop Page that calculates the OZ needed. Beer Smith 3 does not have an easy method to do that.

I did have to make sure that any AAU is not zero as it caused my Hop OZ to go to infinity.
 
You can also go to a backup but you would loose andy changes made to the configuration including your lost element so it would be where it was.

I always make a quick backup before I start some major changes and then make peroidic backups when I am happy with my changes.
So I have the Element on Port 6, confimed with my wiring map and physcial wiring in my control panel. If only I could make it reappear... I don't want to go back in time and lose recent changes!!
 
Open your default.brucfg file and do a search for the Element name you are looking for. It will tell you the X/Y coordinates of the element on the screen. You can also dig down into that file a little more and it'll tell you what workspace its on. Would be at least a place to start.

**Don't save the file if it prompts when you close it**

1680002840873.png
 
Open your default.brucfg file and do a search for the Element name you are looking for. It will tell you the X/Y coordinates of the element on the screen. You can also dig down into that file a little more and it'll tell you what workspace its on. Would be at least a place to start.

**Don't save the file if it prompts when you close it**

View attachment 816265
OK, I found it;
Name>Prop Valve</Name>
<UserControl>true</UserControl>
<Width>260</Width>
<X>90</X>
<Y>540</Y>

Still no trace of this Element on my actual workspace; could I delete it from the backup config file and then somehow upload to Brucontrol?
 
Were you able to determine which workspace it was on? Also, scroll up and look for BackgroundImageIndex for that Element and make sure its set to 0. Looks like it should be on the left side of your screen about halfway down.
 
I only have one workspace, and I see nothing at the x and Y location - this Element remains invisible.

Meanwhile I attempted to go back in time and use a previous config from the automatically backed up files, and now my workspace is blank…. this is not good!!!
 
07:28:21.278: File created 03-28-2023
07:28:23.430: Device 'Interface 3' @ 192.168.2.35 = Disconnected
07:28:25.160: Device 'Interface 3' @ 192.168.2.35 = Connected
08:25:35.304: Controller unlocked.
08:27:07.483: Controller unlocked.
08:40:40.827: Controller unlocked.
08:41:00.048: Controller unlocked.
08:42:18.702: Controller unlocked.
12:33:21.891: Controller unlocked.
15:44:47.620: Device 'Interface 3' @ 192.168.2.35 = Disconnected
15:46:33.774: Loading configuration file 'C:\Users\Carine Luys\Documents\BruControl\3.brucfg'...
15:46:33.868: Device 'Interface 3' @ 192.168.2.35 = Connected
15:51:12.582: Device 'Interface 3' @ 192.168.2.35 = Disconnected
15:51:12.644: Controller stopped.
15:53:01.676: Controller started.
15:53:01.691: Controller version 1.1 (build 0.22)
15:53:01.707: Loading global settings file 'C:\Users\Carine Luys\Documents\BruControl\settings.brusettings'...
15:53:02.322: Created default configuration file.
15:53:02.378: Opening database: Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\Carine Luys\Documents\BruControl\Data\Data.mdf;Integrated Security=True
15:53:16.857: Loading device definition file 'C:\Program Files (x86)\BruControl\ArduinoDue.brumc'...
15:53:17.069: Loading device definition file 'C:\Program Files (x86)\BruControl\ArduinoMEGA.brumc'...
15:53:17.477: Loading device definition file 'C:\Program Files (x86)\BruControl\ESP32.brumc'...
15:53:17.776: Loading device definition file 'C:\Program Files (x86)\BruControl\ESP8266.brumc'...
15:53:18.104: Loading device definition file 'C:\Program Files (x86)\BruControl\FeatherM0.brumc'...
15:53:18.776: Loading device definition file 'C:\Program Files (x86)\BruControl\GrandCentralM4.brumc'...
15:53:19.145: Loading device definition file 'C:\Program Files (x86)\BruControl\M5_Stack.brumc'...
15:55:53.279: Loading configuration file 'C:\Users\Carine Luys\Documents\BruControl\test3.brucfg'...
15:56:24.264: Controller stopped.
15:56:46.008: Controller started.
15:56:46.071: Controller version 1.1 (build 0.22)
15:56:46.086: Loading global settings file 'C:\Users\Carine Luys\Documents\BruControl\settings.brusettings'...
15:56:46.313: Loading configuration file 'C:\Users\Carine Luys\Documents\BruControl\test3.brucfg'...
15:56:46.384: Opening database: Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\Carine Luys\Documents\BruControl\Data\Data.mdf;Integrated Security=True
15:57:21.189: Loading device definition file 'C:\Program Files (x86)\BruControl\ArduinoDue.brumc'...
15:57:21.274: Loading device definition file 'C:\Program Files (x86)\BruControl\ArduinoMEGA.brumc'...
15:57:21.461: Loading device definition file 'C:\Program Files (x86)\BruControl\ESP32.brumc'...
15:57:21.944: Loading device definition file 'C:\Program Files (x86)\BruControl\ESP8266.brumc'...
15:57:22.104: Loading device definition file 'C:\Program Files (x86)\BruControl\FeatherM0.brumc'...
15:57:22.884: Loading device definition file 'C:\Program Files (x86)\BruControl\GrandCentralM4.brumc'...
15:57:23.325: Loading device definition file 'C:\Program Files (x86)\BruControl\M5_Stack.brumc'...
15:58:47.561: Loading configuration file 'C:\Users\Carine Luys\Documents\BruControl\UniFlex_1V_PropSSR.brucfg'...
15:59:09.908: Loading configuration file 'C:\Users\Carine Luys\Documents\BruControl\test3.brucfg'...
15:59:18.537: Loading configuration file 'C:\Users\Carine Luys\Documents\BruControl\3.brucfg'...
16:00:00.583: Controller stopped.
16:00:53.327: Controller started.
16:00:53.343: Controller version 1.1 (build 0.22)
16:00:53.358: Loading global settings file 'C:\Users\Carine Luys\Documents\BruControl\settings.brusettings'...
16:00:53.618: Created default configuration file.
16:00:53.659: Opening database: Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\Carine Luys\Documents\BruControl\Data\Data.mdf;Integrated Security=True
16:00:58.527: Loading device definition file 'C:\Program Files (x86)\BruControl\ArduinoDue.brumc'...
16:00:58.605: Loading device definition file 'C:\Program Files (x86)\BruControl\ArduinoMEGA.brumc'...
16:00:58.637: Loading device definition file 'C:\Program Files (x86)\BruControl\ESP32.brumc'...
16:00:58.668: Loading device definition file 'C:\Program Files (x86)\BruControl\ESP8266.brumc'...
16:00:58.715: Loading device definition file 'C:\Program Files (x86)\BruControl\FeatherM0.brumc'...
16:00:58.746: Loading device definition file 'C:\Program Files (x86)\BruControl\GrandCentralM4.brumc'...
16:00:58.777: Loading device definition file 'C:\Program Files (x86)\BruControl\M5_Stack.brumc'...
16:03:41.243: Loading configuration file 'C:\Users\Carine Luys\Documents\BruControl\default.brucfg'...
16:03:47.857: Loading configuration file 'C:\Users\Carine Luys\Documents\BruControl\3.brucfg'...
 
At 16:00:53, you can see it created a default config file, and 16:03:41 it loaded that default config, so whatever you did to try and restore the backup file didn't work. Change the file extension of the default.brucfg file to something else, then copy a backup file and name it exactly the same, default.brucfg
 
So thanks to @RiverCityBrewer, I discovered that I had a file extension issue. To sum up, Brucontrol configuration can only use .brucfg files. In order to see the actual file extensions you need to make the following selection in Windows;

1680096293224.png
 
Does the script Clear command just clear the variables within the script where it was executed, or is it universal and clear All variables across scripts?
 
I came across this at automation direct; I wonder if Brucontrol would work with this Arduino compatible CPU? If affirmative, would there be any advantage to using such line of products?

1680545197963.png
 
I came across this at automation direct; I wonder if Brucontrol would work with this Arduino compatible CPU? If affirmative, would there be any advantage to using such line of products?

View attachment 816781
We did some initial development on the firmware for this, but there wasn't a ton of interest so redirected attention elsewhere. The I/O is not too trivial, as they use a bus system, so we need to customize a chunk of the handling for each element type. Not that difficult, just requires time.
 
Simple Error with simi dire consequences

This is NOT an issue with BruControl but an error on my part.o_O

I created an endless loop in a script with the start command.

I had a script named Script 5

A it did lots of things, but at the end of the Script I put
start "Script 5"

Everytime it reached the command, it re ran, and re ran, and re ran, endlessly. BruControl gave an error and basically locked. I could not quit or continue. I had to use the Power switch on my computer to force a shut down.

I deleted some program logs and generally cleaned the computer with a utility.

I did not lose anything and I was able to fix the script.

So FYI: Be careful using the start command so you do not create an endless loop!!:rolleyes:

The start command worked as it should, this was MY error.
 
problem with if end if logic

I have the following code:

new string vSMsg
new string vSMsg1
new string vSMsg2
new string vSHopOZ
new string vSHopName
new string vSDropTime
new string vSMsgSpacer
new bool vBStartofBoilHops
vBStartofBoilHops = true
vSMsgSpacer = " "
[Start of Boil Hops]
if vBStartofBoilHops == true
"gblS_HopMessage_ALARM" displayname = "Bitter Hops at the Start of Boil! "
//
[Hop1]
// some other stuff for vSMsg
[End Start of Boil Hops]
"gblS_HopMessage_ALARM" value = vSMsg
endif
//
clear
stop "scrHopMsgDrop"


My issue is that I am getting an error :

[ERROR Line 0: 'end' statement without preceding conditional]

if I change to

new string vSMsg
new string vSMsg1
new string vSMsg2
new string vSHopOZ
new string vSHopName
new string vSDropTime
new string vSMsgSpacer
new bool vBStartofBoilHops
vBStartofBoilHops = true
vSMsgSpacer = " "
[Start of Boil Hops]
if vBStartofBoilHops == true
"gblS_HopMessage_ALARM" displayname = "Bitter Hops at the Start of Boil! "
//
[Hop1]
some other stuff for vSMsg
[End Start of Boil Hops]
"gblS_HopMessage_ALARM" value = vSMsg
//endif
//

it runs fine. So I have an if without an endif!

//some other stuff for vSMsg is a bunch of nested if endif statements that also work fine without that final endif.
 
I'm running 1.1 build 22 with an esp32. I have 2 RTDs working and a duty cycle output working just fine to control a heating element through SSR. I am having trouble with the PID control however. The output from the PID remains at 255 even when input is greater than target. The only way I can get the PID output to go to zero is to make the target a large negative number (i.e. -400)
Any insight as to what I have set incorrectly here?
 

Attachments

  • 20230414_094315.jpg
    20230414_094315.jpg
    6.1 MB · Views: 0
  • 20230414_094659.jpg
    20230414_094659.jpg
    894.4 KB · Views: 0
Hard to tell without an output trend, but I would bet you are experiencing intergal windup (Ki). Try setting that value lower. I'm not saying this value will work for you, but for reference, my Ki for my mash PID is .02

Also, increase your calc and output time. 5-10 seconds should be sufficient in a standard water heating system.
 
Hard to tell without an output trend, but I would bet you are experiencing intergal windup (Ki). Try setting that value lower. I'm not saying this value will work for you, but for reference, my Ki for my mash PID is .02

Also, increase your calc and output time. 5-10 seconds should be sufficient in a standard water heating system.
Thank you for the suggestion. Even with those adjustments, it still continue heating. I even attempted a target of -100 and it kept a 255 output. Only when I set the target at something drastic like -400 did it change the output to 0 (those are the dips in the red line). Attached is the trend of the RTD temp (Input to PID control) and the PID output. Please let me know you have any other suggestions.
 

Attachments

  • PIDpic.JPG
    PIDpic.JPG
    301 KB · Views: 0
Yes, no difference. If it is helpful, I tried hysteresis control and am having trouble getting it to toggle as well. It just stays on.
 

Attachments

  • PIDpic.JPG
    PIDpic.JPG
    300.4 KB · Views: 0
That is quite strange. Can you post what board and what pin you are using for control, as well as what kind of relay you are controlling?
 

Attachments

  • 20230414_151217.jpg
    20230414_151217.jpg
    862.9 KB · Views: 0
Hmm, it looks like that should be working ok. Have you tried a different pin on the board to rule it out? Also, what firmware are you running?
 
I am trying to hook up some Valves that are powered on and powered off. They are not reverse polarity but have a Negative and two + leads. I am using a Relay to switch. When the Element is Off, it is fine, but when I turn the Element on, it pulses On then Off fairly rapidly {and the valve is moving slighly with the pulses. When I hook them up to the Mega (or Grand Central), the relay pulses on and off. I have thought it might be the relay but I changed the relay out out. Any ideas?
 
OK, I found it;
Name>Prop Valve</Name>
<UserControl>true</UserControl>
<Width>260</Width>
<X>90</X>
<Y>540</Y>

Still no trace of this Element on my actual workspace; could I delete it from the backup config file and then somehow upload to Brucontrol?
I've noticed that there have been a number of posts about elements going missing, scripts being lost, and/or even unintended consequeses from naming conventions in elements that were later picked up in scripts. This causes a lot of time being spent on searching for items or trying to debug. I had the same problem when my windows machine crashed and I was trying to rebuild what I had done before. While all the advice given in this forum is excellent, my personal approach to the problem was to use node-red to walk through the xml contained in backup brucontrol files (see above for how to find them) to pull out all the instances of the workspaces, the element names contained in each, the type of element and the id of the element. While it may seem tp be too much of an additional burden to implement node-red--depending on what you are looking for--I'm including my node-red flow as an example of what it can do: (copy and paste the import this code as a new flow in node-red)

Code:
[
    {
        "id": "3650d7a4f00805cd",
        "type": "tab",
        "label": "Find Brucontrol Elements by Workspace",
        "disabled": false,
        "info": ""
    },
    {
        "id": "1adf9c33a16a2580",
        "type": "xml",
        "z": "3650d7a4f00805cd",
        "name": "xml --> js object",
        "property": "payload",
        "attr": "",
        "chr": "",
        "x": 320,
        "y": 120,
        "wires": [
            [
                "0d2dafbdd04e43d5",
                "ec7022b3cb16c45e"
            ]
        ]
    },
    {
        "id": "0d2dafbdd04e43d5",
        "type": "function",
        "z": "3650d7a4f00805cd",
        "name": "js object to rows",
        "func": "/*\npayload.Configuration.Workspaces[].Workspace[].Name[]\npayload.Configuration.Workspaces[].Workspace[].Elements[].Element[].Name[]\npayload.Configuration.Workspaces[].Workspace[].Elements[].Element[].ID[]\n\n04/25/23\n\npayload.Configuration.Workspaces[0].Workspace[0].Name[0]\npayload.Configuration.Workspaces[0].Workspace[0].Elements[0].Element[0].Name[0]\npayload.Configuration.Workspaces[0].Workspace[0].Elements[0].Element[0].ID[0]\n\npayload.Configuration.Workspaces\npayload.Configuration.Workspaces[0].Workspace\n*/\n\nmsg.originalData = msg.payload; //save in msg (for debugging)\n\nvar workspaces = msg.payload.Configuration.Workspaces[0].Workspace;\n//var workspaces = msg.payload.Configuration.Workspaces.Workspace;\n//var workspaces = msg.payload.Configuration.Workspaces;\n\n//workspace name get name\nvar wsName = 1;\nvar rows = [];\nfor (let iWS = 0; iWS < workspaces.length; iWS++) {\n    let workspace = workspaces[iWS];\n    let elements = workspace.Elements[0].Element;\n    let workspaceName = workspace.Name[0];\n    let workspaceRows = elements.map(el => {\n        return {\n            workspace: workspaceName,\n            id:   el.ID[0],\n            name:   el.Name[0],\n            type:   el.$[\"i:type\"],\n        }\n    })\n    rows.push(...workspaceRows)\n}\nmsg.payload = rows;\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 320,
        "y": 180,
        "wires": [
            [
                "aa64322c2ebdc794"
            ]
        ]
    },
    {
        "id": "aa64322c2ebdc794",
        "type": "csv",
        "z": "3650d7a4f00805cd",
        "name": "",
        "sep": ",",
        "hdrin": "",
        "hdrout": "all",
        "multi": "mult",
        "ret": "\\n",
        "temp": "workspace,name,type,id",
        "skip": "0",
        "strings": true,
        "include_empty_strings": "",
        "include_null_values": "",
        "x": 510,
        "y": 180,
        "wires": [
            [
                "fcd6d0634d779913"
            ]
        ]
    },
    {
        "id": "8f33db8d99d2624f",
        "type": "comment",
        "z": "3650d7a4f00805cd",
        "name": "____Use this path as a model for your path to 'UniFlex_3V_BinarySSR.brucfg'(XML) under Brucontrol folder ___",
        "info": "",
        "x": 380,
        "y": 280,
        "wires": []
    },
    {
        "id": "5d19643d05b00b9e",
        "type": "comment",
        "z": "3650d7a4f00805cd",
        "name": "Convert to JS object",
        "info": "",
        "x": 330,
        "y": 80,
        "wires": []
    },
    {
        "id": "cca7dff47396985e",
        "type": "comment",
        "z": "3650d7a4f00805cd",
        "name": "Convert JS object to rows",
        "info": "",
        "x": 330,
        "y": 220,
        "wires": []
    },
    {
        "id": "772ad3494f072aea",
        "type": "comment",
        "z": "3650d7a4f00805cd",
        "name": "Convert rows to CSV",
        "info": "",
        "x": 560,
        "y": 220,
        "wires": []
    },
    {
        "id": "d33d57244befddd6",
        "type": "inject",
        "z": "3650d7a4f00805cd",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 100,
        "y": 80,
        "wires": [
            [
                "3550faeb4f3ea6a8"
            ]
        ]
    },
    {
        "id": "3550faeb4f3ea6a8",
        "type": "file in",
        "z": "3650d7a4f00805cd",
        "name": "brucfg",
        "filename": "C:/Users/sedgi/OneDrive/Documents/Brucontrol/UniFlex_3V_BinarySSR.brucfg",
        "filenameType": "str",
        "format": "utf8",
        "chunk": false,
        "sendError": false,
        "encoding": "none",
        "allProps": false,
        "x": 90,
        "y": 220,
        "wires": [
            [
                "1adf9c33a16a2580"
            ]
        ]
    },
    {
        "id": "fcd6d0634d779913",
        "type": "file",
        "z": "3650d7a4f00805cd",
        "name": "UniFlex_3V_BinarySSR.brucfg-new.csv",
        "filename": "C:/Users/sedgi/OneDrive/Documents/BeerSmith3/UniFlex_3V_BinarySSR.brucfg-new.csv",
        "filenameType": "str",
        "appendNewline": true,
        "createDir": false,
        "overwriteFile": "true",
        "encoding": "none",
        "x": 680,
        "y": 340,
        "wires": [
            []
        ]
    },
    {
        "id": "d70cbb87bbf8033e",
        "type": "comment",
        "z": "3650d7a4f00805cd",
        "name": "Define where you want the csv file to be written each time script runs--most close app viewing file before running again",
        "info": " - ",
        "x": 860,
        "y": 380,
        "wires": []
    },
    {
        "id": "afa556db999f82e8",
        "type": "comment",
        "z": "3650d7a4f00805cd",
        "name": "VERY IMPORTANT: Only use backup files or copy of current default.brucfg",
        "info": "",
        "x": 260,
        "y": 40,
        "wires": []
    },
    {
        "id": "c42c37fd76a41461",
        "type": "comment",
        "z": "3650d7a4f00805cd",
        "name": "(must close app viewing .csv before running again)",
        "info": "",
        "x": 650,
        "y": 420,
        "wires": []
    },
    {
        "id": "ec7022b3cb16c45e",
        "type": "debug",
        "z": "3650d7a4f00805cd",
        "name": "debug XML import",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 530,
        "y": 80,
        "wires": []
    }
]

The result is a .csv file which lets you look "under the hood" of any configuration file for Brucontrol. For example, this flow examines the UniFlex_3V_BinarySSR.brucfg which is downloadable from brucontrol.com (or may be included in your recently updated brucontrol app). It returns the file attached. This will give you an accurate idea of where to look for anything missing as well as if you have accidentally implemented naming conventions that get in the way of your scripting.

Beyond that, if you can recover the physical hard drive that crashed (or if you were savant enough to save a backup of default.brucfg somewhere else) and then are able to read it by attaching it to another computer, you can open your last default.brucfg as XML (for example in Visual Studio Code) and find all your scripts by searching on the word "scripts" not only will the name of the script be there, but also the entire script that you can copy and paste into your new brucontrol setup.

While I haven't had time to implement it, it should also be possible to use node-red to detect the wiring map you had for each element by finding the "DevicePort" and then looking under that at the "Number" which will correspond to the brucontrol pin (although this will require alignment through device id or something else.)

I hope this helps someone who has gone through the the frustration of "losing" their work on Brucontrol or having "buggy" behavior in their scripts. It would be nice to have an explanation of how the xml file is set up in the appendix of the manual as well as some sort of reporting tools available from Brucontrol to do this work such as this node-red flow demonstrates. In the meantime, this is one way I can, hopefully, give back to the community.
 

Attachments

  • uniflex_3V.jpg
    uniflex_3V.jpg
    108.9 KB · Views: 0
Gents,
I’m in trouble; installed the very last electric component tonight - I’m planning water tests later this week. This component is a simple float switch. One wire from 5VDC (supply is from VCC pin on my Unishield Mega 2560). The other wire goes into pin 5-3 P on the Unishield, with a 10kohm pull-down to ground. Basically same wiring has my other float switches.

My power is always off when I do my wiring. When I turned power ON; the Unishield is dark!!! I checked the VS input @ 24vdc, the Unishield is grounded, with no other apparent wire issue.

Looks like the Interface (Mega2560) is dead. Any idea on how to confirm before I replace it ( I have a spare)?

I disconnected the float switch completely while I troubleshoot…

I was basically done, I can’t believe it!!’
 
I am making some progress on my troubleshooting; I disconnected the 24vdc input from the Unishield VS pin. I supplied 5VDC from an external power supply into Vin of the Unishield. The power supply function switch is now set at VR Only and…Voilà! I recovered the interface!!!

So it seems like the Unishield DC-DC Power Supply (DDPS) got cooked …, so I need to find the cause and see what is the best way to test the DDPS and hopefully be able to replace it…?
 
Last edited:
I am making some progress on my troubleshooting; I disconnected the 24vdc input from the Unishield VS pin. I supplied 5VDC from an external power supply into Vin of the Unishield. The power supply function switch is now set at VR Only and…Voilà! I recovered the interface!!!

So it seems like the Unishield DC-DC Power Supply (DDPS) got cooked …, so I need to find the cause and see what is the best way to test the DDPS and hopefully be able to replace it…?
So I found the cause of this mishap; the float switch connector at the control panel is shorted…

So the VCC pin from Unishield ended up with excessive amp draw…

So now I need to figure a way to do without the onboard DDPS - perhaps supply all 5VDC directly with my Meanwell 5VDC power supply..?
 
Last edited:
General Arduino Mega2560 query; I have an electronic salon 8 relay board with 5VDC coils; can the relay board’s VCC pin be supplied with a dedicated 5VDC power supply, while the coils get command signal directly from an Arduino digital out pin? Could these command signals draw beyond the recommended 20mA max current?
 
I'd need to see a schematic of the board in question to be sure, but typically the coils are driven via an external power source (Vcc) and control voltage from the arduino is separated. Sometimes there is a jumper involved to share or isolate power.
 
General Arduino Mega2560 query; I have an electronic salon 8 relay board with 5VDC coils; can the relay board’s VCC pin be supplied with a dedicated 5VDC power supply, while the coils get command signal directly from an Arduino digital out pin? Could these command signals draw beyond the recommended 20mA max current?
This is what I got from the d-228 relay board’s data sheet;

Control signal input
High level current
[email protected] 0.4mA@5V 1.1mA@12V 2.2mA@24V
[email protected] 1.0mA@5V 2.4mA@12V 5.0mA@24V

So to answer my own question, the control output from the Mega2560 would be .001 amp, which is below the max amp draw of .020.

Makes sense?
 
Back
Top