From af128764e8a1e8522cfcfef56b1a846a57fb4802 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Mon, 23 May 2016 15:46:10 +0200 Subject: [PATCH] fix init dei valori x calcolo dist/direzione (zeri iniziali a nullo...) pubblicato update in test simulatore di CMS aggiunto prj x gestione vers codice --- MTC_Sim/MTC_Sim.sln | 6 ++ MTC_Sim/MTC_Sim/AdapterFanuc.cs | 10 ++- MTC_Sim/MTC_Sim/MTC-Adapter.csproj | 3 + MTC_Sim/MTC_Sim/Properties/AssemblyInfo.cs | 7 -- MTC_Sim/VersGen/AdapterVers.cs | 11 ++++ MTC_Sim/VersGen/AdapterVers.tt | 15 +++++ MTC_Sim/VersGen/App.config | 6 ++ MTC_Sim/VersGen/Properties/AssemblyInfo.cs | 32 +++++++++ MTC_Sim/VersGen/VersGen.csproj | 76 ++++++++++++++++++++++ 9 files changed, 158 insertions(+), 8 deletions(-) create mode 100644 MTC_Sim/VersGen/AdapterVers.cs create mode 100644 MTC_Sim/VersGen/AdapterVers.tt create mode 100644 MTC_Sim/VersGen/App.config create mode 100644 MTC_Sim/VersGen/Properties/AssemblyInfo.cs create mode 100644 MTC_Sim/VersGen/VersGen.csproj diff --git a/MTC_Sim/MTC_Sim.sln b/MTC_Sim/MTC_Sim.sln index 2659926..fd35ecc 100644 --- a/MTC_Sim/MTC_Sim.sln +++ b/MTC_Sim/MTC_Sim.sln @@ -14,6 +14,8 @@ Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "CMSCncLib", "CMSCncLib\CMSC EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MTC-Adapter", "MTC_Sim\MTC-Adapter.csproj", "{736DF121-11E6-4D46-835D-6560ACF241E4}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VersGen", "VersGen\VersGen.csproj", "{58E399F3-9D4E-49D3-AB35-9ED536543D50}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -32,6 +34,10 @@ Global {736DF121-11E6-4D46-835D-6560ACF241E4}.Debug|Any CPU.Build.0 = Debug|Any CPU {736DF121-11E6-4D46-835D-6560ACF241E4}.Release|Any CPU.ActiveCfg = Release|Any CPU {736DF121-11E6-4D46-835D-6560ACF241E4}.Release|Any CPU.Build.0 = Release|Any CPU + {58E399F3-9D4E-49D3-AB35-9ED536543D50}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {58E399F3-9D4E-49D3-AB35-9ED536543D50}.Debug|Any CPU.Build.0 = Debug|Any CPU + {58E399F3-9D4E-49D3-AB35-9ED536543D50}.Release|Any CPU.ActiveCfg = Release|Any CPU + {58E399F3-9D4E-49D3-AB35-9ED536543D50}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/MTC_Sim/MTC_Sim/AdapterFanuc.cs b/MTC_Sim/MTC_Sim/AdapterFanuc.cs index bc08eb2..6e2c3b2 100644 --- a/MTC_Sim/MTC_Sim/AdapterFanuc.cs +++ b/MTC_Sim/MTC_Sim/AdapterFanuc.cs @@ -44,6 +44,7 @@ namespace MTC_Sim // inizializzo posizioni assi... prevPosAxis = new double[adpConf.nAxis]; + prevDirAxis = new int[adpConf.nAxis]; FANUC_ref = (FANUC)Runtime.NC; if (utils.CRB("verbose")) lg.Info("FANUC_ref da CMSCncLib"); @@ -934,7 +935,14 @@ namespace MTC_Sim vettAxis[i].mAxDistDone.Value = Math.Abs(distPerc); // sistemo direzione +/- (POS/NEG se lineari, CCW/CW se rotativi) - newDir= Convert.ToInt32(distPerc / Math.Abs(distPerc)); + if (distPerc != 0) + { + newDir = Convert.ToInt32(distPerc / Math.Abs(distPerc)); + } + else + { + newDir = prevDirAxis[i]; + } vettAxis[i].mAxDir.Value = newDir; // se la direzione è variata salvo il cambio direzione... diff --git a/MTC_Sim/MTC_Sim/MTC-Adapter.csproj b/MTC_Sim/MTC_Sim/MTC-Adapter.csproj index a905dbb..fd9e498 100644 --- a/MTC_Sim/MTC_Sim/MTC-Adapter.csproj +++ b/MTC_Sim/MTC_Sim/MTC-Adapter.csproj @@ -55,6 +55,9 @@ + + AdapterVers.cs + diff --git a/MTC_Sim/MTC_Sim/Properties/AssemblyInfo.cs b/MTC_Sim/MTC_Sim/Properties/AssemblyInfo.cs index da2847a..8d9760a 100644 --- a/MTC_Sim/MTC_Sim/Properties/AssemblyInfo.cs +++ b/MTC_Sim/MTC_Sim/Properties/AssemblyInfo.cs @@ -8,9 +8,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyTitle("MTC_Adapter")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Steamware - CMS - SCM")] [assembly: AssemblyProduct("MTC_Adapter")] -[assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -29,8 +27,3 @@ using System.Runtime.InteropServices; // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.1.0")] -[assembly: AssemblyFileVersion("1.0.1.0")] diff --git a/MTC_Sim/VersGen/AdapterVers.cs b/MTC_Sim/VersGen/AdapterVers.cs new file mode 100644 index 0000000..b75cdad --- /dev/null +++ b/MTC_Sim/VersGen/AdapterVers.cs @@ -0,0 +1,11 @@ +// +// This code was generated by a tool. Any changes made manually will be lost +// the next time this code is regenerated. +// + +using System.Reflection; + +[assembly: AssemblyVersion("1.0.1.85")] +[assembly: AssemblyFileVersion("1.0.1.85")] +[assembly: AssemblyCopyright("Steamware-CMS-SCM © 2016-2016")] +[assembly: AssemblyCompany("Steamware-CMS-SCM")] diff --git a/MTC_Sim/VersGen/AdapterVers.tt b/MTC_Sim/VersGen/AdapterVers.tt new file mode 100644 index 0000000..d0b3311 --- /dev/null +++ b/MTC_Sim/VersGen/AdapterVers.tt @@ -0,0 +1,15 @@ +<#@ template language="C#" #> +// +// This code was generated by a tool. Any changes made manually will be lost +// the next time this code is regenerated. +// + +using System.Reflection; + +[assembly: AssemblyVersion("1.0.1.<#= this.RevisionNumber #>")] +[assembly: AssemblyFileVersion("1.0.1.<#= this.RevisionNumber #>")] +[assembly: AssemblyCopyright("Steamware-CMS-SCM © 2016-<#= DateTime.Now.Year #>")] +[assembly: AssemblyCompany("Steamware-CMS-SCM")] +<#+ + int RevisionNumber = (int)(DateTime.UtcNow - new DateTime(2014,10,1)).TotalDays/7; +#> \ No newline at end of file diff --git a/MTC_Sim/VersGen/App.config b/MTC_Sim/VersGen/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/MTC_Sim/VersGen/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/MTC_Sim/VersGen/Properties/AssemblyInfo.cs b/MTC_Sim/VersGen/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..15292d5 --- /dev/null +++ b/MTC_Sim/VersGen/Properties/AssemblyInfo.cs @@ -0,0 +1,32 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("VersGen")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyProduct("VersGen")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("58e399f3-9d4e-49d3-ab35-9ed536543d50")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] diff --git a/MTC_Sim/VersGen/VersGen.csproj b/MTC_Sim/VersGen/VersGen.csproj new file mode 100644 index 0000000..b015b0e --- /dev/null +++ b/MTC_Sim/VersGen/VersGen.csproj @@ -0,0 +1,76 @@ + + + + + Debug + AnyCPU + {58E399F3-9D4E-49D3-AB35-9ED536543D50} + Library + Properties + VersGen + VersGen + v4.5.2 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + True + True + AdapterVers.tt + + + + + + + + + TextTemplatingFileGenerator + AdapterVers.cs + + + + + + + + \ No newline at end of file