Skip to content
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

ZMT zurich med tech

  1. Home
  2. Sim4Life
  3. Python API
  4. Extract power balance

Extract power balance

Scheduled Pinned Locked Moved Python API
3 Posts 2 Posters 332 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MD
    wrote on last edited by
    #1

    Hi, I have issues with extracting the specific values of the Power Balance into Python. I've tried 2 methods so far with both a different error.

    simulation_extractor = simulation.Results()
    em_sensor_extractor = simulation_extractor["Overall Field"]
    inputs = em_sensor_extractor.Outputs["Power Balance"]
    inputs.Update()
    print(inputs.Data.DataSimpleDataCollection.FieldAxisValue(0))

    Gives me this error:
    b10f9a49-0f4a-4473-b349-0902016f32ed-image.png

    Changing that last line into
    print(inputs.Data.DataSimpleDataCollection.FieldValue("Pin"))
    Gives another error
    b19a7cca-8586-47f9-bba5-632aca681195-image.png

    Also AttributeSimpleDataCollection instead of DataSimpleDataCollection gives the same errors.

    What is the best way to get the radiated power? Thanks

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Cosimo
      ZMT
      wrote on last edited by
      #2

      Here is an example showing how you can print the power balance available keys and how you can get the radiated power value.

      powerBalance = em_sensor_extractor.Outputs["Power Balance"]
      powerBalance.Update()
      print(powerBalance.Data.DataSimpleDataCollection.Keys())
      
      powerBalance_RadPower = powerBalance.Data.DataSimpleDataCollection.FieldValue('RadPower',0)
      print(f"Power Balance - Radiated Power = {powerBalance_RadPower} W")
      
      1 Reply Last reply
      1
      • M Offline
        M Offline
        MD
        wrote on last edited by
        #3

        This works indeed! Thanks a lot!

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Search