MrPLC Member
  • Content count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Nedward

  • Rank
    Hi, I am New!

Profile Information

  • Country Norway

Recent Profile Visitors

208 profile views
  1. NA5 Active Alarm Counter

    No. That sounds wierd. There may be that you use P_First_Run to do something on startup. What happens if the counter is UINT? You will never need have a negative number of alarms anyway. Do you use an NX/NJ plc also?
  2. NA5 Active Alarm Counter

    You can make an function block that handles alarms through a STRUCT. I use a STRUCT for each alarm that takes in analog or digital input, analog alarm limits for "low", "low low (critical low)", "high", "high high". There is a setting for delay. There is a counter for the number of alarm events for each alarm. I keep track of the state of the alarm too. There is "normal", "active and no ACK", "active and ACKed" and "back to normal, no ACK". I also put the name of the alarm in the STRUCT.    There will be a fair bit of programming the first time you make the FB, but the advantage is that you can manage a wast amount of alarms on a few lines of code if you create an array of alarm STRUCT and an array of FB_alarm.   FOR index := 0 TO 100 BY 1 DO FB_alarm[index](alarmSTRUCT[index], ack_all_input := ack_allButton, ENO => someBOOL); END_FOR You can do the same for the settings in your alarm STRUCT if you don't need special settings certain alarms. FOR index := 0 TO 100 BY 1 DO alarmSTRUCT[index].settings.delay := TIME#1s; END_FOR //Or like this if you need to change settings for a few alarms IF P_FIRST_RUN //Make initial settings the first scan after power up FOR index := 0 TO 100 BY 1 DO alarmSTRUCT[index].settings.delay := TIME#1s; END_FOR; ELSIF //Get delay setting from a constant alarmSTRUCT[3].settings.delay :=TIME#20s; //Get setting from var alarmSTRUCT[15].settings.delay :=timeVar; END_IF; The only thing that is left then is to map the alarm input to an analog or digital input on your PLC.
  3. You can possibly use the "Watch tab page" under view (ALT+4). 
  4. Sysmac Studio INT(Bits) to ARRAY of BOOL

    You can create a union of WORD and ARRAY[0..15] OF BOOL. Then you can do something like this: yourUnion.wordInUnion := INT_TO_WORD(yourINT); Then you are able to address the bits in the array. If you need to combine the 8 first elements of 8 arrays in one singe array with 96 elements you can do this with the AryMove instruction. I haven't given this much thought tough, there may be a more suitable approach.