Git Product home page Git Product logo

Comments (9)

jbae11 avatar jbae11 commented on July 29, 2024

wouldn't it be easier if we just did t = self.context.time instead of messing with the whole dt variable?
Without it the user can have an intuitive sense of time rather than having to convert the time into other units.
so if the dt in the simulation is a month (2592000 secs), the equation t variable would be in months.

    def demand_calc(self, time):
        """
        Calculate the electrical demand at a given timestep (time).

        Parameters
        ----------
        time : int
            The timestep that the demand will be calculated at.
        Returns
        -------
        demand : The calculated demand at a given timestep.
        """
        t = time
        demand = eval(self.demand_eq)
        return demand

from d3ploy.

jbae11 avatar jbae11 commented on July 29, 2024

But generally I agree the clarification in the readme is needed

from d3ploy.

FlanFlanagan avatar FlanFlanagan commented on July 29, 2024

We can do that, but you need to ensure that the user puts their equation in with regard to the timestep.

Also, not all growth rates will be in regard to the operational time step of the simulation. For example you might consider your growth rate annually, but the time step of the simulation might be weeks, or months, or even seconds. In which case the demand equation needs to account for these differences.

I suppose this is acceptable, since we're already asking users to understand how to input a equation via eval, so they much have some knowledge of how to write python. I'm just hesitant to put most of the burden on the user, when we could solve the problem on the developer side.

from d3ploy.

gwenchee avatar gwenchee commented on July 29, 2024

So from my understanding, we can move forward in two ways:

  1. Assume that dt is a month and tell the user that the input in the demand_eq assumes that time is in month-long time steps.
  2. Generalize it so that the user can define the time step length of their demand_eq.

Option 1 is easier to implement but we lose generality. I personally would be in favor of option 2. Perhaps, we could implement only month-long and year-long time step options (and not provide minute/second options).

Thoughts? @jbae11 @FlanFlanagan

from d3ploy.

jbae11 avatar jbae11 commented on July 29, 2024

I think the best way is option 2 with default month. If @FlanFlanagan agrees, I'll make a PR about it once #40 gets merged.

from d3ploy.

gwenchee avatar gwenchee commented on July 29, 2024

Let's do Option 3:
Make it clear to the user that the demand_eq should have the same time step length as the dt that they defined in the simulation control. Default dt is month-long and so, default demand_eq will also be a month.

from d3ploy.

FlanFlanagan avatar FlanFlanagan commented on July 29, 2024

Option 3 is my vote.

from d3ploy.

jbae11 avatar jbae11 commented on July 29, 2024

okay, I'll make the PR once #47 is merged.

from d3ploy.

gwenchee avatar gwenchee commented on July 29, 2024

closed with #46

from d3ploy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.