From e936af0d5c8046cbba7a9e2c895d2ea990d653e4 Mon Sep 17 00:00:00 2001 From: UVCLimHun Date: Tue, 24 Jun 2025 17:02:07 +0900 Subject: [PATCH] wjdakf aksgdmsdlfemfdl dlTDJTdj --- .../New Folder/TopIcon/New Folder.meta | 8 + .../TopIcon/New Folder/Group 79 (2).png | Bin 0 -> 818 bytes .../TopIcon/New Folder/Group 79 (2).png.meta | 130 +++++++ .../TopIcon/New Folder/Group 80 (2).png | Bin 0 -> 855 bytes .../TopIcon/New Folder/Group 80 (2).png.meta | 130 +++++++ .../TopIcon/New Folder/Group 81 (2).png | Bin 0 -> 848 bytes .../TopIcon/New Folder/Group 81 (2).png.meta | 130 +++++++ .../TopIcon/New Folder/Group 88.png | Bin 0 -> 992 bytes .../TopIcon/New Folder/Group 88.png.meta | 130 +++++++ .../TopIcon/New Folder/Group 89.png | Bin 0 -> 852 bytes .../TopIcon/New Folder/Group 89.png.meta | 130 +++++++ .../TopIcon/New Folder/Group 91.png | Bin 0 -> 752 bytes .../TopIcon/New Folder/Group 91.png.meta | 130 +++++++ .../TopIcon/New Folder/Group 92.png | Bin 0 -> 717 bytes .../TopIcon/New Folder/Group 92.png.meta | 130 +++++++ .../TopIcon/New Folder/Group 93.png | Bin 0 -> 878 bytes .../TopIcon/New Folder/Group 93.png.meta | 130 +++++++ .../TopIcon/New Folder/Group 94.png | Bin 0 -> 727 bytes .../TopIcon/New Folder/Group 94.png.meta | 130 +++++++ Assets/Prefabs/UITopItem/Panel_Top.prefab | 124 +++--- .../LibraryPrefab/Source_Pallet.prefab | 24 +- Assets/Resources/ModelsUpdated/Pallet.prefab | 23 +- Assets/Scenes/Simulation_0.0.1.unity | 310 +-------------- .../SimulationModelProcess.cs | 145 ------- .../SimulationModelProduct.cs | 6 +- .../SimulationModelResource.cs | 11 +- .../SimulationModels/SimulationModelSink.cs | 73 ---- .../SimulationModels/SimulationModelSource.cs | 115 ------ .../LogicData/BackUp/Source_Pallet 1.prefab | 154 ++++++++ .../BackUp/Source_Pallet 1.prefab.meta | 7 + .../WorkSpace/LH/LogicData/LogicItemButton.cs | 6 +- Assets/WorkSpace/LH/LogicInfo.cs | 39 +- Assets/WorkSpace/LH/LogicMappingDataBase.cs | 3 - Assets/WorkSpace/LH/MQTTDataBase.cs | 2 +- Assets/WorkSpace/LH/MQTTManager.cs | 7 + Assets/WorkSpace/LH/Manager.prefab | 34 +- Assets/WorkSpace/LH/Simulation.meta | 8 + .../LH/Simulation/MQTTDataDistributer.cs | 22 ++ .../LH/Simulation/MQTTDataDistributer.cs.meta | 2 + .../LH/Simulation/SimulationDefaultJson.cs | 12 + .../Simulation/SimulationDefaultJson.cs.meta | 2 + .../LH/Simulation}/SimulationModel.cs | 67 +--- .../LH/Simulation}/SimulationModel.cs.meta | 0 .../LH/Simulation}/SimulationModelConveyor.cs | 273 +++++++++----- .../SimulationModelConveyor.cs.meta | 0 .../LH/Simulation}/SimulationModelMove.cs | 264 ++++++++++++- .../Simulation}/SimulationModelMove.cs.meta | 0 .../LH/Simulation/SimulationModelProcess.cs | 356 ++++++++++++++++++ .../SimulationModelProcess.cs.meta | 0 .../LH/Simulation/SimulationModelSink.cs | 153 ++++++++ .../Simulation}/SimulationModelSink.cs.meta | 0 .../LH/Simulation/SimulationModelSource.cs | 133 +++++++ .../Simulation}/SimulationModelSource.cs.meta | 0 .../LH/Simulation}/SimulationModelStore.cs | 5 + .../Simulation}/SimulationModelStore.cs.meta | 0 Assets/WorkSpace/LH/Web/WebReceiver.cs | 8 +- Assets/WorkSpace/LWJ/SaveLoadmanager.cs | 6 +- 57 files changed, 2664 insertions(+), 908 deletions(-) create mode 100644 Assets/Image/UIIcons/New Folder/TopIcon/New Folder.meta create mode 100644 Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 79 (2).png create mode 100644 Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 79 (2).png.meta create mode 100644 Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 80 (2).png create mode 100644 Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 80 (2).png.meta create mode 100644 Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 81 (2).png create mode 100644 Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 81 (2).png.meta create mode 100644 Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 88.png create mode 100644 Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 88.png.meta create mode 100644 Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 89.png create mode 100644 Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 89.png.meta create mode 100644 Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 91.png create mode 100644 Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 91.png.meta create mode 100644 Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 92.png create mode 100644 Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 92.png.meta create mode 100644 Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 93.png create mode 100644 Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 93.png.meta create mode 100644 Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 94.png create mode 100644 Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 94.png.meta delete mode 100644 Assets/Scripts/SimulationModels/SimulationModelProcess.cs delete mode 100644 Assets/Scripts/SimulationModels/SimulationModelSink.cs delete mode 100644 Assets/Scripts/SimulationModels/SimulationModelSource.cs create mode 100644 Assets/WorkSpace/LH/LogicData/BackUp/Source_Pallet 1.prefab create mode 100644 Assets/WorkSpace/LH/LogicData/BackUp/Source_Pallet 1.prefab.meta create mode 100644 Assets/WorkSpace/LH/Simulation.meta create mode 100644 Assets/WorkSpace/LH/Simulation/MQTTDataDistributer.cs create mode 100644 Assets/WorkSpace/LH/Simulation/MQTTDataDistributer.cs.meta create mode 100644 Assets/WorkSpace/LH/Simulation/SimulationDefaultJson.cs create mode 100644 Assets/WorkSpace/LH/Simulation/SimulationDefaultJson.cs.meta rename Assets/{Scripts/SimulationModels => WorkSpace/LH/Simulation}/SimulationModel.cs (54%) rename Assets/{Scripts/SimulationModels => WorkSpace/LH/Simulation}/SimulationModel.cs.meta (100%) rename Assets/{Scripts/SimulationModels => WorkSpace/LH/Simulation}/SimulationModelConveyor.cs (69%) rename Assets/{Scripts/SimulationModels => WorkSpace/LH/Simulation}/SimulationModelConveyor.cs.meta (100%) rename Assets/{Scripts/SimulationModels => WorkSpace/LH/Simulation}/SimulationModelMove.cs (56%) rename Assets/{Scripts/SimulationModels => WorkSpace/LH/Simulation}/SimulationModelMove.cs.meta (100%) create mode 100644 Assets/WorkSpace/LH/Simulation/SimulationModelProcess.cs rename Assets/{Scripts/SimulationModels => WorkSpace/LH/Simulation}/SimulationModelProcess.cs.meta (100%) create mode 100644 Assets/WorkSpace/LH/Simulation/SimulationModelSink.cs rename Assets/{Scripts/SimulationModels => WorkSpace/LH/Simulation}/SimulationModelSink.cs.meta (100%) create mode 100644 Assets/WorkSpace/LH/Simulation/SimulationModelSource.cs rename Assets/{Scripts/SimulationModels => WorkSpace/LH/Simulation}/SimulationModelSource.cs.meta (100%) rename Assets/{Scripts/SimulationModels => WorkSpace/LH/Simulation}/SimulationModelStore.cs (94%) rename Assets/{Scripts/SimulationModels => WorkSpace/LH/Simulation}/SimulationModelStore.cs.meta (100%) diff --git a/Assets/Image/UIIcons/New Folder/TopIcon/New Folder.meta b/Assets/Image/UIIcons/New Folder/TopIcon/New Folder.meta new file mode 100644 index 00000000..64c01ad1 --- /dev/null +++ b/Assets/Image/UIIcons/New Folder/TopIcon/New Folder.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 672b468357b522948b844e004a76923d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 79 (2).png b/Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 79 (2).png new file mode 100644 index 0000000000000000000000000000000000000000..2abf9ed08ec21c790eb31fab659320789d9d2763 GIT binary patch literal 818 zcmV-21I_%2P)?>2K~#7F-I+0O z+CUV?pG_q?p)70+6ec#9V1g_lkdWGn4^TQFu>oVJ@(th{&@ODK85k%m8DYX36VwY* zB_xQD7+`?j-{m6eTpD8^)ap;N!1lrY^6uW9^H4}YqtUogRrSN+aJXfsQFa9BGU)8k z6h*nKR4QLZ4HSAR_l|v_#ope~bZcbUBZwPJ z?lZZAX0=+a;f*24jFJTWem|AVWlAIxB$1#>5`bKxP#~|@OYwMIs-$BGe!oxS@z}WT6vq+7kcvbWiv`I* zN|IcXvjlxUpE2h|Ad1gL6U1UM3WvjVF+s>7ThWPV@jkoF!=~iy;R|3}HH*{^K4ZhKx0XNJpdMO)8a2(R@BPzV9V0 zMeuJCV;j2gx|PnYps;7b!%L0$5M%CPi0v#PcE7_?1Q88B_jo7gf~jHW5A#66M~`CxAF3mV5Y&pdj(!vFvP07*qoM6N<$f^~x+{Ivj_u*KmX6-O>I=kryxi1bxSjN6F4G-2qGlICl z#C;)epjRrDDjHlM6IVK<)ibbYeyCQfk6fUx>%YjkiJ;0e6Z!V$5WNz4k2h>3`K>W= z@5rNInZqoO&=m*-0u+nIC>o8@6^Y-{%R;OKMBxC%V$tl6Mk8vs+jIpYx1>lg804aG z-fT8}tkGzgZxbULMaz0O}K9+$Jcl0f(i5wr^gLMYNJ z^Bj;C7z%~{N*P$M*F4n#LePfqfQs*|NO=(AFhk*?a5!v^BXu~0KujFLrOS;}1Pg@% zPuG>!I9u2jD13Lxnx=y76pM9E_^IFTo4#`rDGwro5DK3O&pD0l6k}pQSTdO;H?b`c z;xIW9i3FumDN^D1=g0TrOuT-H0Fr!ozq$M+J%$i#?xR z;6dzWToDK$P&Q@9`^IxPz8}04We);G!@8?E2ksT$FLr@IgCsva;XC+9fL% zrPFB&1On7(G)M+l0%4_8Dn*82a51yljE2J@&F6Fe8H7MQgkxO0-RAwym$;fhOp?#% z`L)~a(qJ&)A`cOd$0?ai^6?mRY}_fN)}Sp8)a!NX^?FAqwbvqEz_zR#q$~()KxC~} z3PlX=zW#)85EAq*~qThECDupENK$!fJCS%d|`dawW{7G<$mkXMA)AR-f~ z!;PD~ASDp##4AWYGU-N0pdEpi5Qr>*01`!L4Z^L}YSpuQ?H85#JHjr$#M*;2xam9jQbO7h!*O0&9p^#F8V a1O5P5s!SSrfoN#}0000sC literal 0 HcmV?d00001 diff --git a/Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 81 (2).png.meta b/Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 81 (2).png.meta new file mode 100644 index 00000000..0b4f4d79 --- /dev/null +++ b/Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 81 (2).png.meta @@ -0,0 +1,130 @@ +fileFormatVersion: 2 +guid: b1b5360f3d07766408505400c3a2758e +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spriteCustomMetadata: + entries: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 88.png b/Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 88.png new file mode 100644 index 0000000000000000000000000000000000000000..c543b0e9c9fdec954339871ba4e91572ee5bc72b GIT binary patch literal 992 zcmV<610Vc}P)(p8!&BwY&j&gX}hRXen7}00{{SL@KDz zrT{4t1%DMtko9Nc$b>=IGXdsE){MvY`1tzX3Tdh``P}RIDk-QBm zs+5BuSX)?F_#M|FkmuySr~xH)+a>Rdikf$+nP_NN6uF}6^he&G9EjA8{Zbs3?1v2t z(xAxwlx(25xVTv0MiW%z=Ih&<87OOhEfflCnqaY5{3mZ02uX3NNPcRoTW?;nhn!N9 zYN*J4mW%?KBZ?!*F7oa2D8#AJ+1V-id|vME?&Rp`NUpE1r3HxEB_%pKI%H^QNRu=5 zfq?z$Dj z+H$#^CJr$o9eJURI`1$pvazw@q>oM(WC99AumsXVoolI7YDmf4+??(oCqZT`bzdGccWD1$Vl%o*M6hx9c8 zL>nYqLXZjBPAmhAAH@+h)@%+Ch?zyw&UhDi3$+OpU!hJCAl?LDBKn$8+vl(^5)m}; z5$dE!MbN+w6yW+>(FLi$NdU4zi4*FyfM7*h^yz5}b&F8u2di7We+(*Q7Pcg#Ah8)f zJUoyvyp-&rLNYT{DK4@|-z8%p+sajcG?9l>m!f0@b}G2dJX~L2|2s1?!|jB8EXc0@ zFqOC@`g}bV9Lf7ayIOrW8wg(NT_;NJFp?H!z+zC5$G;)A2v*{uxx;^j5k!}g#S7>F O0000>vgh z+!wNkYUOgdf(s7F;0lMZ+D6RHkCjU0i38SZwO@3*M9`}j2Knyp;9i03r?+e;`7JQG z_heIHn?n`{$i9jKFiQ4SK+rNf7K>3bnN%Hfxm=XX<#=zV-e{Q|3T*XvQY z+vV5iK7%hx7S7Pcp62<)9h}+zf}qwB2rx#w9n?=``N~JRT2EqHEnW45$P_Qxjm|G#o_8 zk@3j#>2!MO-x>?CR*gm@o?uR=lQNkMcl?qp1q2veL=RW7EH25k5JLzZ*4w!;tV1LW zoWwfBZeR(Zbj%@>>-9RV*XyJ4R4PT$Xq3CwY&NfQ&NM)2;UjFP0x(=duf;V}0O1;5 zj?m$FLulcY5**u#9@h*5O0GdT+Q#ECMIsS??{>R+hDzYrBel9_2oNupl0ohG!disd z?KTHADoucJ0u7riTvHRyWWDDu83pY3`!eLIaEbs<`K7@OX#%|DirH|Gr6-9V{TF~D z*;iu#j>*0fQCWB;oujhXJ}>1x%#BKSMkt eS&9W|o?(I{d`uPEiGuh}TU0xh8IAY&f!|nOWlLzqyi~B}u zV7A-s4t9h<7T0jXstoMS&z(-^P6#wj^Ebtp2w{0(ksq!c?=?t0-g71SqqDe=q$ntJ z$YO)kB@cmlQWrxf#Zg}1I|@iLnWS>LO#A(wX0sXXb~{hIR4PUJ{J*;g_LgP&+Dj8y zEEXx9PKyO|xg5>sbI*kCkcc?r0Xe&M0mq^%ZtDv z_G7VF(0aWViGi@oLYhDTZ%!r?ku>n445SKlfzW=xFG@{RVlC9j_Nc@vP)0__A`qcP z-9w#>iqv}$rKMCVomw0+J1WuyqV1taLnPWCx{C}V3q)Ub`!nhwTHa=}d3}NB;lu;M zXf*n-7t12BK-4&R2QAGFCmy@prk(=qQ;?#`m``MdNqk zBPq(sZFojP5$g18qV820IgM#z~f(CQ&1z3foDa5&ttOP?JcnIU3F=s3

AFPhd+(o%y5a?s3)oG+==yTNV>9-HIoyjco)W|xOzs=m zLD1=Rx;Wv2Os*MEt2MARKX<#`2QC-{!5=bL2(mme$qzSidQGyA_iQKm>oU2IWGUF@ zP{khEiw{Ac?8S3Ql0uG}2{}lrrY52+2q8Rsecz|eW<#UVh>yBZ5=0^3afT859X4g%C<|hZ4F&^Ruh(P( zX~E@k$qNB%4L`X|AuWh0y#{#HMPx4_1oi9(W{A*PcqB_fW7FO5_h=YCk$psHX1c7! zg)UNyECbzEjQsZ?`fzLr$P&a>@XhhX@p$~ZR;%Ikj@}k@SHB)F&Nb1SaVyxP>%x~> zJewz+*Y1u*(L40WTn8+o|9?X~qF7N6&u{n#2B!MC7;b*P00000NkvXXu0mjfZ%a0% literal 0 HcmV?d00001 diff --git a/Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 92.png.meta b/Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 92.png.meta new file mode 100644 index 00000000..b2cac5d3 --- /dev/null +++ b/Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 92.png.meta @@ -0,0 +1,130 @@ +fileFormatVersion: 2 +guid: 338405d6332a3db4b8d80383044bb882 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spriteCustomMetadata: + entries: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 93.png b/Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 93.png new file mode 100644 index 0000000000000000000000000000000000000000..7b63fb14e1f3263d55e9d66ceb981cf07cb8ac4a GIT binary patch literal 878 zcmV-!1CjiRP)q8M zbvPVPxm@mtmVtx*7x$43_{J`8>AZ~Cb07DGD(VIkS7Js#>HOk=n?>w9)9|Rix$_`8 zn7FTG4@&ubzJLoZkcmrg!fG3sH$N2$g(ohsR4V) ziTgk{1$*$5qNWRL#b5i)xC1LOpC>WWI1XUBiyZ4i;jtq2cyxb?!t?tV6RSoolGV*ZMxmA z(7Y8Acz1Wl&xhvMWHRCBUazOw@AZ0jf5R-ob8tSNQ=`$~38793HSKo$ReQNy^26nF zktmjv1WAG9FattgsZ_`cmIXo_7Ga}>*zfn7{vlcj3q)AA4}@p>{l2a}!U}tyWoT#Fzi5FW&XYPA~o zoSDqToP{msFUIQaVWb5jDewSR;NfD;d{SWX&UptB9W7l!D!K zUiehoM01DZko86=YKLx;sDK$TqJRH}ct)}!ANCFY0(vMm+Or5IPyhe`07*qoM6N<$ Eg4ni^7XSbN literal 0 HcmV?d00001 diff --git a/Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 93.png.meta b/Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 93.png.meta new file mode 100644 index 00000000..dfd62292 --- /dev/null +++ b/Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 93.png.meta @@ -0,0 +1,130 @@ +fileFormatVersion: 2 +guid: 481cc16de01ceec409e2290fd0555532 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spriteCustomMetadata: + entries: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 94.png b/Assets/Image/UIIcons/New Folder/TopIcon/New Folder/Group 94.png new file mode 100644 index 0000000000000000000000000000000000000000..fb6005f0112401b8e0ef350a47f41a765c367683 GIT binary patch literal 727 zcmV;|0x127P)D-tzA^Mo-jF;Rr*cA%K?SGv7gN0)>?S%LHxkv zzLOZJ&1SQO16`2G)s5FG46HXlw_2?`T~JlkzvN#aT*?EJ{BULTUY*3_J)24X$xQAe z2@0k;M6p8Rl7(QF#6@{WJ`#;asZ=VRl+WjL8jVJ7E9- z^LZK!2HcWdg4^wurqk)!IuJ=D631RGm&=q+r**mEaL6qvlaJWt03MPD-=f$_4)ptd zibNu=uj7kgDwWcs)h-7xHqS-A9bW_?hgXU5W{x?GNggp1&jn|*nLgiH;T?BYJQu_m z^Aca9*b0`tVzKDB8l59BL5#&*E=QqIh^t*-f|v3p_)>%yftP$Tfmkd?m*85^ zTp4P$8U=}KK}^7Izk;7*x7*QXv*BvvT99{<_X-4wM&dGt;F!ckLuTQg1O^`u!I}!bG7G!i?w?Afg2NknU65V listProducts = new List(); - public Transform productPos; - public UnityEvent onProcessStart; - public UnityEvent onProcessEnd; - int productCount = 0; - float processTime = 0; - float elapsedTime = 0; - ConcurrentQueue dataQueue; - bool startBatch = false; - // Start is called once before the first execution of Update after the MonoBehaviour is created - void Start() - { - - } - - // Update is called once per frame - void Update() - { - if (!startBatch) return; - elapsedTime += Time.deltaTime; - if (elapsedTime > processTime) - { - onProcessEnd?.Invoke(); - startBatch = false; - } - } - protected override IEnumerator RunSimulationCoroutine() - { - yield return new WaitUntil(() => !string.IsNullOrEmpty(nodeID)); - while (dataQueue == null) - { - dataQueue = MQTTDataBase.Instance.GetDataQueue(nodeID); - if (dataQueue == null) - yield return null; - else - break; - } - while (true) - { - if (dataQueue.IsEmpty) - { - yield return null; - continue; - } - if (dataQueue.TryDequeue(out JObject currentData)) - { - string eventKey = "_event"; - if (currentData.ContainsKey(eventKey)) - { - string value = currentData[eventKey].ToString(); - if (value.Contains(eventUsingQueue)) - { - string[] queueIDKey = { "data", "queue_name" }; - string[] loadCountKey = { "data", "required_items" }; - string queueID = GetJsonValue(currentData, queueIDKey)?.ToString(); - int loadCount = GetJsonIntValue(currentData, loadCountKey); - SimulationModel model = DataManager.I.GetModel(queueID); - SimulationModelStore storeModel = (SimulationModelStore)model; - for (int i = 0; i < loadCount; i++) - { - GameObject product = null; - yield return new WaitUntil(() => { - product = storeModel.GetProduct(); - return product != null; - }); - product.transform.parent = productPos; - product.transform.localPosition = Vector3.zero; - product.transform.localRotation = Quaternion.identity; - listProducts.Add(product); - } - } - else if (value.Contains(eventUsingStore)) - { - string[] queueIDKey = { "data", "store_name" }; - string[] loadCountKey = { "data", "required_items" }; - string queueID = GetJsonValue(currentData, queueIDKey)?.ToString(); - int loadCount = GetJsonIntValue(currentData, loadCountKey); - SimulationModel model = DataManager.I.GetModel(queueID); - SimulationModelStore storeModel = (SimulationModelStore)model; - for (int i = 0; i < loadCount; i++) - { - GameObject product = null; - yield return new WaitUntil(() => { - product = storeModel.GetProduct(); - return product != null; - }); - product.transform.parent = productPos; - product.transform.localPosition = Vector3.zero; - product.transform.localRotation = Quaternion.identity; - listProducts.Add(product); - } - } - else if (value.Contains(eventStartBatch)) - { - string[] productCountKey = { "data", "product_count" }; - string[] processTimeKey = { "data", "processing_time" }; - int productCount = GetJsonIntValue(currentData, productCountKey); - processTime = GetJsonFloatValue(currentData, processTimeKey); - elapsedTime = 0; - startBatch = true; - onProcessStart?.Invoke(); - } - else if (value.Contains(eventOutputQueue)) - { - string[] outputQueueKey = { "data", "queue_name" }; - string[] productCountKey = { "data", "products_to_add" }; - string queueID = GetJsonValue(currentData, outputQueueKey)?.ToString(); - int productCount = GetJsonIntValue(currentData, productCountKey); - SimulationModel model = DataManager.I.GetModel(queueID); - SimulationModelStore storeModel = (SimulationModelStore)model; - for (int i = 0; i < productCount; i++) - { - if (listProducts.Count > 0) - { - GameObject product = listProducts[0]; - storeModel.StoreProduct(product); - listProducts.Remove(product); - } - else - { - Debug.LogWarning("Trying to unload from empty transporter : " + nodeID); - } - } - } - } - } - yield return null; - } - yield return null; - } -} diff --git a/Assets/Scripts/SimulationModels/SimulationModelProduct.cs b/Assets/Scripts/SimulationModels/SimulationModelProduct.cs index 13f1aaed..00d0e827 100644 --- a/Assets/Scripts/SimulationModels/SimulationModelProduct.cs +++ b/Assets/Scripts/SimulationModels/SimulationModelProduct.cs @@ -1,5 +1,9 @@ using UnityEngine; public class SimulationModelProduct : SimulationModel -{ +{ + public override void GetData(string data) + { + throw new System.NotImplementedException(); + } } diff --git a/Assets/Scripts/SimulationModels/SimulationModelResource.cs b/Assets/Scripts/SimulationModels/SimulationModelResource.cs index 21d13b99..58d99286 100644 --- a/Assets/Scripts/SimulationModels/SimulationModelResource.cs +++ b/Assets/Scripts/SimulationModels/SimulationModelResource.cs @@ -2,15 +2,8 @@ using UnityEngine; public class SimulationModelResource : SimulationModel { - // Start is called once before the first execution of Update after the MonoBehaviour is created - void Start() + public override void GetData(string data) { - - } - - // Update is called once per frame - void Update() - { - + throw new System.NotImplementedException(); } } diff --git a/Assets/Scripts/SimulationModels/SimulationModelSink.cs b/Assets/Scripts/SimulationModels/SimulationModelSink.cs deleted file mode 100644 index b28355bc..00000000 --- a/Assets/Scripts/SimulationModels/SimulationModelSink.cs +++ /dev/null @@ -1,73 +0,0 @@ -using Newtonsoft.Json.Linq; -using System.Collections.Concurrent; -using UnityEngine; -using System.Collections; -using Octopus.Simulator.Networks; - -public class SimulationModelSink : SimulationModel -{ - public string eventShipItem = "items_shipped_successfully"; - public string eventRemoveItem = "item_removed_from_queue"; - public int totalShipped = 0; - ConcurrentQueue dataQueue; - // Start is called once before the first execution of Update after the MonoBehaviour is created - void Start() - { - - } - - // Update is called once per frame - void Update() - { - - } - protected override IEnumerator RunSimulationCoroutine() - { - yield return new WaitUntil(() => !string.IsNullOrEmpty(nodeID)); - while (dataQueue == null) - { - dataQueue = MQTTDataBase.Instance.GetDataQueue(nodeID); - if (dataQueue == null) - yield return null; - else - break; - } - while (true) - { - if (dataQueue.IsEmpty) - { - yield return null; - continue; - } - if (dataQueue.TryDequeue(out JObject currentData)) - { - string eventKey = "_event"; - if (currentData.ContainsKey(eventKey)) - { - string value = currentData[eventKey].ToString(); - if (value.Contains(eventShipItem)) - { - - } - else if (value.Contains(eventRemoveItem)) - { - string[] queueIDKey = { "data", "queue_name" }; - string[] queueRemainKey = { "data", "remaining_queue_length" }; - string queueID = GetJsonValue(currentData, queueIDKey)?.ToString(); - int queueCapacity = GetJsonIntValue(currentData, queueRemainKey); - SimulationModel model = DataManager.I.GetModel(queueID); - SimulationModelStore storeModel = (SimulationModelStore)model; - while (storeModel.storedProducts.Count > queueCapacity) - { - //Destroy(storeModel.GetProduct()); - totalShipped++; - yield return null; - } - } - } - } - yield return null; - } - yield return null; - } -} diff --git a/Assets/Scripts/SimulationModels/SimulationModelSource.cs b/Assets/Scripts/SimulationModels/SimulationModelSource.cs deleted file mode 100644 index 77790902..00000000 --- a/Assets/Scripts/SimulationModels/SimulationModelSource.cs +++ /dev/null @@ -1,115 +0,0 @@ -using System.Collections.Concurrent; -using System.Collections.Generic; -using UnityEngine; -using System.Collections; -using Newtonsoft.Json.Linq; -using Octopus.Simulator.Networks; - -public class SimulationModelSource : SimulationModel -{ - public string eventGenerateProduct = "product_generated"; - public string eventGenerateDefect = "product_defective"; - public string eventQueueProduct = "product_queued"; - public GameObject productPrefab; - public GameObject defectPrefab; - public List listProducts = new List(); - public List listDefects = new List(); - public Transform productPos; - public Vector3 productDistance = new Vector3(0, 0.321f, 0); - //ConcurrentQueue> dataQueue; - ConcurrentQueue dataQueue; - int productCount = 0; - int defectCount = 0; - void Update() - { - int interval = 0; - if (productCount != listProducts.Count) - { - productCount = listProducts.Count; - for (int i = 0; i < productCount; i++) - { - GameObject gb = listProducts[i]; - gb.transform.localPosition = productDistance * interval; - interval++; - } - } - if (defectCount != listDefects.Count) - { - defectCount = listDefects.Count; - for (int i = 0; i < defectCount; i++) - { - GameObject gb = listDefects[i]; - gb.transform.localPosition = productDistance * interval; - interval++; - } - } - } - protected override IEnumerator RunSimulationCoroutine() - { - yield return new WaitUntil(() => !string.IsNullOrEmpty(nodeID)); - while (dataQueue == null) - { - dataQueue = MQTTDataBase.Instance.GetDataQueue(nodeID); - if (dataQueue == null) - yield return null; - else - break; - } - while (true) - { - if (dataQueue.IsEmpty) - { - yield return null; - continue; - } - if (dataQueue.TryDequeue(out JObject currentData)) - { - string eventKey = "_event"; - if (currentData.ContainsKey(eventKey)) - { - string value = currentData[eventKey].ToString(); - if (value.Contains(eventGenerateProduct)) - { - GameObject gb = Instantiate(productPrefab, productPos); - listProducts.Add(gb); - } - else if (value.Contains(eventGenerateDefect)) - { - GameObject gb = Instantiate(defectPrefab, productPos); - listProducts.Add(gb); - } - else if (value.Contains(eventQueueProduct)) - { - string[] queueIDKey = { "data", "queue" }; - string[] capacityKey = { "data", "queue_length" }; - string[] storeTypeKey = { "data", "queue_type" }; - string queueID = GetJsonValue(currentData, queueIDKey)?.ToString(); - int queueCapacity = GetJsonIntValue(currentData, capacityKey); - string storeType = GetJsonValue(currentData, storeTypeKey)?.ToString(); - SimulationModel model = DataManager.I.GetModel(queueID); - GameObject product = null; - if (listProducts.Count > 0) - { - product = listProducts[0]; - listProducts.Remove(product); - } - else if (listDefects.Count > 0) - { - product = listDefects[0]; - listDefects.Remove(product); - } - if (model != null && product != null) - { - SimulationModelStore storeModel = (SimulationModelStore)model; - storeModel.maxCapacity = queueCapacity; - storeModel.storeType = storeType; - storeModel.StoreProduct(product); - } - } - } - } - yield return null; - } - yield return null; - } -} diff --git a/Assets/WorkSpace/LH/LogicData/BackUp/Source_Pallet 1.prefab b/Assets/WorkSpace/LH/LogicData/BackUp/Source_Pallet 1.prefab new file mode 100644 index 00000000..61193547 --- /dev/null +++ b/Assets/WorkSpace/LH/LogicData/BackUp/Source_Pallet 1.prefab @@ -0,0 +1,154 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &6559360343920525660 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7374929338666446432} + m_Layer: 0 + m_Name: Models + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &7374929338666446432 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6559360343920525660} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 6052881152895185930} + m_Father: {fileID: 6733763396490065076} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &8981091474273742600 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6733763396490065076} + - component: {fileID: 3778496298057829303} + m_Layer: 0 + m_Name: Source_Pallet 1 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6733763396490065076 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8981091474273742600} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 7374929338666446432} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &3778496298057829303 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8981091474273742600} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b2c92ea944db86b48b0e0b711555ea37, type: 3} + m_Name: + m_EditorClassIdentifier: + modelName: Pallet + modelType: 1 + modelID: + nodeID: + eventGenerateProduct: product_generated + eventGenerateDefect: product_defective + eventQueueProduct: product_queued + productPrefab: {fileID: 3554305899873773484, guid: a0607d71a04b3f4459be2d9646fcb429, type: 3} + defectPrefab: {fileID: 3554305899873773484, guid: cdaf18132be58d64ebab6d9d81fffbd9, type: 3} + listProducts: [] + listDefects: [] + productPos: {fileID: 0} + productDistance: {x: 0, y: 0.321, z: 0} +--- !u!1001 &1125099510866031357 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 7374929338666446432} + m_Modifications: + - target: {fileID: 5825089394656910413, guid: 71cb5b14e9e72d047acd0f48e86dbccc, type: 3} + propertyPath: m_Name + value: "\uD314\uB81B\uD2B8" + objectReference: {fileID: 0} + - target: {fileID: 6601449523113608951, guid: 71cb5b14e9e72d047acd0f48e86dbccc, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6601449523113608951, guid: 71cb5b14e9e72d047acd0f48e86dbccc, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6601449523113608951, guid: 71cb5b14e9e72d047acd0f48e86dbccc, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6601449523113608951, guid: 71cb5b14e9e72d047acd0f48e86dbccc, type: 3} + propertyPath: m_LocalRotation.w + value: 0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 6601449523113608951, guid: 71cb5b14e9e72d047acd0f48e86dbccc, type: 3} + propertyPath: m_LocalRotation.x + value: -0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 6601449523113608951, guid: 71cb5b14e9e72d047acd0f48e86dbccc, type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 6601449523113608951, guid: 71cb5b14e9e72d047acd0f48e86dbccc, type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 6601449523113608951, guid: 71cb5b14e9e72d047acd0f48e86dbccc, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6601449523113608951, guid: 71cb5b14e9e72d047acd0f48e86dbccc, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6601449523113608951, guid: 71cb5b14e9e72d047acd0f48e86dbccc, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 71cb5b14e9e72d047acd0f48e86dbccc, type: 3} +--- !u!4 &6052881152895185930 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 6601449523113608951, guid: 71cb5b14e9e72d047acd0f48e86dbccc, type: 3} + m_PrefabInstance: {fileID: 1125099510866031357} + m_PrefabAsset: {fileID: 0} diff --git a/Assets/WorkSpace/LH/LogicData/BackUp/Source_Pallet 1.prefab.meta b/Assets/WorkSpace/LH/LogicData/BackUp/Source_Pallet 1.prefab.meta new file mode 100644 index 00000000..042b4c29 --- /dev/null +++ b/Assets/WorkSpace/LH/LogicData/BackUp/Source_Pallet 1.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 06b98fd7ba214da4ebafbbb341ef802a +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WorkSpace/LH/LogicData/LogicItemButton.cs b/Assets/WorkSpace/LH/LogicData/LogicItemButton.cs index 44765f1c..da373f0d 100644 --- a/Assets/WorkSpace/LH/LogicData/LogicItemButton.cs +++ b/Assets/WorkSpace/LH/LogicData/LogicItemButton.cs @@ -37,10 +37,10 @@ namespace Octopus.Simulator }; componentMap = new Dictionary() { - { ComponentType.Product_Generator,productGeneratorIcon }, + { ComponentType.Source,productGeneratorIcon }, { ComponentType.Processor,processorIcon }, - { ComponentType.Transporter,transporterIcon }, - { ComponentType.Shipment,shipmentIcon }, + { ComponentType.Move,transporterIcon }, + { ComponentType.Sink,shipmentIcon }, { ComponentType.Conveyor,transporterIcon }, }; diff --git a/Assets/WorkSpace/LH/LogicInfo.cs b/Assets/WorkSpace/LH/LogicInfo.cs index eca69c15..9f6e0ad9 100644 --- a/Assets/WorkSpace/LH/LogicInfo.cs +++ b/Assets/WorkSpace/LH/LogicInfo.cs @@ -133,10 +133,10 @@ namespace Octopus.Simulator public enum ComponentType { - Product_Generator, + Source, Processor, - Transporter, - Shipment, + Move, + Sink, Conveyor } @@ -205,7 +205,7 @@ namespace Octopus.Simulator } [Serializable] - public class ProductGenerator : ILogicComponent + public class Source : ILogicComponent { public string name; public int? rate=0; @@ -222,7 +222,7 @@ namespace Octopus.Simulator public override string Name => name; public override string Description => description; public override string Label => label; - public override ComponentType Type => ComponentType.Product_Generator; + public override ComponentType Type => ComponentType.Source; } [Serializable] @@ -246,42 +246,42 @@ namespace Octopus.Simulator } [Serializable] - public class Transporter : ILogicComponent + public class Move : ILogicComponent { public string name; public string description; public string label; - public int? transport_time = 0; - public float? transport_distance = 0f; - public float? movement_speed = 0f; + public int? move_time = 0; + public float? move_distance = 0f; + public float? move_speed = 0f; public int? capacity = 0; public string input_queue; public string output_queue; public string defect_queue; public string required_resource; - public string transporter_type; + public string move_type; public float return_time; public int min_batch_size; public override string Name => name; public override string Description => description; public override string Label => label; - public override ComponentType Type => ComponentType.Transporter; + public override ComponentType Type => ComponentType.Move; } [Serializable] - public class Shipment : ILogicComponent + public class Sink : ILogicComponent { public string? name; public string? description; public string? label; - public int? shipping_interval = 0; - public int? shipping_amount = 0; + public int? sinking_interval = 0; + public int? sinking_amount = 0; public List? input_queues; public override string? Name => name; public override string? Description => description; public override string? Label => label; - public override ComponentType Type => ComponentType.Shipment; + public override ComponentType Type => ComponentType.Sink; } [Serializable] @@ -290,7 +290,7 @@ namespace Octopus.Simulator public string name; public string description; public string label; - public int move_time; + public int? move_time=0; public float belt_speed; public int? capacity = 0; public string input_queue; @@ -488,12 +488,11 @@ namespace Octopus.Simulator // ŸÀÔº° ÀνºÅϽº »ý¼º ILogicComponent comp = type switch { - "product_generator" => new ProductGenerator(), + "source" => new Source(), "processor" => new Processor(), - "transporter" => new Transporter(), - "shipment" => new Shipment(), + "move" => new Move(), + "sink" => new Sink(), "conveyor" => new Conveyor(), - "store" => new Conveyor(), _ => throw new NotSupportedException($"Áö¿øÇÏÁö ¾Ê´Â component type: {type}") }; diff --git a/Assets/WorkSpace/LH/LogicMappingDataBase.cs b/Assets/WorkSpace/LH/LogicMappingDataBase.cs index 413c49a4..920fb7a6 100644 --- a/Assets/WorkSpace/LH/LogicMappingDataBase.cs +++ b/Assets/WorkSpace/LH/LogicMappingDataBase.cs @@ -15,17 +15,14 @@ namespace Octopus.Simulator { mappingObjectDict[name] = target; target.nodeID = name; - target.SetPopupData(); } else { - mappingObjectDict[name].DeletePopupData(); mappingObjectDict.Remove(name); } } else { - target.SetPopupData(); mappingObjectDict.Add(name, target); target.nodeID = name; } diff --git a/Assets/WorkSpace/LH/MQTTDataBase.cs b/Assets/WorkSpace/LH/MQTTDataBase.cs index 8e978e6c..11670731 100644 --- a/Assets/WorkSpace/LH/MQTTDataBase.cs +++ b/Assets/WorkSpace/LH/MQTTDataBase.cs @@ -20,7 +20,7 @@ namespace Octopus.Simulator.Networks public void AddDict(string key, string value) { - Debug.Log("#### : " + key + " : " + value); + //Debug.Log("#### : " + key + " : " + value); JObject json = JObject.Parse(value); var queue = mqttData.GetOrAdd(key, _ => new ConcurrentQueue()); queue.Enqueue(json); diff --git a/Assets/WorkSpace/LH/MQTTManager.cs b/Assets/WorkSpace/LH/MQTTManager.cs index c4b19f13..57079bed 100644 --- a/Assets/WorkSpace/LH/MQTTManager.cs +++ b/Assets/WorkSpace/LH/MQTTManager.cs @@ -14,6 +14,7 @@ namespace Octopus.Simulator.Networks public static MQTTManager mqttManager; public Dictionary clientTable = new Dictionary(); public BaseSimulationMessage basemessage; + public MQTTDataDistributer distributer; public event Action onMessageReceived; @@ -31,6 +32,11 @@ namespace Octopus.Simulator.Networks SetMqttConfig(); } + private void Start() + { + distributer = MQTTDataDistributer.Instance; + } + public void SetMqttConfig() { TextAsset json = Resources.Load(MQTTpath); @@ -116,6 +122,7 @@ namespace Octopus.Simulator.Networks { basemessage = JsonConvert.DeserializeObject(payload); MQTTDataBase.Instance.AddDict(basemessage.component_id, payload); + distributer.Distribute(basemessage.component_id, payload); } if (topicName.Contains("middleware")) { diff --git a/Assets/WorkSpace/LH/Manager.prefab b/Assets/WorkSpace/LH/Manager.prefab index 922def46..97cdd1e1 100644 --- a/Assets/WorkSpace/LH/Manager.prefab +++ b/Assets/WorkSpace/LH/Manager.prefab @@ -14,6 +14,7 @@ GameObject: - component: {fileID: 6191105916327120908} - component: {fileID: 8343195631698366838} - component: {fileID: 3408166986665272114} + - component: {fileID: 5971518917654927081} m_Layer: 0 m_Name: NetworkManager m_TagString: Untagged @@ -50,8 +51,8 @@ MonoBehaviour: m_EditorClassIdentifier: basemessage: component_id: + distributer: {fileID: 0} MQTTpath: MQTTConfig - _topic: --- !u!114 &8164125700257988699 MonoBehaviour: m_ObjectHideFlags: 0 @@ -106,12 +107,6 @@ MonoBehaviour: config: nodes: [] edges: [] - UIPrefabPath: UIPrefab - LogicPrefab: {fileID: 0} - LinePrefab: {fileID: 0} - LogicWindow: {fileID: 0} - LogicContent: {fileID: 0} - backGround: {fileID: 0} references: version: 2 RefIds: [] @@ -142,6 +137,18 @@ MonoBehaviour: text: {fileID: 0} projectMenuButton: {fileID: 0} menuPanel: {fileID: 0} +--- !u!114 &5971518917654927081 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1392524223077930677} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71e088f68ecd7ca4d96932d185270f94, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &2069922514250663687 GameObject: m_ObjectHideFlags: 0 @@ -152,6 +159,7 @@ GameObject: m_Component: - component: {fileID: 5366961481726599031} - component: {fileID: 4739726380097546759} + - component: {fileID: 760967818649470882} m_Layer: 0 m_Name: Manager m_TagString: Untagged @@ -194,6 +202,18 @@ MonoBehaviour: logicId: simulationId: modelId: +--- !u!114 &760967818649470882 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2069922514250663687} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7625fed507a93284c98c450bebdc4ce9, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &6518512601816170710 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/WorkSpace/LH/Simulation.meta b/Assets/WorkSpace/LH/Simulation.meta new file mode 100644 index 00000000..f76df02c --- /dev/null +++ b/Assets/WorkSpace/LH/Simulation.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 35f1365f676483d4f954575ec13c4fbe +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WorkSpace/LH/Simulation/MQTTDataDistributer.cs b/Assets/WorkSpace/LH/Simulation/MQTTDataDistributer.cs new file mode 100644 index 00000000..8e660233 --- /dev/null +++ b/Assets/WorkSpace/LH/Simulation/MQTTDataDistributer.cs @@ -0,0 +1,22 @@ +using Octopus.Simulator; +using UnityEngine; + +public class MQTTDataDistributer : MonoBehaviour +{ + public static MQTTDataDistributer Instance; + // Start is called once before the first execution of Update after the MonoBehaviour is created + + private void Awake() + { + Instance = this; + } + + public void Distribute(string id, string data) + { + var simulationModel = LogicMappingDataBase.GetGameObject(id); + if (simulationModel) + { + simulationModel.GetData(data); + } + } +} diff --git a/Assets/WorkSpace/LH/Simulation/MQTTDataDistributer.cs.meta b/Assets/WorkSpace/LH/Simulation/MQTTDataDistributer.cs.meta new file mode 100644 index 00000000..03f192b1 --- /dev/null +++ b/Assets/WorkSpace/LH/Simulation/MQTTDataDistributer.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 71e088f68ecd7ca4d96932d185270f94 \ No newline at end of file diff --git a/Assets/WorkSpace/LH/Simulation/SimulationDefaultJson.cs b/Assets/WorkSpace/LH/Simulation/SimulationDefaultJson.cs new file mode 100644 index 00000000..32398db9 --- /dev/null +++ b/Assets/WorkSpace/LH/Simulation/SimulationDefaultJson.cs @@ -0,0 +1,12 @@ +using UnityEngine; +using System; + +[Serializable] +public class SimulationDefaultJson +{ + public string type; + public string _event; + public string component_type; + public string component_id; + public object data; +} diff --git a/Assets/WorkSpace/LH/Simulation/SimulationDefaultJson.cs.meta b/Assets/WorkSpace/LH/Simulation/SimulationDefaultJson.cs.meta new file mode 100644 index 00000000..cb719f83 --- /dev/null +++ b/Assets/WorkSpace/LH/Simulation/SimulationDefaultJson.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 1af3e01803c699841954328518aedbd9 \ No newline at end of file diff --git a/Assets/Scripts/SimulationModels/SimulationModel.cs b/Assets/WorkSpace/LH/Simulation/SimulationModel.cs similarity index 54% rename from Assets/Scripts/SimulationModels/SimulationModel.cs rename to Assets/WorkSpace/LH/Simulation/SimulationModel.cs index ebf3b8e7..6591232d 100644 --- a/Assets/Scripts/SimulationModels/SimulationModel.cs +++ b/Assets/WorkSpace/LH/Simulation/SimulationModel.cs @@ -1,6 +1,5 @@ using UnityEngine; using System.Collections; -using Newtonsoft.Json.Linq; using Newtonsoft.Json; using System.Collections.Generic; using Octopus.Simulator; @@ -18,12 +17,13 @@ public enum SimulationModelType Sink } -public class SimulationModel : MonoBehaviour, IClickable +public abstract class SimulationModel : MonoBehaviour, IClickable { public string modelName; public SimulationModelType modelType; public string modelID; public string nodeID; + public string eventKey; private bool isQuitting = false; public Action onModelClicked; void Awake() @@ -54,7 +54,6 @@ public class SimulationModel : MonoBehaviour, IClickable } public void OnClick() { - //Debug.Log("Clicked : " + gameObject.name); onModelClicked?.Invoke(this); } void FitCollider() @@ -76,66 +75,6 @@ public class SimulationModel : MonoBehaviour, IClickable { yield return null; } - public object GetJsonValue(JToken token, IEnumerable path) - { - foreach (var key in path) - { - if (token == null) return null; - token = token[key]; - } - return token; - } - public JArray GetJsonArray(JToken token, IEnumerable path) - { - foreach (var key in path) - { - if (token == null) return null; - token = token[key]; - } - return token as JArray; - } - public int GetJsonIntValue(JToken token, IEnumerable path) - { - int value = 0; - foreach (var key in path) - { - if (token == null) return 0; - token = token[key]; - } - if (token != null && int.TryParse(token.ToString(), out value)) - { - return value; - } - return 0; - } - public float GetJsonFloatValue(JToken token, IEnumerable path) - { - float value = 0; - foreach (var key in path) - { - if (token == null) return 0; - token = token[key]; - } - if (token != null && float.TryParse(token.ToString(), out value)) - { - return value; - } - return 0; - } - public void UpdatePopupData(string json) - { - var wrapper=JsonConvert.DeserializeObject(json); - - } - - public void SetPopupData() - { - var ldmanager = FindAnyObjectByType(); - } - - public void DeletePopupData() - { - - } + public abstract void GetData(string data); } diff --git a/Assets/Scripts/SimulationModels/SimulationModel.cs.meta b/Assets/WorkSpace/LH/Simulation/SimulationModel.cs.meta similarity index 100% rename from Assets/Scripts/SimulationModels/SimulationModel.cs.meta rename to Assets/WorkSpace/LH/Simulation/SimulationModel.cs.meta diff --git a/Assets/Scripts/SimulationModels/SimulationModelConveyor.cs b/Assets/WorkSpace/LH/Simulation/SimulationModelConveyor.cs similarity index 69% rename from Assets/Scripts/SimulationModels/SimulationModelConveyor.cs rename to Assets/WorkSpace/LH/Simulation/SimulationModelConveyor.cs index a4215457..891f7e09 100644 --- a/Assets/Scripts/SimulationModels/SimulationModelConveyor.cs +++ b/Assets/WorkSpace/LH/Simulation/SimulationModelConveyor.cs @@ -6,6 +6,7 @@ using System.Collections; using Newtonsoft.Json.Linq; using System.Collections.Concurrent; using Octopus.Simulator.Networks; +using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs; public class SimulationModelConveyor : SimulationModel { @@ -28,7 +29,7 @@ public class SimulationModelConveyor : SimulationModel // Update is called once per frame void Update() { - if ( moveTargetCargo != null) + if (moveTargetCargo != null) { startPosition = this.transform.Find(nameof(startPosition)).transform.position; endPosition = this.transform.Find(nameof(endPosition)).transform.position; @@ -39,7 +40,7 @@ public class SimulationModelConveyor : SimulationModel { moveTargetCargo.transform.position = Vector3.Lerp(startPosition, endPosition, elapseTime / transportTime); } - else if ( elapseTime > transportTime ) + else if (elapseTime > transportTime) { moveTargetCargo = null; elapseTime = 0; @@ -48,7 +49,7 @@ public class SimulationModelConveyor : SimulationModel } } - + /* protected override IEnumerator RunSimulationCoroutine() { yield return new WaitUntil(() => !string.IsNullOrEmpty(nodeID)); @@ -174,6 +175,100 @@ public class SimulationModelConveyor : SimulationModel } } + */ + public override void GetData(string data) + { + var wrapclass = JsonConvert.DeserializeObject(data); + + if (wrapclass._event.Contains("conveyor_started")) + { + ConveyorStartedEventMessage startDataMessage + = JsonConvert.DeserializeObject(data); + + Debug.Log("conveyor"+startDataMessage.Data.InputQueues.ToString() + this.name); + + transportTime = (int)startDataMessage.Data.MoveTime; + + if (startDataMessage.Data.InputQueues.Count != 0) + { + inputQueueID = startDataMessage.Data.InputQueues[0].Queue; + } + + if (startDataMessage.Data.InputStores.Count != 0) + { + inputStoreID = startDataMessage.Data.InputStores[0].Queue; + } + } + + if (wrapclass._event.Contains("conveyor_loading")) + { + //targetCargo = Instantiate(this.gameObject); + //var resourcePath = "Models"; + //var tmpModel = Resources.Load(string.Format("{0}/{1}", resourcePath, "Box_Pallet")); + //targetCargo = Instantiate(tmpModel); + + SimulationModel model; + Debug.Log($"queue{inputQueueID}"); + Debug.Log($"store{inputStoreID}"); + if (!string.IsNullOrEmpty(inputQueueID)) + { + model = DataManager.I.GetModel(inputQueueID); + } + else + { + model = DataManager.I.GetModel(inputStoreID); + } + + SimulationModelStore storeModel = model.GetComponent(); + + if (moveTargetCargo == null) + { + moveTargetCargo = storeModel.GetProduct(); + storedCargo = moveTargetCargo; + + moveTargetCargo.transform.position = startPosition; + moveTargetCargo.transform.rotation = Quaternion.identity; + } + + ConveyorLoadingEventMessage message + = JsonConvert.DeserializeObject(data); + Debug.Log(message); + + } + + if (wrapclass._event.Contains("conveyor_unloading")) + { + Debug.Log("unloading"); + if (wrapclass._event.Contains("_to_queue")) + { + ConveyorUnloadingToQueueEventMessage message + = JsonConvert.DeserializeObject(data); + + string destinationID = message.Data.QueueName; + + SimulationModel model = DataManager.I.GetModel(destinationID); + SimulationModelStore storemodel = model.GetComponent(); + + storemodel.StoreProduct(storedCargo); + storedCargo = null; + } + + else if (wrapclass._event.Contains("_to_store")) + { + ConveyorUnloadingToStoreEventMessage message + = JsonConvert.DeserializeObject(data); + + + string destinationID = message.Data.StoreName; + + SimulationModel model = DataManager.I.GetModel(destinationID); + SimulationModelStore storemodel = model.GetComponent(); + + storemodel.StoreProduct(storedCargo); + storedCargo = null; + } + } + } } [Serializable] @@ -418,7 +513,7 @@ public class ConveyorStartedData public string? ConveyorLabel { get; set; } [JsonProperty("move_time")] - public int? MoveTime { get; set; } + public float? MoveTime { get; set; } [JsonProperty("belt_speed")] public float? BeltSpeed { get; set; } @@ -530,122 +625,122 @@ public class ConveyorLoadingData } [Serializable] - public class ConveyorEventMessage - { - [JsonProperty("type")] - public string? Type { get; set; } +public class ConveyorEventMessage +{ + [JsonProperty("type")] + public string? Type { get; set; } - [JsonProperty("_event")] - public string? Event { get; set; } + [JsonProperty("_event")] + public string? Event { get; set; } - [JsonProperty("component_type")] - public string? ComponentType { get; set; } + [JsonProperty("component_type")] + public string? ComponentType { get; set; } - [JsonProperty("component_id")] - public string? ComponentId { get; set; } + [JsonProperty("component_id")] + public string? ComponentId { get; set; } - [JsonProperty("component_label")] - public string? ComponentLabel { get; set; } + [JsonProperty("component_label")] + public string? ComponentLabel { get; set; } - [JsonProperty("simulation_time")] - public float? SimulationTime { get; set; } + [JsonProperty("simulation_time")] + public float? SimulationTime { get; set; } - [JsonProperty("data")] - public ConveyorEventData? Data { get; set; } - } + [JsonProperty("data")] + public ConveyorEventData? Data { get; set; } +} - [Serializable] - public class ConveyorEventData - { - [JsonProperty("conveyor_id")] - public string? ConveyorId { get; set; } +[Serializable] +public class ConveyorEventData +{ + [JsonProperty("conveyor_id")] + public string? ConveyorId { get; set; } - [JsonProperty("conveyor_label")] - public string? ConveyorLabel { get; set; } + [JsonProperty("conveyor_label")] + public string? ConveyorLabel { get; set; } - [JsonProperty("move_time")] - public int? MoveTime { get; set; } + [JsonProperty("move_time")] + public int? MoveTime { get; set; } - [JsonProperty("belt_speed")] - public float? BeltSpeed { get; set; } + [JsonProperty("belt_speed")] + public float? BeltSpeed { get; set; } - [JsonProperty("belt_length")] - public float? BeltLength { get; set; } + [JsonProperty("belt_length")] + public float? BeltLength { get; set; } - [JsonProperty("capacity")] - public int? Capacity { get; set; } + [JsonProperty("capacity")] + public int? Capacity { get; set; } - [JsonProperty("min_gap")] - public float? MinGap { get; set; } + [JsonProperty("min_gap")] + public float? MinGap { get; set; } - [JsonProperty("input_queues")] - public List? InputQueues { get; set; } + [JsonProperty("input_queues")] + public List? InputQueues { get; set; } - [JsonProperty("output_queue")] - public string? OutputQueue { get; set; } + [JsonProperty("output_queue")] + public string? OutputQueue { get; set; } - [JsonProperty("defect_queue")] - public string? DefectQueue { get; set; } + [JsonProperty("defect_queue")] + public string? DefectQueue { get; set; } - [JsonProperty("required_resource")] - public string? RequiredResource { get; set; } + [JsonProperty("required_resource")] + public string? RequiredResource { get; set; } - [JsonProperty("items_on_belt")] - public int? ItemsOnBelt { get; set; } - } + [JsonProperty("items_on_belt")] + public int? ItemsOnBelt { get; set; } +} - [Serializable] - public class ConveyorMovingEventMessage - { - [JsonProperty("type")] - public string? Type { get; set; } +[Serializable] +public class ConveyorMovingEventMessage +{ + [JsonProperty("type")] + public string? Type { get; set; } - [JsonProperty("_event")] - public string? Event { get; set; } + [JsonProperty("_event")] + public string? Event { get; set; } - [JsonProperty("component_type")] - public string? ComponentType { get; set; } + [JsonProperty("component_type")] + public string? ComponentType { get; set; } - [JsonProperty("component_id")] - public string? ComponentId { get; set; } + [JsonProperty("component_id")] + public string? ComponentId { get; set; } - [JsonProperty("component_label")] - public string? ComponentLabel { get; set; } + [JsonProperty("component_label")] + public string? ComponentLabel { get; set; } - [JsonProperty("simulation_time")] - public float? SimulationTime { get; set; } + [JsonProperty("simulation_time")] + public float? SimulationTime { get; set; } - [JsonProperty("data")] - public ConveyorMovingData? Data { get; set; } - } + [JsonProperty("data")] + public ConveyorMovingData? Data { get; set; } +} - [Serializable] - public class ConveyorMovingData - { - [JsonProperty("item_positions")] - public List? ItemPositions { get; set; } +[Serializable] +public class ConveyorMovingData +{ + [JsonProperty("item_positions")] + public List? ItemPositions { get; set; } - [JsonProperty("average_position")] - public float? AveragePosition { get; set; } + [JsonProperty("average_position")] + public float? AveragePosition { get; set; } - [JsonProperty("current_speed")] - public float? CurrentSpeed { get; set; } + [JsonProperty("current_speed")] + public float? CurrentSpeed { get; set; } - [JsonProperty("conveyor_id")] - public string? ConveyorId { get; set; } + [JsonProperty("conveyor_id")] + public string? ConveyorId { get; set; } - [JsonProperty("conveyor_label")] - public string? ConveyorLabel { get; set; } + [JsonProperty("conveyor_label")] + public string? ConveyorLabel { get; set; } - [JsonProperty("belt_speed")] - public float? BeltSpeed { get; set; } + [JsonProperty("belt_speed")] + public float? BeltSpeed { get; set; } - [JsonProperty("belt_length")] - public float? BeltLength { get; set; } + [JsonProperty("belt_length")] + public float? BeltLength { get; set; } - [JsonProperty("capacity")] - public int? Capacity { get; set; } + [JsonProperty("capacity")] + public int? Capacity { get; set; } - [JsonProperty("items_on_belt")] - public int? ItemsOnBelt { get; set; } - } + [JsonProperty("items_on_belt")] + public int? ItemsOnBelt { get; set; } +} diff --git a/Assets/Scripts/SimulationModels/SimulationModelConveyor.cs.meta b/Assets/WorkSpace/LH/Simulation/SimulationModelConveyor.cs.meta similarity index 100% rename from Assets/Scripts/SimulationModels/SimulationModelConveyor.cs.meta rename to Assets/WorkSpace/LH/Simulation/SimulationModelConveyor.cs.meta diff --git a/Assets/Scripts/SimulationModels/SimulationModelMove.cs b/Assets/WorkSpace/LH/Simulation/SimulationModelMove.cs similarity index 56% rename from Assets/Scripts/SimulationModels/SimulationModelMove.cs rename to Assets/WorkSpace/LH/Simulation/SimulationModelMove.cs index ae78d334..094e7002 100644 --- a/Assets/Scripts/SimulationModels/SimulationModelMove.cs +++ b/Assets/WorkSpace/LH/Simulation/SimulationModelMove.cs @@ -1,18 +1,133 @@ using Newtonsoft.Json.Linq; using UnityEngine; -using System.Collections; +using System; using System.Collections.Concurrent; using System.Collections.Generic; using UnityEngine.Events; using Octopus.Simulator.Networks; +using Newtonsoft.Json; + +[Serializable] +public class MoveDataClass_start +{ + public string move_id; + public string move_label; + public string type; + public float move_time; + public int capacity; + public int products_per_batch; + public List input_queues; + public string output_queue; + public string defect_queue; + public string required_resource; + public float return_time; + public int min_batch_size; + public float loading_delay; + public float unloading_delay; +} + +[Serializable] +public class MoveDataClass_loading +{ + public string move_id; + public string move_label; + public int loaded_count; + public List source_queues; + public List source_stores; + public float loading_delay; +} + +[Serializable] +public class MoveDataClass_Request_Resource +{ + public string move_id; + public string move_label; +} + +[Serializable] +public class MoveDataClass_Resource_Acquired +{ + public string resource; +} + +[Serializable] +public class MoveDataClass_Speed_Factor_Applied +{ + public float original; + public float adjusted; +} + +[Serializable] +public class MoveDataClass_Move_Moving +{ + public float time; + public float loading_delay; + public float unloading_delay; + public MoveMovingInput input; + public MoveMovingOutput output; +} + +[Serializable] +public class MoveMovingInput +{ + public List queues; + public List stores; +} +[Serializable] +public class MoveMovingOutput +{ + public string queue; + public string store; + public string defect_queue; + public string defect_store; +} + +[Serializable] +public class MoveDataClass_Arrived +{ + public int count; +} + +[Serializable] +public class MoveDataClass_Unloading_Defect +{ + public string product_id; + public string output_queue; + public int output_queue_length; + public float unloading_delay; +} + +[Serializable] +public class MoveDataClass_Unloading +{ + public string product_id; + public string output_queue; + public int output_queue_length; + public float unloading_delay; +} + +[Serializable] +public class MoveDataClass_Unloading_Store +{ + public string product_id; + public string store_queue; + public int store_queue_length; + public float unloading_delay; +} + +[Serializable] +public class MoveDataClass_returning +{ + public float return_time; +} public class SimulationModelMove : SimulationModel { - public string eventLoading = "transporter_loading"; - public string eventMove = "transporter_moving"; - public string eventUnloading = "transporter_unloading"; - public string eventSpeed = "transporter_speed_factor_applied"; - public string eventReturning = "transporter_returning"; + string eventLoading = "move_loading"; + string eventMove = "move_moving"; + string eventUnloading = "move_unloading"; + string eventSpeed = "move_speed_factor_applied"; + string eventReturning = "move_returning"; public List listProducts = new List(); public Transform productPos; public Vector3 productDistance = new Vector3(0, 0.321f, 0); @@ -44,7 +159,7 @@ public class SimulationModelMove : SimulationModel } if (destination != null) { - elapsedTime += Time.deltaTime; + elapsedTime += Time.deltaTime; if (elapsedTime / arrivalTime > 1.0f) { @@ -61,9 +176,10 @@ public class SimulationModelMove : SimulationModel transform.forward = dir; prevPos = transform.position; } - + } } + /* protected override IEnumerator RunSimulationCoroutine() { yield return new WaitUntil(() => !string.IsNullOrEmpty(nodeID)); @@ -253,4 +369,136 @@ public class SimulationModelMove : SimulationModel } yield return null; } + */ + public override void GetData(string data) + { + var wrapclass = JsonConvert.DeserializeObject(data); + + if (wrapclass._event.Contains(eventLoading)) + { + var moveData_loading = JsonConvert.DeserializeObject(wrapclass.data.ToString()); + if (moveData_loading.source_queues != null && (moveData_loading.source_queues.Count >= 1)) + { + string queueID = moveData_loading.source_queues[0].ToString(); + SimulationModel model = DataManager.I.GetModel(queueID); + SimulationModelStore storeModel = (SimulationModelStore)model; + for (int i = 0; i < moveData_loading.loaded_count; i++) + { + GameObject product = null; + product = storeModel.GetProduct(); + if (product != null) + { + product.transform.parent = productPos; + product.transform.localPosition = Vector3.zero; + product.transform.localRotation = Quaternion.identity; + listProducts.Add(product); + } + } + } + if (moveData_loading.source_stores != null && (moveData_loading.source_stores.Count >= 1)) + { + string storeID = moveData_loading.source_stores[0].ToString(); + SimulationModel model = DataManager.I.GetModel(storeID); + SimulationModelStore storeModel = (SimulationModelStore)model; + for (int i = 0; i < moveData_loading.loaded_count; i++) + { + GameObject product = null; + product = storeModel.GetProduct(); + if (product != null) + { + product.transform.parent = productPos; + product.transform.localPosition = Vector3.zero; + product.transform.localRotation = Quaternion.identity; + listProducts.Add(product); + } + } + } + } + if (wrapclass._event.Contains(eventMove)) + { + elapsedTime = 0; + originalPos = transform.position; + prevPos = transform.position; + var moveData_Move = JsonConvert.DeserializeObject(wrapclass.data.ToString()); + + if (moveData_Move.input.queues != null && moveData_Move.input.queues.Count >= 1) + { + string queueID = moveData_Move.input.queues[0].ToString(); + SimulationModel model = DataManager.I.GetModel(queueID); + SimulationModelStore storeModel = (SimulationModelStore)model; + origin = storeModel.GetTransporterPosition(); + } + else if (moveData_Move.input.stores != null && moveData_Move.input.stores.Count >= 1) + { + string storeID = moveData_Move.input.stores[0].ToString(); + SimulationModel model = DataManager.I.GetModel(storeID); + SimulationModelStore storeModel = (SimulationModelStore)model; + origin = storeModel.GetTransporterPosition(); + } + + if (!string.IsNullOrEmpty(moveData_Move.output.queue)) + { + SimulationModel model = DataManager.I.GetModel(moveData_Move.output.queue); + SimulationModelStore storeModel = (SimulationModelStore)model; + destination = storeModel.GetTransporterPosition(); + } + else if (!string.IsNullOrEmpty(moveData_Move.output.store)) + { + SimulationModel model = DataManager.I.GetModel(moveData_Move.output.store); + SimulationModelStore storeModel = (SimulationModelStore)model; + destination = storeModel.GetTransporterPosition(); + } + } + else if (wrapclass._event.Contains(eventUnloading)) + { + string targetID = ""; + + if (wrapclass._event.Contains("unloading_store")) + { + var moveData_unLoading = JsonConvert.DeserializeObject(wrapclass.data.ToString()); + targetID = moveData_unLoading.store_queue; + } + else + { + var moveData_unLoading = JsonConvert.DeserializeObject(wrapclass.data.ToString()); + targetID = moveData_unLoading.output_queue; + } + + var model = DataManager.I.GetModel(targetID); + SimulationModelStore storeModel = (SimulationModelStore)model; + + if (listProducts.Count > 0) + { + GameObject product = listProducts[0]; + storeModel.StoreProduct(product); + listProducts.Remove(product); + } + else + { + Debug.LogWarning("Trying to unload from empty transporter : " + nodeID); + } + } + if (wrapclass._event.Contains(eventSpeed)) + { + var moveData_Speed = JsonConvert.DeserializeObject(wrapclass.data.ToString()); + float originalTime = moveData_Speed.original; + float adjustedTime = moveData_Speed.adjusted; + arrivalTime += adjustedTime - originalTime; + elapsedTime = 0; + originalPos = transform.position; + prevPos = transform.position; + } + if (wrapclass._event.Contains(eventReturning)) + { + var moveData_Return = JsonConvert.DeserializeObject(wrapclass.data.ToString()); + elapsedTime = 0; + arrivalTime = moveData_Return.return_time; + originalPos = transform.position; + prevPos = transform.position; + if (origin != null) + { + destination = origin; + } + } + } } diff --git a/Assets/Scripts/SimulationModels/SimulationModelMove.cs.meta b/Assets/WorkSpace/LH/Simulation/SimulationModelMove.cs.meta similarity index 100% rename from Assets/Scripts/SimulationModels/SimulationModelMove.cs.meta rename to Assets/WorkSpace/LH/Simulation/SimulationModelMove.cs.meta diff --git a/Assets/WorkSpace/LH/Simulation/SimulationModelProcess.cs b/Assets/WorkSpace/LH/Simulation/SimulationModelProcess.cs new file mode 100644 index 00000000..41f00592 --- /dev/null +++ b/Assets/WorkSpace/LH/Simulation/SimulationModelProcess.cs @@ -0,0 +1,356 @@ +using Newtonsoft.Json.Linq; +using UnityEngine; +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using UnityEngine.Events; +using Octopus.Simulator.Networks; +using Newtonsoft.Json; + +[Serializable] +public class ProcessDataClass_start +{ + public string processor_id; + public string processor_label; + public int processing_time; + public List input_queues; + public List input_stores; + public string output_queue; +} + +[Serializable] +public class ProcessInputQueue +{ + public string queue_name; + public int required_items; +} + +[Serializable] +public class ProcessInputStore +{ + public string store_name; + public int required_items; +} + +[Serializable] +public class ProcessDataClass_using_queue +{ + public string processor_id; + public string processor_label; + public string queue_name; + public int queue_length; + public int required_items; + public int priority_order; + public string queue_type; +} + +[Serializable] +public class ProcessDataClass_using_store +{ + public string processor_id; + public string processor_label; + public string store_name; + public int store_length; + public int required_items; + public int priority_order; + public string queue_type; +} + +[Serializable] +public class ProcessDataClass_checking_inputs +{ + public string processor_id; + public List queues; + public List stores; +} + +[Serializable] +public class ProcessDataClass_defects_detected +{ + public string processor_id; + public int defect_count; +} + +[Serializable] +public class ProcessDataClass_requesting_resource +{ + public string processor_id; + public string resource_name; +} + +[Serializable] +public class ProcessDataClass_resource_acquired +{ + public string processor_id; + public string resource_name; +} + +[Serializable] +public class ProcessDataClass_speed_factor_applied +{ + public string processor_id; + public string resource_name; + public float original_time; + public float adjusted_time; + public float speed_factor; +} + +[Serializable] +public class ProcessDataClass_batch_started +{ + public string processor_id; + public int product_count; + public int processing_time; +} + +[Serializable] +public class ProcessDataClass_batch_completed +{ + public string processor_id; + public int product_count; +} + +[Serializable] +public class ProcessDataClass_output_queue +{ + public string processor_id; + public string queue_name; + public int queue_length_before; + public int products_to_add; +} + +[Serializable] +public class ProcessDataClass_waiting +{ + public string processor_id; + public int missing; +} + +public class SimulationModelProcess : SimulationModel +{ + public string eventUsingQueue = "processor_using_queue"; + public string eventUsingStore = "processor_using_store"; + public string eventStartBatch = "processor_batch_started"; + public string eventOutputQueue = "processor_output_queue"; + public List listProducts = new List(); + public Transform productPos; + public UnityEvent onProcessStart; + public UnityEvent onProcessEnd; + int productCount = 0; + float processTime = 0; + float elapsedTime = 0; + ConcurrentQueue dataQueue; + bool startBatch = false; + // Start is called once before the first execution of Update after the MonoBehaviour is created + void Start() + { + + } + + // Update is called once per frame + void Update() + { + if (!startBatch) return; + elapsedTime += Time.deltaTime; + if (elapsedTime > processTime) + { + onProcessEnd?.Invoke(); + startBatch = false; + } + } + /* + protected override IEnumerator RunSimulationCoroutine() + { + yield return new WaitUntil(() => !string.IsNullOrEmpty(nodeID)); + while (dataQueue == null) + { + dataQueue = MQTTDataBase.Instance.GetDataQueue(nodeID); + if (dataQueue == null) + yield return null; + else + break; + } + while (true) + { + if (dataQueue.IsEmpty) + { + yield return null; + continue; + } + if (dataQueue.TryDequeue(out JObject currentData)) + { + string eventKey = "_event"; + if (currentData.ContainsKey(eventKey)) + { + string value = currentData[eventKey].ToString(); + if (value.Contains(eventUsingQueue)) + { + string[] queueIDKey = { "data", "queue_name" }; + string[] loadCountKey = { "data", "required_items" }; + string queueID = GetJsonValue(currentData, queueIDKey)?.ToString(); + int loadCount = GetJsonIntValue(currentData, loadCountKey); + SimulationModel model = DataManager.I.GetModel(queueID); + SimulationModelStore storeModel = (SimulationModelStore)model; + for (int i = 0; i < loadCount; i++) + { + GameObject product = null; + yield return new WaitUntil(() => { + product = storeModel.GetProduct(); + return product != null; + }); + product.transform.parent = productPos; + product.transform.localPosition = Vector3.zero; + product.transform.localRotation = Quaternion.identity; + listProducts.Add(product); + } + } + else if (value.Contains(eventUsingStore)) + { + string[] queueIDKey = { "data", "store_name" }; + string[] loadCountKey = { "data", "required_items" }; + string queueID = GetJsonValue(currentData, queueIDKey)?.ToString(); + int loadCount = GetJsonIntValue(currentData, loadCountKey); + SimulationModel model = DataManager.I.GetModel(queueID); + SimulationModelStore storeModel = (SimulationModelStore)model; + for (int i = 0; i < loadCount; i++) + { + GameObject product = null; + yield return new WaitUntil(() => { + product = storeModel.GetProduct(); + return product != null; + }); + product.transform.parent = productPos; + product.transform.localPosition = Vector3.zero; + product.transform.localRotation = Quaternion.identity; + listProducts.Add(product); + } + } + else if (value.Contains(eventStartBatch)) + { + string[] productCountKey = { "data", "product_count" }; + string[] processTimeKey = { "data", "processing_time" }; + int productCount = GetJsonIntValue(currentData, productCountKey); + processTime = GetJsonFloatValue(currentData, processTimeKey); + elapsedTime = 0; + startBatch = true; + onProcessStart?.Invoke(); + } + else if (value.Contains(eventOutputQueue)) + { + string[] outputQueueKey = { "data", "queue_name" }; + string[] productCountKey = { "data", "products_to_add" }; + string queueID = GetJsonValue(currentData, outputQueueKey)?.ToString(); + int productCount = GetJsonIntValue(currentData, productCountKey); + SimulationModel model = DataManager.I.GetModel(queueID); + SimulationModelStore storeModel = (SimulationModelStore)model; + for (int i = 0; i < productCount; i++) + { + if (listProducts.Count > 0) + { + GameObject product = listProducts[0]; + storeModel.StoreProduct(product); + listProducts.Remove(product); + } + else + { + Debug.LogWarning("Trying to unload from empty transporter : " + nodeID); + } + } + } + } + } + yield return null; + } + yield return null; + } + */ + + public override void GetData(string data) + { + var wrapclass = JsonConvert.DeserializeObject(data); + if (wrapclass._event.Contains(eventUsingQueue)) + { + var processData_UsingQueue = JsonConvert.DeserializeObject(wrapclass.data.ToString()); + /* + string[] queueIDKey = { "data", "queue_name" }; + string[] loadCountKey = { "data", "required_items" }; + string queueID = GetJsonValue(currentData, queueIDKey)?.ToString(); + int loadCount = GetJsonIntValue(currentData, loadCountKey); + */ + string queueID = processData_UsingQueue.queue_name; + int loadCount = processData_UsingQueue.required_items; + SimulationModel model = DataManager.I.GetModel(queueID); + SimulationModelStore storeModel = model.GetComponent(); + for (int i = 0; i < loadCount; i++) + { + GameObject product = null; + product = storeModel.GetProduct(); + /* + yield return new WaitUntil(() => + { + product = storeModel.GetProduct(); + return product != null; + }); + */ + product.transform.parent = productPos; + product.transform.localPosition = Vector3.zero; + product.transform.localRotation = Quaternion.identity; + listProducts.Add(product); + } + } + else if (wrapclass._event.Contains(eventUsingStore)) + { + var processData_UsingStore = JsonConvert.DeserializeObject(wrapclass.data.ToString()); + string queueID = processData_UsingStore.store_name; + int loadCount = processData_UsingStore.required_items; + SimulationModel model = DataManager.I.GetModel(queueID); + SimulationModelStore storeModel = model.GetComponent(); + for (int i = 0; i < loadCount; i++) + { + GameObject product = null; + product = storeModel.GetProduct(); + /* + yield return new WaitUntil(() => + { + product = storeModel.GetProduct(); + return product != null; + }); + */ + product.transform.parent = productPos; + product.transform.localPosition = Vector3.zero; + product.transform.localRotation = Quaternion.identity; + listProducts.Add(product); + } + } + else if (wrapclass._event.Contains(eventStartBatch)) + { + var processData_BatchStart = JsonConvert.DeserializeObject(wrapclass.data.ToString()); + int productCount = processData_BatchStart.product_count; + processTime = processData_BatchStart.processing_time; + elapsedTime = 0; + startBatch = true; + onProcessStart?.Invoke(); + } + else if (wrapclass._event.Contains(eventOutputQueue)) + { + var processData_OutputQueue = JsonConvert.DeserializeObject(wrapclass.data.ToString()); + string queueID = processData_OutputQueue.queue_name; + int productCount = processData_OutputQueue.products_to_add; + SimulationModel model = DataManager.I.GetModel(queueID); + SimulationModelStore storeModel = model.GetComponent(); + for (int i = 0; i < productCount; i++) + { + if (listProducts.Count > 0) + { + GameObject product = listProducts[0]; + storeModel.StoreProduct(product); + listProducts.Remove(product); + } + else + { + Debug.LogWarning("Trying to unload from empty transporter : " + nodeID); + } + } + } + } +} diff --git a/Assets/Scripts/SimulationModels/SimulationModelProcess.cs.meta b/Assets/WorkSpace/LH/Simulation/SimulationModelProcess.cs.meta similarity index 100% rename from Assets/Scripts/SimulationModels/SimulationModelProcess.cs.meta rename to Assets/WorkSpace/LH/Simulation/SimulationModelProcess.cs.meta diff --git a/Assets/WorkSpace/LH/Simulation/SimulationModelSink.cs b/Assets/WorkSpace/LH/Simulation/SimulationModelSink.cs new file mode 100644 index 00000000..1c048f6d --- /dev/null +++ b/Assets/WorkSpace/LH/Simulation/SimulationModelSink.cs @@ -0,0 +1,153 @@ +using Newtonsoft.Json.Linq; +using System.Collections.Generic; +using System; +using UnityEngine; +using System.Collections; +using Octopus.Simulator.Networks; +using Newtonsoft.Json; + +[Serializable] +public class SinkDataClass_Started +{ + public string sink_id; + public string label; + public int sinking_interval; + public int sinking_amount; + public List input_queues; +} + +[Serializable] +public class SinkInputQueues +{ + public string queue_name; + public int required_items; +} + +[Serializable] +public class SinkDataClass_items_shipped_successfully +{ + public string sink_id; + public string sink_label; + public int current_sink_count; + public int total_shipped_count; + public int simulation_time_seconds; + public List shipped_items_details; + public int simulation_time; +} + +[Serializable] +public class ShippedItemsDetails +{ + public string product_id; + public float creation_time; + public bool is_defective; +} + +[Serializable] +public class SinkDataClass_waiting_for_items +{ + public string sink_id; + public string sink_label; + public int simulation_time; + public List input_queues_status; +} + +[Serializable] +public class InputQueuesStatus +{ + public string queue_name; + public int required_items; + public int current_items; +} + +[Serializable] +public class SinkDataClass_item_removed_from_queue +{ + public string sink_id; + public string sink_label; + public string queue_name; + public string product_id; + public int remaining_queue_length; +} + +public class SimulationModelSink : SimulationModel +{ + public string eventShipItem = "items_shipped_successfully"; + public string eventRemoveItem = "item_removed_from_queue"; + public int totalShipped = 0; + /* + protected override IEnumerator RunSimulationCoroutine() + { + yield return new WaitUntil(() => !string.IsNullOrEmpty(nodeID)); + while (dataQueue == null) + { + dataQueue = MQTTDataBase.Instance.GetDataQueue(nodeID); + if (dataQueue == null) + yield return null; + else + break; + } + while (true) + { + if (dataQueue.IsEmpty) + { + yield return null; + continue; + } + if (dataQueue.TryDequeue(out JObject currentData)) + { + string eventKey = "_event"; + if (currentData.ContainsKey(eventKey)) + { + string value = currentData[eventKey].ToString(); + if (value.Contains(eventShipItem)) + { + + } + else if (value.Contains(eventRemoveItem)) + { + string[] queueIDKey = { "data", "queue_name" }; + string[] queueRemainKey = { "data", "remaining_queue_length" }; + string queueID = GetJsonValue(currentData, queueIDKey)?.ToString(); + int queueCapacity = GetJsonIntValue(currentData, queueRemainKey); + SimulationModel model = DataManager.I.GetModel(queueID); + SimulationModelStore storeModel = (SimulationModelStore)model; + while (storeModel.storedProducts.Count > queueCapacity) + { + //Destroy(storeModel.GetProduct()); + totalShipped++; + yield return null; + } + } + } + } + yield return null; + } + yield return null; + } + */ + public override void GetData(string data) + { + var wrapclass = JsonConvert.DeserializeObject(data); + if (wrapclass._event.Contains(eventShipItem)) + { + + } + else if (wrapclass._event.Contains(eventRemoveItem)) + { + var sinkDataClass_item_removed_from_queue = JsonConvert.DeserializeObject(wrapclass.data.ToString()); + string queueID = sinkDataClass_item_removed_from_queue.queue_name; + int queueCapacity = sinkDataClass_item_removed_from_queue.remaining_queue_length; + SimulationModel model = DataManager.I.GetModel(queueID); + SimulationModelStore storeModel = (SimulationModelStore)model; + /* + while (storeModel.storedProducts.Count > queueCapacity) + { + //Destroy(storeModel.GetProduct()); + totalShipped++; + yield return null; + } + */ + } + } +} diff --git a/Assets/Scripts/SimulationModels/SimulationModelSink.cs.meta b/Assets/WorkSpace/LH/Simulation/SimulationModelSink.cs.meta similarity index 100% rename from Assets/Scripts/SimulationModels/SimulationModelSink.cs.meta rename to Assets/WorkSpace/LH/Simulation/SimulationModelSink.cs.meta diff --git a/Assets/WorkSpace/LH/Simulation/SimulationModelSource.cs b/Assets/WorkSpace/LH/Simulation/SimulationModelSource.cs new file mode 100644 index 00000000..7f865b2b --- /dev/null +++ b/Assets/WorkSpace/LH/Simulation/SimulationModelSource.cs @@ -0,0 +1,133 @@ +using System.Collections.Concurrent; +using System.Collections.Generic; +using UnityEngine; +using System; +using System.Collections; +using Octopus.Simulator.Networks; +using Newtonsoft.Json; + +[Serializable] +public class SourceDataClass_start +{ + public string generator_id; + public string label; + public float production_rate; + public float cycle_time; + public int batch_size; + public int products_per_batch; + public List input_queues; + public List input_stores; + public string output_queue; + public bool has_resource; + public int priority; + public float defect_rate; +} + +[Serializable] +public class SourceDataClass_Queued +{ + public string generator_id; + public string label; + public string product_id; + public string queue; + public int queue_length; + public string queue_type; +} + +[Serializable] +public class SourceDataClass_Stored +{ + public string generator_id; + public string label; + public string product_id; + public string store; + public int store_length; +} + +public class SimulationModelSource : SimulationModel +{ + public string eventGenerateProduct = "product_generated"; + public string eventGenerateDefect = "product_defective"; + public string eventQueueProduct = "product_queued"; + public string eventStoreProduct = "product_stored"; + public GameObject productPrefab; + public GameObject defectPrefab; + public List listProducts = new List(); + public List listDefects = new List(); + public Transform productPos; + public Vector3 productDistance = new Vector3(0, 0.321f, 0); + int productCount = 0; + int defectCount = 0; + private void Awake() + { + eventKey = "generator_event"; + } + + public override void GetData(string data) + { + var wrapclass = JsonConvert.DeserializeObject(data); + if (wrapclass._event.Contains(eventGenerateProduct)) + { + GameObject gb = Instantiate(productPrefab, productPos); + listProducts.Add(gb); + ProductSorting(); + } + else if (wrapclass._event.Contains(eventGenerateDefect)) + { + GameObject gb = Instantiate(defectPrefab, productPos); + listProducts.Add(gb); + ProductSorting(); + } + else if (wrapclass._event.Contains(eventQueueProduct)) + { + var QueueData = JsonConvert.DeserializeObject(wrapclass.data.ToString()); + string queueID = QueueData.queue; + int queueCapacity = QueueData.queue_length; + string storeType = QueueData.queue_type; + SimulationModel model = DataManager.I.GetModel(queueID); + GameObject product = null; + if (listProducts.Count > 0) + { + product = listProducts[0]; + listProducts.Remove(product); + } + else if (listDefects.Count > 0) + { + product = listDefects[0]; + listDefects.Remove(product); + } + if (model != null && product != null) + { + SimulationModelStore storeModel = model.GetComponent< SimulationModelStore>(); + storeModel.maxCapacity = queueCapacity; + storeModel.storeType = storeType; + storeModel.StoreProduct(product); + } + } + } + + void ProductSorting() + { + int interval = 0; + if (productCount != listProducts.Count) + { + productCount = listProducts.Count; + for (int i = 0; i < productCount; i++) + { + GameObject gb = listProducts[i]; + gb.transform.localPosition = productDistance * interval; + interval++; + } + } + if (defectCount != listDefects.Count) + { + defectCount = listDefects.Count; + for (int i = 0; i < defectCount; i++) + { + GameObject gb = listDefects[i]; + gb.transform.localPosition = productDistance * interval; + interval++; + } + } + } +} diff --git a/Assets/Scripts/SimulationModels/SimulationModelSource.cs.meta b/Assets/WorkSpace/LH/Simulation/SimulationModelSource.cs.meta similarity index 100% rename from Assets/Scripts/SimulationModels/SimulationModelSource.cs.meta rename to Assets/WorkSpace/LH/Simulation/SimulationModelSource.cs.meta diff --git a/Assets/Scripts/SimulationModels/SimulationModelStore.cs b/Assets/WorkSpace/LH/Simulation/SimulationModelStore.cs similarity index 94% rename from Assets/Scripts/SimulationModels/SimulationModelStore.cs rename to Assets/WorkSpace/LH/Simulation/SimulationModelStore.cs index e1de8fd8..ba778761 100644 --- a/Assets/Scripts/SimulationModels/SimulationModelStore.cs +++ b/Assets/WorkSpace/LH/Simulation/SimulationModelStore.cs @@ -51,4 +51,9 @@ public class SimulationModelStore : SimulationModel return null; return transporterPositions[UnityEngine.Random.Range(0, transporterPositions.Count)]; } + + public override void GetData(string data) + { + throw new System.NotImplementedException(); + } } diff --git a/Assets/Scripts/SimulationModels/SimulationModelStore.cs.meta b/Assets/WorkSpace/LH/Simulation/SimulationModelStore.cs.meta similarity index 100% rename from Assets/Scripts/SimulationModels/SimulationModelStore.cs.meta rename to Assets/WorkSpace/LH/Simulation/SimulationModelStore.cs.meta diff --git a/Assets/WorkSpace/LH/Web/WebReceiver.cs b/Assets/WorkSpace/LH/Web/WebReceiver.cs index 13a3ce47..acd192cb 100644 --- a/Assets/WorkSpace/LH/Web/WebReceiver.cs +++ b/Assets/WorkSpace/LH/Web/WebReceiver.cs @@ -15,12 +15,12 @@ namespace Octopus.Simulator.Networks public void Start() { #if UNITY_EDITOR - config.projectId = "1"; + config.projectId = "15"; //config.simulationId = "15"; - config.logicId = "1"; + config.logicId = "14"; WebParameters.config = config; - onParameterRecived += FindAnyObjectByType().RequestInfo; - onParameterRecived += FindAnyObjectByType().RequestInfo; + //onParameterRecived += FindAnyObjectByType().RequestInfo; + //onParameterRecived += FindAnyObjectByType().RequestInfo; onParameterRecived?.Invoke(); #else Application.ExternalCall("loadingComplete"); diff --git a/Assets/WorkSpace/LWJ/SaveLoadmanager.cs b/Assets/WorkSpace/LWJ/SaveLoadmanager.cs index 9a733687..20a7ec12 100644 --- a/Assets/WorkSpace/LWJ/SaveLoadmanager.cs +++ b/Assets/WorkSpace/LWJ/SaveLoadmanager.cs @@ -176,15 +176,15 @@ namespace Octopus.Simulator.Networks loadInfos = JsonConvert.DeserializeObject>(jsonData); - string resourcePath = "ModelsUpdated"; + string resourcePath = "Library/LibraryPrefab"; Dictionary loadModels = new Dictionary(); foreach (var item in loadInfos) { - var simulationModel = Resources.Load(string.Format("{0}/{1}", resourcePath, item.prefabName)); - var spawnItem = Instantiate(simulationModel).GetComponent(); + var spawn = Instantiate(simulationModel); + var spawnItem = spawn.GetComponent(); spawnItem.modelName = item.modelName; //spawnItem.modelType = item.modelType;