Skip to content

Commit

Permalink
Final version
Browse files Browse the repository at this point in the history
  • Loading branch information
Коля authored and Коля committed Mar 20, 2022
1 parent 45a1e90 commit 666b309
Show file tree
Hide file tree
Showing 20 changed files with 671 additions and 132 deletions.
80 changes: 80 additions & 0 deletions LabWork/Force_lab/Counter.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

65 changes: 65 additions & 0 deletions LabWork/Force_lab/Counter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
using System;
using System.IO;
using System.Windows.Forms;
using WpfMath;

namespace Application
{
public partial class Counter : UserControl
{
public Counter()
{
InitializeComponent();
}
private Science _data;

public Science Data
{
set => _data = value;
get { return _data; }
}
private void button1_Click(object sender, EventArgs e)
{
if (Data == null)
{
try
{
throw new ScienceException("Нет измерений");
}
catch (ScienceException)
{
return;
}
}
Science dim = Data;
double mu_max = Math.Round((dim.Force_graph + dim.Pogr_F) / (dim.Normal_reaction_graph - dim.Pogr_N), 2);
double mu_min = Math.Round((dim.Force_graph - dim.Pogr_F) / (dim.Normal_reaction_graph + dim.Pogr_N), 2);
double delta = Math.Round((mu_max - mu_min) / 2, 3);
double mu = Math.Round((mu_max + mu_min) / 2, 3);
string latex = @"\color{white}{
\mu = \frac{F_t}{N}\\\\
\mu_{max} = \frac{F_{max}}{N_{min}}\text{ }\mu_{min} = \frac{F_{min}}{N_{max}}\text{ }\mu_{avg}=\frac{\mu_{max} + \mu_{min}}{2}\text{ }\Delta\mu=\frac{\mu_{max} - \mu_{min}}{2}\text{ }\epsilon_{\mu} = \frac{\Delta\mu}{\mu}\\\\
\mu_{max} = \frac{" + $"{Math.Round(dim.Force_graph + dim.Pogr_F, 3)} H" + @"}{" + $"{Math.Round(dim.Normal_reaction_graph - dim.Pogr_N, 3)} H" + @"} = " + $"{mu_max}" + @"\text{ }
\mu_{min} = \frac{" + $"{Math.Round(dim.Force_graph - dim.Pogr_F, 3)} H" + @"}{" + $"{Math.Round(dim.Normal_reaction_graph + dim.Pogr_N, 3)} H" + @"} = " + $"{mu_min}" + @"\text{ }
\mu_{avg}=\frac{" + $"{mu_max} + {mu_min}" + @"}{2}=" + $"{mu}" + @"\text{ }\Delta\mu=\frac{" + $"{mu_max} - {mu_min}" + @"}{2}=" + $"{delta}" + @"\text{ }\epsilon_{\mu} = \frac{" + $"{delta}" + @"}{" + $"{mu}" + @"}=" + $"{Math.Round(delta / mu * 100),0}" + @"\text{ %}
}";
string fileName = @"..\formula.png";

var parser = new TexFormulaParser();
try
{
var formula = parser.Parse(latex);
var pngBytes = formula.RenderToPng(40.0, 0.0, 0.0, "Times New Roman");
File.WriteAllBytes(fileName, pngBytes);
pictureBox1.ImageLocation = @"..\formula.png";
pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
}
catch (Exception)
{

return;
}

}
}
}
60 changes: 60 additions & 0 deletions LabWork/Force_lab/Counter.resx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
7 changes: 1 addition & 6 deletions LabWork/Force_lab/Force.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ private void Force_Load(object sender, EventArgs e)
Table.Columns.Add("Сила нормальной реакции опоры N, Н", typeof(string));
Table.Columns.Add("Сила трения F, H", typeof(string));




var model = new PlotModel
Expand Down Expand Up @@ -288,11 +288,6 @@ private void update_Click_1(object sender, EventArgs e)
size,
size));

scatterSeries.Points.Add(new ScatterPoint(
values.Normal_reaction_graph + Convert.ToDouble(plu_1.Text),
values.Force_graph + Convert.ToDouble(plu_2.Text),
size,
size));

scatterSeries.Points.Add(new ScatterPoint(
values.Normal_reaction_graph,
Expand Down
26 changes: 14 additions & 12 deletions LabWork/Force_lab/Force.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,22 @@
<head>
<meta charset="utf-8" />
<title></title>
<script type="text/javascript"
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
</head>
<body>
<h1 style="font-family: Bahnschrift; text-align: center; font-weight: bold">Лабароторная работа</h1>
<h2 style="font-family: Bahnschrift; text-align: center; font-weight: bold">{{labname}}</h2>
<div style="overflow: hidden;">
<div style="font-family: Bahnschrift; width: 100%; font-size: 25px;">
<div style="float: left; width: 328px; height: 306px;">Цель работы: {{aim}}</div>
<div style="float: left; width: 328px; height: 306px; ">Оборудование: {{equipment}}</div>
<div style="float: left; width: 328px; height: 306px; margin-right: 180px;">Цель работы: {{aim}}</div>
<div style="float: left; width: 328px; height: 306px; margin-right: 180px; ">Оборудование: {{equipment}}</div>
<div style="float: left; width: 328px; height: 306px; ">Работу выполнил: {{firstname}} {{lastname}}
{{group}}</div>
</div>
</div>
<div style="font-family: Bahnschrift; width: 100%; margin-top:240px; font-size: 45px;">
<div style="font-family: Bahnschrift; width: 100%; margin-top:140px; font-size: 45px;">
Теоритическое обоснование
<table style="border: 3px solid #000000; width:100%; height: 900px;">

Expand All @@ -39,9 +42,8 @@ <h2 style="font-family: Bahnschrift; text-align: center; font-weight: bold">{{la
</tr>
</table>
</div>
<div style="font-family: Bahnschrift; width: 50%; margin-top:160px;">
<h1>Практическая часть</h1>
<h2>Результаты измерений</h2>
<div style="font-family: Bahnschrift; width: 50%; margin-top:160px; font-size: 45px;">
Результаты измерений
<table style="margin-top: 10px; font-size: 25px; border: 3px solid #000000; width: 200%; height: 300px; border-collapse: collapse;">
<tr>
<td style="padding: 3px; border: 1px solid black;">Вид поверхности</td>
Expand Down Expand Up @@ -73,9 +75,10 @@ <h2>Результаты измерений</h2>
</div>

<div style="margin-top:50px; font-family: Bahnschrift; font-size: 45px;">
<h2>Эксперимент №2</h2>
<h3>l = {{length}}</h3>
<h3>h = {{height}}</h3>
Эксперимент №2
<p>l = {{length}}\(\pm\){{len_pogr}}</p>
<p>h = {{height}}\(\pm\){{h_pogr}}</p>


Расчет погрешностей измерений
<img
Expand All @@ -84,12 +87,12 @@ <h3>h = {{height}}</h3>
</div>
<div style="margin-top:50px; font-family: Bahnschrift; font-size: 45px;">
Вывод
<p style="font-size: 25px; text-align: center;">
<p style="font-size: 25px; text-align: left;">
{{final}}
</p>
</div>
<div style="font-family: Bahnschrift; width: 100%; margin-top:240px; font-size: 45px;">
<h1>Заметки</h1>
Заметки
<table style="border: 3px solid #000000; width:100%; height: 900px;">

<tr>
Expand All @@ -111,6 +114,5 @@ <h1>Заметки</h1>
</tr>
</table>
</div>

</body>
</html>
Loading

0 comments on commit 666b309

Please sign in to comment.