hi!!!
I have created a script and then added a control manager in the console window. How can I tell my manager to execute the script each 2 or 3 seconds for example? The manager executes the script at restart but I want it to launch it periodically! Is there a line of code to add in the script or something to change in the manger properties ?
control manager
- mkoller
- Posts:741
- Joined: Fri Sep 17, 2010 9:03 am
Re: control manager
Why not keep the manager running and do something like this in the script:
Code: Select all
while ( 1 )
{
doMyWork();
delay(3);
}
- JOSEPHINE
- Posts:12
- Joined: Tue Nov 24, 2015 5:06 pm
Re: control manager
Hello,
i'm here again with another problem for my control manager. Everytime when i start my project my control manager is work perfectly, and after a few seconds later it's stop, and i have to restart again. i want to know where is the problem.
thank you for ur help.
i'm here again with another problem for my control manager. Everytime when i start my project my control manager is work perfectly, and after a few seconds later it's stop, and i have to restart again. i want to know where is the problem.
thank you for ur help.
- mkoller
- Posts:741
- Joined: Fri Sep 17, 2010 9:03 am
Re: control manager
Too less information.
Does it stop normally ? Does it crash ? What's in the logfile when it stops ?
Can you post your script ?
Does it stop normally ? Does it crash ? What's in the logfile when it stops ?
Can you post your script ?
- JOSEPHINE
- Posts:12
- Joined: Tue Nov 24, 2015 5:06 pm
Re: control manager
**** here the logviewer message
*** i guess that it's normally
WCCOActrl (2), 2015.12.04 18:08:50.326, SYS, INFO, 181, Closing connection to (SYS: 1 Data -num 0 CONN: 1)
WCCOActrl (2), 2015.12.04 18:08:50.336, SYS, INFO, 181, Closing connection to (SYS: 1 Event -num 0 CONN: 1)
WCCILdata (0), 2015.12.04 18:08:50.336, SYS, INFO, 39, Connection lost, MAN: (SYS: 1 Ctrl -num 2 CONN: 1), Connection closed
WCCILevent (0), 2015.12.04 18:08:50.345, SYS, INFO, 39, Connection lost, MAN: (SYS: 1 Ctrl -num 2 CONN: 1), Connection closed
WCCOActrl (2), 2015.12.04 18:08:50.353, SYS, INFO, 39, Connection lost, MAN: (SYS: 1 Event -num 0 CONN: 1), Connection closed
WCCOActrl (2), 2015.12.04 18:08:50.368, SYS, INFO, 2, Manager Stop
WCCILpmon (1), 2015.12.04 18:08:50.385, SYS, INFO, 12/pmon, Manager WCCOActrl(2) restarting too rapidly - giving up restarting
**** and now my script
main()
{
while(1)
{
dyn_dyn_anytype tab1;
dyn_dyn_anytype tab2;
dyn_dyn_anytype tab3;
/// Ccompteur des alarmes présentes qui correspond "came unacknowledged"
dpQuery("SELECT ALERT 'COUNT(_alert_hdl.._value)' FROM '*.*.*.*' WHERE '_alert_hdl.._act_state' = 1", tab1);
dpSet("System1:Compteurs.PRESENT", tab1[2][3]);
/// Ccompteur des alarmes présentes qui correspond "came acknowledged"
dpQuery("SELECT ALERT 'COUNT(_alert_hdl.._value)' FROM '*.*.*.*' WHERE '_alert_hdl.._act_state' = 2", tab2);
dpSet("System1:Compteurs.ACKNOWLEDGE", tab2[2][3]);
///Ccompteur des alarmes présentes qui correspond "went unacknowledged"
dpQuery("SELECT ALERT 'COUNT(_alert_hdl.._value)' FROM '*.*.*.*' WHERE '_alert_hdl.._value' = 1 AND '_alert_hdl.._act_state' = 3", tab3);
dpSet("System1:Compteurs.UNACKNOWLEDGE", tab3[2][3]);
}
}
thank u
*** i guess that it's normally
WCCOActrl (2), 2015.12.04 18:08:50.326, SYS, INFO, 181, Closing connection to (SYS: 1 Data -num 0 CONN: 1)
WCCOActrl (2), 2015.12.04 18:08:50.336, SYS, INFO, 181, Closing connection to (SYS: 1 Event -num 0 CONN: 1)
WCCILdata (0), 2015.12.04 18:08:50.336, SYS, INFO, 39, Connection lost, MAN: (SYS: 1 Ctrl -num 2 CONN: 1), Connection closed
WCCILevent (0), 2015.12.04 18:08:50.345, SYS, INFO, 39, Connection lost, MAN: (SYS: 1 Ctrl -num 2 CONN: 1), Connection closed
WCCOActrl (2), 2015.12.04 18:08:50.353, SYS, INFO, 39, Connection lost, MAN: (SYS: 1 Event -num 0 CONN: 1), Connection closed
WCCOActrl (2), 2015.12.04 18:08:50.368, SYS, INFO, 2, Manager Stop
WCCILpmon (1), 2015.12.04 18:08:50.385, SYS, INFO, 12/pmon, Manager WCCOActrl(2) restarting too rapidly - giving up restarting
**** and now my script
main()
{
while(1)
{
dyn_dyn_anytype tab1;
dyn_dyn_anytype tab2;
dyn_dyn_anytype tab3;
/// Ccompteur des alarmes présentes qui correspond "came unacknowledged"
dpQuery("SELECT ALERT 'COUNT(_alert_hdl.._value)' FROM '*.*.*.*' WHERE '_alert_hdl.._act_state' = 1", tab1);
dpSet("System1:Compteurs.PRESENT", tab1[2][3]);
/// Ccompteur des alarmes présentes qui correspond "came acknowledged"
dpQuery("SELECT ALERT 'COUNT(_alert_hdl.._value)' FROM '*.*.*.*' WHERE '_alert_hdl.._act_state' = 2", tab2);
dpSet("System1:Compteurs.ACKNOWLEDGE", tab2[2][3]);
///Ccompteur des alarmes présentes qui correspond "went unacknowledged"
dpQuery("SELECT ALERT 'COUNT(_alert_hdl.._value)' FROM '*.*.*.*' WHERE '_alert_hdl.._value' = 1 AND '_alert_hdl.._act_state' = 3", tab3);
dpSet("System1:Compteurs.UNACKNOWLEDGE", tab3[2][3]);
}
}
thank u
- mkoller
- Posts:741
- Joined: Fri Sep 17, 2010 9:03 am
Re: control manager
Your code loads the system as fast as possible, which I assume is not really what you intended to do.
I think you asked before how to do an action every 2-3 seconds, so what I miss is the delay(3);
And this is probably the problem - you probably overload the system by sending too many messages and then the event manager will shut down the communication with your ctrl manager.
But if that is the case, you should get messages in the log file.
Please check what comes BEFORE the "Closing connection" messages
I think you asked before how to do an action every 2-3 seconds, so what I miss is the delay(3);
And this is probably the problem - you probably overload the system by sending too many messages and then the event manager will shut down the communication with your ctrl manager.
But if that is the case, you should get messages in the log file.
Please check what comes BEFORE the "Closing connection" messages
- JOSEPHINE
- Posts:12
- Joined: Tue Nov 24, 2015 5:06 pm
Re: control manager
hi !
SEVERE, 54, Unexpected state, ModMasterConnection, sendRequest, Timeout expires for connection to server 192.15.15.15 on port 502
this the message who come before the "closing connection" messages.
Even if i put "delay(3) on my script, it doesn't change nothing.
SEVERE, 54, Unexpected state, ModMasterConnection, sendRequest, Timeout expires for connection to server 192.15.15.15 on port 502
this the message who come before the "closing connection" messages.
Even if i put "delay(3) on my script, it doesn't change nothing.
- najoua
- Posts:26
- Joined: Fri Nov 27, 2015 10:21 am
Re: control manager
Hello,
I have the same problem! I have tried the script above and I made it in a try catch block. In fact, errors are caught at the 3rd select query. How can we increase the timeout of a connection? Is one connection sufficient for the three SQL queries or one connection is needed per query?
As far as the error caught is concerned, I think it's about a null exception when the query returns nothing!
Thanks,
I have the same problem! I have tried the script above and I made it in a try catch block. In fact, errors are caught at the 3rd select query. How can we increase the timeout of a connection? Is one connection sufficient for the three SQL queries or one connection is needed per query?
As far as the error caught is concerned, I think it's about a null exception when the query returns nothing!
Thanks,
- mkoller
- Posts:741
- Joined: Fri Sep 17, 2010 9:03 am
Re: control manager
I think things are getting mixed up here. The mentioned error message has nothing to do with the query.
Sadly we do not see from which manager it was thrown but I'm pretty sure it's not from the CTRL Manager, which has nothing to do with Modbus.
What error did you get in the catch block ?
Note: if an exception is thrown in CTRL and it is not handled, then the thread will be stopped. If that was the only thread in the manager, and there is
nothing more to do (e.g. no dpConnect()) then the manager stops - which seems to be the situation for Josephine
Sadly we do not see from which manager it was thrown but I'm pretty sure it's not from the CTRL Manager, which has nothing to do with Modbus.
What error did you get in the catch block ?
Note: if an exception is thrown in CTRL and it is not handled, then the thread will be stopped. If that was the only thread in the manager, and there is
nothing more to do (e.g. no dpConnect()) then the manager stops - which seems to be the situation for Josephine