Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connecting to PSCAD using an external client #153

Open
thk-LE opened this issue Dec 3, 2024 · 0 comments
Open

Connecting to PSCAD using an external client #153

thk-LE opened this issue Dec 3, 2024 · 0 comments

Comments

@thk-LE
Copy link

thk-LE commented Dec 3, 2024

Hello,

When trying to run the PSCAD script i tried to use an external client. I ran into 2 issues using this method. The first is that the requirements.txt file was missing mhi-pscad so i needed to run: "pip install mhi-pscad". The second problem is that the connection function did not work when trying to attach to PSCAD. One time it even connected to a coworkers PSCAD client as we are working with PSCAD on a server. The solution to those problems was using the function shown below. In that function the tkinter and path part can be changed to the workspace path being included in the configuration file.

def connectPSCAD_LE() -> mhi.pscad.PSCAD:
    """
    

    Returns
    -------
    pscad : Application
        Returns a link to the opened PSCAD workspace, and runs the MTB using that workspace.
        
        It does that by using the first available license
    """
    root = tkinter.Tk() 
    root.withdraw()
    root.wm_attributes('-topmost', 1)
    WorkspacePath = filedialog.askopenfilename()
    pscad = mhi.pscad.launch()
    dict_certificates = pscad.get_available_certificates()
    available_certificates : list(tuple) = [x for x in dict_certificates.items() if "1/1" in str(x)] 
    pscad.get_certificate(available_certificates[0][1]) # First available license
    pscad.load(WorkspacePath)
    return pscad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant