Sign in to follow this  
Followers 0
charleschia1986

Cicode problem

9 posts in this topic

Hi guys, I am new to CitectScada. I have wrote some codes in Cicode but how am i suppose to link it to my Graphic Builder? Is there any specific setup that i need to do before I start writing the code? May i do something like this? IF (T1a = 1) THEN T2a=0; END Which T1a and T2a are two of my Variable Tags. I actually tried to write this into my cicode but it doesn't seem to be working. Am i missing anything or i am not supposed to do so. THANKS for the Helps, i really appreciate it.

Share this post


Link to post
Share on other sites
I have exactly the same problem. I have written some Cicode to return a value (I want log alternator RPM data every 60 secs). My Cicode compiles without errors as does my Citect screen. AFAIK T1a and T2a have to be declared as GLOBAL INT in Cicode. Where I am at loss is how to invoke my AlternatorRPM function from Citect. Citect does a screen scan every 250ms. My current thoughts are via the Citect kernel (seems drastic) or Admin Tools / Configure Menu item / Edit Menu item. Will keep you posted when I make progress.

Share this post


Link to post
Share on other sites
You can configure an event (look under system, events) In the name field select global, and select say 00:00:01 in the period for a 1 second update. Select your cluster in the cluster field. The action field should contain the function you want to call, say MyFunc() In cicode: Function MyFunc() IF (T1a = 1) THEN T2a=0; END END Rgds

Share this post


Link to post
Share on other sites
Sparky is spot on - it is the Event that triggers the running of the Cicode (Schneider documentation is not very clear on this point).

Share this post


Link to post
Share on other sites
hi guys, thanks for the replies and i really appreciate it. I already tried to configure an event under system, but it doesn't seem to be working too... i have this in my Cicode: FUNCTION MyFunc() IF (DTBd = 1) THEN D4d = 1; END END ** Note that DTBd and D4d is declared in Variable Tags. and my event is as following: Name: GLOBAL Time: 00:00:01 Period: 00:00:10 Trigger: DTBd Action: MyFunc() Not sure what to enter under "Trigger", so i had several attempts by changing the content of "Trigger" but still doesn't work. oh yea, i am checking by putting a symbol (D4d=1) under Citect graphic see whether it turns on or not when DTBd=1. Did i do anything wrong? Thanks for helping me.. Edited by charleschia1986

Share this post


Link to post
Share on other sites
Just wondering do i need stuffs like readtagbit, writetag, writetagbit and so on? thanks.

Share this post


Link to post
Share on other sites
When using Events, be sure to go to: Tools Computer Setup Wizard Custom Setup ...to the Events Setup window. Make sure "Enable Events on this Computer" is checked (do this on the Server if the event is only to run on the server) then make sure your configured event is checked in the box to the right. This will enable the event to run continually on the selected computer. See the Help file, search for "Events Configuration".

Share this post


Link to post
Share on other sites
The Citect help file is generally a good place to start for Help Your event will not run until the trigger is true: Trigger The Cicode expression (or Variable tag) which is used to determine whether the event Action is executed. This expression is checked every one second. Enter a value of 64 characters maximum.

Share this post


Link to post
Share on other sites
Do this! Make a variabel called HP, make it an INT. Make a cluster called Your_cluster Make a cicode FUNCTION Test() HP=666 END Go to events and add this Name: Test Cluster: Your_cluster Time: 00:00:00 Period 00:00:01 Action Test() *Leave the rest blank Go to computer setup Event setup mark the "Enabe events on this computer" mark the event that you just made "Test" Finish the computer setup Now got to graphic builder and make an analog numeric choose the tag HP SAVE ALL CICIODE, GRAPHIC AND SO ON! Complie and run. Now will citect set the value of 666 to your variabel everytime the event is actioned! :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0