0

I am building an energy management system in python. To model the physical system I am using the PandaPower library, which has the option to perform optimization using the Julia package PowerModels.jl. The program works as expected when executing it from the CMD, but I want to run it as a service so the OS makes sure it will be running all the time.

To run my program as a windows service I am trying using NSSM. The service starts and it shows as running, but for some reason it seems like it is unable to call the Julia code.

I have tried to find a clue by checking the loggs retrieved from the programm running on both the CMD and NSSM. The loggs generated from the programm running on the CMD look like this:

2023-06-27 09:42:47,646:pandapower.opf.run_pandamodels:DEBUG:the json file for converted net is stored in: C:\Users\ADMINI~1\AppData\Local\Temp\2\pp_to_pm_v4qs_18d.json 2023-06-27 09:42:47,646:julia:DEBUG: 2023-06-27 09:42:47,646:julia:DEBUG:exception occured? None 2023-06-27 09:42:47,646:julia:DEBUG:exception occured? None 2023-06-27 09:42:47,658:julia:DEBUG:exception occured? None 2023-06-27 09:42:47,658:julia:DEBUG:exception occured? None 2023-06-27 09:42:47,658:julia:DEBUG:exception occured? None 2023-06-27 09:42:47,658:julia:DEBUG:exception occured? None 2023-06-27 09:42:47,658:julia:DEBUG:exception occured? None 2023-06-27 09:42:47,658:julia:DEBUG:exception occured? None 2023-06-27 09:42:47,658:julia:DEBUG:exception occured? None 2023-06-27 09:42:47,658:julia:DEBUG:exception occured? None 2023-06-27 09:42:47,658:julia:DEBUG:exception occured? None 2023-06-27 09:42:47,658:julia:DEBUG:exception occured? None 2023-06-27 09:42:47,658:julia:DEBUG:exception occured? None 2023-06-27 09:42:47,690:julia:DEBUG:exception occured? None 2023-06-27 09:42:47,955:julia:DEBUG:exception occured? None 2023-06-27 09:42:47,955:pandapower.opf.run_pandamodels:INFO:Optimization ('run_powermodels_opf') is finished in 0.16 seconds: 2023-06-27 09:42:47,971:pandapower.opf.run_pandamodels:DEBUG:the json file for converted net is deleted from C:\Users\ADMINI~1\AppData\Local\Temp\2\pp_to_pm_v4qs_18d.json 2023-06-27 09:42:48,003:opcua.client.ua_client.Socket:INFO:opening connection

While the logs generated from the programm running from NSSM look like this:

2023-06-27 10:08:21,804:pandapower.opf.run_pandamodels:DEBUG:the json file for converted net is stored in: C:\Windows\TEMP\pp_to_pm_0ua7pq3q.json 2023-06-27 10:08:21,804:julia:DEBUG: 2023-06-27 10:08:21,820:opcua.client.ua_client.Socket:INFO:opening connection

So it looks like the problem occours when calling the julia code using the julia package. The configuration of PowerMOdels.jl was done following these steps. Sadly, the only other piece of information I can get from the loggs is a "[WinError 2] The system cannot find the file specified" comming from the outputfile generated by NSSM, but that's it so I havent been able to figure what file it's missing and why.

As for the NSSM config I only set the path, the startup directory, and the configuration so It might be that I am missing something(?). I have tried checking on the Julia package code but i can't find anything suspocious; the problem must be arising from the NSSM.

I'd also appreatiate any approach different from NSSM that you can suggest to me. This is my first post so if I am missing some key info, I'd gratefull if you to let me know :)

0 Answers0