From fbfa289de7c2486d7caf8ac25a18e9b0c187fb73 Mon Sep 17 00:00:00 2001 From: Eugene Tan <30103647+yrtan@users.noreply.github.com> Date: Wed, 10 Oct 2018 11:16:34 +1100 Subject: [PATCH 1/2] Create licence file Starting off with an MIT licence --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..e6ca6aee --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Gregory Portmann + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From 1e8abdd735f6421783dfb32008627dc80e376854 Mon Sep 17 00:00:00 2001 From: Eugene Tan Date: Fri, 12 Oct 2018 14:58:56 +1100 Subject: [PATCH 2/2] Added to option to select the AT version on initialisation. Defaults to 1.3 --- mml/gotoat.m | 5 +++-- mml/setpathasp.m | 10 +++++----- mml/setpathmml.m | 13 ++++++++++--- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/mml/gotoat.m b/mml/gotoat.m index 738f805b..168151ca 100644 --- a/mml/gotoat.m +++ b/mml/gotoat.m @@ -12,6 +12,7 @@ ATPATHDirectory = ''; ATVersion = []; +ATVersionDefault = 1.3; while length(varargin) > 0 if isstruct(varargin{1}) || iscell(varargin{1}) @@ -36,10 +37,10 @@ if ismac || ispc % Not linking properly on Linux yet!!! ATVersion = 2.0; else - ATVersion = 1.3; + ATVersion = ATVersionDefault; end else - ATVersion = 1.3; + ATVersion = ATVersionDefault; end end diff --git a/mml/setpathasp.m b/mml/setpathasp.m index 7e8bab82..0f658e6b 100644 --- a/mml/setpathasp.m +++ b/mml/setpathasp.m @@ -80,13 +80,13 @@ if strcmpi(SubMachineName,'StorageRing') - [MachineName, SubMachineName, LinkFlag, MMLROOT] = setpathmml(Machine, 'StorageRing', 'StorageRing', LinkFlag); + [MachineName, SubMachineName, LinkFlag, MMLROOT] = setpathmml(Machine, 'StorageRing', 'StorageRing', LinkFlag, '', 1.4); elseif strcmpi(SubMachineName,'Booster') - [MachineName, SubMachineName, LinkFlag, MMLROOT] = setpathmml(Machine, 'Booster', 'Booster', LinkFlag); + [MachineName, SubMachineName, LinkFlag, MMLROOT] = setpathmml(Machine, 'Booster', 'Booster', LinkFlag, '', 1.4); elseif strcmpi(SubMachineName,'LTB') - [MachineName, SubMachineName, LinkFlag, MMLROOT] = setpathmml(Machine, 'LTB', 'Transport', LinkFlag); + [MachineName, SubMachineName, LinkFlag, MMLROOT] = setpathmml(Machine, 'LTB', 'Transport', LinkFlag, '', 1.4); elseif strcmpi(SubMachineName,'BTS') - [MachineName, SubMachineName, LinkFlag, MMLROOT] = setpathmml(Machine, 'BTS', 'Transport', LinkFlag); + [MachineName, SubMachineName, LinkFlag, MMLROOT] = setpathmml(Machine, 'BTS', 'Transport', LinkFlag, '', 1.4); elseif strcmpi(SubMachineName,'Injector') - [MachineName, SubMachineName, LinkFlag, MMLROOT] = setpathmml(Machine, 'Injector', 'Booster', LinkFlag); + [MachineName, SubMachineName, LinkFlag, MMLROOT] = setpathmml(Machine, 'Injector', 'Booster', LinkFlag, '', 1.4); end diff --git a/mml/setpathmml.m b/mml/setpathmml.m index d8d6dcc7..10bfb583 100644 --- a/mml/setpathmml.m +++ b/mml/setpathmml.m @@ -8,12 +8,13 @@ % 3. MachineType - 'StorageRing' {Default}, 'Booster', 'Linac', or 'Transport' % 4. OnlineLinkMethod - 'LabCA', 'SCA', 'MCA', 'Tango', 'SLC', 'UCODE', ... {Default: 'LabCA'} % 5. MMLROOT - Directory path to the MML root directory +% 6. ATVersion - Version of AT to use. Choice of 1.3, 1.4 and 2.0. % Written by Greg Portmann % Updated by Igor Pinayev -% Inputs: MachineName, SubMachineName, MachineType, LinkFlag, MMLROOT +% Inputs: MachineName, SubMachineName, MachineType, LinkFlag, MMLROOT, ATVersion % First strip-out the link method @@ -127,7 +128,7 @@ switch upper(SubMachineName) case {'LTB', 'LB', 'BTS', 'BS', 'LT1', 'LT2', 'INJECTOR', 'LINAC', 'GUN', 'PTB'} MachineType = 'Transport'; - case {'BOOSTER', 'BOOSTER RING', 'BR'} + case {'BOOSTER', 'BOOSTERRING', 'BOOSTER RING', 'BR'} MachineType = 'Booster'; case {'SR', 'STORAGERING', 'STORAGE RING', 'HER', 'LER', '800MEV'} MachineType = 'StorageRing'; @@ -197,6 +198,12 @@ MMLROOT = getmmlroot('IgnoreTheAD'); end +% Define AT version to use otherwise the default is 1.3 +if length(varargin) >= 5 + ATVersion = varargin{5}; +else + ATVersion = 1.3; +end % The path does not needs to be set in Standalone mode if ~isdeployed_local @@ -239,7 +246,7 @@ end % AT path - setpathat; + setpathat(ATVersion); % if MatlabVersion >= 9.3 % 2017b (not sure about 2017a) % if ismac || ispc % Not linking properly on Linux yet!!! % % AT2.0