PLCS.net - Interactive Q & A

PLCS.net - Interactive Q & A (http://www.plctalk.net/qanda/index.php)
-   LIVE PLC Questions And Answers (http://www.plctalk.net/qanda/forumdisplay.php?f=2)
-   -   Citect/cicode (http://www.plctalk.net/qanda/showthread.php?t=68735)

joigunni January 9th, 2012 02:57 PM

Citect/cicode
 
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?:hmmm:

jimtech67 January 10th, 2012 02:44 PM

This is a bump

I would love to know if this is possible.

PeterW January 10th, 2012 07:03 PM

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.

Dua Anjing January 10th, 2012 07:24 PM

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.

joigunni January 11th, 2012 02:28 PM

ok, but thanks for your help, have to find some other way.:utoh:

tragically1969 January 26th, 2012 06:40 AM

Quote:

Originally Posted by joigunni (Post 463963)
ok, but thanks for your help, have to find some other way.:utoh:

As people took the time to answer you and give advice it would be considered courteous to share how you did it if you did find a solution.......

joigunni January 29th, 2012 01:48 AM

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

PeterW January 29th, 2012 01:32 PM

Quote:

Originally Posted by joigunni (Post 466606)
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.

joigunni January 29th, 2012 05:08 PM

1 Attachment(s)
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.


jimtech67 January 29th, 2012 05:28 PM

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.

Best Regards,
Dennis

chelton January 30th, 2012 02:41 PM

3 Attachment(s)
Quote:

Originally Posted by joigunni (Post 466669)
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.


All times are GMT -5. The time now is 06:54 AM.

.