From ef938ab84aa012bdaeff153e345595b3f9892dec Mon Sep 17 00:00:00 2001 From: moxitech Date: Sat, 16 Nov 2024 14:12:21 +0700 Subject: [PATCH] Simulation activate/deactivate --- docker-compose.yaml | 28 +++++----- docs/imgs/sim_process.png | Bin 0 -> 23769 bytes src/microservices/py-simulation/main.py | 2 +- .../py-simulation/requirements.txt | 15 ++++++ src/server/internal/server/server.go | 4 ++ src/server/internal/server/server_handlers.go | 9 ++++ .../components/Threejs/ThreeJsInstance.tsx | 22 +++++++- .../src/app/pages/simulations/page.tsx | 50 ++++++++++++++++-- 8 files changed, 107 insertions(+), 23 deletions(-) create mode 100644 docs/imgs/sim_process.png create mode 100644 src/microservices/py-simulation/requirements.txt diff --git a/docker-compose.yaml b/docker-compose.yaml index 3ce8b78..a87480f 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -73,7 +73,7 @@ services: dockerfile: Dockerfile env_file: ".env" ports: - - "10000:10000" + - "10001:10000" depends_on: - nats networks: @@ -95,26 +95,22 @@ services: networks: - dns_net restart: always - # For messaging - nats: - image: nats - container_name: dns-nats + + # + math: + container_name: dns-math + build: + context: ./src/microservices/py-simulation + dockerfile: Dockerfile + env_file: ".env" ports: - - "8222:8222" - - "6222:6222" - command: "--cluster_name NATS --cluster nats://0.0.0.0:6222 --http_port 8222 " + - "10000:10000" networks: - dns_net restart: always - nats-1: - image: nats - container_name: dns-nats-cluster-1 - command: "--cluster_name NATS --cluster nats://0.0.0.0:6222 --routes=nats://ruser:T0pS3cr3t@nats:6222" - networks: - - dns_net - depends_on: ["nats"] - restart: always + + # For messaging volumes: postgres_data: diff --git a/docs/imgs/sim_process.png b/docs/imgs/sim_process.png new file mode 100644 index 0000000000000000000000000000000000000000..b54f84df1c3fc5cac0400407e906ff82b6ce218d GIT binary patch literal 23769 zcmeIacT|(v*ESqvtk`BO2ngtiqA-9cMY;_TkRnBp78#@qNSBfXbp#7VK}6{tsS)Wd z8AU;**U+OzYJf-yfrKRAxkIzfue|TK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s;Jio3A{p z@vJ-5babzWR+x{kZ_ZN*npz8ps@5!+@Snus!D%)K*MyJ^b1oiKLxK=2u44aZI_;U8 z;A1r?#AWFV{T~P4!k;Yaiu+O;UvsGjpeWmt9wWY+@ha;LKs9U?{ky_Cx@TqR4D+eX)~ITqpp2uRoiPCrE3Kib1Xk~Br6 z<(XSlzfK;*BRD1GD}!J$h)Xo>@ { + +interface IThreeJsInstance { + Click: (value: boolean) => void; // клик по кнопке +} + +const ThreeJsInstance : React.FC = ({Click}) => { const [drones, setDrones] = useState([]); const [baseStations, setBaseStations] = useState([]); const [selectedObject, setSelectedObject] = useState<{ type: 'drone' | 'baseStation'; id: number } | null>(null); @@ -58,6 +63,16 @@ const ThreeJsInstance = () => { ]); }; + const runSimulation = () => { + // GET: + // baseStations + // drones + // SET TO PAYLOAD + const STANDART_TS = 300; // seconds + const STANDART_TIMESTEP = 1; // timestep + Click(true) + } + const handleObjectClick = (type: 'drone' | 'baseStation', id: number) => { setSelectedObject({ type, id }); setIsModalOpen(true); @@ -181,7 +196,7 @@ const ThreeJsInstance = () => { - {selectedObject && ( @@ -270,3 +285,6 @@ const BaseStationModel = ({ position, onClick, isSelected }: { position: [number }; export default ThreeJsInstance; + + +// /simulation/forceRunCalc => start simulation => REQUEST(DTO) => START_PLAYER() diff --git a/src/usn-frontend/src/app/pages/simulations/page.tsx b/src/usn-frontend/src/app/pages/simulations/page.tsx index 25bd73b..0cd18ff 100644 --- a/src/usn-frontend/src/app/pages/simulations/page.tsx +++ b/src/usn-frontend/src/app/pages/simulations/page.tsx @@ -1,17 +1,43 @@ "use client"; +import InitPlayer from '@/app/components/Player/Player'; import ThreeJsInstance from '@/app/components/Threejs/ThreeJsInstance'; import React, { useEffect, useState } from 'react'; const Simulations: React.FC = () => { - const [activeSimalationWindow, setActiveSimalationWindow] = useState(false); + const [activeSimulationWindow, setActiveSimulationWindow] = useState(false); + const [mathServer, setMathServer] = useState(""); + const [simulationDto, setSimulationDto] = useState({}); + const ActiveSimulation = (value: boolean) => setActiveSimulationWindow(value); + + useEffect(() => { + // let value = SendRequestGetLink() + // value.then(e => { + // if (e.status == 1002){ + // e.json().then( res =>{ + // if (res.link) { + // setMathServer(res.link) + // }})} + // }) + setMathServer("localhost:10000/run/sumulation") + }, []) + + // => localhost:10000/run/sumulation + return ( -
+ {/* TEST : MATH SERVER ENDPOINT */} + {/*

{mathServer}

*/}
- {activeSimalationWindow ?
-
: } + {activeSimulationWindow ? +
+ {}} + TimeEnd={100} + TimeStep={1} + > +
: }
); }; + + +const SendRequestGetLink = async () => { + const requestOptions: RequestInit = { + method: "GET", + redirect: "follow" + }; + + try { + const response = await fetch(`http://api.localhost/simulation/forceRunCalc`, requestOptions); + return response; + } catch (error) { + throw new Error('Network error'); + } +}; + export default Simulations; \ No newline at end of file