%% ************************************************************************
% Model         :   Open Loop Control of bldc motor for hall calibration
% Description   :   Set Parameters for Open Loop Control of 3-phase motors
% File name     :   mcb_hall_calibration_f28379d_data.m
% Copyright 2020 The MathWorks, Inc.

%% Set PWM Switching frequency
Init_Block = [ bdroot '/Hall Calibration/Parameters' ];
PWM_frequency 	= eval(get_param([Init_Block '/PWM Frequency'], 'Value'));    %Hz          // converter s/w freq

%% Set Sample Times
T_pwm           = 1/PWM_frequency;  %s      // PWM switching time period
Ts          	= T_pwm;        %sec        // Sample time for controller

%% Set data type for controller & code-gen

selectedDataType = eval(get_param([Init_Block '/Data Type'],'Value'));
if selectedDataType == 0
    dataType = 'single';
else
    dataType = fixdt(1,32,17);
end
clear selectedDataType;

%% System Parameters // Hardware parameters 

% Update motor details below
motor.polePairs     = eval(get_param([Init_Block '/Number of pole pairs'], 'Value'));         %           // Pole Pairs for the motor
motor.base_speed    = eval(get_param([Init_Block '/Motor BaseSpeed'], 'Value'));     %rpm        // Rated speed (Synchronous Speed)

% Update target below
target = mcb_SetProcessorDetails('F28379D',PWM_frequency);

