function [d]=getRawVelocityDemand(x,sim_step,j)
%% simulate driver's velocity demand (in mph)

% driver velocity demand can go from 30 to 110 mph at steps of 5 mph.
% Only x bits are used to encode this signal. 00...0 corresponds to 30
% mph and 11...1 to 110 mph

% global sim_step
% global j

if j*sim_step >= 0 && j*sim_step < 15 
    d=dec2bin((2^x*(60-30))/(110-30));
elseif j*sim_step >= 15 && j*sim_step < 25
    d=dec2bin((2^x*(65-30))/(110-30));
elseif j*sim_step >= 25 && j*sim_step < 35
    d=dec2bin((2^x*(55-30))/(110-30));
elseif j*sim_step >= 35 && j*sim_step < 45
    d=dec2bin((2^x*(70-30))/(110-30));
elseif j*sim_step >= 45 && j*sim_step < 55
    d=dec2bin((2^x*(50-30))/(110-30));
elseif j*sim_step >=55 
    d=dec2bin((2^x*(70-30))/(110-30));
end