Solved

Initial Data Empty

  • 7 November 2022
  • 2 replies
  • 43 views

Badge +3

Hey!

I have some parameters that should initialize as 1 and then optionally be updated with a script. The weird thing is when I use Initial Data and define it as 1, they are empty!  Only one of the nine parameters populates properly as 1, the rest are blank. This has caused me to assign them all with := in the script at the beginning, but this is quite ugly and impractical.

 

Is there something about Initial Data I'm not understanding? Let me know if you need more info!

 

Here's an example of one that doesn't load, where i is a node index that works throughout the model:

Parameter MultiplierPVCap {
    IndexDomain: i;
    InitialData: 1;
}

 

And the one that does load:

Parameter MultiplierH2storage {
    IndexDomain: yr;
    InitialData: 1;
}

icon

Best answer by Chris Kuip 7 November 2022, 19:40

View original

2 replies

Userlevel 5
Badge +7

Hello

 

For the issue at hand, I've been able to reproduce the described behavior, see the enclosed project. Upon opening the WebUI looks as follows:

This behavior can be explained as follows:

The AIMMS strategy to initialize identifiers is very roughly as follows:

  1. Definitions and initial data attributes are worked first.
  2. Procedures such as MainInitialization and PostMainInitialization are run next. 

In step 1, when aset, for instance S, is empty, then there is no data assigned for a one-dimensional parameter, p_dat1(i), with initial data attribute "1”.

When the initialization procedures subsequently fill the set S, they just fill that set and do not work the initial data attribute of one-dimensional parameters with index i.

 

In step 1, when aset, such as calendar yearcal, is defined it is not empty and initialized before p_dat2(yr).  That is why p_dat2 does contain 1's.

 

Does this explain the behavior you observed?

 

With kind regards,

 

Chris.

PS. More on initialization can be found at: https://how-to.aimms.com/Articles/351/351-app-initialization-termination-with-libraries.html

Badge +3

Hey Chris,

So from what you said, because the set (i) is empty when initial data runs, the parameter isn't populated.
Then when the set is filled, AIMMS doesn't go back to fill the parameter.

 

I think a work-around would then be to eliminate the parameter index, but that gives me less flexibility for defining it per node i. But I guess if it gets that detailed it should be an import anyway.

Thanks!

Reply


Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator