Change variable then execute sequence


Recommended Posts

Hello, 

I have 5 manifolds that have fluid running through them and if a clog is detected, then I want to purge just that manifold by triggering a sequence. 

My issue is that I have 5 channels named WaterManifold0, WaterManifold1, etc to WaterManifold4. 

I really just want to be able to say manifold = 0 or Manifold =1 and then add that to "WaterManifold" such that I get "WaterManifold0"

Can I use:

private string WaterManifold = WaterManifold + Manifold 

Then inside the sequence It will turn on just that manifold (WaterManifold because now WaterManifold = WaterManifold4 for example) for the specified time, turn it back off, then start the normal sequence. 

 

Here is the sequence that it would trigger:

private string WaterManifold = WaterManifold + Manifold

CleanCycle=1

Sequence.WM1.End()
Sequence.WM2.End()
Sequence.WM3.End()
Sequence.WM4.End()
Sequence.WM5.End()

WaterManifold0=1
WaterManifold1=1
WaterManifold2=1
WaterManifold3=1
WaterManifold4=1
WaterManifold5=1
CleanOut = 0
ReCirc = 1
delay (7)

WaterManifold=0
delay(tClean)
WaterManifold=1


CleanCycle=0


Sequence.StartUp.Begin()

 

Thank you

Link to comment
Share on other sites

OK.  You are kind of on the right track but have some syntax errors, and you need to use the execute() function.  First you need to build a string with the channel name.  You were close with: 

private string WaterManifold = WaterManifold + Manifold

but the syntax is wrong.  You want:

private string waterManifold = "WaterManifold" + manifold

Then to set whatever manifold it references to 0, you would do:

execute(waterManifold + " = 0")

doing what you did:

waterManifold = 0

would put a "0" in the private string variable waterManifold that you created.

A few other things.  Why are you opening all the other manifolds?  That, presumably will interfere with the main sequence right?  I guess I need to see the rest of your logic.  It seems like maybe you have 5 sequences, one for each manifold.  In that case, you don't need to start another sequence to clear the clog.  You can just call the sequence as a function.  

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.