OpenModelica / OMSimulator

The OpenModelica FMI & SSP-based co-simulation environment.
Other
70 stars 50 forks source link

CSV fields containing commas must be quoted #1197

Open Thewodoros opened 1 year ago

Thewodoros commented 1 year ago

Description

In Model Exchange mode, my FMU writes derivatives into results, and their column headers contain commas. This confuses the programs reading these CSV. Such fields must be surrounded with double quotes.

Steps to reproduce the behavior

I used driveline model from Amesim FMU tutorial. When in Model exchange mode, it writes a lot of derivatives into the result file, so the header row looks like this:

time,model.root.system.signal03.output,model.root.system.rotaryspeedsensor.wsig,model.root.system.rotaryload2ports_1.w,model.root.system.rotaryspringdamper.are,model.root.system.mass_friction1port.v1,model.root.system.mass_friction1port.x1,model.root.system.rotaryload2ports.w,model.root.system.der(rotaryload2ports_1.w,1),model.root.system.der(rotaryspringdamper.are,1),model.root.system.der(mass_friction1port.v1,1),model.root.system.der(mass_friction1port.x1,1),model.root.system.der(rotaryload2ports.w,1)

Expected behavior

Fields with commas should be quoted, like this

time,model.root.system.signal03.output,model.root.system.rotaryspeedsensor.wsig,model.root.system.rotaryload2ports_1.w,model.root.system.rotaryspringdamper.are,model.root.system.mass_friction1port.v1,model.root.system.mass_friction1port.x1,model.root.system.rotaryload2ports.w,"model.root.system.der(rotaryload2ports_1.w,1)","model.root.system.der(rotaryspringdamper.are,1)","model.root.system.der(mass_friction1port.v1,1)","model.root.system.der(mass_friction1port.x1,1)","model.root.system.der(rotaryload2ports.w,1)"

Version and OS