architecture-building-systems / revitpythonshell

An IronPython scripting environment for Autodesk Revit and Vasari
MIT License
490 stars 112 forks source link

Voltage values and voltage drop values for circuits not consistent with Revit app #148

Closed s-github-2 closed 6 months ago

s-github-2 commented 6 months ago

Describe the bug

Voltage values printed in RevitPythonShell dont match those in the application for electrical circuits so trying to figure out what is the cause of the discrepancy


from Autodesk.Revit.DB import FilteredElementCollector as Fec
from Autodesk.Revit.DB import BuiltInCategory as Bic

e_cir = Fec(doc).\
        OfCategory(Bic.OST_ElectricalCircuit).\
        WhereElementIsNotElementType().ToElements()
print ('len ecircuits',len(e_cir))

for e in e_cir:
    print (f'Name {e.Name}',f"Cir Number {e.CircuitNumber}",f"Length: {e.Length:.2f}",f"Voltage: {e.Voltage:.2f}")
    print (f"Apparent Load {e.ApparentLoad:.2f}",f" Vdrop: {e.VoltageDrop:.2f}")
    print ("---")

To Reproduce

View properties for electrical circuits in the Revit app and then compare with output from the script copied above . I am getting values that are approximately but not exactly 10 times larger than the voltage drop shown in the Revit app itself for the same electrical circuit. For example a circuit with Voltage Drop 0.24V in Revit Application shows up as 13.13 using the above script This is the output of the script for my circuit. Circuit number 1 is a 120V circuit which is printing Voltage 1291.67 for some reason and the voltage drop is getting reported as 2.53 instead of 0.24 len ecircuits 5 Name 1 Cir Number 1 Length: 19.60 Voltage: 1291.67 Apparent Load 3875.01 Vdrop: 2.53

Name 2 Cir Number 2 Length: 31.82 Voltage: 1291.67 Apparent Load 12378.50 Vdrop: 13.13

Name 3 Cir Number 3 Length: 53.77 Voltage: 1291.67 Apparent Load 10763.91 Vdrop: 19.29

Name 9,11 Cir Number 9,11 Length: 22.91 Voltage: 2238.89 Apparent Load 11194.47 Vdrop: 4.75

Name 10,12 Cir Number 10,12 Length: 40.59 Voltage: 2238.89 Apparent Load 11194.47 Vdrop: 8.42 Expected behavior Values should match precisely

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

Ianhuuuuang commented 6 months ago

您好,邮件已收到,尽快给您回复。

s-github-2 commented 6 months ago

found the answer in this post https://thebuildingcoder.typepad.com/blog/2010/06/voltage-units.html Revit insanely uses a MIX of unit systems - all else metric except for length which is why voltage internal is weird

Question: What is the internal unit used by Revit for voltage? In the API, the ElectricalSystem.Voltage property returns a value that is about 10.76391 times the expected value in Volts, i.e., I get 1291.669 instead of 120 V. The same applies to the TrueLoad property. So I assume Revit is using some non-standard unit for voltage?

Answer: Electrical potential can be defined using the following more fundamental units:

(Length2 Mass) / (Time3 Current).

In Revit, this formula makes use of the following units:

Length: feet Mass: kg Time: s Current: A The unit Volt is defined in the same way, of course, but uses the SI unit meters instead of feet, as specified by the International System of Units SI.

As a result, to convert the Revit internal database voltage unit to Volts, you have to multiply it with 0.3048^2.

s-github-2 commented 6 months ago

Not an issue with RevitPythonShell but just a #$%@ issue with Revit internal units needing 0.3048^2 scaling for voltage