BH2114

Members
  • Content Count

    19
  • Joined

  • Last visited

Community Reputation

0 Neutral

About BH2114

  • Rank
    Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Here is a demo file of the AscA function text conversion_1.ctl
  2. I have a sequence as below which works: while(1) private st = systime() while(systime() - st < logInterval*60) delay(.2) if (logFlag==0) break endif endwhile if (logFlag==0) break delay(.1) endif FileHandle = File.Open(NewFileName,0,1,1,1) private string out= ChannelData File.Write(FileHandle,out) File.Close(FileHandle) wait(.1) endwhile This sequence writes (channelData) to a file every (loggingInterval*60). When (logFlag =0), the while loop breaks and the sequence continues to other tasks. I have one additional variable (step) that starts at 0 and increments by (1) to the value (8). when logFlag =0, step is reset to =0 I would like to write (channelData) once each time (step) increments, in addition to the normal file writes that take place as a result of (logInterval*60). Just cant figure out how to nest the if statement (if thats what should be used) and updating step in the same manner that (st) is being updated also does not seem to work. Note: this appends to a file that was previously created.
  3. actually, upon more consideration, I think that this makes more sense: while(1) private st = systime() while(systime() - st < logInterval*60) delay(.2) if (logflag==0) break endif endwhile if (logflag==0) break endif private string k =format("%4.2f",TorqueOutput[0]) private string l =SpeedOutput[0] private string m =format("%3.1f",Temp1[0]) private string n =format("%3.1f",Temp2[0]) private string o =format("%3.1f",Temp3[0]) private string p =format("%3.1f",Temp4[0]) private string q =format("%3.1f",Temp5[0]) private string r =format("%3.1f",Temp6[0]) private string s =format("%3.1f",Temp7[0]) private string t =format("%3.1f",Temp8[0]) private string u =format("%3.1f",Temp9[0]) private string v =format("%3.1f",Temp21[0]) private string w =format("%4.2f",Horsepower[0]) private string x =formatdatetime("%m/%d/%Y %H:%M:%S",systime()) private string crlf = chr(13) + chr(10) private string a = '<td class="tg-yw4l">' private string deg = chr(176)+' C</td>' FileHandle = File.Open(NewFileName,0,1,1,1) private string out= '<tr>' out += crlf + a + x + '</td>' out += crlf + a + k + ' Ft. Lbs</td>' out += crlf + a + l + ' RPM</td>' out += crlf + a + m + deg out += crlf + a + o + deg out += crlf + a + p + deg out += crlf + a + q + deg out += crlf + a + r + deg out += crlf + a + s + deg out += crlf + a + t + deg out += crlf + a + u + deg out += crlf + a + v + deg out += crlf + a + w + deg out += crlf + a + w + ' HP</td>' out += crlf + '</tr>' File.Write(FileHandle,out) File.Close(FileHandle) wait(.2) endwhile FileHandle = File.Open(NewFileName,0,1,1,1) private string out= '</table>' out += crlf + '</html>
  4. In the following code, I have a long list of string items that get written to a file. I suspect that using an array would be a more efficient way of doing this. that being the case, could you provide an example of how this is done? while(1) private st = systime() while(systime() - st < logInterval*60) delay(.2) if (logflag==0) break endif endwhile if (logflag==0) break endif private string k =format("%4.2f",TorqueOutput[0]) private string l =SpeedOutput[0] private string m =format("%3.1f",Temp1[0]) private string n =format("%3.1f",Temp2[0]) private string o =format("%3.1f",Temp3[0]) private string p =format("%3.1f",Temp4[0]) private string q =format("%3.1f",Temp5[0]) private string r =format("%3.1f",Temp6[0]) private string s =format("%3.1f",Temp7[0]) private string t =format("%3.1f",Temp8[0]) private string u =format("%3.1f",Temp9[0]) private string v =format("%3.1f",Temp21[0]) private string w =format("%4.2f",Horsepower[0]) private string x =formatdatetime("%m/%d/%Y %H:%M:%S",systime()) private string crlf = chr(13) + chr(10) private string a = '<td class="tg-yw4l">' private string deg = chr(176)+' C</td>' FileHandle = File.Open(NewFileName,0,1,1,1) private string out= '<tr>' out += crlf out += a out += x out += '</td>' out += crlf out += a out += k out += ' Ft. Lbs</td>' out += crlf out += a out += l out += ' RPM</td>' out += crlf out += a out += m out += deg out += crlf out += a out += n out += deg out += crlf out += a out += o out += deg out += crlf out += a out += p out += deg out += crlf out += a out += q out += deg out += crlf out += a out += r out += deg out += crlf out += a out += s out += deg out += crlf out += a out += t out += deg out += crlf out += a out += u out += deg out += crlf out += a out += v out += deg out += crlf out += a out += w out += ' HP</td>' out += crlf out += '</tr>' out += crlf File.Write(FileHandle,out) File.Close(FileHandle) wait(.2) endwhile FileHandle = File.Open(NewFileName,0,1,1,1) private string out= '</table>' out += crlf out += '</html>
  5. BH2114

    Alarm Reset slow

    I think I saw something on this somewhere in the forum, but I cannot find it now, I have 45 alarms, and I have a test sequence that when run will fire them all. They all ack properly using the Alarm.AckAllAlarms() function. The reset is a different story. I am using alarmreset=0 as the reset event for all the alarms. This is brought to 1 by a reset button. In some cases that button must be held down for 20 seconds to reset a particular alarm. the button uses a quick sequence as follows: alarmreset=1 (on mouse down checked) alarmreset=0 (on mouse down not checked) Is there anything that can be done about this?
  6. BH2114

    IncludeAllTime

    Here is the code that starts the logging file. It almost works, everything writes fine, except the section that creates SecondHeaderOutputString presently produces a header line that starts with the time and is enclosed in quotes. I need to figure out a way to log that line without the leading time column and get rid of the quotes on the beginning and end of the one logged line, private string x = (stripStringA(CustomerName)) private string Path="C:\Test Data\IGB\" private string FileExt=".csv delay(.1) Customer_Name=CustomerName //Makes the file name try logging.IGB_Log.strFileName = path+ x +"_"+(format("%.0f" ,customer_name.Time[0]))+fileext catch() System.ErrorMessage(strLastError) endcatch delay(.1) //clears, then loads channels to log logging.IGB_Log.ClearChannelList() Logging.IGB_Log.AddChannel("Customer_Name",12) Logging.IGB_Log.AddChannel("Job_Number",12) Logging.IGB_Log.AddChannel("Test_Reason",12) Logging.IGB_Log.AddChannel("Operator",12) Logging.IGB_Log.AddChannel("Type_Oil",12) Logging.IGB_Log.AddChannel("ATP",12) Logging.IGB_Log.AddChannel("Dummy_Inter_SN",12) Logging.IGB_Log.AddChannel("Dummy_Tail_SN",12) Logging.IGB_Log.AddChannel("Test_Tail_SN",12) Logging.IGB_Log.AddChannel("Test_Inter_SN",12) delay(.1) //sets the logging interval logging.IGB_Log.refreshRate = 3 Logging.IGB_Log.Start() delay(.1) //loads data into the channels Customer_Name=CustomerName Job_Number=JobNumber Test_Reason=TestReason Operator=Operator1 ATP=ATP1 type_Oil=TypeOil Dummy_Tail_SN=DummyTailSN Dummy_Inter_SN=DummyInterSN Test_Inter_SN=TestInterSN Test_Tail_SN=TestTailSN //starts logging Logging.IGB_Log.Start() delay(4) //stops logging Endlogging(igb_log) logging.IGB_Log.ClearChannelList() // Start section that needs to be fixed writes new header information..this is the section that I want to write without time or quotes delay(.1) Logging.IGB_Log.AddChannel("secondHeaderOutputString",2) //The next line does not work //logging.Igb_log.IncludeAllTime=0 delay(.1) header2="Time,Torque,Speed,TGB Input Inner Brg,TGB Oil Sump,TGB Output Inner Brg,TGB Output Mid Brg,IGB Input Outer Brg,IGB Output Outer Brg,Phila Input Brg,Phila Output Brg,Phila Rear Brg,Facility Air Temp,Horsepower" Logging.IGB_Log.Start() SecondHeaderOutputString=header2 delay(4) Endlogging(igb_log) //ends logging the header after one line //end section that needs to be fixed delay(.1) //clears and sets new logging channels logging.IGB_Log.ClearChannelList() Logging.IGB_Log.AddChannel("torqueOutput",2) Logging.IGB_Log.AddChannel("SpeedOutput",2) Logging.IGB_Log.AddChannel("temp1",2) Logging.IGB_Log.AddChannel("temp2",2) Logging.IGB_Log.AddChannel("temp3",2) Logging.IGB_Log.AddChannel("temp4",2) Logging.IGB_Log.AddChannel("temp6",2) Logging.IGB_Log.AddChannel("temp7",2) Logging.IGB_Log.AddChannel("temp8",2) Logging.IGB_Log.AddChannel("temp9",2) Logging.IGB_Log.AddChannel("temp10",2) Logging.IGB_Log.AddChannel("temp21",2) Logging.IGB_Log.AddChannel("Horsepower",2) //Changes the logging interval logging.IGB_Log.refreshRate = 300 //The next line does not work //logging.Igb_log.IncludeAllTime=1 Delay(.1) //starts logging Logging.IGB_Log.Start() Delay(.1) //Adds Values to the channels for test purposes TorqueOutput.addvalue(1) SpeedOutput.addvalue(1) Temp1.addvalue(60) Temp2.addvalue(60) Temp3.addvalue(60) Temp4.addvalue(60) Temp5.addvalue(60) Temp6.addvalue(60) Temp7.addvalue(60) Temp8.addvalue(60) Temp9.addvalue(60) Temp10.addvalue(60) Temp21.addvalue(60)
  7. BH2114

    IncludeAllTime

    Will the logging.mylogset. IncludeAllTime varible turn off the "theTime" column in the logging set? I have tried it and cant get it to work that way. I want to be able to turn the time column off programatically before starting the logging set, Can you give an example of the correct syntax for this? I also want to change the logging fixed interval as well if you could give an example of how that is done.
  8. I have an oil pump that takes 3 seconds to develop pressure. I need to mask the oil pressure = 0 for 5 seconds after the oil pump is powered on, then evaluate. I have this in a function, which works, except that the 5 second delay hangs the display. return=0 alarm normal return=1 Fires Alarm private a = main_lubepumpmon[0] // 1 indicates that the pump is powered on. private b = main_Oil_press[0] // 1 indicates that oil pressure is up. if(b==1) private c = 2 else private c = 0 endif private d = c+a delay(5) switch case (d==1) return 1 endcase switch case (d==3) return 0 endcase switch case (d==2) return 0 endcase switch case (d==0) return 0 endcase Obviously, I'm doing something wrong here.
  9. Is there any viable way for a screen using JQ widgets to seamlessly communicate with DF? Sort of like replacing the DF ui with a JS UI using JQ widget like components, and using the DF for back end processing.
  10. Also, because I am using getFocus & setFocus, entering data is much faster than a whole bunch of system popup boxes OnKeyDown Sequence: if (key==13) switch case (component.Name_EditBox.GetFocus()) component.SpeedSP1_EditBox.SetFocus() case (component.SpeedSP1_EditBox.GetFocus()) component.TorqueSP1_EditBox.SetFocus() case (component.TorqueSP1_EditBox.GetFocus()) component.TimeSP1_EditBox.SetFocus() case (component.TimeSP1_EditBox.GetFocus()) component.SpeedSP2_EditBox.SetFocus() case (component.SpeedSP2_EditBox.GetFocus()) component.TorqueSP2_EditBox.SetFocus() case (component.TorqueSP2_EditBox.GetFocus()) component.TimeSP2_EditBox.SetFocus() case (component.TimeSP2_EditBox.GetFocus()) component.SpeedSP3_EditBox.SetFocus() case (component.SpeedSP3_EditBox.GetFocus()) component.TorqueSP3_EditBox.SetFocus() case (component.TorqueSP3_EditBox.GetFocus()) component.TimeSP3_EditBox.SetFocus() case (component.TimeSP3_EditBox.GetFocus()) component.SpeedSP4_EditBox.SetFocus() case (component.SpeedSP4_EditBox.GetFocus()) component.TorqueSP4_EditBox.SetFocus() case (component.TorqueSP4_EditBox.GetFocus()) component.TimeSP4_EditBox.SetFocus() case (component.TimeSP4_EditBox.GetFocus()) component.SpeedSP5_EditBox.SetFocus() case (component.SpeedSP5_EditBox.GetFocus()) component.TorqueSP5_EditBox.SetFocus() case (component.TorqueSP5_EditBox.GetFocus()) component.TimeSP5_EditBox.SetFocus() case (component.TimeSP5_EditBox.GetFocus()) component.SpeedSP6_EditBox.SetFocus() case (component.SpeedSP6_EditBox.GetFocus()) component.TorqueSP6_EditBox.SetFocus() case (component.TorqueSP6_EditBox.GetFocus()) component.TimeSP6_EditBox.SetFocus() case (component.TimeSP6_EditBox.GetFocus()) component.SpeedSP7_EditBox.SetFocus() case (component.SpeedSP7_EditBox.GetFocus()) component.TorqueSP7_EditBox.SetFocus() case (component.TorqueSP7_EditBox.GetFocus()) component.TimeSP7_EditBox.SetFocus() case (component.TimeSP7_EditBox.GetFocus()) component.SpeedSP8_EditBox.SetFocus() case (component.SpeedSP8_EditBox.GetFocus()) component.TorqueSP8_EditBox.SetFocus() case (component.TorqueSP8_EditBox.GetFocus()) component.TimeSP8_EditBox.SetFocus() case (component.TimeSP8_EditBox.GetFocus()) component.Name_EditBox.SetFocus() case (component.Cust_Name.GetFocus()) component.Job_No.SetFocus() case (component.Job_No.GetFocus()) component.Cust_Name.SetFocus() case (component.Cust_Name1.GetFocus()) component.Job_No1.SetFocus() case (component.Job_No1.GetFocus()) component.Cust_Name1.SetFocus() endcase endif
  11. On a related subject regarding edit text boxes, is it possible to set its properties so that when the edit box is clicked, the existing data in the box is highlighted so that when new input is added it will overwrite the existing data in box? i.e., the box has data "Enter Name". When user Mouse clicks on data box, jt highlights that text so that when name is entered, that old data is erased.
  12. Thank you, that works perfectly. As to your blog post on input boxes, I agree with the principles of that post. However, in this case, these input boxes are not on the main page but serve as inputs to a recipe. The recipe is 8 stages of speed, torque and time for testing gearboxes. This recipe is then loaded into an array and becomes the test profile. The addrecipe Sequence is now:: private string newrecipe newrecipe[0][fName] = NewRecipeName switch case (NewSpeedSP>0) newrecipe[0][fSpeedSP] = StripString(NewSpeedSP) default newrecipe[0][fSpeedSP] =0 endcase switch case (NewTorqueSP>0) newrecipe[0][fTorqueSP] = StripString(NewTorqueSP) default newrecipe[0][fTorqueSP] =0 endcase switch case (NewTimeSP>0) newrecipe[0][fTimeSP] = StripString(NewTimeSP) default newrecipe[0][fTimeSP] =0 endcase switch case (NewSpeedSP1>0) newrecipe[0][fSpeedSP1] = StripString(NewSpeedSP1) default newrecipe[0][fSpeedSP1] =0 endcase switch case (NewTorqueSP1>0) newrecipe[0][fTorqueSP1] = StripString(NewTorqueSP1) default newrecipe[0][fTorqueSP1] =0 endcase switch case (NewTimeSP1>0) newrecipe[0][fTimeSP1] = StripString(NewTimeSP1) default newrecipe[0][fTimeSP1] =0 endcase switch case (NewSpeedSP2>0) newrecipe[0][fSpeedSP2] = StripString(NewSpeedSP2) default newrecipe[0][fSpeedSP2] =0 endcase switch case (NewTorqueSP2>0) newrecipe[0][fTorqueSP2] = StripString(NewTorqueSP2) default newrecipe[0][fTorqueSP2] =0 endcase switch case (NewTimeSP2>0) newrecipe[0][fTimeSP2] = StripString(NewTimeSP2) default newrecipe[0][fTimeSP2] =0 endcase switch case (NewSpeedSP3>0) newrecipe[0][fSpeedSP3] = StripString(NewSpeedSP3) default newrecipe[0][fSpeedSP3] =0 endcase switch case (NewTorqueSP3>0) newrecipe[0][fTorqueSP3] = StripString(NewTorqueSP3) default newrecipe[0][fTorqueSP3] =0 endcase switch case (NewTimeSP3>0) newrecipe[0][fTimeSP3] = StripString(NewTimeSP3) default newrecipe[0][fTimeSP3] =0 endcase switch case (NewSpeedSP4>0) newrecipe[0][fSpeedSP4] = StripString(NewSpeedSP4) default newrecipe[0][fSpeedSP4] =0 endcase switch case (NewTorqueSP4>0) newrecipe[0][fTorqueSP4] = StripString(NewTorqueSP4) default newrecipe[0][fTorqueSP4] =0 endcase switch case (NewTimeSP4>0) newrecipe[0][fTimeSP4] = StripString(NewTimeSP4) default newrecipe[0][fTimeSP4] =0 endcase switch case (NewSpeedSP5>0) newrecipe[0][fSpeedSP5] = StripString(NewSpeedSP5) default newrecipe[0][fSpeedSP5] =0 endcase switch case (NewTorqueSP5>0) newrecipe[0][fTorqueSP5] = StripString(NewTorqueSP5) default newrecipe[0][fTorqueSP5] =0 endcase switch case (NewTimeSP5>0) newrecipe[0][fTimeSP5] = StripString(NewTimeSP5) default newrecipe[0][fTimeSP5] =0 endcase switch case (NewSpeedSP6>0) newrecipe[0][fSpeedSP6] = StripString(NewSpeedSP6) default newrecipe[0][fSpeedSP6] =0 endcase switch case (NewTorqueSP6>0) newrecipe[0][fTorqueSP6] = StripString(NewTorqueSP6) default newrecipe[0][fTorqueSP6] =0 endcase switch case (NewTimeSP6>0) newrecipe[0][fTimeSP6] = StripString(NewTimeSP6) default newrecipe[0][fTimeSP6] =0 endcase switch case (NewSpeedSP7>0) newrecipe[0][fSpeedSP7] = StripString(NewSpeedSP7) default newrecipe[0][fSpeedSP7] =0 endcase switch case (NewTorqueSP7>0) newrecipe[0][fTorqueSP7] = StripString(NewTorqueSP7) default newrecipe[0][fTorqueSP7] =0 endcase switch case (NewTimeSP7>0) newrecipe[0][fTimeSP7] = StripString(NewTimeSP7) default newrecipe[0][fTimeSP7] =0 endcase recipes.Append(newrecipe) ResetDisplay() And in this instance, I only wanted numeric data input to the array, so the StripString Function is thus: function stripString(string originalstring) private x = asca(originalstring) return (chra(filter(x, (x >= asc("0") && x <= asc("9"))))) Thanks for the assist.
  13. Thank you. That does work,, as in the attached test file.However,. note that the test file has two different input boxes and has an output box that is associated with each input box. Can you please explain how to direct the function output to the appropriate box that is associated with each input? Thanks text conversion_2.ctl
  14. On the same subject, I have the following code,that filters out everything except numeric input. This method works, except that there are seven more sets of 3 just like this, and writing a separate filter for each one seems like overkill. Can this be done with a single filter using variables? If so, please provide an example. Thanks. Private a =AscA(newSpeedSP) Private b =AscA(newTorqueSP) Private c =AscA(newTimeSP) private string nSF private string nTrqF private string nTmeF private string newrecipe private string nSF = chra(filter(a, (a >= asc("0") && a <= asc("9")))) private string nTrqF = chra(filter(b, (b >= asc("0") && b <= asc("9")))) private string nTmeF = chra(filter(c, (c >= asc("0") && c <= asc("9")))) newrecipe[0][fName] = NewRecipeName switch case (NewSpeedSP>0) newrecipe[0][fSpeedSP] = nSF default newrecipe[0][fSpeedSP] =0 endcase switch case (NewTorqueSP>0) newrecipe[0][fTorqueSP] = nTrqF default newrecipe[0][fTorqueSP] =0 endcase switch case (NewTimeSP>0) newrecipe[0][fTimeSP] = nTmeF default newrecipe[0][fTimeSP] =0 endcase
  15. Here is a demo file for this method.text conversion_1.ctl