Citect SCADA Help - association of variable

EICS

Member
Join Date
Dec 2008
Location
Melbourne, Australia
Posts
323
Excuse my inexperience with cicode, I have a citect issue I need to make "Global" where the line below is shown in bold in the below function SPDisplayTagInfo().


FM_D2FIB4_MBSP_NEW; ! <------- Make Global here

The function works and is what i want but instead of"FM_D2FIB4_MBSP_NEW" tag i need to associate with value of the first variable passed, i know this is simple but is got me stumped. just about to leave site an will probably clear my mental blank on the drive home.








FUNCTION
SPDisplayTagInfo() ! This function is called on page opening of !6fibSP

STRING sVtags; ! Variable tag name
STRING sComment; ! Comment field of the variable tag
STRING sZeroScale; ! Eng. zero scale of variable tag
STRING sFullScale; ! Eng. full scale of variable tag
STRING sEngUnits; ! Eng. units of variable tag
STRING sValidRng; ! Valid range of the variable tag

STRING sGlobalMin; ! "Global" Fiberiser Minimum Speed Value
STRING sGlobalMax; ! "Global" Fiberiser Maximum Speed Value
INT iExistValue; ! "INTEGER" type - Existing Setpoint Value
REAL rRealExistValue; ! "REAL" type - Existing setpoint value
REAL rPCExistValue; ! % of Existing setpoint value

sVtags = AssInfoEx(1,0); ! the first variable tag (e.g. FM_D2FIB4_MBSP_NEW)

iExistValue =
FM_D2FIB4_MBSP_NEW; ! <------- Make Global here for all positions
rRealExistValue = IntToReal(iExistValue);
rPCExistValue = rRealExistValue * 0.90;

sComment = DspInfoField(0,sVtags,"Comment"); ! the comment of the first variable tag
sZeroScale = rPCExistValue:####; ! the New "Zero Value" (90% of the Existing value)
! sZeroScale = FM_SPIN_MIN_ALLOW_SPEED; ! the "Zero Value" (Global Minimum Value)
sFullScale = FM_SPIN_MAX_ALLOW_SPEED; ! the "Full Value"

sEngUnits = DspInfoField(0,sVtags,"Eng_Units"); ! the "Engineering Unit" of the first variable tag

IF sEngUnits = "RPM" THEN; ! IF the Tag is Speed "RPM" then give the range

sValidRng = sZeroScale +" To "+ sFullScale; ! The Engineering Range of the first variable tag

ELSE
sValidRng = "Error" + " " + sEngUnits; !

END ! IF Statement END

PageSetStr(1,sComment); ! Display Tag Comment
PageSetStr(2,sValidRng); ! Display Tags' valid range.


END ! SPDisplayTagInfo END

 
Last edited:
You need to add a parameter to the Function (I called it glob_value, but you can call it whatever you want):

FUNCTION
SPDisplayTagInfo(INT glob_value) ! This function is called on page opening of !6fibSP

STRING sVtags; ! Variable tag name
STRING sComment; ! Comment field of the variable tag
STRING sZeroScale; ! Eng. zero scale of variable tag
STRING sFullScale; ! Eng. full scale of variable tag
STRING sEngUnits; ! Eng. units of variable tag
STRING sValidRng; ! Valid range of the variable tag

STRING sGlobalMin; ! "Global" Fiberiser Minimum Speed Value
STRING sGlobalMax; ! "Global" Fiberiser Maximum Speed Value
INT iExistValue; ! "INTEGER" type - Existing Setpoint Value
REAL rRealExistValue; ! "REAL" type - Existing setpoint value
REAL rPCExistValue; ! % of Existing setpoint value

sVtags = AssInfoEx(1,0); ! the first variable tag (e.g. FM_D2FIB4_MBSP_NEW)

iExistValue = glob_value; ! <------- Make Global here for all positions
rRealExistValue = IntToReal(iExistValue);
rPCExistValue = rRealExistValue * 0.90;

sComment = DspInfoField(0,sVtags,"Comment"); ! the comment of the first variable tag
sZeroScale = rPCExistValue:####; ! the New "Zero Value" (90% of the Existing value)
! sZeroScale = FM_SPIN_MIN_ALLOW_SPEED; ! the "Zero Value" (Global Minimum Value)
sFullScale = FM_SPIN_MAX_ALLOW_SPEED; ! the "Full Value"

sEngUnits = DspInfoField(0,sVtags,"Eng_Units"); ! the "Engineering Unit" of the first variable tag

IF sEngUnits = "RPM" THEN; ! IF the Tag is Speed "RPM" then give the range

sValidRng = sZeroScale +" To "+ sFullScale; ! The Engineering Range of the first variable tag

ELSE
sValidRng = "Error" + " " + sEngUnits; !

END ! IF Statement END

PageSetStr(1,sComment); ! Display Tag Comment
PageSetStr(2,sValidRng); ! Display Tags' valid range.


END ! SPDisplayTagInfo END
 
Many Thanks SigmaDelta. will try this tomorrow.

i hope i explained what i want to do correctly, i did post in haste before i left site, on the way home i had further thoughts.

i have a super genie that i can use to write a new set point to any of 9 devices, they are all tagged similar as such

FM_D2FIB1_MBSP_NEW
FM_D2FIB2_MBSP_NEW
FM_D2FIB3_MBSP_NEW
FM_D2FIB4_MBSP_NEW

and all share a unique prefix (FM_D2FIB4) and same suffix ( "_MBSP_NEW" ).so what i really want to do is Substitute the Prefix so that the function will run for all 9 devices. the tags to be read are all Integers

String sTagBase;
iExistValue = sTagBase, + "_MBSP_NEW"

or something like the above where sTagBase is a subsitution.

from above code post

sVtags = AssInfoEx(1,0); ! the first variable tag (e.g. FM_D2FIB4_MBSP_NEW)

this will be one of the 9 Devices, and this code works for SVtags to give the Tagname as a string "FM_D2FIB4_MBSP_NEW"
for any device.


so having said all that is your example what i need then ?
 
Last edited:
Just trying to understand.
You are calling a genie which is displaying a single value FM_D2FIB*_MBSP_NEW Associated to ?1? on the genie ? (* can be 1-9).
Then SPDisplayTagInfo() is called from the genie page.
In SPDisplayTagInfo() you want iExistValue to be the value of sVtags which is the Associated ?1? from above?
 
Excuse my inexperience with cicode, I have a citect issue I need to make "Global" where the line below is shown in bold in the below function SPDisplayTagInfo().


FM_D2FIB4_MBSP_NEW; ! <------- Make Global here

The function works and is what i want but instead of"FM_D2FIB4_MBSP_NEW" tag i need to associate with value of the first variable passed, i know this is simple but is got me stumped. just about to leave site an will probably clear my mental blank on the drive home.

sVtags = AssInfoEx(1,0); ! the first variable tag (e.g. FM_D2FIB4_MBSP_NEW)

iExistValue = [/I]FM_D2FIB4_MBSP_NEW; ! <------- Make Global here for all positions


AssInfoEx(1,0) Returns a string.

You need
iExistValue = StrtoInt(TagRead(sVtags));

Then you could have iExistValue = StrtoInt(TagRead("Prefix"+sVtags+"Suffix"))
 
Well Done Andrew, yes that is exactly what i need.



the SPDisplayTagInfo() function is called from "on page open" page property of a Pop Up Faceplate for data entry for the Tag FM_D2FIB*_MBSP_NEW ( * can nbe 1 - 9)



it gets info about the Tag and displays 2 Strings for the new page


- Tag Comment
- Valid Range


the code works well, but i need to modify the Range as the lower limit of the range can only be 90% of the existing setpoint or Higher
 
AssInfoEx(1,0) Returns a string.

You need
iExistValue = StrtoInt(TagRead(sVtags));

Then you could have iExistValue = StrtoInt(TagRead("Prefix"+sVtags+"Suffix"))


Oh that explains the association error i was getting.


Many Thanks chelton, that looks like what i need, many thanks.
i will try this tomorrow morning and post my results.




Many Thanks to all responders, i really appreciate this.
 
Oh that explains the association error i was getting.


Many Thanks chelton, that looks like what i need, many thanks.
i will try this tomorrow morning and post my results.




Many Thanks to all responders, i really appreciate this.

Yes Chelton has answered your question, that will work how you want.

With this section of the code you are just converting from Int to real and doing the multiply by 0.9.
iExistValue = TagRead(sVtags)
rRealExistValue = IntToReal(iExistValue);
rPCExistValue = rRealExistValue * 0.90;

I would just do it in 1 line to make more efficient and easier to read, replace above 3 lines with below.
rPCExistValue = (IntToReal(TagRead(sVtags))* 0.90)

And delete iExistValue and rRealExistValue declarations.


Also with the tag Comment You could just do that on the genie page with replacing PageGetStr(1)with AssInfoEx(1,16)

Keep as is if it makes it easier for you though.
 
Many Thanks Andrew, i will do just as you suggest with the single line.


Again many thanks, this is the most cicode i have ever done i'm at around 2,000 lines in a file with approx 20 + functions. well over my head but getting there. once i get it all working ( i reckon i'm 80% through the spec i have been handed) i will go through and condense some of the extra lines and tidy up which will reduce a lot as i have sections remarked out and heavily documented.


enjoying the challenge, but can be tiring at times.


Thanks again to all.
 
Last edited:

Similar Topics

So i've been at this for a long while, i have Citect Scada 2018, i have full access to everything but i can't seem to find any option or...
Replies
0
Views
9
Hello Everyone, I am working on reports in Vijeo Citect V7.40. I want to generate a report whenever I press the button. I am able to generate it...
Replies
0
Views
879
Hello Everyone, I am working on an already existing project updating new equipments installed. I have no prior experience in this field but I do...
Replies
8
Views
3,411
Hi, I am maintaining a Citect SCADA with 2 x IO servers and 2 x File servers. the version of Citect is 5.21.00 Service Pack G. I have my project...
Replies
0
Views
1,929
Hi i am by no means a cicode expert in fact i struggle with code. as a plant electrician i can do alarms, graphis, trends etc. i have citect...
Replies
3
Views
1,421
Back
Top Bottom