Search the Community

Showing results for tags 'cicode'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Found 4 results

  1. CITECT SCADA

    How am I going to send the variable tag value of ABB1_T3_C to TEST_INTERNAL.  How to do this in cicode? please send me some input. i tried this but it doesnt work.   
  2. I am having a problem getting citect to write to my sql database.  Whilst it will write I am restricted by the length of a single cicode command. I think its 255 characters. For my problem I am trying to write 48 tags to the database in one write command to obtain 1 time stamp. Is it possible to write multiple times to the same tables row ? Currently when I write a new row is created at the given timestamp. the cicode is attached. A solution would be to do 4 writes of 12 tags at a time but all would need to go in the same MSSQL table row. I'm ok using the data instead of time and date as this write only happens once each day Any help would be awesome..   *********************************************************************************************************************************** /* **    FILE:        SpurLoad.CI ** * Load Tags from Citect in TO temp array */ STRING tagname[24]="M340_PwrCtrl_SLD0000","M340_PwrCtrl_SLD0030","M340_PwrCtrl_SLD0100","M340_PwrCtrl_SLD0130","M340_PwrCtrl_SLD0200","M340_PwrCtrl_SLD0230","M340_PwrCtrl_SLD0300","M340_PwrCtrl_SLD0330","M340_PwrCtrl_SLD0400","M340_PwrCtrl_SLD0430","M340_PwrCtrl_SLD0500","M340_PwrCtrl_SLD0530","M340_PwrCtrl_SLD0600","M340_PwrCtrl_SLD0630","M340_PwrCtrl_SLD0700","M340_PwrCtrl_SLD0730","M340_PwrCtrl_SLD0800","M340_PwrCtrl_SLD0830","M340_PwrCtrl_SLD0900","M340_PwrCtrl_SLD0930","M340_PwrCtrl_SLD1000","M340_PwrCtrl_SLD1030","M340_PwrCtrl_SLD1100"; /* add array TO hold values */ STRING tagval[24]; INT hSQL; FUNCTION SQL_INSERT_lds() /* Loop FOR number of tags (13 lots of 30 min) TO be read adding to array Variables */ INT i;     FOR i = 0 TO 21 DO              tagval = TagRead(tagname);              END      /* Open ODBC connection TO CitectDB configured in ODBC Manager with DSN_SQL */          hSQL = SQLConnect("DSN=DSN_SQL"); /* IF connection IS OK, insert in TO table "lds" the values */ IF hSQL <> -1 THEN     SQLExec(hSQL, "INSERT INTO lds (dateandtime,S0000,S0030,S0100,S0130,S0200,S0230,S0300,S0330,S0400,S0430,S0500,S0530,S0600,S0630,S0700,S0730,S0800,S0830,S0900,S0930,S1000,S1030) VALUES (SYSDATETIME(),'"+tagval[0]+"','"+tagval[1]+"','"+tagval[2]+"','"+tagval[3]+"','"+tagval[4]+"','"+tagval[5]+"','"+tagval[6]+"','"+tagval[7]+"','"+tagval[8]+"','"+tagval[9]+"','"+tagval[10]+"','"+tagval [11]+"','"+tagval[12]+"','"+tagval[13]+"','"+tagval[14]+"','"+tagval[15]+"','"+tagval[16]+"','"+tagval[17]+"','"+tagval[18]+"','"+tagval[19]+"','"+tagval[20]+"','"+tagval[21]+"')");     SQLEnd(hSQL);     SleepMS(100); SQLDisconnect(hSQL); ELSE     Message("Error Message","SQL TRADING DAY DATABASE WRITE FAIL",48); END END   SpurLoad.ci
  3. Hi every body. I want to get and set Time Picker value in process analyst in citect scada using cicode. Also  I tried to find an event or function when time picker value is changed , is called but find nothing. May you help me please?
  4. Hi Guys, I wish to know if there is a method by which one can use string substitutions in Cicode functions.. It is a very useful thing, when used with structured tag names. In my current project, there are 200 Energy meters, each having 8 tags, hence 1600 tags. Each group of 8 tags has the same pattern ie <prefix> being the identity of a given meter. <prefix>_Vavg, <prefix>_Iavg, <prefix>_MaxkW, <prefix>_kWh, <prefix>_kVAr, <prefix>_kW, <prefix>_RunHrs I wish to log this data onto a SQL database table named "METER_LOG", carrying out the logging actions for each meter in a record, that has these fields(Columns) |Meter_Id |----|Vavg|---|Iavg|----|MaxkW|----|kWh|----|kVAr|----|kW|----|RunHrs| My goal now to do this in a loop, so that all the logging actions are done with a few lines of code. There is a table-"METER_IDs" that gives the list of all Meter_IDs or <prefix> And the code I wish to implement is a cicode function that would look like this.- It is not correct, I've used genie substitution syntax and that won't work here. FUNCTION LogAllMeters() int hSQL; string %Cur_ID%;// --This is the string that will be substituted in the loop hSQL = SQLConnect("DSN=<DSN_name>; UID =xxxx; PWD=yyyy"); IF hSQL <> -1 THEN Status = SQLExec(hSQL, "SELECT Meter_ID FROM METER_IDs ORDER BY Meter_ID"); IF Status = 0 THEN WHILE SQLNext(hSQL) = 0 DO // --Scan till the end of the list for all meters %Cur_ID% = SQLGetField(hSQL, "Meter_Id"); INSERT Into METER_LOG VALUES ( %Cur_ID%, %Cur_ID%_Vavg, %Cur_ID%_Iavg, %Cur_ID%_MaxkW, %Cur_ID%_kWh, %Cur_ID%-kVAr, %Cur_ID%_kW, %Cur_ID%_RunHrs); END SQLEnd(hSQL); SQLDisconnect(hSQL); END ELSE SQLDisconnect(hSQL); Message("Error", SQLErrMsg(), 48);END//----outer IF End// of FunctionI would greatly appreciate it if someone could guide me with a way to substitute strings so that the structured tags are correctly referenced inside the loop. Thanks a million for looking in.