Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: DSup/ASup object question

DSup/ASup object question 13 years 3 weeks ago #1729

  • Snarf77
  • Snarf77's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 847
  • Thank you received: 2
  • Karma: 5
Hi all,

Is there a way to add a dynamic text in the alarm text of a DSup / ASup object.

Indeed let's say I have an alarm indicating a problem between N components and I would like to see a text (for example only) : \"thermal alarm in component: N\" where N is a string contained in another object attribute ?
For information N could be 50 elements so that's why I don't want to create 50 individual alarms for each of them.

I'm not sure is my demand is clear, so don't hesitate to ask additionnal information.

Thanks in advance
The administrator has disabled public write access.

Re:DSup/ASup object question 13 years 3 weeks ago #1741

  • claes
  • claes's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 3170
  • Thank you received: 497
  • Karma: 133
Hi Snarf,

You can insert a string in DetectText before the DSup or ASup is triggered. You can do this with the string functions, or you can fetch a pointer to the Sup object with a GetData connected to a DataArithm and use some c-function, eg sprintf, to set the DetectText. The code in the DataArithm would be something like (the element number connected to I1).

[code:1]classdef Da1 ASup;

sprintf( Da1->DetectText, \"Thermal alarm in component: %d\", I1);[/code:1]
/Claes
The administrator has disabled public write access.

Re:DSup/ASup object question 12 years 11 months ago #2048

  • Snarf77
  • Snarf77's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 847
  • Thank you received: 2
  • Karma: 5
Hi Claes,

I try to concat string to display a dynamic event text within my component and I got a problem: Is it possible to get from the plc the string of an Enum object.

I tried with a GetSp linked to an Enum type of the main object but I got a compile error:
%GSX-E-REFPARTYPE, referenced parameter type is not correct

I tried to add ##Enum or #Enum to attribute of the GetSp but in this case I got a syntax error in the plc editor.


What is the correct syntax use ?

Thanks
The administrator has disabled public write access.

Re:DSup/ASup object question 12 years 11 months ago #2049

  • claes
  • claes's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 3170
  • Thank you received: 497
  • Karma: 133
There is no easy way to fetch the enum string. You can fetch the enum value with an GetIp and the easiest way to convert it to a string is maybe to do it 'by hand' with a switch statement in the DataArithm code.

/Claes
The administrator has disabled public write access.

Re:DSup/ASup object question 12 years 11 months ago #2050

  • Snarf77
  • Snarf77's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 847
  • Thank you received: 2
  • Karma: 5
:ohmy: ....

Let's put that on a wish list if you find this feature could be useful for all....

In my opinion using a manual switch will cause both the type and the dataaritmh to be kept in sync when update or version evolves... I think it will cause more problem than the original asset to have a much more dedicated alarm text...

Thanks for answering anyway

Snarf
The administrator has disabled public write access.
  • Page:
  • 1
Time to create page: 8.819 seconds