Brucontrol script primer. Is there one?

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.

Jkpatton

Active Member
Joined
Jul 26, 2016
Messages
34
Reaction score
2
Hello all

Anyone have any threads or insight for a brucontrol scripting primer or how to? Just now starting to really tinker with and would like to add things like float switches and interlocks into the script. I was brought up on plc ladder logic and sadly that won't help me much here. I just need a couple of the basics and I think I can pick it up from there. Not looking to do a lot of automation but just add some fail safes.
 
I’m biased, but I would suggest the User Manual. It has several examples that you can queue off of. It’s not comprehensive but I think it will get you pointed in a direction. We can write up a dedicated primer if everyone feels it beneficial or add more examples to the manual.
 
We can write up a dedicated primer if everyone feels it beneficial or add more examples to the manual

As @Jkpatton mentions above maybe primer on the basics with lots of examples, as this will get the ball rolling for more advanced/complex scripting. For myself a "Scripting For Dummies" series would be nice :yes:. Maybe a standalone manual from the User Manual dedicated to scripting only, would help some of us get to the next level with our setups.
Another option might be to make some short "You Tube" videos like @Die_Beerery provides from time to time, maybe a collaborative effort of sorts with those who would like to share their knowledge with some of us script challenged people.
 
Last edited:
agreed ... I find I have a hard time retaining the knowledge when it comes to writing the scripts.. seems like I'll learn what I need to then weeks or months later it all looks foreign to me again.. I know its not rocket science.
 
agreed ... I find I have a hard time retaining the knowledge when it comes to writing the scripts.. seems like I'll learn what I need to then weeks or months later it all looks foreign to me again.. I know its not rocket science.

As someone who writes a fair amount of scripting (primarily in VB), comments are your friend! The more commentary you add, even to the point of being superfluous, the easier it is to come back to and understand what, how, and why you did what you did.
 
im looking to do easy things in comparison to automation. Such as not allowing elements to fire til a float switch is satisfied and associted light with that. Interlock for allowing only hlt or bk elements to fire at the same time. that kind of thing. I was really good with ladder logic back in my prime but this isnt quite ladder logic here.
 
im looking to do easy things in comparison to automation. Such as not allowing elements to fire til a float switch is satisfied and associted light with that. Interlock for allowing only hlt or bk elements to fire at the same time. that kind of thing. I was really good with ladder logic back in my prime but this isnt quite ladder logic here.
I have both of the things you mention in my brucontrol build but they are done with hardware, a floatswitch wired to interupt the ssr signal and a relay with a set of NC and NO contacts to prevent both banks of elements from being on at the same time... I think hardware is the more reliable way to accomplish these two goals.
 
Any future plans for a single pole double throw type switch element?
 
Any future plans for a single pole double throw type switch element?

do you have more specifics? it seems like you could just have a definition of a variable in the boot script that says output 2 is off if output 1 is on, and on if output 1 is off... but a relay board does this in hardware already.... so yoru specifics might shed some light on what you really want.

If you wanted a center off, you might need a variable to interface. Write a script that says if Var1 is -1, Out1 is on, Out 2 is off, if Var1 is 0, both are off, and if Var1 is +1, Out1 is off and Out2 is on... but the specifics of what you want, again, would help..
 
I am glad the issue of scripting help has come up, and agree more scripting help may be needed. I too am struggling with writing script, as my rig gets more and more complicated with pressure sensors, flow meter, proportional valves, propane valves, etc. I have copied and pasted snippets of code, to try and fit my equipment, but if there is an error in the code, there 8s very little information on how do I debug a script. As an example, I copied exactly the line "MaxFlowRate /= 60" for my adafruit flowmeter and get an error message "Cannot assign a value to an immediate value". I have no idea what that means or how to fix it if I copied it incorrectly. My two cents on this issue.
 
Agree that some error descriptions would be helpful. Right now you just know it’s wrong.

In your case, are you including those quotes? If not, what is MaxFlowRate? Keep in mind the interpreter speaks one language and is very literal. If you try to have math done on something that isn’t math capable, the interpreter will balk.
 
Hi, BrunDog, no that line is not in quotes. It is quoted for this discussion. I actually copied and pasted that line and others prior from an example script you had posted at one time, as that portion was addressing calibration of the flow meter, and minimum and maximum flow rates. I can expound on that script in the forum rather than in this thread if you wish. My main point was the need for some debugging information, not just script examples.
 
yea you can't do that.

MaxFlowRate /= 60

MaxFlowRate will need to be defined as a value

//values here
new value MaxFlowRate
MaxFlowRate = X (x being some number)

//scripting
MaxFlowRate /= 60

What are you trying to do with max flow? you will need it in some form of a statement..i.e.

if MaxFlowRate /= 60
"valve" state = off
esle
"valve" state = on
endif

for example
 
I'm not sure if we should blow this thread up with scripts, but we certainly have a responsibility to help give anyone the resources they need.

That said, we'll look at writing a primer of some sort - it would be heavy example based as the manual already shows the statements, properties, etc.

Regarding the script @purdman10 is referening, testing this script works fine, so I am not sure why that error is arising, other than the variable is being deleted prior having the math line conducted:

Code:
new value MaxFlowRate
MaxFlowRate = 2

[loop]
MaxFloWrate /= 2
sleep 1000
goto loop

EDIT: Whoops... @Die_Beerery beat me to it! But note you can't do math during an 'if' conditional.
 
Back
Top