<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Create an alarm list without use of Alarm config</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/b75883c5e0/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/b75883c5e0/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/CODESYS-V2/thread/b75883c5e0/</id><updated>2024-06-06T19:20:51.920000Z</updated><subtitle>Recent posts to Create an alarm list without use of Alarm config</subtitle><entry><title>Create an alarm list without use of Alarm config</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/b75883c5e0/?limit=25#96d0" rel="alternate"/><published>2024-06-06T19:20:51.920000Z</published><updated>2024-06-06T19:20:51.920000Z</updated><author><name>talhaali</name><uri>https://forge.codesys.com/u/talhaali/</uri></author><id>https://forge.codesys.com2b6ad240bef142cf3c03239ab9229761357888e5</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi, I am trying to access active alarms in code(As alarm count variable updates only when we go to to alarm table frame in visualization). I wrote following code but it is not working:&lt;/p&gt;
&lt;p&gt;VAR &lt;br/&gt;
    iCountActiveAlarms : INT;&lt;br/&gt;
    parritfActiveAlarms : POINTER TO ARRAY&lt;span&gt;[0..0]&lt;/span&gt; OF IAlarm;&lt;br/&gt;
    itfAlarmManagerClientAll    : IAlarmManagerClient;&lt;br/&gt;
END_VAR&lt;/p&gt;
&lt;p&gt;AlarmManager.g_AlarmHandler.GetActiveAlarms(&lt;br/&gt;
    itfAlarmManagerClient   :=itfAlarmManagerClientAll,&lt;br/&gt;
    iCountActiveAlarms      =&amp;gt; iCountActiveAlarms,&lt;br/&gt;
    parritfActiveAlarms     =&amp;gt; parritfActiveAlarms);&lt;/p&gt;
&lt;p&gt;The Value is always 0.&lt;br/&gt;
Please help.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Create an alarm list without use of Alarm config</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/b75883c5e0/?limit=25#f7f7" rel="alternate"/><published>2024-06-06T19:20:50.156000Z</published><updated>2024-06-06T19:20:50.156000Z</updated><author><name>talhaali</name><uri>https://forge.codesys.com/u/talhaali/</uri></author><id>https://forge.codesys.comc1ec3667c9887f3a70ad8ee49a8beb0996c7061e</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi, I am trying to access active alarms in code(As alarm count variable updates only when we go to to alarm table frame in visualization). I wrote following code but it is not working:&lt;/p&gt;
&lt;p&gt;VAR &lt;br/&gt;
    iCountActiveAlarms : INT;&lt;br/&gt;
    parritfActiveAlarms : POINTER TO ARRAY&lt;span&gt;[0..0]&lt;/span&gt; OF IAlarm;&lt;br/&gt;
    itfAlarmManagerClientAll    : IAlarmManagerClient;&lt;br/&gt;
END_VAR&lt;/p&gt;
&lt;p&gt;AlarmManager.g_AlarmHandler.GetActiveAlarms(&lt;br/&gt;
    itfAlarmManagerClient   :=itfAlarmManagerClientAll,&lt;br/&gt;
    iCountActiveAlarms      =&amp;gt; iCountActiveAlarms,&lt;br/&gt;
    parritfActiveAlarms     =&amp;gt; parritfActiveAlarms);&lt;/p&gt;
&lt;p&gt;The Value is always 0.&lt;br/&gt;
Please help.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Create an alarm list without use of Alarm config</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/b75883c5e0/?limit=25#d7be" rel="alternate"/><published>2020-02-27T21:26:55.840000Z</published><updated>2020-02-27T21:26:55.840000Z</updated><author><name>shooter</name><uri>https://forge.codesys.com/u/shooter/</uri></author><id>https://forge.codesys.com9cdb7a2d059f22f2ea2ab7570f549a7d82e6e466</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;i never give up.&lt;/p&gt;
&lt;p&gt;IF should be&lt;/p&gt;
&lt;p&gt;IF activealarm&lt;span&gt;[1]&lt;/span&gt;=TRUE THEN&lt;br/&gt;
etc&lt;br/&gt;
at the end END_IF&lt;br/&gt;
this is because activealarm is not in the varlist but activealarmarray is.&lt;br/&gt;
it is a simple error everybody makes.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Create an alarm list without use of Alarm config</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/b75883c5e0/?limit=25#f92e" rel="alternate"/><published>2020-02-27T21:26:54.403000Z</published><updated>2020-02-27T21:26:54.403000Z</updated><author><name>techkarlsson</name><uri>https://forge.codesys.com/u/techkarlsson/</uri></author><id>https://forge.codesys.com3f9bfcc086b1c8afd6dc4556c603f3db2e1bbfe3</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Thanks for you effort but I give up now shooter.&lt;br/&gt;
I've tried to get that IF statement to work but just errors about that cannot convert array to bool or whatever. Then tried a FOR statement but my knowledge level is simply too low. I will do this in some other way. Guess I need to take some classes in ST before I try it again.&lt;/p&gt;
&lt;p&gt;Cheers.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Create an alarm list without use of Alarm config</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/b75883c5e0/?limit=25#4f05" rel="alternate"/><published>2020-02-27T21:26:50.297000Z</published><updated>2020-02-27T21:26:50.297000Z</updated><author><name>shooter</name><uri>https://forge.codesys.com/u/shooter/</uri></author><id>https://forge.codesys.com9825084cef1f6e789f72ba5800a0e75376510209</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;no this is nice start&lt;br/&gt;
now in the visualisation make a line with:&lt;br/&gt;
datealarm&lt;span&gt;[1]&lt;/span&gt; and textalarm&lt;span&gt;[1]&lt;/span&gt; followed by alarmline&lt;span&gt;[(textalarm[1]&lt;/span&gt;)&lt;br/&gt;
make this ten lines (1..10) for example&lt;br/&gt;
now play a little with numbers by changing the number in textalarm, you will get all the different messages.&lt;/p&gt;
&lt;p&gt;if an alarm is not active anymore change the bool to false. (this can be used to change visibility.&lt;br/&gt;
but better is to shift other lines one up.&lt;/p&gt;
&lt;p&gt;if your show_visu is on the screen you will see one alarm. good for beginning.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Create an alarm list without use of Alarm config</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/b75883c5e0/?limit=25#10d4" rel="alternate"/><published>2020-02-27T21:26:48.800000Z</published><updated>2020-02-27T21:26:48.800000Z</updated><author><name>techkarlsson</name><uri>https://forge.codesys.com/u/techkarlsson/</uri></author><id>https://forge.codesys.com6a3548aad966c8888152a90ed7be0d08da6820a0</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Ok, tried it but I can't get it to work. I don't think I've understood you fully. Maybe I should stick with CFC and ladder...&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nv"&gt;VAR_GLOBAL&lt;/span&gt;
   &lt;span class="nv"&gt;ALARMLINE&lt;/span&gt; : &lt;span class="nv"&gt;ARRAY&lt;/span&gt;[&lt;span class="mi"&gt;1&lt;/span&gt;..&lt;span class="mi"&gt;100&lt;/span&gt;] &lt;span class="nv"&gt;OF&lt;/span&gt; &lt;span class="nv"&gt;STRING&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
   &lt;span class="nv"&gt;SHOW_VISU&lt;/span&gt;: &lt;span class="nv"&gt;STRING&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;END_VAR&lt;/span&gt;
&lt;span class="nv"&gt;_____________________________________________________________________&lt;/span&gt;
&lt;span class="nv"&gt;FUNCTION_BLOCK&lt;/span&gt; &lt;span class="nv"&gt;TEST_OF_LIST_2&lt;/span&gt;
&lt;span class="nv"&gt;VAR&lt;/span&gt;
   &lt;span class="nv"&gt;ACTIVEALARM&lt;/span&gt; : &lt;span class="nv"&gt;ARRAY&lt;/span&gt;[&lt;span class="mi"&gt;0&lt;/span&gt;..&lt;span class="mi"&gt;10&lt;/span&gt;] &lt;span class="nv"&gt;OF&lt;/span&gt; &lt;span class="nv"&gt;BOOL&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
   &lt;span class="nv"&gt;DATEALARM&lt;/span&gt; : &lt;span class="nv"&gt;ARRAY&lt;/span&gt;[&lt;span class="mi"&gt;0&lt;/span&gt;..&lt;span class="mi"&gt;10&lt;/span&gt;] &lt;span class="nv"&gt;OF&lt;/span&gt; &lt;span class="nv"&gt;DATE&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
   &lt;span class="nv"&gt;TEXTALARM&lt;/span&gt; : &lt;span class="nv"&gt;ARRAY&lt;/span&gt;[&lt;span class="mi"&gt;0&lt;/span&gt;..&lt;span class="mi"&gt;10&lt;/span&gt;] &lt;span class="nv"&gt;OF&lt;/span&gt; &lt;span class="nv"&gt;INT&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;END_VAR&lt;/span&gt;
&lt;span class="nv"&gt;ALARMLINE&lt;/span&gt;[&lt;span class="mi"&gt;1&lt;/span&gt;]:&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;001 TEST1&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;ALARMLINE&lt;/span&gt;[&lt;span class="mi"&gt;2&lt;/span&gt;]:&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;002 TEST2&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;ALARMLINE&lt;/span&gt;[&lt;span class="mi"&gt;3&lt;/span&gt;]:&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;003 TEST3&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;ALARMLINE&lt;/span&gt;[&lt;span class="mi"&gt;4&lt;/span&gt;]:&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;004 TEST4&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;ALARMLINE&lt;/span&gt;[&lt;span class="mi"&gt;5&lt;/span&gt;]:&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;005 TEST5&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;ALARMLINE&lt;/span&gt;[&lt;span class="mi"&gt;6&lt;/span&gt;]:&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;006 TEST6&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;ALARMLINE&lt;/span&gt;[&lt;span class="mi"&gt;7&lt;/span&gt;]:&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;007 TEST7&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;ALARMLINE&lt;/span&gt;[&lt;span class="mi"&gt;8&lt;/span&gt;]:&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;008 TEST8&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;ALARMLINE&lt;/span&gt;[&lt;span class="mi"&gt;9&lt;/span&gt;]:&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;009 TEST9&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;ALARMLINE&lt;/span&gt;[&lt;span class="mi"&gt;10&lt;/span&gt;]:&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;010 TEST10&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;IF&lt;/span&gt; &lt;span class="nv"&gt;ACTIVEALARM&lt;/span&gt; &lt;span class="k"&gt;THEN&lt;/span&gt;
   &lt;span class="nv"&gt;SHOW_VISU&lt;/span&gt; :&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;ALARMLINE&lt;/span&gt;[&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;TEXTALARM&lt;/span&gt;[&lt;span class="nv"&gt;i&lt;/span&gt;]&lt;span class="ss"&gt;)&lt;/span&gt;]&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;END_IF&lt;/span&gt;
&lt;span class="nv"&gt;__________________________________________________________________________&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Finally I'm watching the SHOW_VISU variable in the VISU-table.&lt;/p&gt;
&lt;p&gt;Am I far off?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Create an alarm list without use of Alarm config</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/b75883c5e0/?limit=25#995b" rel="alternate"/><published>2020-02-27T21:26:44.732000Z</published><updated>2020-02-27T21:26:44.732000Z</updated><author><name>techkarlsson</name><uri>https://forge.codesys.com/u/techkarlsson/</uri></author><id>https://forge.codesys.com72ad5e72b2f93cd9c6f374e35eb01af2d7969da6</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Thanks for your reply shooter!&lt;/p&gt;
&lt;p&gt;I will try this out asap. &lt;/p&gt;
&lt;p&gt;Cheers.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Create an alarm list without use of Alarm config</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/b75883c5e0/?limit=25#70a9" rel="alternate"/><published>2020-02-27T21:26:43.262000Z</published><updated>2020-02-27T21:26:43.262000Z</updated><author><name>shooter</name><uri>https://forge.codesys.com/u/shooter/</uri></author><id>https://forge.codesys.com1562b8458be248cd376bef96a96ca1e35eabfe09</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;make alarmlinearray &lt;span&gt;[0..100]&lt;/span&gt;:string (30);&lt;/p&gt;
&lt;p&gt;fill it with texts in a function block&lt;br/&gt;
like &lt;br/&gt;
alarmline&lt;span&gt;[1]&lt;/span&gt;:='001 it is too cold outhere';&lt;br/&gt;
alarmline&lt;span&gt;[2]&lt;/span&gt;:='002 the winter is coming';&lt;br/&gt;
etc&lt;/p&gt;
&lt;p&gt;a activealarmarray&lt;span&gt;[0..10]&lt;/span&gt;:bool;&lt;br/&gt;
a dataealarmarray&lt;span&gt;[0..10]&lt;/span&gt;:date;&lt;br/&gt;
a textalarmarray&lt;span&gt;[0..10]&lt;/span&gt;:int;&lt;/p&gt;
&lt;p&gt;on screen&lt;br/&gt;
if activealarmarray= true;&lt;br/&gt;
show the date and the text by alarmline&lt;span&gt;[(textalarmarray[linenumber]&lt;/span&gt;)];&lt;br/&gt;
repeat this 10 times.&lt;/p&gt;
&lt;p&gt;there are complex ways to do this just start with this simple one so you get familiar with it.&lt;br/&gt;
oscat is using a lot of pointers etc  it is working but very difficult to understand&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Create an alarm list without use of Alarm config</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/b75883c5e0/?limit=25#6b12" rel="alternate"/><published>2020-02-27T21:26:39.200000Z</published><updated>2020-02-27T21:26:39.200000Z</updated><author><name>techkarlsson</name><uri>https://forge.codesys.com/u/techkarlsson/</uri></author><id>https://forge.codesys.com7d78f662ccd7ca0985bea5cf288cc9a4795e0406</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;First of all, thanks for you replies hki75!&lt;/p&gt;
&lt;p&gt;Unfortunately I think my level of programming is way lower than yours and I don't fully understand your code.&lt;br/&gt;
As I understand it your example is to create an .csv file with the one alarm per row?&lt;/p&gt;
&lt;p&gt;I was hoping there was a simple way in the visualization "table" function in which I could split my long string up to induvidual rows instead of one single row.&lt;/p&gt;
&lt;p&gt;Your example is still interesting in case I want to add a logging function in the future but at the moment that is more than my head can handle!&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Create an alarm list without use of Alarm config</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/b75883c5e0/?limit=25#74b3" rel="alternate"/><published>2020-02-27T21:26:37.742000Z</published><updated>2020-02-27T21:26:37.742000Z</updated><author><name>hki75</name><uri>https://forge.codesys.com/u/hki75/</uri></author><id>https://forge.codesys.comb0b18ca1e3d8123c5bbb6659ee7f688d90d2cd6f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;the best should be directly create string by string each one with its relevant LF+CR character.&lt;br/&gt;
like this&lt;/p&gt;
&lt;p&gt;AlarmString : string;&lt;br/&gt;
StringLen:INT;                                                                          (&lt;em&gt; string length &lt;/em&gt;) &lt;br/&gt;
StringPointer: POINTER TO ARRAY&lt;span&gt;[0...max String Length ]&lt;/span&gt; of byte;    (&lt;em&gt; need to define the max length of your alarm string&lt;/em&gt;) &lt;br/&gt;
OpenFile: DWORD;&lt;br/&gt;
WriteFile: DWORD;&lt;br/&gt;
CloseFile:DWORD;&lt;br/&gt;
FileName:STRING:='Alarms.csv';  (&lt;em&gt; file name..ex Alarms.csv &lt;/em&gt;)&lt;/p&gt;
&lt;p&gt;(&lt;em&gt; then with your application you wrote into the "AlarmString "  and..&lt;/em&gt;)&lt;br/&gt;
StringLen:=LEN(AlarmString );&lt;br/&gt;
StringPointer:=ADR(AlarmString);&lt;br/&gt;
StringPointer^&lt;span&gt;[StringLen+1]&lt;/span&gt;:=10;  (&lt;em&gt; LF &lt;/em&gt;)&lt;br/&gt;
StringPointer^&lt;span&gt;[StringLen+2]&lt;/span&gt;:=13;  (&lt;em&gt; CR &lt;/em&gt;)&lt;/p&gt;
&lt;p&gt;(&lt;em&gt; and then append every new alarms string in your alarm File... ex Alarms.csv, return to next row for future alarms &lt;/em&gt;)&lt;/p&gt;
&lt;p&gt;OpenFile:=SysFileOpen(FileName, a);   (&lt;em&gt; open Alarms.csv and append &lt;/em&gt;)&lt;br/&gt;
WriteFile:=SysFileWrite(FileName, ADR(AlarmString ), StringLen+2);&lt;br/&gt;
CloseFile:=SysFileClose(FileName);&lt;/p&gt;
&lt;p&gt;I used something like this in a log-report application..&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>