Hi. I am using SimVision for Analog-Mixed Signal (AMS) simulations. Within SimVision, I have probed certain signals, such as currents, for analysis. To calculate the range average of these signals after my simulation, I am using the Expression Calculator in SimVision. This approach is dynamic. The expression I am using is as follows : range_average((waves::signal1_$flow + waves::signal2_$flow), 10us, 50us) However, I need to automate this operation for post-processing purposes. To achieve this, I have developed a TCL script. Unfortunately, the script only works partially and does not fully meet the required functionality. Could anyone provide guidance on how to implement this requirement effectively? Are there any alternative methods or improvements I can make to my approach? script: # Step 1: Open the waveform database if {[catch {database open waves.shm} errorMessage]} { puts "Error: Failed to open waveform database. Details: $errorMessage" return } # Step 2: Define signals and the combined signal set signal1 "signal1_$flow" set signal2 "signal2_$flow" set combined_signal "$signal1 + $signal2" # Step 3: Create the average calculation expression set expression "range_average(($combined_signal), 1 us, 70 us)" set avg_value "" # Step 4: Create the condition and check for errors if {[catch {condition new -name range_avg_cond -expr $expression} errorMessage]} { puts "Error: Failed to create condition. Details: $errorMessage" database close return } else { puts "Debug: Condition 'range_avg_cond' created successfully." } # Step 5: Allow processing (optional delay based on waveform size) after 1000 # Step 6: Retrieve the calculated result if {[catch {set avg_value [condition get -name range_avg_cond]} errorMessage]} { puts "Error: Failed to retrieve condition value. Details: $errorMessage" database close return } # Ensure the average value is valid if {[string length $avg_value] == 0} { puts "Error: Unable to calculate the average. Check the expression or signals." database close return } # Step 7: Print the result to the console puts "The average value is: $avg_value A" # Step 8: Generate the report file set report_file [open "report.txt" w] puts $report_file "SimVision Analysis Report" puts $report_file "------------------------" puts $report_file "Signal 1: $signal1" puts $report_file "Signal 2: $signal2" puts $report_file "Time Window: 1 us to 70 us\n" puts $report_file "Sum Expression: $combined_signal" puts $report_file "Average Expression: $expression" puts $report_file "Average Value: $avg_value A\n" close $report_file puts "Report generated: report.txt" # Step 9: Optionally create a waveform window and display the condition window new WaveWindow waveform add -signals {range_avg_cond} update # Step 10: Close the waveform database database close ##run command. simvision -input Note: I can able to see expression function results in new waveform window. But, not in report file or console window. I want to see in report file/ console.
↧