Home About Spanem Friendchat Coming Soon!Python Scripts Coming Soon!GCC Work Coming Soon!Resume Coming Soon!Email Filer Coming Soon!LinAlg Contact

Compiled Python WebSocket server

March 24, 2023

Topic:

Brief technical overview of the function and components of the web-based beam analysis and design software called Spanem.

In this overview we will see how Spanem works and is being deployed within a local development environment for testing and addition of new features. A link to a working beta version will be available here soon.

First, the project's client side html is served to my local network at 192.168.0.200 port 8080 with a python http development server using the http.server and socketserver libraries. The main html file then loads the relevant JavaScript and CSS files to allow for proper function and styling, respectively.

Compiled Python HTTP development server file Python HTTP development server code Running Python HTTP development server

Then a python WebSocket server is initiated to connect and communicate with the WebSocket client setup in the browser when it needs to request an analysis from the server. This WebSocket server is able to communicate with the server application(s) and return analysis results.

Compiled Python WebSocket server

To log into Spanem locally, I now can use a browser to request all of the files from the http server.

Compiled Python HTTP development server file

As soon as the IP address and port information is typed into the address bar, the http server registers the request and the browser loads the site information.

Response from Running Python HTTP development server

When you hit ENTER on the browser, you get access to the default view of the Spanem web application.

Default Spanem Screen

When you type in a load it gets added to the middle of the beam by default. Also, notice the UPDATE ANALYSIS button is highlighted pink. This means the shear, moment, and deflection graphs are not updated and feedback from the analysis server is required.

Adding a point Load in Spanem

When you press UPDATE ANALYSIS, the server processes the load on the backend and returns the results that the JavaScript in the browser can then use to update the graphs.

Update Analysis Button must be pressed after each load update Response from Running Python WebSocket beam-analysis server Updated Spanem screen with up-to-date shear, moment, and deflection diagrams

Using the load specification language of the Spanem software, point loads can be placed anywhere along the beam. A second number on the same line represents the load's location on the beam. A third number translates the input as a distributed load, the first number represents the starting load intensity (lbs/ft), the second number represents the ending load intensity (lbs/ft), and the third number indicates the starting point of this distributed load, an optional fourth number indicates the width of the distributed load (otherwise the load extends to the end of the beam).

More complex load pattern on Spanem screen

Here is another loading scenario, showing upward loading (negative) requiring a downward reaction at the left end of the beam.

Load pattern with negative loads on Spanem screen

When the guest to the web app is finished and closes their web browser, the WebSocket connection is securely closed and the server remains on standby for the next request.

Load pattern with negative loads on Spanem screen

Software Technologies Required to Run Spanem:

  • HTML
  • SVG
  • CSS
  • JavaScript client application
  • JScrambler to secure the application
  • WebSocket w/ TLS
  • HTTP
  • Python server application using many libraries
  • Nginx
  • Linux OS to run webserver

Thank you for reading, and please check back in for updates.

Drew