close all;
clear;
clc;

Vbus = 1000; % bus voltage

Vnom = 480; % ll-rms nominal system voltage
fref = 60; % nominal frequency
omegaRef = 2*pi*fref;

Ts = 1e-4; % sample time

%% Transient timings
T_loadStep = 5;
T_droopEnable = 10;
T_loadStep2 = 20;

%% Inverter parameters
Lfilt = 200e-6;
Rfilt = 1.4e-3;
Cfilt = 100e-6;

Kp_Ireg = 0.3;
Ki_Ireg = 20;

Limits_Ireg = [1.25, -1.25]; % PI limiter in current reg block
Limits_Vreg = [1.25, -1.25];

Kp_Vreg = 0.5;
Ki_Vreg = 5;

Pref1 = 1e6;
Pref2 = 0.5e6;

%% Tie line parameters
Rt = 10e-3;
Lt = 5e-6;

%% Load parameters
Pload1 = 0.75e6;
Qload1 = 0.15e6;
deltaQ = 0.15e6;
deltaP = -0.25e6;

%% Droop parameters
Frequency_Droop = 1; % in %
Voltage_Droop = 10;% in %

% limit acceptable frequency range for computing P and Q
fmax_meas = 65;
fmin_meas = 55;

