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

setTankData is not setting and returning the correct elevation #23

Open
lbutler opened this issue Feb 7, 2020 · 3 comments
Open

setTankData is not setting and returning the correct elevation #23

lbutler opened this issue Feb 7, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@lbutler
Copy link
Contributor

lbutler commented Feb 7, 2020

Adding tests to NetworkNode.ts I noticed that setTankData isn't returning elevation as I would have expected.

The below test is failing for elevation. Will need to confirm what is going on.

Noticed that changing to imperial units makes things off by a factor of 10, while in metric returns comes back as 3.048

    test('set and get tank values', () => {
      const model = new Project(ws);
      model.init('report6.rpt', 'out6.bin', FlowUnits.LPS, HeadLossType.HW);

      //Create Network
      const tankId = model.addNode('N1', NodeType.Tank);

      model.setTankData(tankId, 10, 1, 0, 5, 3.2, 1, '');

      const elevation = model.getNodeValue(tankId, NodeProperty.Elevation);
      const minLevel = model.getNodeValue(tankId, NodeProperty.MinLevel);
      const maxLevel = model.getNodeValue(tankId, NodeProperty.MaxLevel);
      const tankDiam = model.getNodeValue(tankId, NodeProperty.TankDiam);
      const minVolume = model.getNodeValue(tankId, NodeProperty.MinVolume);

      expect(elevation).toEqual(10);
      expect(minLevel).toEqual(0);
      expect(maxLevel).toEqual(5);
      expect(tankDiam).toEqual(3.2);
      expect(minVolume).toEqual(1);
    });

 ✕ set and get tank values (5ms)

   Epanet Network Node Functions › Impliment Methods › set and get tank values

    expect(received).toEqual(expected) // deep equality

    Expected: 10
    Received: 3.048


@lbutler lbutler added the bug Something isn't working label Feb 7, 2020
@lbutler lbutler changed the title Expect setTankData is not setting and returning the correct elevation Feb 7, 2020
@cdzuwa
Copy link
Contributor

cdzuwa commented May 3, 2020

bug due to internal workings of the owa toolkit.issue resolved!

@lbutler
Copy link
Contributor Author

lbutler commented May 3, 2020

Thanks @cdzuwa for letting me know! I didn't get a chance to dive into this but good to know it was fixed upstream.
At this stage, I'm going to keep epanet-js locked to public release so not sure if I'll do a hotfix on my library until 2.3 or something else.
Going to jump back into this library soon and try to get test coverage up.

@cdzuwa
Copy link
Contributor

cdzuwa commented May 3, 2020

You're doing a great job.Nice piece of software

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants