Skip to content

Conversation

@acavelan
Copy link
Collaborator

@acavelan acavelan commented Jan 20, 2026

The current example scenario uses Fourier coefficients for seasonality. In practice, users may prefer monthly values. This PR adds an example using monthly values.

When using monthly values, the seasonality is shifter to the right by 15 days because the model is assuming the provided monthly values are averages for each month. This PR removes the shift to align with using Fourier coefficients so that both methods produce near identical InputEIR and SimulatedEIR.

Example of XML configuration:

Fourier coefficients

                    <fourierSeries EIRRotateAngle="0">
                        <coeffic a="-1.0313715140024822" b="0.5474993785222372"/>
                        <coeffic a="-0.005155722300211589" b="-0.19769509633382162"/>
                    </fourierSeries>

Monthly values

                    <monthlyValues smoothing="fourier" EIRRotateAngle="0">
                        <value>98</value>
                        <value>132</value>
                        <value>223</value>
                        <value>403</value>
                        <value>1156</value>
                        <value>953</value>
                        <value>755</value>
                        <value>403</value>
                        <value>293</value>
                        <value>149</value>
                        <value>116</value>
                        <value>107</value>
                    </monthlyValues>

Note that EIRRotateAngle becomes available for monthly values (it was previously only available for Fourier coefficients).
In addition, EIRRotateAngle is now optional for both methods and defaults to 0.

Tests that were using monthly values have been updated.

Copy link
Collaborator

@b-s-code b-s-code left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I support the inclusion of example monthly values.

The monthly values added here give different output to what is obtained by specifying Fourier coefficients.

The difference isn't huge and I assume it is to be expected? E.g. these output plots look similar but there are some observable differences. Top row = Fourier coefficients in XML, bottom row = monthly values in XML.

Screenshot From 2026-01-22 10-35-10

I don't suppose there's any reason this might be an issue? None come to my mind.

If no concerns on your end then I'm happy for this to be merged.

@acavelan
Copy link
Collaborator Author

acavelan commented Feb 5, 2026

Apparently when using monthly values, InputEIR is shifted slightly. I'm working on a fix.

@acavelan
Copy link
Collaborator Author

acavelan commented Feb 5, 2026

EIRRotateAngle = M_PI * (1.0 / 12.0 - 1.0 / 365.0);

When using monthly values, the InputEIR vector is shifted by approximately half a month: this is most likely assuming the monthly values provided by the user are averages for each month.

@acavelan acavelan force-pushed the addMonthlyValuesToExampleScenario branch from 0e13aac to 2940247 Compare February 5, 2026 15:59
@acavelan acavelan requested a review from b-s-code February 5, 2026 16:17
Copy link
Collaborator

@b-s-code b-s-code left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one. Just a print statement left over.


// Now we rescale to get an EIR of targetEIR.
// Calculate current sum as is usually done.
cout << EIRRotateAngle << endl;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can delete?

Copy link
Collaborator

@b-s-code b-s-code left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants