Another Alerton Visual Logic Question
I need to know how to make and use a subroutine DDC in visuallogic with example .
really appreciating your help.
You'll need to be a little more descriptive there Ahmed on what kind of equipment you are trying to control with your subroutine.
Thanks a lot for your interest.I'm not working in a specific project I'm just tring to learn so any explained example will be enough.lets say 20 VAVs
Originally Posted by noskilltech
First off, only Global Controllers are capable of doing subroutines. When you open a new Visualogic drawing, you will get to choose between a VLC or Global. Opening a new Global controller file will include the necessary subroutine functions in your shapes. The key functions are,
Function 1, which is the End of Normal Programming, (used in all controllers)
Function 2, which is the End of Subroutine Programming (which denotes the end of each piece of subroutine code)
Function 67, which is the Subroutine Caller. (the parameter list)
Function 3, which is the Set Context function. (for variable address referencing)
For the VAV job example I would program the VAV subcallers starting at 21xx, with the XX being the VAV number. I normally use Seq 3999 for my End of Normal Device. Any Subroutine sequences will be > 3999. I normally use seq 5000 to start my main subroutine. Seq 5000 would then be entered in the Device 67 box.
There is no special device needed to begin a subroutine, but if you say the SR starts at 5000, there had better be a device at seq 5000 for the program to branch to, or the program will silently crash. I usually place a generic transfer device to leave in the start location, so it won't be changed or removed by mistake. You will need an End of Subroutine Device (2) at the end of each subroutine to prevent DDC execution into the next subroutine. If you want to get fancy you can program in a multiple entry subroutine that is entered at different sequence numbers but exits out at one End of Subroutine Device.
Function 3, the Set Context Function is the key to processing varying Device IDs in one Subroutine. This function will use a number from the Device 67 parameter list to allow on the fly reset of which Device ID the SR is accessing. You will use an address like Context AI-1 to read AI-1 from whichever is the current Subcaller being executed.
Remember, If you write to a specific point, such as a directly addressed (not context) AV-24 in a subroutine, it will be written to every time that SR is executed. You probably want to initialize a Branch Variable before the subcallers, and then write that final value into an AV point after all of the Subcallers have executed. for accumulators and the like.
I hope I didn't make too many mistakes here.
Many thanks, I think I got many things clear
now. But still, I'm confused in what the SR is used for in that case. I'd say
"and Please correct" It would be used to calculate Air flow for Each
VAV using Fun 6:Velocity Pressure to fpm Converter "Why I should use SR It
is only a single function" any way where to but that function what is the
sequence the DDC would follow. How the Subroutine Caller(fun:67) Parameters
would be used and for which device instance I mean which function assign the
device instance to fun:67 Parameters . Sorry for the confusion.
If you could attach *.bd3 file as an example
would be great .(TIA)
SR is just short for subroutine.
In a VAV system, the global subroutine would be used for a few things.
1 - Time Schedule. Send the time schedule for the Main Air Handler out to all of the VAV controllers for that zone(CRITICAL - Delay the actual Air Handler Fan Start for 2 or 3 minutes to allow time for the VAV boxes to open first). If there were more than one VAV system, you would use an entry in the device 67 parameter list for a BV that is the Time Schedule point. The boxes on the two(or more) systems would have either BV-1 or BV-2 (for instance) in that entry, depending on which schedule they were using.
2 - Accumulators to track collective values from all of the boxes in the particular system, such as Max Damper %, Min Damper %, Max Cooling or Heating %. Values such as these can be used to control the Air Handler operation, such as Supply Air Temp, Fan Speed, etc. Lets say you have 2 systems in involved, and you want to monitor 5 values each. I would use the Branch Variables 801, 811, 821, 831, 841, and 851, for system 1 boxes. And I would use 802, 812, 822, 832, 842, and 852 for the system 2 boxes. Before the subcaller seq numbers, you need to Zero Out or Not Out all of the Branch variables used, depending on whether you are looking for an analog value(high, low, total) or digital/logical result(such as Are any of the boxes in heating?)
You would read the value from the box itself using the Context addressing, and run that value through a High Low Selector (for example) that would output into one of the Substitution entries in the Device 67 containing a Branch Value. After the Subcaller sequences are complete, each Branch Variable is written to a corresponding AV to use in Air handler programming and for display on the screen. Branch 801 would be written to AV-801, Branch *02 would be written to AV-802, etc. This would give you a value updated after every program cycle.
These AV points would then go into Device 67 subcallers to an Air Handler subroutine. That way, you would have one program to handle all VAV Air Handlers, with each one using the collective data from it's own VAVs.
3 - Alarm monitoring. I prefer to have a single light on the front display to indicate an alarm in a system, such as High Space Temp in a group of VAVs or Air Handlers. A subroutine can search all of the zones and signal the existence of an alarm somewhere. Once a user sees the one light, he can search through the zones to find the problem. This method will keep the Display 1 clear of excess clutter, but still offer quick access to the necessary info.
All this cryptic talk has me thinking it must be the craziest system out there to program.
Personally don't know squat about Alerton. Seen the visual logic few times, didn't look too outrageous.
Great effort ,great clarification ,thanks a lot
And still wating an example you can upload it to that site : mediafire