Citect/cicode

joigunni

Supporting Member
Join Date
Jan 2011
Location
Iceland
Posts
52
Hi
I have a Local Variables in Citect set with “zero scale=0” and “full scale =12” now I want to change the full scale at Runtime, can I do that in Cicode?o_O
 
Are these tags in the tag base? real IO or memory.

CICODE cannot access tags but you can pass and return parameters.

eg

CICODE


INT
FUNCTION
TEST(INT A)

INT X = A;

RETURN X
END

from the graphic page have an instruction, inside a button perahps


FullScale = TEST(NewValue)





Is this what you mean?



edit. Not sure I've answered right, thinking now you may have a string tag with the contents "Full Scale =12", if so then the above maybe still valid as a pointer, instead of INT at the beginning use STRING and the entry argument could be changed to STRING etc.
 
Last edited:
In earlier versions it was actually possible (but not simple,easy or recommended). There were a set of undocumented functions relating to RDB's. RDB's are (or were) the runtime data base files that Citect used when you compiled youre project. One problem with doing them would be that next time you compile dyou would overwrite the RDB with data from the off-line file (variable.dbf) But that wa sin earlier versions (V3 & V4) I havn't used any of these in later version sand don't even know if they still exist.
 
I did not find a actual solution. In my program I have a weight scale mad by rectangle that will fill up by red color when it sense some weight. The scale is from 0 to 500 kg. In some case I want to be able to change to higher scale, like from 0 to 2000 kg. At first I put the scale setting in the “Variables Tags” to “Eng Zero Scale = 0” and “Eng Full Scale=500” but as you know there is no way to change those scale in run-time so I cleared those settings and instead made small mat-formula.

Calculated_weight= ((input_weight*3)*2000)/scale_value

// Analog input from PLC give me scale that is 0-10500,
//variable-tag scale is 0-32000
//Max weight is 2000kg
//on Max weight 2000kg I will get 10500 from PLC analog-input

if I put the scale_value to 500kg, the math will look like this:
Calculated_weight= ((10500*3)*2000)/500
Calculated_weight=126000

And if I got 500kg on PLC input, PLC will give me 2625, and the math will look like this:
Calculated_weight= ((2625*3)*2000)/500
Calculated_weight=31500
And the rectangle will be filed

If I still have 500kg on PLC input, and put the scale_valu to 1000kg, the math will look like this:
Calculated_weight= ((2625*3)*2000)/1000
Calculated_weight=15750
And the rectangle will be half filed
 
but as you know there is no way to change those scale in run-time

I don't know, I'm currently passing data between citect tags, variable tags and IO tags with citect, using the method I said above. (It appears my reply was ignored though)

Maybe its an 'English not first language' problem. But I still don't know the format of the tags you were trying to change, the way you put the lot in a string made it look like the tags were string tags, but your talking about numbers which means integer.

Confusing.
 
You are probable right, ‘English not first language’ problem. I’m using integer Tags.
See this picture, I’m trying to change this parameters “zero scale=0” and “full scale =100”, I mean I want to change this parameters in Runtime.



Citect2.PNG
 
I got his from Citect Support when I inquired.

Hello Jim,

It is not possible to change the scaling when the application is running and get the changed scale to be implemented online. There is no cicode function or mechanism to achieve the requirement in v6.10. It is because potentially it could cause an mismatch of historical trend data and thus, hindering the system to run (if you are trending the variable tag).

In v7.xx onwards, you can do online changes by restarting the necessary processes after you made the changes (running multi-process). Other than that, there is no mechanism to change the scale of the tag on-the-fly.

Please advise me if you have further inquiry.

[FONT=&quot]Best Regards,
Dennis[/FONT]
 
You are probable right, ‘English not first language’ problem. I’m using integer Tags.
See this picture, I’m trying to change this parameters “zero scale=0” and “full scale =100”, I mean I want to change this parameters in Runtime.


Why not create a "scale" tag that can be changed at runtime, then from your rectangle "fill properties" call a cicode function to create the scale you want.

tags.jpg graphics.jpg code.PNG
 

Similar Topics

I am trying to display a variable within a cicode function onto a graphics page. This function queries a SQL database. I can get the value onto a...
Replies
3
Views
228
Hi guys, its my first time progamming cicode and I need to do popups alarms, there are several digital alarms and in their rising edge transition...
Replies
0
Views
479
Is there a way to run a Cicode function in the Cicode Editor? I have a function that works but I would like to run it without having a button on...
Replies
12
Views
2,915
in the past i have only been doing small mods to existing cicode and coping sections to reuse and modify to suit. Now i have been tasked to write...
Replies
5
Views
2,738
Does anyone have a Citect 2018 CiCode Reference Guide in pdf Format??? I know all the functions are in the help but..... I like to print them out...
Replies
5
Views
2,191
Back
Top Bottom