Skip to content

Init section for device json input #405

@lukelowry

Description

@lukelowry

Summary

The exciter and governor models desperately need a way to initialize their external. We are initializing these models in an unfortunate way because we don't have a way to set the initial values of external states in the case format:

Some of the more advanced models cannot be implemented due to our current approach of intialziation intra-model.

Rationale

Right now, during initialization, the Genrou model writes information to the governor Tgov1 via the mechanical power signal. And then (the sequencing matters, which is unfortunate) the governor initialization reads this data that landed in its own internal state:

  // Initial mechanical = initial electric torque
  if (signals_.template isAssigned<Tgov1InternalVariables::PM>())
  {
    p0 = y_[2]; ///<- generator needs to be initialized first
  }

  // Input Variables (Parameter for now)
  pref_ = R_ * p0;

which is then used to initialize the static values of pref which is an external variable of the governor

But the dependency chain is backward, since we can know a priori from the power flow solution the value of pref. And the case format itself embeds knowledge of the models, so if the machine Genrou isn't wired up to an exciter, then the author of the case format already knows to initialize pmech with the value we would have given pref if it had a governor.

Additionally, this would allow us to fully unit test models without coupling them with other models as we do with the exciter, governor, and machine trio.

Description

a init section which only accepts names of external variables

  {
      "class": "Tgov1",
      "ports": {
          "bus": 26,
          "speed": 28,
          "pmech": 29
      },
      "id": "26_1_tgov1",
      "init":{
            "pref": 10.0,
       },
      "params": {
          "R": 0.05,
          "T1": 0.5,
          "T2": 2.5,
          "T3": 7.5,
          "Pvmin": 0.0,
          "Pvmax": 1.0,
          "Dt": 0.0
      }
  },

Additional information

I had a conversation a while ago about this with @abirchfield, but I hit a wall with the REECA exciter implementation for IBR because of this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions