Book a Demo

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - rsksharath

Pages: [1]
1
Hello,

I have created a simple Javascript to store simulation variables (sim.xx) in a csv file.
Then I referenced this Javascript as post processing script in a simulation script, expecting that this Javascript executes once simulation is stopped.
But this Javascript is never executed in my opinion.

When I tested Javascript in Javascript console to store a string in csv, it worked.
Is there any procedure or part of scripting I am missing here?

My Javascript:

// Get the current EA file path
var eaFilePath = Repository.ConnectionString;

// Extract the directory path from the EA file path
var directoryPath = eaFilePath.substring(0, eaFilePath.lastIndexOf("\\") + 1);

// Create a CSV content
var csvContent = "data1,data2\r\n"; // Replace with your simulation data

// Create a file path for the CSV file
var csvFilePath = directoryPath + "simulation_data.csv";

//var csvFilePath = "C:\Users\HFR1KOR\SW_repo\poc_behavioural_sim\simulation_data.csv"


// Create the CSV content
var csvContent = "data1,data2,data3\r\n"; // Replace with your simulation data


// Save the CSV content to a text file
var fileSystem = new COMObject("Scripting.FileSystemObject");
var file = fileSystem.CreateTextFile(csvFilePath, true);
file.Write(csvContent);
file.Close();

2
Hello,

I have created a simple Javascript to store simulation variables (sim.xx) in a csv file.
Then I referenced this Javascript as post processing script in a simulation script, expecting that this Javascript executes once simulation is stopped.
But this Javascript is never executed in my opinion.

When I tested Javascript in Javascript console to store a string in csv, it worked.
Is there any procedure or part of scripting I am missing here?

My Javascript:

// Get the current EA file path
var eaFilePath = Repository.ConnectionString;

// Extract the directory path from the EA file path
var directoryPath = eaFilePath.substring(0, eaFilePath.lastIndexOf("\\") + 1);

// Create a CSV content
var csvContent = "data1,data2\r\n"; // Replace with your simulation data

// Create a file path for the CSV file
var csvFilePath = directoryPath + "simulation_data.csv";

//var csvFilePath = "C:\Users\HFR1KOR\SW_repo\poc_behavioural_sim\simulation_data.csv"


// Create the CSV content
var csvContent = "data1,data2,data3\r\n"; // Replace with your simulation data


// Save the CSV content to a text file
var fileSystem = new COMObject("Scripting.FileSystemObject");
var file = fileSystem.CreateTextFile(csvFilePath, true);
file.Write(csvContent);
file.Close();



Pages: [1]