diff --git a/+combustiontoolbox/+core/@ChemicalSystem/findProducts.m b/+combustiontoolbox/+core/@ChemicalSystem/findProducts.m index db0a67cd4..e0189e56f 100644 --- a/+combustiontoolbox/+core/@ChemicalSystem/findProducts.m +++ b/+combustiontoolbox/+core/@ChemicalSystem/findProducts.m @@ -63,7 +63,7 @@ % If FLAG_BURCAT == false, then remove the species from Third millenium database (Burcat) if ~FLAG_BURCAT - listSpecies_DB = findSpecies(listSpecies_DB, {}, 'any', {'_M'}, 'all'); + listSpecies_DB = listSpecies_DB(~contains(listSpecies_DB, '_M')); % If indexElements_DB is given, now have to been recalculated if FLAG_IND diff --git a/+combustiontoolbox/+core/@Mixture/Mixture.m b/+combustiontoolbox/+core/@Mixture/Mixture.m index cd5f80887..c5ae094ff 100644 --- a/+combustiontoolbox/+core/@Mixture/Mixture.m +++ b/+combustiontoolbox/+core/@Mixture/Mixture.m @@ -320,7 +320,7 @@ % Change units to bar if ~strcmpi(ip.Results.units, 'bar') - p = Units.convert(p, ip.Results.units, 'bar'); + p = combustiontoolbox.common.Units.convert(p, ip.Results.units, 'bar'); end % Assign pressure @@ -1930,4 +1930,4 @@ function mergeDuplicateSpecies(obj) end -end \ No newline at end of file +end diff --git a/+combustiontoolbox/+equilibrium/@EquilibriumSolver/equilibriumGibbs.m b/+combustiontoolbox/+equilibrium/@EquilibriumSolver/equilibriumGibbs.m index d63bd6b1d..1d12ff512 100644 --- a/+combustiontoolbox/+equilibrium/@EquilibriumSolver/equilibriumGibbs.m +++ b/+combustiontoolbox/+equilibrium/@EquilibriumSolver/equilibriumGibbs.m @@ -286,7 +286,7 @@ % Get molecular weight species [kg/mol] W = system.propertyVector; - W(indexCondensed_check) = set_prop_DB(system.listSpecies(indexCondensed_check), 'W', system.species); + W(indexCondensed_check) = system.propertiesMatrix(indexCondensed_check, system.ind_W)'; % Definitions NC_max = NE - 1; diff --git a/+combustiontoolbox/+equilibrium/@EquilibriumSolver/equilibriumHelmholtz.m b/+combustiontoolbox/+equilibrium/@EquilibriumSolver/equilibriumHelmholtz.m index 9da543391..8a2ef6ac8 100644 --- a/+combustiontoolbox/+equilibrium/@EquilibriumSolver/equilibriumHelmholtz.m +++ b/+combustiontoolbox/+equilibrium/@EquilibriumSolver/equilibriumHelmholtz.m @@ -278,7 +278,7 @@ % Get molecular weight species [kg/mol] W = system.propertyVector; - W(indexCondensed_check) = set_prop_DB(system.listSpecies(indexCondensed_check), 'W', system.species); + W(indexCondensed_check) = system.propertiesMatrix(indexCondensed_check, system.ind_W)'; % Definitions NC_max = NE - 1; diff --git a/+combustiontoolbox/+utils/+display/@PlotConfig/PlotConfig.m b/+combustiontoolbox/+utils/+display/@PlotConfig/PlotConfig.m index a547b414a..abdc9d5e1 100644 --- a/+combustiontoolbox/+utils/+display/@PlotConfig/PlotConfig.m +++ b/+combustiontoolbox/+utils/+display/@PlotConfig/PlotConfig.m @@ -108,7 +108,7 @@ function value = get.position(obj) % Get figure position - if ~isempty(obj.position) + if isempty(obj.position_) value = combustiontoolbox.utils.display.getMonitorPositions(2); obj.position_ = value; return diff --git a/+combustiontoolbox/+utils/+display/getMonitorPositions.m b/+combustiontoolbox/+utils/+display/getMonitorPositions.m index 8312f3b8c..770b788d8 100644 --- a/+combustiontoolbox/+utils/+display/getMonitorPositions.m +++ b/+combustiontoolbox/+utils/+display/getMonitorPositions.m @@ -33,7 +33,7 @@ % Get screen device objects devices = env.getScreenDevices(); % Get initial points - position = get_monitor_positions_MATLAB(varargin{:}); + position = combustiontoolbox.utils.display.getMonitorPositionsMATLAB(varargin{:}); % Get screen size for the selected monitor position = [position(1), position(2), ... devices(monitor_id).getDisplayMode().getWidth(),... diff --git a/+combustiontoolbox/+utils/+optimization/simplexDual.m b/+combustiontoolbox/+utils/+optimization/simplexDual.m index b198af7ff..7b3474736 100644 --- a/+combustiontoolbox/+utils/+optimization/simplexDual.m +++ b/+combustiontoolbox/+utils/+optimization/simplexDual.m @@ -9,33 +9,32 @@ % b (float): Right-hand side vector of the equality constraints % % Returns: - % x (float): Optimal solution vector - % x_min (float): Minimum value of x + % Tuple containing + % + % * x (float): Optimal solution vector + % * x_min (float): Minimum value of x % % Example: % [x, x_min] = simplexDual(A, b) % Definitions - [m, n] = size(A); - + [~, n] = size(A); + b = b(:); + sumA = sum(A, 2); + % Coefficients for the objective function max t -> min -t - c = [zeros(n, 1); -1]; - - % Set inequality constraints (x_j - t >= 0) - A_ineq = [-eye(n), ones(n, 1)]; - b_ineq = zeros(n, 1); - - % Set equality constraints (A * x = b) - A_eq = [A, zeros(m, 1)]; - b_eq = b; - + c = zeros(n + 1, 1); + c(end) = -1; + + % Set equality constraints (A * z + sum(A, 2) * t = b) + A_eq = [A, sumA]; + % Solve the linear programming problem using the simplex method - x = combustiontoolbox.utils.optimization.simplex([A_ineq; A_eq], [b_ineq; b_eq], c); + zt = combustiontoolbox.utils.optimization.simplex(A_eq, b, c); - % Remove t - x_min = x(end); - x(end) = []; + % Recover minimum value + x_min = max(zt(end), 0); - % Check - % [x, x_min] = combustiontoolbox.utils.optimization.simplexDualCheck(A_eq, b_eq, c, A_ineq, b_ineq); -end \ No newline at end of file + % Recover solution (x = z + t) + x = zt(1:n) + x_min; +end