function q = calcq(HyCase,temperature)
% This function caculate 'q' for a stream with the specified temperature
% and Pressure and composition as stream 'F'
HyCase.Application.PlayScript([pwd,'\definefromother.SCP'])
HyCase.Flowsheet.MaterialStreams.Item('7').TemperatureValue = temperature;
HyCase.Solver.CanSolve = 1;
hf = HyCase.Flowsheet.MaterialStreams.Item('7').MolarEnthalpyValue;

HyCase.Flowsheet.MaterialStreams.Item('7').Temperature.Erase

HyCase.Flowsheet.MaterialStreams.Item('7').vapourFractionValue = 1;
HyCase.Solver.CanSolve = 1;
hv_sat = HyCase.Flowsheet.MaterialStreams.Item('7').MolarEnthalpyValue;

HyCase.Flowsheet.MaterialStreams.Item('7').vapourFractionValue = 0;
HyCase.Solver.CanSolve = 1;
hl_sat = HyCase.Flowsheet.MaterialStreams.Item('7').MolarEnthalpyValue;

q = (hv_sat - hf)/(hv_sat - hl_sat);

HyCase.Flowsheet.MaterialStreams.Item('7').vapourFraction.Erase