Skip to content

Issue with MSXepanet class #501

@bertawp31

Description

@bertawp31

Hi everyone,
I'm new to WNTR and don't have much experience. I'm working on a project in Pycharm where I have to use the MSXepanet class, and I'm having some trouble.
I'm trying to use the ENgetcount() function (from MSXepanet class), but I always end up getting the same error. Could you please help me with this? Thank you so much in advance. Best regards,

This is my code:

import os
import numpy as np
import pandas as pd
import wntr.epanet.msx
from wntr.epanet.msx.toolkit import MSXepanet
from wntr.epanet.msx.enums import TkObjectType
from wntr.epanet.toolkit import ENepanet

inpfile = "networks/Xarxa_Manresa.inp"
msxfile = "data/Xarxa_Manresa.msx"
rptfile = "resultats_simulacio"
binfile = "bin_file_prova"

msxobj = wntr.epanet.msx.toolkit.MSXepanet(inpfile,rptfile,binfile,msxfile)`
msxobj.ENopen()
var = msxobj.ENgetcount(0)
print(var)
msxobj.ENclose()

I have also tried with msxobj = wntr.epanet.msx.MSXepanet(inpfile,rptfile,binfile,msxfile)

And this is the error I'm getting:
n_nodes = msxobj.ENgetcount(0) # NODECOUNT
NameError: name 'msxobj' is not defined

Image

Environment

  • Operating system: Windows 10 Home
  • Python version: 3.11

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions